/** * Kills a cache - stops it, clears any data in any stores, and rolls back any associated txs */ public static void killCaches(Cache... caches) { killCaches(Arrays.asList(caches)); }
protected void removeCacheFromCluster(String cacheName) { for (EmbeddedCacheManager cm : cacheManagers) { TestingUtil.killCaches(cm.getCache(cacheName)); } }
public static void killTreeCaches(TreeCache... treeCaches) { for (TreeCache tc : treeCaches) { if (tc != null) TestingUtil.killCaches(tc.getCache()); } } }
@AfterMethod public void tearDown() throws Exception { TestingUtil.killCaches(cache); cm.stop(); }
@AfterMethod public void tearDown() throws Exception { TestingUtil.replaceComponent(cache, CacheNotifier.class, origNotifier, true); TestingUtil.killCaches(cache); cm.stop(); }
@Test(expectedExceptions = StoreUnavailableException.class) public void testCacheAvailability() { Cache<Object, Object> cache = createManagerAndGetCache(0); cache.put(1, 1); DummyInMemoryStore dims = TestingUtil.getFirstWriter(cache); dims.setAvailable(false); PersistenceManager pm = TestingUtil.extractComponent(cache, PersistenceManager.class); eventually(() -> !pm.isAvailable()); try { cache.put(1, 2); } catch (Exception e) { assertEquals(1, cache.get(1)); throw e; } TestingUtil.killCaches(); }