# sprint-1 Fixed tests for atomic CLOCK mode
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1c5681af Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1c5681af Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1c5681af Branch: refs/heads/ignite-82 Commit: 1c5681afdf4df4cbd498b291e43c5c2ea4494cba Parents: 03890cc Author: sboikov <sboi...@gridgain.com> Authored: Thu Feb 12 11:35:06 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Thu Feb 12 11:35:06 2015 +0300 ---------------------------------------------------------------------- .../cache/GridCacheAbstractFullApiSelfTest.java | 26 ++++++++++++++++++-- ...achePartitionedMultiNodeFullApiSelfTest.java | 2 ++ 2 files changed, 26 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1c5681af/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java index e3cdd64..fd85730 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -2206,6 +2206,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract checkSize(F.asSet("key1", "key2", "key3")); + atomicClockModeDelay(cache); + IgniteCache<String, Integer> asyncCache = cache.withAsync(); if (async) { @@ -2227,6 +2229,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract cache.put("key2", 2); cache.put("key3", 3); + atomicClockModeDelay(cache); + if (async) { IgniteCache<String, Integer> asyncCache0 = jcache(gridCount() > 1 ? 1 : 0).withAsync(); @@ -2246,6 +2250,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract for (int i = 0; i < entryCnt; i++) assertEquals(Integer.valueOf(i), cache.get(String.valueOf(i))); + atomicClockModeDelay(cache); + if (async) { asyncCache.removeAll(); @@ -2259,7 +2265,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract } /** - * Provides count on entities to be removed in removeAll() test + * @return Count of entries to be removed in removeAll() test. */ protected long hugeRemoveAllEntryCount(){ return 1000L; @@ -3909,8 +3915,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract /** * Checks iterators are cleared after using. + * + * @param cache Cache. + * @throws Exception If failed. */ - private void checkIteratorEmpty(IgniteCache<String, Integer> cache) throws InterruptedException, InterruptedException { + private void checkIteratorEmpty(IgniteCache<String, Integer> cache) throws Exception { int cnt = 5; for (int i = 0; i < cnt; ++i) { @@ -3939,4 +3948,17 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract } } } + + /** + * @param cache Cache. + * @throws Exception If failed. + */ + protected void atomicClockModeDelay(IgniteCache cache) throws Exception { + CacheConfiguration ccfg = (CacheConfiguration)cache.getConfiguration(CacheConfiguration.class); + + if (ccfg.getCacheMode() != LOCAL && + ccfg.getAtomicityMode() == CacheAtomicityMode.ATOMIC && + ccfg.getAtomicWriteOrderMode() == CacheAtomicWriteOrderMode.CLOCK) + U.sleep(100); + } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1c5681af/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java index d02fdc2..6b2f8f9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java @@ -78,6 +78,8 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti c0.putAll(putMap); + atomicClockModeDelay(c0); + c1.removeAll(putMap.keySet()); for (int i = 0; i < size; i++) {