ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [21/48] incubator-ignite git commit: #ignite-738: GridCachePartitionedPreloadLifecycleSelfTest uses new query api.
Date Thu, 16 Apr 2015 08:38:21 GMT
#ignite-738: GridCachePartitionedPreloadLifecycleSelfTest uses new query api.


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

Branch: refs/heads/ignite-737
Commit: b6882fd4c33b5126108264a47d8c91fbacd67a2b
Parents: 9fdcf9e
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Mon Apr 13 20:20:09 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Mon Apr 13 20:20:09 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/query/CacheQueries.java      |  1 -
 .../datastructures/GridCacheSetImpl.java          |  7 +------
 ...dCachePartitionedPreloadLifecycleSelfTest.java | 18 +++++++-----------
 3 files changed, 8 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6882fd4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java
index f8c38ad..4843986 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueries.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.query;
 
 import org.apache.ignite.cache.query.*;
-import org.apache.ignite.internal.*;
 import org.apache.ignite.lang.*;
 import org.jetbrains.annotations.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6882fd4/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
index 7d7b028..94fd25a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
@@ -120,12 +120,7 @@ public class GridCacheSetImpl<T> extends AbstractCollection<T>
implements Ignite
 
             qry.projection(ctx.grid().cluster().forNodes(nodes));
 
-            Iterable<Integer> col = (Iterable<Integer>)qry.execute(new SumReducer()).get();
-
-            int sum = 0;
-
-            for (Integer val : col)
-                sum += val;
+            int sum = F.reduce((Iterable<Object>)qry.execute().get(), new SumReducer());
 
             return sum;
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6882fd4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
index a794e78..a2443b2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
@@ -18,11 +18,9 @@
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
 import org.apache.ignite.*;
+import org.apache.ignite.cache.query.*;
 import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.*;
-import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.lifecycle.*;
@@ -30,7 +28,6 @@ import org.apache.ignite.resources.*;
 import org.apache.ignite.transactions.*;
 
 import javax.cache.*;
-import java.util.*;
 
 import static org.apache.ignite.cache.CacheMode.*;
 import static org.apache.ignite.cache.CacheRebalanceMode.*;
@@ -174,17 +171,16 @@ public class GridCachePartitionedPreloadLifecycleSelfTest extends GridCachePrelo
             info("Checking '" + (i + 1) + "' nodes...");
 
             for (int j = 0; j < G.allGrids().size(); j++) {
-                GridCacheAdapter<Object, MyValue> c2 = ((IgniteKernal)grid(j)).internalCache("two");
+                IgniteCache<Object, MyValue> c2 = grid(j).cache("two");
 
-                CacheQuery<Map.Entry<Object, MyValue>> qry = c2.queries().createScanQuery(null);
+                ScanQuery<Object, MyValue> qry = new ScanQuery<>(null);
 
-                int totalCnt = F.sumInt(qry.execute(new IgniteReducer<Map.Entry<Object,
MyValue>, Integer>() {
-                    @IgniteInstanceResource
-                    private Ignite grid;
+                final Ignite grid = grid(j);
 
+                int totalCnt = F.reduce(c2.query(qry).getAll(), new IgniteReducer<Cache.Entry<Object,
MyValue>, Integer>() {
                     private int cnt;
 
-                    @Override public boolean collect(Map.Entry<Object, MyValue> e)
{
+                    @Override public boolean collect(Cache.Entry<Object, MyValue> e)
{
                         Object key = e.getKey();
 
                         assertNotNull(e.getValue());
@@ -210,7 +206,7 @@ public class GridCachePartitionedPreloadLifecycleSelfTest extends GridCachePrelo
                     @Override public Integer reduce() {
                         return cnt;
                     }
-                }).get());
+                });
 
                 info("Total entry count [grid=" + j + ", totalCnt=" + totalCnt + ']');
 


Mime
View raw message