ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [14/28] incubator-ignite git commit: # IGNITE-56 Use IgniteCache in ignite-core module (5).
Date Fri, 06 Feb 2015 14:50:54 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbb22e18/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
index 8c39a49..65555b5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
@@ -37,8 +37,11 @@ import org.apache.ignite.transactions.*;
 import org.jdk8.backport.*;
 import org.jetbrains.annotations.*;
 
+import javax.cache.*;
 import javax.cache.configuration.*;
+import javax.cache.integration.*;
 import java.util.*;
+import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.*;
@@ -191,6 +194,43 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest
{
     }
 
     /**
+     * @param cache Cache.
+     * @param keys Keys.
+     * @param replaceExistingValues Replace existing values.
+     */
+    protected static <K> void loadAll(Cache<K, ?> cache, Set<K> keys, boolean
replaceExistingValues) throws Exception {
+        final AtomicReference<Exception> ex = new AtomicReference<>();
+
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        cache.loadAll(keys, replaceExistingValues, new CompletionListener() {
+            @Override public void onCompletion() {
+                latch.countDown();
+            }
+
+            @Override public void onException(Exception e) {
+                ex.set(e);
+
+                latch.countDown();
+            }
+        });
+
+        latch.await();
+
+        if (ex.get() != null)
+            throw ex.get();
+    }
+
+    /**
+     * @param cache Cache.
+     * @param key Keys.
+     * @param replaceExistingValues Replace existing values.
+     */
+    protected static <K> void load(Cache<K, ?> cache, K key, boolean replaceExistingValues)
throws Exception {
+        loadAll(cache, Collections.singleton(key), replaceExistingValues);
+    }
+
+    /**
      * Cleans up cache store.
      */
     protected void resetStore() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbb22e18/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
index 1b88833..f3cef28 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
@@ -199,11 +199,11 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends
GridCache
         // Force reload on primary node.
         for (int i = 0; i < gridCount(); i++) {
             if (ignite(i).affinity(null).isPrimary(ignite(i).cluster().localNode(), key))
-                jcache(i).loadAll(Collections.singleton(key), true, null);
+                load(jcache(i), key, true);
         }
 
         // Will do near get request.
-        cache.loadAll(Collections.singleton(key), true, null);
+        load(cache, key, true);
 
         assertEquals(null, cache.localPeek(key));
     }
@@ -232,7 +232,7 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends
GridCache
         assert cache.localPeek(key2) == null;
         assert cache.localPeek(key3) == null;
 
-        cache.loadAll(ImmutableSet.of(key1, key2), true, null);
+        loadAll(cache, ImmutableSet.of(key1, key2), true);
 
         assert cache.localPeek(key1) == null;
         assert cache.localPeek(key2) == null;
@@ -244,7 +244,7 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends
GridCache
         assert cache.localPeek(key2) == null;
         assert cache.localPeek(key3) == null;
 
-        cache.loadAll(ImmutableSet.of(key1, key2), true, null);
+        loadAll(cache, ImmutableSet.of(key1, key2), true);
 
         assert cache.localPeek(key1) == null;
         assert cache.localPeek(key2) == null;
@@ -282,45 +282,6 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends
GridCache
     }
 
     /** {@inheritDoc} */
-    @Override public void testEvict() throws Exception {
-        IgniteCache<String, Integer> cache = jcache();
-
-        List<String> keys = primaryKeysForCache(jcache(), 2);
-
-        String key = keys.get(0);
-        String key2 = keys.get(1);
-
-        cache.put(key, 1);
-
-        assertEquals((Integer)1, cache.get(key));
-
-        cache.localEvict(Collections.<String>singleton(key));
-
-        assertNull(cache.localPeek(key));
-
-        cache.loadAll(Collections.singleton(key), true, null);
-
-        assertEquals(null, cache.localPeek(key));
-
-        cache.remove(key);
-
-        cache.put(key, 1);
-        cache.put(key2, 102);
-
-        cache.localEvict(Collections.<String>singleton(key));
-
-        assertEquals((Integer)1, cache.get(key));
-
-        cache.localEvict(Collections.<String>singleton(key2));
-
-        assertNull(cache.localPeek(key2));
-
-        cache.localEvict(Collections.<String>singleton(key));
-
-        assertNull(cache.localPeek(key));
-    }
-
-    /** {@inheritDoc} */
     @Override public void testUnswap() throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbb22e18/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
index 809d537..b2d9a5c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
@@ -143,11 +143,11 @@ public class GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest extends
GridCacheNe
         // Force reload on primary node.
         for (int i = 0; i < gridCount(); i++) {
             if (ignite(i).affinity(null).isPrimary(ignite(i).cluster().localNode(), key))
-                jcache(i).loadAll(Collections.singleton(key), true, null);
+                load(jcache(i), key, true);
         }
 
         // Will do near get request.
-        cache.loadAll(Collections.singleton(key), true, null);
+        load(cache, key, true);
 
         assertEquals((Integer)1, cache.localPeek(key));
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbb22e18/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
index a77c563..2df1551 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
@@ -180,42 +180,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
     }
 
     /** {@inheritDoc} */
-    @Override public void testReload() throws Exception {
-        // Not needed for near-only cache.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testReloadAsync() throws Exception {
-        // Not needed for near-only cache.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testReloadFiltered() throws Exception {
-        // Not needed for near-only cache.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testReloadAsyncFiltered() throws Exception {
-        // Not needed for near-only cache.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testReloadAll() throws Exception {
-        // Not needed for near-only cache.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testReloadAllAsync() throws Exception {
-        // Not needed for near-only cache.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testReloadAllFiltered() throws Exception {
-        // Not needed for near-only cache.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testReloadAllAsyncFiltered() throws Exception {
+    @Override public void testLoadAll() throws Exception {
         // Not needed for near-only cache.
     }
 
@@ -305,7 +270,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
 
         for (String key : subKeys) {
             assertNull(nearCache.localPeek(key));
-            assertNull(primary.localPeek(key));
+            assertNotNull(primary.localPeek(key));
         }
 
         assertEquals(vals.get(lastKey), nearCache.localPeek(lastKey));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fbb22e18/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
index 4854f7c..0fc9364 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
@@ -354,11 +354,6 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
         assertEquals(0, cache2.projection(prjFilter).size() - cache2.projection(prjFilter).nearSize());
     }
 
-    /** {@inheritDoc} */
-    @Override public void testLockAsyncWithTimeoutEntry() throws Exception {
-        // No-op, since all cases are tested separately.
-    }
-
     /**
      * @throws Exception If failed.
      */


Mime
View raw message