ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [01/12] incubator-ignite git commit: #IGNITE-99: Refactoring. Move GridCache.affinity() to Ignite.affinity(String cacheName).
Date Fri, 16 Jan 2015 15:43:04 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-99 [created] 25609651b


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25609651/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java
b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java
index 73a18ea..5741eba 100644
--- a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java
@@ -26,7 +26,7 @@ import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.gridgain.grid.cache.*;
-import org.gridgain.grid.cache.affinity.*;
+import org.apache.ignite.cache.affinity.*;
 import org.gridgain.grid.cache.query.*;
 import org.gridgain.grid.kernal.processors.cache.query.*;
 import org.gridgain.grid.kernal.processors.query.*;
@@ -133,13 +133,13 @@ public abstract class GridCacheAbstractFieldsQuerySelfTest extends GridCommonAbs
         assert orgCache.putx("o1", new Organization(1, "A"));
         assert orgCache.putx("o2", new Organization(2, "B"));
 
-        GridCache<GridCacheAffinityKey<String>, Person> personCache = grid(0).cache(null);
+        GridCache<CacheAffinityKey<String>, Person> personCache = grid(0).cache(null);
 
         assert personCache != null;
 
-        assert personCache.putx(new GridCacheAffinityKey<>("p1", "o1"), new Person("John
White", 25, 1));
-        assert personCache.putx(new GridCacheAffinityKey<>("p2", "o1"), new Person("Joe
Black", 35, 1));
-        assert personCache.putx(new GridCacheAffinityKey<>("p3", "o2"), new Person("Mike
Green", 40, 2));
+        assert personCache.putx(new CacheAffinityKey<>("p1", "o1"), new Person("John
White", 25, 1));
+        assert personCache.putx(new CacheAffinityKey<>("p2", "o1"), new Person("Joe
Black", 35, 1));
+        assert personCache.putx(new CacheAffinityKey<>("p3", "o2"), new Person("Mike
Green", 40, 2));
 
         GridCache<String, String> strCache = grid(0).cache(null);
 
@@ -202,7 +202,7 @@ public abstract class GridCacheAbstractFieldsQuerySelfTest extends GridCommonAbs
                 assert types.contains("String");
                 assert types.contains("Integer");
 
-                assert GridCacheAffinityKey.class.getName().equals(meta.keyClass("Person"));
+                assert CacheAffinityKey.class.getName().equals(meta.keyClass("Person"));
                 assert String.class.getName().equals(meta.keyClass("Organization"));
                 assert String.class.getName().equals(meta.keyClass("String"));
 
@@ -214,7 +214,7 @@ public abstract class GridCacheAbstractFieldsQuerySelfTest extends GridCommonAbs
 
                 assert fields != null;
                 assert fields.size() == 5;
-                assert GridCacheAffinityKey.class.getName().equals(fields.get("_KEY"));
+                assert CacheAffinityKey.class.getName().equals(fields.get("_KEY"));
                 assert Person.class.getName().equals(fields.get("_VAL"));
                 assert String.class.getName().equals(fields.get("NAME"));
                 assert int.class.getName().equals(fields.get("AGE"));
@@ -292,17 +292,17 @@ public abstract class GridCacheAbstractFieldsQuerySelfTest extends GridCommonAbs
             assert row.size() == 3;
 
             if (cnt == 0) {
-                assert new GridCacheAffinityKey<>("p1", "o1").equals(row.get(0));
+                assert new CacheAffinityKey<>("p1", "o1").equals(row.get(0));
                 assert "John White".equals(row.get(1));
                 assert row.get(2).equals(25);
             }
             else if (cnt == 1) {
-                assert new GridCacheAffinityKey<>("p2", "o1").equals(row.get(0));
+                assert new CacheAffinityKey<>("p2", "o1").equals(row.get(0));
                 assert "Joe Black".equals(row.get(1));
                 assert row.get(2).equals(35);
             }
             if (cnt == 2) {
-                assert new GridCacheAffinityKey<>("p3", "o2").equals(row.get(0));
+                assert new CacheAffinityKey<>("p3", "o2").equals(row.get(0));
                 assert "Mike Green".equals(row.get(1));
                 assert row.get(2).equals(40);
             }
@@ -342,12 +342,12 @@ public abstract class GridCacheAbstractFieldsQuerySelfTest extends GridCommonAbs
             assert row.size() == 3;
 
             if (cnt == 0) {
-                assert new GridCacheAffinityKey<>("p2", "o1").equals(row.get(0));
+                assert new CacheAffinityKey<>("p2", "o1").equals(row.get(0));
                 assert "Joe Black".equals(row.get(1));
                 assert row.get(2).equals(35);
             }
             else if (cnt == 1) {
-                assert new GridCacheAffinityKey<>("p3", "o2").equals(row.get(0));
+                assert new CacheAffinityKey<>("p3", "o2").equals(row.get(0));
                 assert "Mike Green".equals(row.get(1));
                 assert row.get(2).equals(40);
             }
@@ -435,19 +435,19 @@ public abstract class GridCacheAbstractFieldsQuerySelfTest extends GridCommonAbs
             assert row.size() == 4;
 
             if (cnt == 0) {
-                assert new GridCacheAffinityKey<>("p1", "o1").equals(row.get(0));
+                assert new CacheAffinityKey<>("p1", "o1").equals(row.get(0));
                 assert "John White".equals(row.get(1));
                 assert row.get(2).equals(25);
                 assert "A".equals(row.get(3));
             }
             else if (cnt == 1) {
-                assert new GridCacheAffinityKey<>("p2", "o1").equals(row.get(0));
+                assert new CacheAffinityKey<>("p2", "o1").equals(row.get(0));
                 assert "Joe Black".equals(row.get(1));
                 assert row.get(2).equals(35);
                 assert "A".equals(row.get(3));
             }
             if (cnt == 2) {
-                assert new GridCacheAffinityKey<>("p3", "o2").equals(row.get(0));
+                assert new CacheAffinityKey<>("p3", "o2").equals(row.get(0));
                 assert "Mike Green".equals(row.get(1));
                 assert row.get(2).equals(40);
                 assert "B".equals(row.get(3));
@@ -585,7 +585,7 @@ public abstract class GridCacheAbstractFieldsQuerySelfTest extends GridCommonAbs
             assert row.size() == 9;
 
             if (cnt == 0) {
-                assert new GridCacheAffinityKey<>("p1", "o1").equals(row.get(0));
+                assert new CacheAffinityKey<>("p1", "o1").equals(row.get(0));
                 assert Person.class.getName().equals(row.get(1).getClass().getName());
                 assert "John White".equals(row.get(2));
                 assert row.get(3).equals(25);
@@ -596,7 +596,7 @@ public abstract class GridCacheAbstractFieldsQuerySelfTest extends GridCommonAbs
                 assert "A".equals(row.get(8));
             }
             else if (cnt == 1) {
-                assert new GridCacheAffinityKey<>("p2", "o1").equals(row.get(0));
+                assert new CacheAffinityKey<>("p2", "o1").equals(row.get(0));
                 assert Person.class.getName().equals(row.get(1).getClass().getName());
                 assert "Joe Black".equals(row.get(2));
                 assert row.get(3).equals(35);
@@ -607,7 +607,7 @@ public abstract class GridCacheAbstractFieldsQuerySelfTest extends GridCommonAbs
                 assert "A".equals(row.get(8));
             }
             if (cnt == 2) {
-                assert new GridCacheAffinityKey<>("p3", "o2").equals(row.get(0));
+                assert new CacheAffinityKey<>("p3", "o2").equals(row.get(0));
                 assert Person.class.getName().equals(row.get(1).getClass().getName());
                 assert "Mike Green".equals(row.get(2));
                 assert row.get(3).equals(40);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25609651/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractQuerySelfTest.java
b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractQuerySelfTest.java
index d2e7ac8..a1e3fb5 100644
--- a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractQuerySelfTest.java
@@ -513,7 +513,7 @@ public abstract class GridCacheAbstractQuerySelfTest extends GridCommonAbstractT
 
                     c.evict(i); // Swap.
 
-                    if (!partitioned || c.affinity().mapKeyToNode(i).isLocal()) {
+                    if (!partitioned || g.affinity(c.name()).mapKeyToNode(i).isLocal()) {
                         ObjectValue peekVal = c.peek(i);
 
                         assertNull("Non-null value for peek [key=" + i + ", val=" + peekVal
+ ']', peekVal);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25609651/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
index a443bed..48f266a 100644
--- a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
+++ b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
@@ -292,7 +292,7 @@ public class GridCacheOffHeapAndSwapSelfTest extends GridCommonAbstractTest
{
 
         for (long i = 0; i < ENTRY_CNT; i++) {
             // Avoid entry creation.
-            int part = cache.affinity().partition(i);
+            int part = grid(0).affinity(cache.name()).partition(i);
 
             Collection<Long> list = grouped.get(part);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25609651/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheQueryMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheQueryMultiThreadedSelfTest.java
b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheQueryMultiThreadedSelfTest.java
index 95cf0c9..251cec3 100644
--- a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheQueryMultiThreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheQueryMultiThreadedSelfTest.java
@@ -223,7 +223,7 @@ public class GridCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTest
         Set<UUID> nodes = new HashSet<>();
 
         for (Map.Entry<Integer, Integer> entry : entries)
-            nodes.add(g.cache(null).affinity().mapKeyToPrimaryAndBackups(entry.getKey()).iterator().next().id());
+            nodes.add(g.affinity(null).mapKeyToPrimaryAndBackups(entry.getKey()).iterator().next().id());
 
         return nodes;
     }
@@ -573,7 +573,7 @@ public class GridCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTest
         for (int i = 0; i < keyCnt; i++) {
             c.putx(i, i);
 
-            info("Affinity [key=" + i + ", aff=" + c.affinity().mapKeyToPrimaryAndBackups(i).iterator().next().id()
+ ']');
+            info("Affinity [key=" + i + ", aff=" + g.affinity(c.name()).mapKeyToPrimaryAndBackups(i).iterator().next().id()
+ ']');
 
             assertTrue(c.evict(i));
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25609651/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedFieldsQuerySelfTest.java
b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedFieldsQuerySelfTest.java
index 57fa1c9..8b6a477 100644
--- a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedFieldsQuerySelfTest.java
@@ -18,7 +18,7 @@
 package org.gridgain.grid.kernal.processors.cache.distributed.near;
 
 import org.gridgain.grid.cache.*;
-import org.gridgain.grid.cache.affinity.*;
+import org.apache.ignite.cache.affinity.*;
 import org.gridgain.grid.cache.query.*;
 import org.gridgain.grid.kernal.processors.cache.*;
 import org.jetbrains.annotations.*;
@@ -86,17 +86,17 @@ public class GridCachePartitionedFieldsQuerySelfTest extends GridCacheAbstractFi
             assertEquals("Row size", 3, row.size());
 
             if (cnt == 0 || cnt == 1) {
-                assertEquals("Key", new GridCacheAffinityKey<>("p1", "o1"), row.get(0));
+                assertEquals("Key", new CacheAffinityKey<>("p1", "o1"), row.get(0));
                 assertEquals("Name", "John White", row.get(1));
                 assertEquals("Age", 25, row.get(2));
             }
             else if (cnt == 2 || cnt == 3) {
-                assertEquals("Key", new GridCacheAffinityKey<>("p2", "o1"), row.get(0));
+                assertEquals("Key", new CacheAffinityKey<>("p2", "o1"), row.get(0));
                 assertEquals("Name", "Joe Black", row.get(1));
                 assertEquals("Age", 35, row.get(2));
             }
             else if (cnt == 4 || cnt == 5) {
-                assertEquals("Key", new GridCacheAffinityKey<>("p3", "o2"), row.get(0));
+                assertEquals("Key", new CacheAffinityKey<>("p3", "o2"), row.get(0));
                 assertEquals("Name", "Mike Green", row.get(1));
                 assertEquals("Age", 40, row.get(2));
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25609651/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedQuerySelfTest.java
b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedQuerySelfTest.java
index 536ef8d..782b7df 100644
--- a/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedQuerySelfTest.java
@@ -406,7 +406,7 @@ public class GridCachePartitionedQuerySelfTest extends GridCacheAbstractQuerySel
             int cnt = 0;
 
             while (true) {
-                if (grid(i).cache(null).affinity().mapKeyToNode(key).equals(grid(i).localNode()))
{
+                if (grid(i).affinity(null).mapKeyToNode(key).equals(grid(i).localNode()))
{
                     assertTrue(grid(i).cache(null).putx(key, key));
 
                     cnt++;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25609651/modules/spring/src/main/java/org/gridgain/grid/GridSpringBean.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/gridgain/grid/GridSpringBean.java b/modules/spring/src/main/java/org/gridgain/grid/GridSpringBean.java
index a3045a8..8d8418f 100644
--- a/modules/spring/src/main/java/org/gridgain/grid/GridSpringBean.java
+++ b/modules/spring/src/main/java/org/gridgain/grid/GridSpringBean.java
@@ -326,6 +326,11 @@ public class GridSpringBean extends GridMetadataAwareAdapter implements
Ignite,
     }
 
     /** {@inheritDoc} */
+    @Override public <K> IgniteCacheAffinity<K> affinity(String cacheName) {
+        return g.affinity(cacheName);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridSpringBean.class, this);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25609651/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8f5676a..e7ad72a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -633,7 +633,7 @@
                                         </group>
                                         <group>
                                             <title>Data Grid APIs</title>
-                                            <packages>org.gridgain.grid.cache:org.gridgain.grid.cache.datastructures:org.gridgain.grid.cache.cloner:org.gridgain.grid.cache.store:org.gridgain.grid.cache.store.hibernate:org.gridgain.grid.cache.store.jdbc:org.gridgain.grid.cache.query:org.gridgain.grid.cache.affinity:org.gridgain.grid.cache.affinity.consistenthash:org.gridgain.grid.cache.affinity.rendezvous:org.gridgain.grid.cache.affinity.fair:org.gridgain.grid.cache.eviction:org.gridgain.grid.cache.eviction.fifo:org.gridgain.grid.cache.eviction.ggfs:org.gridgain.grid.cache.eviction.lru:org.gridgain.grid.cache.eviction.random:org.gridgain.grid.cache.jta:org.gridgain.grid.cache.jta.jndi:org.gridgain.grid.cache.jta.reflect:org.gridgain.grid.cache.websession:org.gridgain.grid.cache.hibernate:org.gridgain.grid.dataload</packages>
+                                            <packages>org.gridgain.grid.cache:org.gridgain.grid.cache.datastructures:org.gridgain.grid.cache.cloner:org.gridgain.grid.cache.store:org.gridgain.grid.cache.store.hibernate:org.gridgain.grid.cache.store.jdbc:org.gridgain.grid.cache.query:org.apache.ignite.cache.affinity:org.apache.ignite.cache.affinity.consistenthash:org.apache.ignite.cache.affinity.rendezvous:org.apache.ignite.cache.affinity.fair:org.gridgain.grid.cache.eviction:org.gridgain.grid.cache.eviction.fifo:org.gridgain.grid.cache.eviction.ggfs:org.gridgain.grid.cache.eviction.lru:org.gridgain.grid.cache.eviction.random:org.gridgain.grid.cache.jta:org.gridgain.grid.cache.jta.jndi:org.gridgain.grid.cache.jta.reflect:org.gridgain.grid.cache.websession:org.gridgain.grid.cache.hibernate:org.gridgain.grid.dataload</packages>
                                         </group>
                                         <group>
                                             <title>Hadoop Accelerator APIs</title>
@@ -835,7 +835,7 @@
                                         </group>
                                         <group>
                                             <title>Data Grid APIs</title>
-                                            <packages>org.gridgain.grid.cache:org.gridgain.grid.cache.datastructures:org.gridgain.grid.cache.cloner:org.gridgain.grid.cache.store:org.gridgain.grid.cache.store.hibernate:org.gridgain.grid.cache.store.jdbc:org.gridgain.grid.cache.query:org.gridgain.grid.cache.affinity:org.gridgain.grid.cache.affinity.consistenthash:org.gridgain.grid.cache.affinity.rendezvous:org.gridgain.grid.cache.affinity.fair:org.gridgain.grid.cache.eviction:org.gridgain.grid.cache.eviction.fifo:org.gridgain.grid.cache.eviction.ggfs:org.gridgain.grid.cache.eviction.lru:org.gridgain.grid.cache.eviction.random:org.gridgain.grid.cache.jta:org.gridgain.grid.cache.jta.jndi:org.gridgain.grid.cache.jta.reflect:org.gridgain.grid.cache.websession:org.gridgain.grid.cache.hibernate:org.gridgain.grid.dataload</packages>
+                                            <packages>org.gridgain.grid.cache:org.gridgain.grid.cache.datastructures:org.gridgain.grid.cache.cloner:org.gridgain.grid.cache.store:org.gridgain.grid.cache.store.hibernate:org.gridgain.grid.cache.store.jdbc:org.gridgain.grid.cache.query:org.apache.ignite.cache.affinity:org.apache.ignite.cache.affinity.consistenthash:org.apache.ignite.cache.affinity.rendezvous:org.apache.ignite.cache.affinity.fair:org.gridgain.grid.cache.eviction:org.gridgain.grid.cache.eviction.fifo:org.gridgain.grid.cache.eviction.ggfs:org.gridgain.grid.cache.eviction.lru:org.gridgain.grid.cache.eviction.random:org.gridgain.grid.cache.jta:org.gridgain.grid.cache.jta.jndi:org.gridgain.grid.cache.jta.reflect:org.gridgain.grid.cache.websession:org.gridgain.grid.cache.hibernate:org.gridgain.grid.dataload</packages>
                                         </group>
                                         <group>
                                             <title>Hadoop Accelerator APIs</title>


Mime
View raw message