ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntikho...@apache.org
Subject [3/3] ignite git commit: IGNITE-4324 Code style fixes. Added test on partition cache.
Date Thu, 08 Jun 2017 13:06:42 GMT
IGNITE-4324 Code style fixes. Added test on partition cache.

Signed-off-by: nikolay_tikhonov <ntikhonov@gridgain.com>


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

Branch: refs/heads/ignite-4324
Commit: 715c40c41a292461d27c9bae8d4db642df3f2974
Parents: 6416897
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Thu Jun 8 16:06:20 2017 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Thu Jun 8 16:06:20 2017 +0300

----------------------------------------------------------------------
 .../cache/query/GridCacheQueryAdapter.java        |  5 +++--
 .../cache/CacheIteratorScanQueryTest.java         | 18 +++++++++++++-----
 2 files changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/715c40c4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
index ba82a68..87eed82 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
@@ -573,8 +573,9 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T>
{
                 if (cctx.affinityNode())
                     return Collections.singletonList(cctx.localNode());
 
-                Collection<ClusterNode> dataNodes = nodes(cctx, null, null);
-                return dataNodes.isEmpty() ? dataNodes : Collections.singletonList(F.rand(dataNodes));
+                Collection<ClusterNode> affNodes = nodes(cctx, null, null);
+
+                return affNodes.isEmpty() ? affNodes : Collections.singletonList(F.rand(affNodes));
 
             case PARTITIONED:
                 return nodes(cctx, prj, part);

http://git-wip-us.apache.org/repos/asf/ignite/blob/715c40c4/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIteratorScanQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIteratorScanQueryTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIteratorScanQueryTest.java
index dc4ca47..0151471 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIteratorScanQueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIteratorScanQueryTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 
 /**
@@ -71,8 +72,12 @@ public class CacheIteratorScanQueryTest extends GridCommonAbstractTest
{
         Ignite server = startGrid(0);
 
         client = true;
-        ccfgs = new CacheConfiguration[] {new CacheConfiguration("test-cache")
-            .setCacheMode(REPLICATED).setNodeFilter(new AlwaysFalseCacheFilter())};
+        ccfgs = new CacheConfiguration[] {
+            new CacheConfiguration("test-cache-replicated").setCacheMode(REPLICATED)
+                .setNodeFilter(new AlwaysFalseCacheFilter()),
+            new CacheConfiguration("test-cache-partitioned").setCacheMode(PARTITIONED)
+                .setNodeFilter(new AlwaysFalseCacheFilter())
+        };
 
         Ignite client = startGrid(1);
 
@@ -84,10 +89,13 @@ public class CacheIteratorScanQueryTest extends GridCommonAbstractTest
{
         assertEquals(1, client.cluster().forServers().nodes().size());
         assertEquals(1, client.cluster().forClients().nodes().size());
 
-        IgniteCache<Object, Object> cache = client.cache("test-cache");
+        for (CacheConfiguration cfg : ccfgs) {
+            IgniteCache<Object, Object> cache = client.cache(cfg.getName());
 
-        assertNotNull(cache);
-        assertNotNull(cache.iterator());
+            assertNotNull(cache);
+            assertNotNull(cache.iterator());
+            assertFalse(cache.iterator().hasNext());
+        }
     }
 
     /**


Mime
View raw message