ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [15/48] incubator-ignite git commit: #ignite-738: GridCacheAbstractReduceFieldsQuerySelfTest uses new query API.
Date Thu, 16 Apr 2015 08:38:15 GMT
#ignite-738: GridCacheAbstractReduceFieldsQuerySelfTest 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/8420ea2a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8420ea2a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8420ea2a

Branch: refs/heads/ignite-737
Commit: 8420ea2aae5029325ce455a0ee3d981cae02de39
Parents: f6c9533
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Mon Apr 13 19:34:35 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Mon Apr 13 19:34:35 2015 +0300

----------------------------------------------------------------------
 ...dCacheAbstractReduceFieldsQuerySelfTest.java | 30 +++++++++++---------
 1 file changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8420ea2a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/reducefields/GridCacheAbstractReduceFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/reducefields/GridCacheAbstractReduceFieldsQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/reducefields/GridCacheAbstractReduceFieldsQuerySelfTest.java
index 14b265c..b09f92d 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/reducefields/GridCacheAbstractReduceFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/reducefields/GridCacheAbstractReduceFieldsQuerySelfTest.java
@@ -20,10 +20,9 @@ package org.apache.ignite.internal.processors.cache.reducefields;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.query.*;
 import org.apache.ignite.cache.query.annotations.*;
 import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.marshaller.optimized.*;
@@ -161,35 +160,40 @@ public abstract class GridCacheAbstractReduceFieldsQuerySelfTest extends
GridCom
      * @throws Exception If failed.
      */
     public void testNoDataInCache() throws Exception {
-        CacheQuery<List<?>> qry = ((IgniteKernal)grid(0))
-            .getCache(null).queries().createSqlFieldsQuery("select age from Person where
orgId = 999");
+        SqlFieldsQuery qry = new SqlFieldsQuery("select age from Person where orgId = 999");
 
-        Collection<IgniteBiTuple<Integer, Integer>> res = qry.execute(new AverageRemoteReducer()).get();
+        Collection<List<?>> res = grid(0).cache(null).query(qry).getAll();
 
-        assertEquals("Result", 0, F.reduce(res, new AverageLocalReducer()).intValue());
+        IgniteBiTuple<Integer, Integer> redRes = F.reduce(res, new AverageRemoteReducer());
+
+        assertEquals("Result", 0, F.reduce(Collections.singleton(redRes), new AverageLocalReducer()).intValue());
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testAverageQuery() throws Exception {
-        CacheQuery<List<?>> qry = ((IgniteKernal)grid(0)).getCache(null).queries().createSqlFieldsQuery("select
age from Person");
+        SqlFieldsQuery qry = new SqlFieldsQuery("select age from Person");
+
+        Collection<List<?>> res = grid(0).cache(null).query(qry).getAll();
 
-        Collection<IgniteBiTuple<Integer, Integer>> res = qry.execute(new AverageRemoteReducer()).get();
+        IgniteBiTuple<Integer, Integer> redRes = F.reduce(res, new AverageRemoteReducer());
 
-        assertEquals("Average", 33, F.reduce(res, new AverageLocalReducer()).intValue());
+        assertEquals("Average", 33, F.reduce(Collections.singleton(redRes), new AverageLocalReducer()).intValue());
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testAverageQueryWithArguments() throws Exception {
-        CacheQuery<List<?>> qry = ((IgniteKernal)grid(0)).getCache(null).queries().createSqlFieldsQuery(
-            "select age from Person where orgId = ?");
+        SqlFieldsQuery qry = new SqlFieldsQuery("select age from Person where orgId = ?");
+        qry.setArgs(1);
+
+        Collection<List<?>> res = grid(0).cache(null).query(qry).getAll();
 
-        Collection<IgniteBiTuple<Integer, Integer>> res = qry.execute(new AverageRemoteReducer(),
1).get();
+        IgniteBiTuple<Integer, Integer> redRes = F.reduce(res, new AverageRemoteReducer());
 
-        assertEquals("Average", 30, F.reduce(res, new AverageLocalReducer()).intValue());
+        assertEquals("Average", 30, F.reduce(Collections.singleton(redRes), new AverageLocalReducer()).intValue());
     }
 
 //    /**


Mime
View raw message