Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9338D200CB1 for ; Fri, 9 Jun 2017 11:57:36 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 92083160B9C; Fri, 9 Jun 2017 09:57:36 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 93C46160BC8 for ; Fri, 9 Jun 2017 11:57:35 +0200 (CEST) Received: (qmail 61511 invoked by uid 500); 9 Jun 2017 09:57:33 -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 61502 invoked by uid 99); 9 Jun 2017 09:57:33 -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; Fri, 09 Jun 2017 09:57:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 267F9DFFAB; Fri, 9 Jun 2017 09:57:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Fri, 09 Jun 2017 09:57:33 -0000 Message-Id: <99940f1583e646e4945c3c55bace9563@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/7] ignite git commit: IgniteCacheGroupsTest: reduced test time. archived-at: Fri, 09 Jun 2017 09:57:36 -0000 IgniteCacheGroupsTest: reduced test time. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4479f213 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4479f213 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4479f213 Branch: refs/heads/ignite-5272-tx Commit: 4479f2135116d5f8a587af58a20feb5eb2c93e5e Parents: 8de8fe5 Author: sboikov Authored: Fri Jun 9 10:56:08 2017 +0300 Committer: sboikov Committed: Fri Jun 9 10:56:08 2017 +0300 ---------------------------------------------------------------------- .../processors/cache/IgniteCacheGroupsTest.java | 98 ++++++++++++-------- 1 file changed, 58 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/4479f213/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java index 78d4e0a..a8b0c8b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java @@ -115,7 +115,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE; /** * */ -@SuppressWarnings("unchecked") +@SuppressWarnings({"unchecked", "ThrowableNotThrown"}) public class IgniteCacheGroupsTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); @@ -708,9 +708,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { Affinity aff = affinity(cache1); for(int i = 0; i < keys; i++) { - if (aff.partition(i) == p) { + if (aff.partition(i) == p) keysSet.add(i); - } } for (Cache.Entry entry : cache1.query(qry)) { @@ -729,9 +728,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { aff = affinity(cache2); for(int i = 0; i < keys; i++) { - if (aff.partition(i) == p) { + if (aff.partition(i) == p) keysSet.add(i); - } } for (Cache.Entry entry : cache2.query(qry)) { @@ -753,9 +751,9 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { Integer[] data1 = generateData(keys); Integer[] data2 = generateData(keys); - boolean local = cacheMode == LOCAL; + boolean loc = cacheMode == LOCAL; - if (local) + if (loc) startGrid(0); else startGridsMultiThreaded(4); @@ -765,11 +763,11 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { srv0.createCache(cacheConfiguration(GROUP1, CACHE1, cacheMode, atomicityMode, 2, false)); srv0.createCache(cacheConfiguration(GROUP1, CACHE2, cacheMode, atomicityMode, 2, false)); - if(!local) + if(!loc) awaitPartitionMapExchange(); if (atomicityMode == TRANSACTIONAL) { - Ignite ignite = ignite(local ? 0 : 1); + Ignite ignite = ignite(loc ? 0 : 1); IgniteCache cache1 = ignite.cache(CACHE1); IgniteCache cache2 = ignite.cache(CACHE2); @@ -790,8 +788,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { List> cls = new ArrayList<>(ldrs * 2); for (int i = 0; i < ldrs ; i++) { - cls.add(putOperation(local ? 0 : 1, ldrs, i, CACHE1, data1)); - cls.add(putOperation(local ? 0 : 2, ldrs, i, CACHE2, data2)); + cls.add(putOperation(loc ? 0 : 1, ldrs, i, CACHE1, data1)); + cls.add(putOperation(loc ? 0 : 2, ldrs, i, CACHE2, data2)); } GridTestUtils.runMultiThreaded(cls, "loaders"); @@ -800,7 +798,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { Set keysSet = sequence(keys); - for (Cache.Entry entry : ignite(local ? 0 : 3).cache(CACHE1)) { + for (Cache.Entry entry : ignite(loc ? 0 : 3).cache(CACHE1)) { assertTrue(keysSet.remove(entry.getKey())); assertEquals(data1[entry.getKey()], entry.getValue()); } @@ -811,7 +809,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { keysSet = sequence(keys); - for (Cache.Entry entry : ignite(local ? 0 : 3).cache(CACHE2)) { + for (Cache.Entry entry : ignite(loc ? 0 : 3).cache(CACHE2)) { assertTrue(keysSet.remove(entry.getKey())); assertEquals(data2[entry.getKey()], entry.getValue()); } @@ -820,6 +818,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { } /** + * @param cacheMode Cache mode. + * @param atomicityMode Cache atomicity mode. * @throws Exception If failed. */ private void entriesTtl(CacheMode cacheMode, CacheAtomicityMode atomicityMode) throws Exception { @@ -830,9 +830,9 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { Integer[] data1 = generateData(keys); Integer[] data2 = generateData(keys); - boolean local = cacheMode == LOCAL; + boolean loc = cacheMode == LOCAL; - if (local) + if (loc) startGrid(0); else startGridsMultiThreaded(4); @@ -849,11 +849,11 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { srv0.createCache(cacheConfiguration(GROUP1, CACHE2, cacheMode, atomicityMode, 2, false)); - if (!local) + if (!loc) awaitPartitionMapExchange(); if (atomicityMode == TRANSACTIONAL) { - Ignite ignite = ignite(local ? 0 : 1); + Ignite ignite = ignite(loc ? 0 : 1); IgniteCache cache1 = ignite.cache(CACHE1); IgniteCache cache2 = ignite.cache(CACHE2); @@ -874,25 +874,25 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { List> cls = new ArrayList<>(ldrs * 2); for (int i = 0; i < ldrs ; i++) { - cls.add(putOperation(local ? 0 : 1, ldrs, i, CACHE1, data1)); - cls.add(putOperation(local ? 0 : 2, ldrs, i, CACHE2, data2)); + cls.add(putOperation(loc ? 0 : 1, ldrs, i, CACHE1, data1)); + cls.add(putOperation(loc ? 0 : 2, ldrs, i, CACHE2, data2)); } GridTestUtils.runMultiThreaded(cls, "loaders"); } - checkData(local ? 0 : 3, CACHE1, data1); - checkData(local ? 0 : 3, CACHE2, data2); + checkData(loc ? 0 : 3, CACHE1, data1); + checkData(loc ? 0 : 3, CACHE2, data2); srv0.destroyCache(CACHE2); - checkData(local ? 0 : 3, CACHE1, data1); + checkData(loc ? 0 : 3, CACHE1, data1); // Wait for expiration Thread.sleep((long)(ttl * 1.2)); - assertEquals(0, ignite(local ? 0 : 3).cache(CACHE1).size()); + assertEquals(0, ignite(loc ? 0 : 3).cache(CACHE1).size()); } /** @@ -1082,21 +1082,21 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { Affinity aff = affinity(cache); - Set localKeys = new TreeSet<>(); + Set locKeys = new TreeSet<>(); for (int key = 0; key < data.length; key++) { if(aff.isPrimaryOrBackup(node, key)) - localKeys.add(key); + locKeys.add(key); } - Iterable> localEntries = cache.localEntries(CachePeekMode.OFFHEAP); + Iterable> locEntries = cache.localEntries(CachePeekMode.OFFHEAP); - for (Cache.Entry entry : localEntries) { - assertTrue(localKeys.remove(entry.getKey())); + for (Cache.Entry entry : locEntries) { + assertTrue(locKeys.remove(entry.getKey())); assertEquals(data[entry.getKey()], entry.getValue()); } - assertTrue(localKeys.isEmpty()); + assertTrue(locKeys.isEmpty()); } /** @@ -1307,12 +1307,13 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { checkCacheDiscoveryDataConsistent(); for (int i = 0; i < NODES; i++) { - for (int c = 0; c < CACHES; c++) { - if (c % 100 == 0) - log.info("Check node: " + i); + log.info("Check node: " + i); - checkCache(i, "testCache1-" + c, 1); - checkCache(i, "testCache2-" + c, 1); + for (int c = 0; c < 10; c++) { + int cache = ThreadLocalRandom.current().nextInt(CACHES); + + checkCache(i, "testCache1-" + cache, 1); + checkCache(i, "testCache2-" + cache, 1); } } @@ -2633,27 +2634,44 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { tearDown(cache); } - + /** + * @throws Exception If failed. + */ public void testLoadCacheAtomicPartitioned() throws Exception { loadCache(PARTITIONED, ATOMIC); } + /** + * @throws Exception If failed. + */ public void testLoadCacheAtomicReplicated() throws Exception { loadCache(REPLICATED, ATOMIC); } + /** + * @throws Exception If failed. + */ public void testLoadCacheTxPartitioned() throws Exception { loadCache(PARTITIONED, TRANSACTIONAL); } + /** + * @throws Exception If failed. + */ public void testLoadCacheTxReplicated() throws Exception { loadCache(REPLICATED, TRANSACTIONAL); } + /** + * @throws Exception If failed. + */ public void testLoadCacheAtomicLocal() throws Exception { loadCache(LOCAL, ATOMIC); } + /** + * @throws Exception If failed. + */ public void testLoadCacheTxLocal() throws Exception { loadCache(LOCAL, TRANSACTIONAL); } @@ -2666,7 +2684,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { private void loadCache(CacheMode cacheMode, CacheAtomicityMode atomicityMode) throws Exception { int keys = 100; - boolean local = cacheMode == LOCAL; + boolean loc = cacheMode == LOCAL; Map data1 = generateDataMap(keys); Map data2 = generateDataMap(keys); @@ -2684,7 +2702,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { CacheConfiguration ccfg2 = cacheConfiguration(GROUP1, CACHE2, cacheMode, atomicityMode, 1, false) .setCacheStoreFactory(fctr2); - Ignite node = startGrids(local ? 1 : 4); + Ignite node = startGrids(loc ? 1 : 4); node.createCaches(F.asList(ccfg1, ccfg2)); @@ -4247,7 +4265,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { * */ static class MapBasedStore implements CacheStore, Serializable { - private final Map src; + /** */ + private final Map src; /** * @param src Source map. @@ -4283,8 +4302,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override - public void writeAll(Collection> entries) throws CacheWriterException { + @Override public void writeAll(Collection> entries) { throw new UnsupportedOperationException(); }