ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject [1/2] incubator-ignite git commit: # IGNITE-56 Migration of tests to IgniteCache
Date Tue, 10 Feb 2015 11:17:27 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-96-tests 244e604a6 -> f138c0036


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index 1e83921..11e2283 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
+import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
@@ -157,7 +158,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
         startGrids(gridCnt);
 
         try {
-            final GridCache<Object, Object> cache = grid(0).cache(null);
+            final IgniteCache<Object, Object> cache = grid(0).jcache(null);
 
             final int range = 100_000;
 
@@ -199,7 +200,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
                                 cache.putAll(upd);
                             }
                         }
-                        catch (CachePartialUpdateCheckedException ignored) {
+                        catch (CachePartialUpdateException ignored) {
                             // No-op.
                         }
                     }
@@ -228,7 +229,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
             fut.get();
 
             for (int k = 0; k < range; k++) {
-                Collection<ClusterNode> affNodes = cache.affinity().mapKeyToPrimaryAndBackups(k);
+                Collection<ClusterNode> affNodes = affinity(cache).mapKeyToPrimaryAndBackups(k);
 
                 // Test is valid with at least one backup.
                 assert affNodes.size() >= 2;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPreloadSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPreloadSelfTest.java
index 1c257c7..f347ba3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPreloadSelfTest.java
@@ -97,7 +97,7 @@ public class GridCacheAtomicPreloadSelfTest extends GridCommonAbstractTest
{
 
             awaitPartitionMapExchange();
 
-            GridCache<Object, Object> cache = grid(0).cache(null);
+            IgniteCache<Object, Object> cache = grid(0).jcache(null);
 
             List<Integer> keys = generateKeys(grid(0).localNode(), cache);
 
@@ -166,10 +166,10 @@ public class GridCacheAtomicPreloadSelfTest extends GridCommonAbstractTest
{
 
             ClusterNode node = grid.localNode();
 
-            GridCache<Object, Object> cache = grid.cache(null);
+            IgniteCache<Object, Object> cache = grid.jcache(null);
 
-            boolean primary = cache.affinity().isPrimary(node, key);
-            boolean backup = cache.affinity().isBackup(node, key);
+            boolean primary = grid.affinity(null).isPrimary(node, key);
+            boolean backup = grid.affinity(null).isBackup(node, key);
 
             if (primary || backup)
                 assertEquals("Invalid cache value [nodeId=" + node.id() + ", primary=" +
primary +
@@ -184,10 +184,10 @@ public class GridCacheAtomicPreloadSelfTest extends GridCommonAbstractTest
{
      * @param cache Cache to get affinity for.
      * @return Collection of keys.
      */
-    private List<Integer> generateKeys(ClusterNode node, GridCache<Object, Object>
cache) {
+    private List<Integer> generateKeys(ClusterNode node, IgniteCache<Object, Object>
cache) {
         List<Integer> keys = new ArrayList<>(3);
 
-        CacheAffinity<Object> aff = cache.affinity();
+        CacheAffinity<Object> aff = affinity(cache);
 
         int base = 0;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
index 0ea0852..5cbbf19 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
@@ -92,7 +92,7 @@ public class GridCacheValueConsistencyAtomicSelfTest extends GridCacheValueConsi
             int total = 0;
 
             for (int idx = 0; idx < gridCount(); idx++) {
-                GridCache<Integer, Integer> cache = grid(idx).cache(null);
+                IgniteCache<Integer, Integer> cache = grid(idx).jcache(null);
 
                 for (int i = 0; i < keyCnt; i++) {
                     Integer val = cache.peek(i);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f138c003/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 2b7dd9e..eb700d4 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -119,6 +119,13 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
     }
 
     /**
+     * @param cache Cache.
+     */
+    protected <K, V> GridCacheAdapter<K, V> internalCache(IgniteCache<K, V>
cache) {
+        return ((IgniteKernal)cache.unwrap(Ignite.class)).internalCache(cache.getName());
+    }
+
+    /**
      * @return Cache.
      */
     protected <K, V> IgniteCache<K, V> jcache() {


Mime
View raw message