# ignite-sprint-3 fixed test

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

Branch: refs/heads/ignite-30
Commit: beedb1789c6636f5823b445cb219ffa9ae28d6d0
Parents: f11e357
Author: sboikov <semen.boi...@inria.fr>
Authored: Tue Apr 7 22:23:23 2015 +0300
Committer: sboikov <semen.boi...@inria.fr>
Committed: Tue Apr 7 22:23:23 2015 +0300

----------------------------------------------------------------------
 ...ePartitionedBasicStoreMultiNodeSelfTest.java | 110 ++-----------------
 1 file changed, 10 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/beedb178/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java
index 05eab37..b362431 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java
@@ -126,22 +126,7 @@ public class 
GridCachePartitionedBasicStoreMultiNodeSelfTest extends GridCommonA
     public void testPutFromPrimary() throws Exception {
         IgniteCache<Integer, String> cache = jcache(0);
 
-        int key = 0;
-
-        while (true) {
-            boolean found = false;
-
-            for (ClusterNode n : grid(0).cluster().nodes()) {
-                if (grid(0).affinity(null).isPrimary(n, key)) {
-                    found = true;
-
-                    break;
-                }
-            }
-
-            if (found)
-                break;
-        }
+        int key = primaryKey(cache);
 
         assertNull(cache.getAndPut(key, "val"));
 
@@ -154,26 +139,11 @@ public class 
GridCachePartitionedBasicStoreMultiNodeSelfTest extends GridCommonA
     public void testPutFromBackup() throws Exception {
         IgniteCache<Integer, String> cache = jcache(0);
 
-        int key = 0;
-
-        while (true) {
-            boolean found = false;
-
-            for (ClusterNode n : grid(0).cluster().nodes()) {
-                if (grid(0).affinity(null).isBackup(n, key)) {
-                    found = true;
-
-                    break;
-                }
-            }
-
-            if (found)
-                break;
-        }
+        int key = backupKey(cache);
 
         assertNull(cache.getAndPut(key, "val"));
 
-        checkStoreUsage(1, 1, 0, 1);
+        checkStoreUsage(1, 1, 0, nearCacheConfiguration() == null ? 2 : 1);
     }
 
     /**
@@ -182,26 +152,11 @@ public class 
GridCachePartitionedBasicStoreMultiNodeSelfTest extends GridCommonA
     public void testPutFromNear() throws Exception {
         IgniteCache<Integer, String> cache = jcache(0);
 
-        int key = 0;
-
-        while (true) {
-            boolean found = false;
-
-            for (ClusterNode n : grid(0).cluster().nodes()) {
-                if (!grid(0).affinity(null).isPrimaryOrBackup(n, key)) {
-                    found = true;
-
-                    break;
-                }
-            }
-
-            if (found)
-                break;
-        }
+        int key = nearKey(cache);
 
         assertNull(cache.getAndPut(key, "val"));
 
-        checkStoreUsage(1, 1, 0, 1);
+        checkStoreUsage(1, 1, 0, nearCacheConfiguration() == null ? 2 : 1);
     }
 
     /**
@@ -210,22 +165,7 @@ public class 
GridCachePartitionedBasicStoreMultiNodeSelfTest extends GridCommonA
     public void testPutIfAbsentFromPrimary() throws Exception {
         IgniteCache<Integer, String> cache = jcache(0);
 
-        int key = 0;
-
-        while (true) {
-            boolean found = false;
-
-            for (ClusterNode n : grid(0).cluster().nodes()) {
-                if (grid(0).affinity(null).isPrimary(n, key)) {
-                    found = true;
-
-                    break;
-                }
-            }
-
-            if (found)
-                break;
-        }
+        int key = primaryKey(cache);
 
         assertTrue(cache.putIfAbsent(key, "val"));
 
@@ -238,26 +178,11 @@ public class 
GridCachePartitionedBasicStoreMultiNodeSelfTest extends GridCommonA
     public void testPutIfAbsentFromBackup() throws Exception {
         IgniteCache<Integer, String> cache = jcache(0);
 
-        int key = 0;
-
-        while (true) {
-            boolean found = false;
-
-            for (ClusterNode n : grid(0).cluster().nodes()) {
-                if (grid(0).affinity(null).isBackup(n, key)) {
-                    found = true;
-
-                    break;
-                }
-            }
-
-            if (found)
-                break;
-        }
+        int key = backupKey(cache);
 
         assertTrue(cache.putIfAbsent(key, "val"));
 
-        checkStoreUsage(1, 1, 0, 1);
+        checkStoreUsage(1, 1, 0, nearCacheConfiguration() == null ? 2 : 1);
     }
 
     /**
@@ -266,26 +191,11 @@ public class 
GridCachePartitionedBasicStoreMultiNodeSelfTest extends GridCommonA
     public void testPutIfAbsentFromNear() throws Exception {
         IgniteCache<Integer, String> cache = jcache(0);
 
-        int key = 0;
-
-        while (true) {
-            boolean found = false;
-
-            for (ClusterNode n : grid(0).cluster().nodes()) {
-                if (!grid(0).affinity(null).isPrimaryOrBackup(n, key)) {
-                    found = true;
-
-                    break;
-                }
-            }
-
-            if (found)
-                break;
-        }
+        int key = nearKey(cache);
 
         assertTrue(cache.putIfAbsent(key, "val"));
 
-        checkStoreUsage(1, 1, 0, 1);
+        checkStoreUsage(1, 1, 0, nearCacheConfiguration() == null ? 2 : 1);
     }
 
     /**

Reply via email to