Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-45 dbfaf0a7d -> 189c5fc9e


fixed client tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/189c5fc9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/189c5fc9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/189c5fc9

Branch: refs/heads/ignite-45
Commit: 189c5fc9e5b4cc42dec41edea05abc6db8a8557a
Parents: dbfaf0a
Author: Yakov Zhdanov <yzhda...@gridgain.com>
Authored: Fri Mar 20 23:59:01 2015 +0300
Committer: Yakov Zhdanov <yzhda...@gridgain.com>
Committed: Fri Mar 20 23:59:01 2015 +0300

----------------------------------------------------------------------
 .../integration/ClientAbstractSelfTest.java     | 30 ++++++++++++++------
 1 file changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/189c5fc9/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
index d6b2f3e..a6944fd 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.client.*;
 import org.apache.ignite.internal.client.ssl.*;
 import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
@@ -112,15 +113,19 @@ public abstract class ClientAbstractSelfTest extends 
GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        exec.shutdown();
+        U.shutdownNow(ClientAbstractSelfTest.class, exec, log);
+
         exec = null;
 
-        GridClientFactory.stop(client.id(), true);
+        if (client != null)
+            GridClientFactory.stop(client.id(), true);
 
         client = null;
 
-        for (HashMapStore cacheStore : cacheStores.values())
-            cacheStore.map.clear();
+        synchronized (cacheStores) {
+            for (HashMapStore cacheStore : cacheStores.values())
+                cacheStore.map.clear();
+        }
 
         grid().jcache(null).clear();
         grid().jcache(CACHE_NAME).clear();
@@ -237,7 +242,7 @@ public abstract class ClientAbstractSelfTest extends 
GridCommonAbstractTest {
      * @throws Exception In case of error.
      */
     @SuppressWarnings("unchecked")
-    private CacheConfiguration cacheConfiguration(@Nullable String cacheName) 
throws Exception {
+    private  static CacheConfiguration cacheConfiguration(@Nullable final 
String cacheName) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
         cfg.setCacheMode(cacheName == null || CACHE_NAME.equals(cacheName) ? 
LOCAL : "replicated".equals(cacheName) ?
@@ -245,12 +250,19 @@ public abstract class ClientAbstractSelfTest extends 
GridCommonAbstractTest {
         cfg.setName(cacheName);
         cfg.setWriteSynchronizationMode(FULL_SYNC);
 
-        HashMapStore cacheStore = cacheStores.get(cacheName);
+        cfg.setCacheStoreFactory(new Factory<CacheStore>() {
+            @Override public CacheStore create() {
+                synchronized (cacheStores) {
+                    HashMapStore cacheStore = cacheStores.get(cacheName);
 
-        if (cacheStore == null)
-            cacheStores.put(cacheName, cacheStore = new HashMapStore());
+                    if (cacheStore == null)
+                        cacheStores.put(cacheName, cacheStore = new 
HashMapStore());
+
+                    return cacheStore;
+                }
+            }
+        });
 
-        cfg.setCacheStoreFactory(new 
FactoryBuilder.SingletonFactory(cacheStore));
         cfg.setWriteThrough(true);
         cfg.setReadThrough(true);
         cfg.setLoadPreviousValue(true);

Reply via email to