#ignite-333: Override testLocalClearKeys in GridCacheNearOnlyMultiNodeFullApiSelfTest.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/79ea1593 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/79ea1593 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/79ea1593 Branch: refs/heads/ignite-409 Commit: 79ea1593bc6d2448f22c019159aafdc185bd6840 Parents: f16407d Author: ivasilinets <ivasilin...@gridgain.com> Authored: Wed Mar 18 20:29:25 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Wed Mar 18 20:29:25 2015 +0300 ---------------------------------------------------------------------- .../cache/GridCacheAbstractFullApiSelfTest.java | 4 +-- ...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 32 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/79ea1593/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 181d3e2..b55b4d1 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 @@ -4123,7 +4123,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract /** * @param keyToRmv Removed key. */ - private void checkLocalRemovedKey(String keyToRmv) { + protected void checkLocalRemovedKey(String keyToRmv) { for (int i = 0; i < 500; ++i) { String key = "key" + i; @@ -4189,7 +4189,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * * @return Map grid's name to its primary keys. */ - private Map<String, List<String>> addKeys() { + protected Map<String, List<String>> addKeys() { // Save entries only on their primary nodes. If we didn't do so, clearLocally() will not remove all entries // because some of them were blocked due to having readers. Map<String, List<String>> keys = new HashMap<>(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/79ea1593/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java index 660b64b..94d0616 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java @@ -496,6 +496,38 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio } } + /** {@inheritDoc} */ + @Override public void testLocalClearKeys() throws Exception { + IgniteCache<String, Integer> nearCache = jcache(); + IgniteCache<String, Integer> primary = fullCache(); + + Collection<String> keys = primaryKeysForCache(primary, 3); + + int i = 0; + + for (String key : keys) + nearCache.put(key, i++); + + String lastKey = F.last(keys); + + Set<String> keysToRmv = new HashSet<>(keys); + + keysToRmv.remove(lastKey); + + assert keysToRmv.size() > 1; + + nearCache.localClearAll(keysToRmv); + + for (String key : keys) { + boolean found = nearCache.localPeek(key, CachePeekMode.ONHEAP) != null; + + if (keysToRmv.contains(key)) + assertFalse("Found removed key " + key, found); + else + assertTrue("Not found key " + key, found); + } + } + /** * @param async If {@code true} uses async method. * @throws Exception If failed.