Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6F6D917286 for ; Thu, 17 Sep 2015 07:48:15 +0000 (UTC) Received: (qmail 90727 invoked by uid 500); 17 Sep 2015 07:48:15 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 90668 invoked by uid 500); 17 Sep 2015 07:48:15 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 90656 invoked by uid 99); 17 Sep 2015 07:48:15 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Sep 2015 07:48:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 32C6DE060C; Thu, 17 Sep 2015 07:48:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Thu, 17 Sep 2015 07:48:15 -0000 Message-Id: <03b3018b22f642e090fd55f7374f6270@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [01/15] ignite git commit: Fixed test to really check query result. Repository: ignite Updated Branches: refs/heads/ignite-1282 25c9f609e -> e942cae9e Fixed test to really check query result. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dcd8b42a Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dcd8b42a Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dcd8b42a Branch: refs/heads/ignite-1282 Commit: dcd8b42aa696bafbb4d7c11a9cf1520d54539001 Parents: ae1e1dc Author: sboikov Authored: Tue Sep 15 16:44:05 2015 +0300 Committer: sboikov Committed: Tue Sep 15 16:44:05 2015 +0300 ---------------------------------------------------------------------- ...CacheScanPartitionQueryFallbackSelfTest.java | 54 ++++++++------------ 1 file changed, 21 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/dcd8b42a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java index df310b4..1ef470a 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java @@ -146,7 +146,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT CacheQuery> qry = cache.context().queries().createScanQuery(null, part, false); - doTestScanQuery(qry); + doTestScanQuery(qry, part); } finally { stopAllGrids(); @@ -176,7 +176,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT CacheQuery> qry = cache.context().queries().createScanQuery(null, part, false); - doTestScanQuery(qry); + doTestScanQuery(qry, part); } finally { stopAllGrids(); @@ -198,7 +198,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT try { Ignite ignite = startGrids(GRID_CNT); - final IgniteCacheProxy cache = fillCache(ignite); + fillCache(ignite); final AtomicBoolean done = new AtomicBoolean(false); @@ -211,6 +211,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT while (!done.get()) { startGrid(id); + Thread.sleep(3000); stopGrid(id); @@ -240,15 +241,10 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT int part = tup.get1(); - try { - CacheQuery> qry = cache.context().queries().createScanQuery( - null, part, false); + CacheQuery> qry = cache.context().queries().createScanQuery( + null, part, false); - doTestScanQuery(qry); - } - catch (ClusterGroupEmptyCheckedException e) { - log.warning("Invalid partition: " + part, e); - } + doTestScanQuery(qry, part); } return null; @@ -315,17 +311,12 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT while (!done.get()) { int part = ThreadLocalRandom.current().nextInt(ignite(nodeId).affinity(null).partitions()); - try { - QueryCursor> cur = - cache.query(new ScanQuery(part)); + QueryCursor> cur = + cache.query(new ScanQuery(part)); - U.debug(log, "Running query [node=" + nodeId + ", part=" + part + ']'); + U.debug(log, "Running query [node=" + nodeId + ", part=" + part + ']'); - doTestScanQueryCursor(cur, part); - } - catch (ClusterGroupEmptyCheckedException e) { - log.warning("Invalid partition: " + part, e); - } + doTestScanQueryCursor(cur, part); } return null; @@ -404,7 +395,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT } }; - int part; + Integer part = null; CacheQuery> qry = null; if (test.get()) { @@ -416,7 +407,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT new Thread(run).start(); if (test.get()) - doTestScanQuery(qry); + doTestScanQuery(qry, part); else latch.await(); } @@ -454,20 +445,18 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT /** * @param qry Query. */ - protected void doTestScanQuery( - CacheQuery> qry) throws IgniteCheckedException { + protected void doTestScanQuery(CacheQuery> qry, int part) + throws IgniteCheckedException { CacheQueryFuture> fut = qry.execute(); - Collection> expEntries = fut.get(); + Collection> qryEntries = fut.get(); - for (Map.Entry e : expEntries) { - Map map = entries.get(((GridCacheQueryAdapter)qry).partition()); + Map map = entries.get(part); - if (map == null) - assertTrue(expEntries.isEmpty()); - else - assertEquals(map.get(e.getKey()), e.getValue()); - } + for (Map.Entry e : qryEntries) + assertEquals(map.get(e.getKey()), e.getValue()); + + assertEquals("Invalid number of entries for partition: " + part, map.size(), qryEntries.size()); } /** @@ -484,7 +473,6 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT int cnt = 0; for (Cache.Entry e : cur) { - assertEquals(map.get(e.getKey()), e.getValue()); cnt++;