ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [07/50] [abbrv] incubator-ignite git commit: #ignite-237: change affinity function in tests.
Date Wed, 04 Mar 2015 08:31:50 GMT
#ignite-237: change affinity function in 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/262aba54
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/262aba54
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/262aba54

Branch: refs/heads/ignite-51
Commit: 262aba541504dde165aab6e0c7456879a42bcb22
Parents: 13d0627
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Thu Feb 26 16:15:58 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Thu Feb 26 16:15:58 2015 +0300

----------------------------------------------------------------------
 ...idCacheConfigurationConsistencySelfTest.java | 46 ++++++--------------
 ...ridCacheConfigurationValidationSelfTest.java |  8 ++--
 2 files changed, 17 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/262aba54/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
index 3bd42dc..311c36f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
@@ -20,8 +20,8 @@ package org.apache.ignite.internal.processors.cache;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.affinity.*;
-import org.apache.ignite.cache.affinity.consistenthash.*;
 import org.apache.ignite.cache.affinity.fair.*;
+import org.apache.ignite.cache.affinity.rendezvous.*;
 import org.apache.ignite.cache.eviction.*;
 import org.apache.ignite.cache.eviction.fifo.*;
 import org.apache.ignite.cache.eviction.lru.*;
@@ -308,14 +308,14 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
             new C1<CacheConfiguration, Void>() {
                 /** {@inheritDoc} */
                 @Override public Void apply(CacheConfiguration cfg) {
-                    cfg.setAffinity(new CacheConsistentHashAffinityFunction() {/*No-op.*/});
+                    cfg.setAffinity(new CacheRendezvousAffinityFunction() {/*No-op.*/});
                     return null;
                 }
             },
             new C1<CacheConfiguration, Void>() {
                 /** {@inheritDoc} */
                 @Override public Void apply(CacheConfiguration cfg) {
-                    cfg.setAffinity(new CacheConsistentHashAffinityFunction());
+                    cfg.setAffinity(new CacheRendezvousAffinityFunction());
                     return null;
                 }
             }
@@ -573,13 +573,13 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
 
         backups = 1;
 
-        aff = new CacheConsistentHashAffinityFunction(false, 100);
+        aff = new CacheRendezvousAffinityFunction(false, 100);
 
         startGrid(1);
 
         // 2nd grid with another affinity.
         // Check include neighbors.
-        aff = new CacheConsistentHashAffinityFunction(true, 100);
+        aff = new CacheRendezvousAffinityFunction(true, 100);
 
         GridTestUtils.assertThrows(log, new Callable<Object>() {
             @Override public Object call() throws Exception {
@@ -590,7 +590,7 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
         backups = 2;
 
         // Check backups.
-        aff = new CacheConsistentHashAffinityFunction(false, 100);
+        aff = new CacheRendezvousAffinityFunction(false, 100);
 
         GridTestUtils.assertThrows(log, new Callable<Object>() {
             @Override public Object call() throws Exception {
@@ -601,7 +601,7 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
         backups = 1;
 
         // Partitions count.
-        aff = new CacheConsistentHashAffinityFunction(false, 1000);
+        aff = new CacheRendezvousAffinityFunction(false, 1000);
 
         GridTestUtils.assertThrows(log, new Callable<Object>() {
             @Override public Object call() throws Exception {
@@ -609,28 +609,8 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
             }
         }, IgniteCheckedException.class, "Affinity partitions count mismatch");
 
-        // Replicas count.
-        aff = new CacheConsistentHashAffinityFunction(false, 100);
-        ((CacheConsistentHashAffinityFunction)aff).setDefaultReplicas(1024);
-
-        GridTestUtils.assertThrows(log, new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                return startGrid(2);
-            }
-        }, IgniteCheckedException.class, "Affinity replicas mismatch");
-
-        // Replicas count attribute name.
-        aff = new CacheConsistentHashAffinityFunction(false, 100);
-        ((CacheConsistentHashAffinityFunction)aff).setReplicaCountAttributeName("attr_name");
-
-        GridTestUtils.assertThrows(log, new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                return startGrid(2);
-            }
-        }, IgniteCheckedException.class, "Affinity replica count attribute name mismatch");
-
         // Different hash ID resolver.
-        CacheConsistentHashAffinityFunction aff0 = new CacheConsistentHashAffinityFunction(false,
100);
+        CacheRendezvousAffinityFunction aff0 = new CacheRendezvousAffinityFunction(false,
100);
 
         aff0.setHashIdResolver(new CacheAffinityNodeIdHashResolver());
 
@@ -725,7 +705,7 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
             /** {@inheritDoc} */
             @SuppressWarnings("unchecked")
             @Override public Void apply(CacheConfiguration cfg) {
-                cfg.setAffinity(new CacheConsistentHashAffinityFunction() {/*No-op.*/});
+                cfg.setAffinity(new CacheRendezvousAffinityFunction() {/*No-op.*/});
 
                 cfg.setEvictionPolicy(new CacheFifoEvictionPolicy());
 
@@ -743,7 +723,7 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
         initCache = new C1<CacheConfiguration, Void>() {
             /** {@inheritDoc} */
             @Override public Void apply(CacheConfiguration cfg) {
-                cfg.setAffinity(new CacheConsistentHashAffinityFunction());
+                cfg.setAffinity(new CacheRendezvousAffinityFunction());
 
                 cfg.setEvictionPolicy(new CacheLruEvictionPolicy());
 
@@ -948,7 +928,7 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
             }
         }, IgniteCheckedException.class, null);
 
-        aff = new CacheConsistentHashAffinityFunction(true); // Check cannot set 'excludeNeighbors'
flag.
+        aff = new CacheRendezvousAffinityFunction(true); // Check cannot set 'excludeNeighbors'
flag.
         backups = Integer.MAX_VALUE;
 
         GridTestUtils.assertThrows(log, new Callable<Object>() {
@@ -957,12 +937,12 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
             }
         }, IgniteCheckedException.class, null);
 
-        aff = new CacheConsistentHashAffinityFunction(false, 100);
+        aff = new CacheRendezvousAffinityFunction(false, 100);
 
         startGrid(1);
 
         // Try to start node with  different number of partitions.
-        aff = new CacheConsistentHashAffinityFunction(false, 200);
+        aff = new CacheRendezvousAffinityFunction(false, 200);
 
         GridTestUtils.assertThrows(log, new Callable<Object>() {
             @Override public Object call() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/262aba54/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationValidationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationValidationSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationValidationSelfTest.java
index 8e5474a..325d346 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationValidationSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationValidationSelfTest.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.affinity.consistenthash.*;
+import org.apache.ignite.cache.affinity.rendezvous.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
@@ -83,7 +83,7 @@ public class GridCacheConfigurationValidationSelfTest extends GridCommonAbstract
         dfltCacheCfg.setCacheMode(PARTITIONED);
         dfltCacheCfg.setPreloadMode(ASYNC);
         dfltCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
-        dfltCacheCfg.setAffinity(new CacheConsistentHashAffinityFunction());
+        dfltCacheCfg.setAffinity(new CacheRendezvousAffinityFunction());
 
         // Non-default cache configuration.
         CacheConfiguration namedCacheCfg = defaultCacheConfiguration();
@@ -92,7 +92,7 @@ public class GridCacheConfigurationValidationSelfTest extends GridCommonAbstract
         namedCacheCfg.setPreloadMode(ASYNC);
         namedCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
         namedCacheCfg.setName(NON_DFLT_CACHE_NAME);
-        namedCacheCfg.setAffinity(new CacheConsistentHashAffinityFunction());
+        namedCacheCfg.setAffinity(new CacheRendezvousAffinityFunction());
 
         // Modify cache config according to test parameters.
         if (gridName.contains(WRONG_PRELOAD_MODE_GRID_NAME))
@@ -100,7 +100,7 @@ public class GridCacheConfigurationValidationSelfTest extends GridCommonAbstract
         else if (gridName.contains(WRONG_CACHE_MODE_GRID_NAME))
             dfltCacheCfg.setCacheMode(REPLICATED);
         else if (gridName.contains(WRONG_AFFINITY_GRID_NAME)) {
-            dfltCacheCfg.setAffinity(new CacheConsistentHashAffinityFunction() {
+            dfltCacheCfg.setAffinity(new CacheRendezvousAffinityFunction() {
                 // No-op. Just to have another class name.
             });
         }


Mime
View raw message