#ignite-565: Change GridCacheCrossCacheQuerySelfTest.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/68c68f74 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/68c68f74 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/68c68f74 Branch: refs/heads/ignite-424 Commit: 68c68f7494a8c0c05e0fd6cd2e7cbf3f33ad7515 Parents: ef2bed6 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Thu Mar 26 15:48:05 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Thu Mar 26 15:48:05 2015 +0300 ---------------------------------------------------------------------- .../cache/GridCacheCrossCacheQuerySelfTest.java | 45 ++++++-------------- 1 file changed, 14 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/68c68f74/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java index 5f2fc0e..b344a41 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java @@ -296,31 +296,38 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest { GridCacheAdapter<Integer, Object> dimCache = ((IgniteKernal)ignite).internalCache("replicated"); + List<DimStore> dimStores = new ArrayList<>(); + + List<DimProduct> dimProds = new ArrayList<>(); + for (int i = 0; i < 2; i++) { int id = idGen++; - dimCache.put(id, new DimStore(id, "Store" + id)); + DimStore v = new DimStore(id, "Store" + id); + + dimCache.put(id, v); + + dimStores.add(v); } for (int i = 0; i < 5; i++) { int id = idGen++; - dimCache.put(id, new DimProduct(id, "Product" + id)); - } + DimProduct v = new DimProduct(id, "Product" + id); + + dimCache.put(id, v); - CacheProjection<Integer, DimStore> stores = dimCache.projection(Integer.class, DimStore.class); - CacheProjection<Integer, DimProduct> prods = dimCache.projection(Integer.class, DimProduct.class); + dimProds.add(v); + } GridCacheAdapter<Integer, FactPurchase> factCache = ((IgniteKernal)ignite).internalCache("partitioned"); - List<DimStore> dimStores = new ArrayList<>(stores.values()); Collections.sort(dimStores, new Comparator<DimStore>() { @Override public int compare(DimStore o1, DimStore o2) { return o1.getId() > o2.getId() ? 1 : o1.getId() < o2.getId() ? -1 : 0; } }); - List<DimProduct> dimProds = new ArrayList<>(prods.values()); Collections.sort(dimProds, new Comparator<DimProduct>() { @Override public int compare(DimProduct o1, DimProduct o2) { @@ -339,30 +346,6 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest { } /** - * Fills the caches with data and executes the query. - * - * @param prj Cache projection. - * @throws Exception If failed. - * @return Result. - */ - private List<Map.Entry<Integer, FactPurchase>> body(CacheProjection<Integer, FactPurchase> prj) - throws Exception { - CacheQuery<Map.Entry<Integer, FactPurchase>> qry = (prj == null ? - ((IgniteKernal)ignite) - .<Integer, FactPurchase>getCache("partitioned") : prj).queries().createSqlQuery(FactPurchase.class, - "from \"replicated\".DimStore, \"partitioned\".FactPurchase where DimStore.id = FactPurchase.storeId"); - - List<Map.Entry<Integer, FactPurchase>> res = new ArrayList<>(qry.execute().get()); - Collections.sort(res, new Comparator<Map.Entry<Integer, FactPurchase>>() { - @Override public int compare(Map.Entry<Integer, FactPurchase> o1, Map.Entry<Integer, FactPurchase> o2) { - return o1.getKey() > o2.getKey() ? 1 : o1.getKey() < o2.getKey() ? -1 : 0; - } - }); - - return res; - } - - /** * Checks result. * @param res Result to check. */