private EmbeddedCacheManager getManagerWithStore(Method m, boolean isClustered, boolean isStoreShared) { return getManagerWithStore(m, isClustered, isStoreShared, "store-"); }
private void doTestRemoveCacheClustered(final Method m, final boolean isStoreShared) { withCacheManagers(new MultiCacheManagerCallable( getManagerWithStore(m, true, isStoreShared, "store1-"), getManagerWithStore(m, true, isStoreShared, "store2-")) { @Override public void call() {
public void testRemoveNonExistentCache(Method m) { EmbeddedCacheManager manager = getManagerWithStore(m, false, false); try { manager.getCache("cache"); // An attempt to remove a non-existing cache should be a no-op manager.administration().removeCache("does-not-exist"); } finally { manager.stop(); } }
public void testRemoveCacheLocal(Method m) { EmbeddedCacheManager manager = getManagerWithStore(m, false, false); try { Cache<String, String> cache = manager.getCache("cache"); cache.put(k(m, 1), v(m, 1)); cache.put(k(m, 2), v(m, 2)); cache.put(k(m, 3), v(m, 3)); DummyInMemoryStore store = getDummyStore(cache); DataContainer data = getDataContainer(cache); assertFalse(store.isEmpty()); assertTrue(0 != data.size()); manager.administration().removeCache("cache"); assertEquals(0, DummyInMemoryStore.getStoreDataSize(store.getStoreName())); assertEquals(0, data.size()); // Try removing the cache again, it should be a no-op manager.administration().removeCache("cache"); assertEquals(0, DummyInMemoryStore.getStoreDataSize(store.getStoreName())); assertEquals(0, data.size()); } finally { manager.stop(); } }