public void removePendingPutsCache() { String pendingPutsName = getPendingPutsName( cache ); EmbeddedCacheManager cm = cache.getCacheManager(); cm.administration().removeCache( pendingPutsName ); }
manager(0).administration().withFlags(CacheContainerAdmin.AdminFlag.PERMANENT).createCache("a", configuration); manager(1).administration().createCache("b", configuration); manager(0).administration().withFlags(CacheContainerAdmin.AdminFlag.PERMANENT).createCache("c", configuration);
public void testClusterCacheTest() { waitForClusterToForm(); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clustering().cacheMode(CacheMode.DIST_SYNC); Configuration configuration = builder.build(); Cache<Object, Object> cache = manager(0).administration().createCache("a", configuration); waitForClusterToForm("a"); assertEquals(cacheManagers.size(), cache.getAdvancedCache().getRpcManager().getMembers().size()); checkConsistencyAcrossCluster("a", configuration); addClusterEnabledCacheManager(); checkConsistencyAcrossCluster("a", configuration); Exceptions.expectException(CacheConfigurationException.class, "ISPN000374: No such template 'nonExistingTemplate' when declaring 'b'", () -> manager(0).administration().createCache("b", "nonExistingTemplate")); // attempt to create an existing cache Exceptions.expectException(CacheConfigurationException.class, "ISPN000507: Cache a already exists", () -> manager(0).administration().createCache("a", configuration)); // getOrCreate should work manager(0).administration().getOrCreateCache("a", configuration); manager(1).administration().removeCache("a"); checkCacheExistenceAcrossCluster("a", false); addClusterEnabledCacheManager(); checkCacheExistenceAcrossCluster("a", false); }
public void testClusterCacheTest() { waitForClusterToForm(); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clustering().cacheMode(CacheMode.DIST_SYNC); Configuration configuration = builder.build(); Exceptions.expectException(UnsupportedOperationException.class, "ISPN000515: The configuration is immutable", () -> manager(0).administration().createCache("a", configuration)); // attempt to delete a cache Exceptions.expectException(UnsupportedOperationException .class, "ISPN000515: The configuration is immutable", () -> manager(0).administration().removeCache("a")); } }
public void testClusterCacheTest() { waitForClusterToForm(); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clustering().cacheMode(CacheMode.DIST_SYNC); Configuration configuration = builder.build(); Cache<Object, Object> cache = manager(0).administration().createCache("a", configuration); } }
@AfterMethod(alwaysRun = true) private void cleanAfterMethod() { cacheManager.administration().removeCache(CACHE_NAME); cacheManager.undefineConfiguration(CACHE_NAME); cacheManager.administration().removeCache(INTERNAL_CACHE_NAME); internalCacheRegistry.unregisterInternalCache(INTERNAL_CACHE_NAME); }
public void testSharedClusterCache() { waitForClusterToForm(); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clustering().cacheMode(CacheMode.DIST_SYNC); Configuration configuration = builder.build(); // Create a persistent cache manager(0).administration().withFlags(CacheContainerAdmin.AdminFlag.PERMANENT).createCache("a", configuration); waitForClusterToForm("a"); checkConsistencyAcrossCluster("a", configuration); // shutdown TestingUtil.killCacheManagers(this.cacheManagers); cacheManagers.clear(); // recreate the cache manager createStatefulCacheManager("A", true); createStatefulCacheManager("B", true); checkConsistencyAcrossCluster("a", configuration); } }
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(); } }
@Override protected void supportedAccessTypeTest(TestRegionFactory regionFactory, Properties properties) { InfinispanBaseRegion region = regionFactory.buildEntityRegion("test", accessType); assertNotNull(TEST_SESSION_ACCESS.entityAccess(region, accessType)); regionFactory.getCacheManager().administration().removeCache(CACHE_NAME); }
@Override protected void supportedAccessTypeTest(TestRegionFactory regionFactory, Properties properties) { InfinispanBaseRegion region = regionFactory.buildCollectionRegion(CACHE_NAME, accessType); assertNotNull(TEST_SESSION_ACCESS.collectionAccess(region, accessType)); regionFactory.getCacheManager().administration().removeCache(CACHE_NAME); }
@Test(dependsOnMethods="testJmxOperations") public void testCacheMBeanUnregisterOnRemove() throws Exception { cacheManager.defineConfiguration("test", new ConfigurationBuilder().build()); assertNotNull(cacheManager.getCache("test")); ObjectName cacheMBean = getCacheObjectName(JMX_DOMAIN, "test(local)"); assertTrue(existsObject(cacheMBean)); cacheManager.administration().removeCache("test"); assertFalse(existsObject(cacheMBean)); }
@Test public void testRemoveCache() { cacheManager.defineConfiguration("A", new ConfigurationBuilder().build()); cacheManager.defineConfiguration("B", new ConfigurationBuilder().build()); cacheManager.defineConfiguration("C", new ConfigurationBuilder().build()); Cache<?, ?> cacheA = cacheManager.getCache("A"); Cache<?, ?> cacheB = cacheManager.getCache("B"); Cache<?, ?> cacheC = cacheManager.getCache("C"); cacheManager.addCacheDependency("A", "B"); cacheManager.addCacheDependency("A", "C"); cacheManager.addCacheDependency("B", "C"); cacheManager.administration().removeCache("B"); CacheEventListener listener = new CacheEventListener(); cacheManager.addListener(listener); cacheManager.stop(); assertAllTerminated(cacheA, cacheB, cacheC); assertEquals(Arrays.asList("A", "C", GlobalConfigurationManager.CONFIG_STATE_CACHE_NAME, DEFAULT_CACHE_NAME), listener.stopOrder); }
public void testRemoveCache() { ConfigurationBuilder cb = TestCacheManagerFactory.getDefaultCacheConfiguration(false); createCacheStoreConfig(cb.persistence(), true); EmbeddedCacheManager local = TestCacheManagerFactory.createCacheManager(cb); try { final String cacheName = "to-be-removed"; local.defineConfiguration(cacheName, local.getDefaultCacheConfiguration()); Cache<String, Object> cache = local.getCache(cacheName); assertTrue(local.isRunning(cacheName)); cache.put("1", wrap("1", "v1")); assertCacheEntry(cache, "1", "v1", -1, -1); local.administration().removeCache(cacheName); assertFalse(local.isRunning(cacheName)); } finally { TestingUtil.killCacheManagers(local); } }
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(); } }
local.administration().removeCache(cacheName); assertFalse(local.isRunning(cacheName)); assertFalse(passivate.get());
assertEquals(5, data2.size()); manager1.administration().removeCache("cache"); assertFalse(manager1.cacheExists("cache")); assertFalse(manager2.cacheExists("cache"));