@Override public void applyx() { X.println("Checking whether cache is empty."); IgniteCache<SampleKey, SampleValue> cache = g.cache("partitioned"); assert cache.localSize() == 0; } }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { jcache().removeAll(); assert jcache().localSize() == 0; assert size(ValueObject.class) == 0; STORE_MAP.clear(); }
/** {@inheritDoc} */ @SuppressWarnings({"SizeReplaceableByIsEmpty"}) @Override protected void beforeTest() throws Exception { for (int i = 0; i < GRID_CNT; i++) { assert jcache(i).localSize() == 0 : "Near cache size is not zero for grid: " + i; assert dht(grid(i)).size() == 0 : "DHT cache size is not zero for grid: " + i; assert jcache(i).localSize() == 0 : "Near cache is not empty for grid: " + i; assert dht(grid(i)).isEmpty() : "DHT cache is not empty for grid: " + i; } }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { jcache().clear(); assertEquals(0, jcache().localSize()); }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { jcache().clear(); assertTrue(jcache().localSize() == 0); } }
/** * @param keys Expected keys. * @throws Exception If failed. */ protected void checkSize(final Collection<String> keys) throws Exception { if (nearEnabled()) assertEquals(keys.size(), jcache().localSize(CachePeekMode.ALL)); else { for (int i = 0; i < gridCount(); i++) executeOnLocalOrRemoteJvm(i, new CheckEntriesTask(keys)); } }
/** {@inheritDoc} */ @Override public void run(int idx) throws Exception { GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(DEFAULT_CACHE_NAME).context(); int size = 0; for (String key : map.keySet()) if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx())) size++; assertEquals("Incorrect key size on cache #" + idx, size, ignite.cache(ctx.name()).localSize(ALL)); } }
/** {@inheritDoc} */ @Override public void run(int idx) throws Exception { GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(cacheName).context(); int size = 0; for (String key : keys) if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx())) size++; assertEquals("Incorrect key size on cache #" + idx, size, ignite.cache(cacheName).localSize(ALL)); } }
/** {@inheritDoc} */ @Override public void run(int idx) throws Exception { GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(DEFAULT_CACHE_NAME).context(); int size = 0; for (String key : keys) if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx())) size++; assertEquals("Incorrect key size on cache #" + idx, size, ignite.cache(DEFAULT_CACHE_NAME).localSize(ALL)); } }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { super.afterTest(); for (int i = 0; i < GRID_CNT; i++) { grid(i).cache(DEFAULT_CACHE_NAME).removeAll(); assert grid(i).cache(DEFAULT_CACHE_NAME).localSize() == 0; } }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { removeListeners(ignite1); removeListeners(ignite2); lsnrs.clear(); for (int i = 1; i <= 3; i++) { jcache(i).clear(); assertTrue( "Cache isn't empty [i=" + i + ", entries=" + ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME).entries() + "]", jcache(i).localSize() == 0); } }
/** @throws Exception If failed. */ @Test public void testThreeNodes() throws Exception { checkNodes(startGridsMultiThreaded(3)); assertTrue(!colocated(0, "test").isEmpty()); assertTrue(jcache(0, "test").localSize() > 0); }
/** @throws Exception If failed. */ @Test public void testNoTransactionSinglePutx() throws Exception { IgniteCache<Integer, String> near = jcache(0); near.put(2, "2"); assertEquals("2", near.localPeek(2)); assertEquals("2", near.get(2)); assertEquals("2", localPeek(dht(primaryGrid(2)), 2)); assertEquals(1, near.localSize()); assertEquals(1, near.localSize()); assertEquals(1, dht(primaryGrid(2)).size()); }
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { super.afterTest(); for (int i = 0; i < gridCount(); i++) { Ignite g = grid(i); g.cache(DEFAULT_CACHE_NAME).removeAll(); assert g.cache(DEFAULT_CACHE_NAME).localSize() == 0; g.cache(DEFAULT_CACHE_NAME).localMxBean().clear(); } }
@Override public boolean applyx() throws IgniteCheckedException { jcache(fi).removeAll(); if (jcache(fi).size(CachePeekMode.ALL) > 0) { for (Cache.Entry<String, ?> k : jcache(fi).localEntries()) jcache(fi).remove(k.getKey()); } return jcache(fi).localSize(CachePeekMode.ALL) == 0; } },
/** * @throws Exception If failed. */ @Test public void testFlush() throws Exception { jcache().put("flushKey1", "flushVal1"); jcache().put("flushKey2", "flushVal2"); Assert.assertTrue(client.flush().get()); Assert.assertNull(jcache().get("flushKey1")); Assert.assertNull(jcache().get("flushKey2")); Assert.assertTrue(jcache().localSize() == 0); }
/** {@inheritDoc} */ @SuppressWarnings({"SizeReplaceableByIsEmpty"}) @Override protected void beforeTest() throws Exception { MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); for (int i = 0; i < GRID_CNT; i++) { assert near(grid(i)).size() == 0 : "Near cache size is not zero for grid: " + i; assert dht(grid(i)).size() == 0 : "DHT cache size is not zero for grid: " + i; assert near(grid(i)).localSize() == 0 : "Near cache is not empty for grid: " + i; assert dht(grid(i)).isEmpty() : "DHT cache is not empty for grid: " + i; } }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); if (testsCfg.awaitPartitionMapExchange()) awaitPartitionMapExchange(); assert jcache().unwrap(Ignite.class).transactions().tx() == null; assertEquals(0, jcache().localSize()); assertEquals(0, jcache().size()); }