Ignite-805 (cherry picked from commit adce9b9)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/069653b7 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/069653b7 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/069653b7 Branch: refs/heads/ignite-1093-2 Commit: 069653b74856d99b2b7535443d15b8515d9bd15c Parents: e5b06e3 Author: Anton Vinogradov <[email protected]> Authored: Tue Sep 8 15:05:55 2015 +0300 Committer: Anton Vinogradov <[email protected]> Committed: Tue Sep 8 15:12:26 2015 +0300 ---------------------------------------------------------------------- ...cheAbstractFullApiMultithreadedSelfTest.java | 63 +++++++++++++------- ...PartitionedFullApiMultithreadedSelfTest.java | 5 -- ...eReplicatedFullApiMultithreadedSelfTest.java | 5 -- ...dCacheLocalFullApiMultithreadedSelfTest.java | 5 -- 4 files changed, 40 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/069653b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiMultithreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiMultithreadedSelfTest.java index bfafe69..2959b34 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiMultithreadedSelfTest.java @@ -163,7 +163,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid * @throws Exception In case of error. */ public void testContainsKey() throws Exception { - runTest(new CI1<IgniteCache<String,Integer>>() { + runTest(new CI1<IgniteCache<String, Integer>>() { @Override public void apply(IgniteCache<String, Integer> cache) { assert cache.containsKey("key" + random()); assert !cache.containsKey("wrongKey"); @@ -175,7 +175,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid * @throws Exception In case of error. */ public void testGet() throws Exception { - runTest(new CIX1<IgniteCache<String,Integer>>() { + runTest(new CIX1<IgniteCache<String, Integer>>() { @Override public void applyx(IgniteCache<String, Integer> cache) { int rnd = random(); @@ -189,7 +189,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid * @throws Exception In case of error. */ public void testGetAsync() throws Exception { - runTest(new CIX1<IgniteCache<String,Integer>>() { + runTest(new CIX1<IgniteCache<String, Integer>>() { @Override public void applyx(IgniteCache<String, Integer> cache) { int rnd = random(); @@ -199,7 +199,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid assert cacheAsync.<Integer>future().get() == rnd; - cache.get("wrongKey"); + cacheAsync.get("wrongKey"); assert cacheAsync.future().get() == null; } @@ -210,7 +210,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid * @throws Exception In case of error. */ public void testGetAll() throws Exception { - runTest(new CIX1<IgniteCache<String,Integer>>() { + runTest(new CIX1<IgniteCache<String, Integer>>() { @Override public void applyx(IgniteCache<String, Integer> cache) { int rnd1 = random(); int rnd2 = random(); @@ -224,17 +224,20 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid }); } - /** + /** * @throws Exception In case of error. */ public void testGetAllAsync() throws Exception { - runTest(new CIX1<IgniteCache<String,Integer>>() { + runTest(new CIX1<IgniteCache<String, Integer>>() { @Override public void applyx(IgniteCache<String, Integer> cache) { int rnd1 = random(); int rnd2 = random(); - cache.withAsync().getAll(ImmutableSet.of("key" + rnd1, "key" + rnd2)); - Map<String, Integer> map = cache.withAsync().<Map<String, Integer>>future().get(); + IgniteCache<String, Integer> cacheAsync = cache.withAsync(); + + cacheAsync.getAll(ImmutableSet.of("key" + rnd1, "key" + rnd2)); + + Map<String, Integer> map = cacheAsync.<Map<String, Integer>>future().get(); assert map.size() == (rnd1 != rnd2 ? 2 : 1); assert map.get("key" + rnd1) == rnd1; @@ -247,7 +250,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid * @throws Exception In case of error. */ public void testRemove() throws Exception { - runTest(new CIX1<IgniteCache<String,Integer>>() { + runTest(new CIX1<IgniteCache<String, Integer>>() { @Override public void applyx(IgniteCache<String, Integer> cache) { int rnd1 = random(); int rnd2 = random(); @@ -255,13 +258,20 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid assert cache.getAndRemove("wrongKey") == null; assert !cache.remove("key" + rnd1, -1); - assert cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP) == null || cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP) == rnd1; - assert cache.localPeek("key" + rnd2, CachePeekMode.ONHEAP) == null || cache.localPeek("key" + rnd2, CachePeekMode.ONHEAP) == rnd2; + Integer v1 = cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP); + Integer v2 = cache.localPeek("key" + rnd2, CachePeekMode.ONHEAP); + + assert v1 == null || v1 == rnd1; + assert v2 == null || v2 == rnd2; + + v1 = cache.getAndRemove("key" + rnd1); - assert cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP) == null || cache.getAndRemove("key" + rnd1) == rnd1; - assert cache.localPeek("key" + rnd2, CachePeekMode.ONHEAP) == null || cache.remove("key" + rnd2, rnd2); + assert cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP) == null && (v1 == null || v1 == rnd1); + + assert cache.getAndRemove("key" + rnd1) == null; + + cache.remove("key" + rnd2, rnd2); - assert cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP) == null; assert cache.localPeek("key" + rnd2, CachePeekMode.ONHEAP) == null; } }); @@ -271,7 +281,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid * @throws Exception In case of error. */ public void testRemoveAsync() throws Exception { - runTest(new CIX1<IgniteCache<String,Integer>>() { + runTest(new CIX1<IgniteCache<String, Integer>>() { @Override public void applyx(IgniteCache<String, Integer> cache) { int rnd1 = random(); int rnd2 = random(); @@ -286,13 +296,20 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid assert !cacheAsync.<Boolean>future().get(); - assert cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP) == null || cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP) == rnd1; - assert cache.localPeek("key" + rnd2, CachePeekMode.ONHEAP) == null || cache.localPeek("key" + rnd2, CachePeekMode.ONHEAP) == rnd2; + Integer v1 = cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP); + Integer v2 = cache.localPeek("key" + rnd2, CachePeekMode.ONHEAP); + + assert v1 == null || v1 == rnd1; + assert v2 == null || v2 == rnd2; + + v1 = removeAsync(cache, "key" + rnd1); + + assert cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP) == null && (v1 == null || v1 == rnd1); + + assert cache.getAndRemove("key" + rnd1) == null; - assert cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP) == null || removeAsync(cache, "key" + rnd1) == rnd1; - assert cache.localPeek("key" + rnd2, CachePeekMode.ONHEAP) == null || removeAsync(cache, "key" + rnd2, rnd2); + removeAsync(cache, "key" + rnd2, rnd2); - assert cache.localPeek("key" + rnd1, CachePeekMode.ONHEAP) == null; assert cache.localPeek("key" + rnd2, CachePeekMode.ONHEAP) == null; } }); @@ -302,7 +319,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid * @throws Exception In case of error. */ public void testRemoveAll() throws Exception { - runTest(new CIX1<IgniteCache<String,Integer>>() { + runTest(new CIX1<IgniteCache<String, Integer>>() { @Override public void applyx(IgniteCache<String, Integer> cache) { int rnd = random(); @@ -318,7 +335,7 @@ public abstract class GridCacheAbstractFullApiMultithreadedSelfTest extends Grid * @throws Exception In case of error. */ public void testRemoveAllAsync() throws Exception { - runTest(new CIX1<IgniteCache<String,Integer>>() { + runTest(new CIX1<IgniteCache<String, Integer>>() { @Override public void applyx(IgniteCache<String, Integer> cache) { int rnd = random(); http://git-wip-us.apache.org/repos/asf/ignite/blob/069653b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiMultithreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiMultithreadedSelfTest.java index 337febd..905996c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiMultithreadedSelfTest.java @@ -27,11 +27,6 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED; */ public class GridCachePartitionedFullApiMultithreadedSelfTest extends GridCacheAbstractFullApiMultithreadedSelfTest { /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-805"); - } - - /** {@inheritDoc} */ @Override protected int gridCount() { return 3; } http://git-wip-us.apache.org/repos/asf/ignite/blob/069653b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFullApiMultithreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFullApiMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFullApiMultithreadedSelfTest.java index 81da1de..512713c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFullApiMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFullApiMultithreadedSelfTest.java @@ -27,11 +27,6 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED; */ public class GridCacheReplicatedFullApiMultithreadedSelfTest extends GridCacheAbstractFullApiMultithreadedSelfTest { /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-805"); - } - - /** {@inheritDoc} */ @Override protected int gridCount() { return 2; } http://git-wip-us.apache.org/repos/asf/ignite/blob/069653b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiMultithreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiMultithreadedSelfTest.java index fc97a59..27593a9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiMultithreadedSelfTest.java @@ -27,11 +27,6 @@ import static org.apache.ignite.cache.CacheMode.LOCAL; */ public class GridCacheLocalFullApiMultithreadedSelfTest extends GridCacheAbstractFullApiMultithreadedSelfTest { /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-805"); - } - - /** {@inheritDoc} */ @Override protected int gridCount() { return 1; }
