protected void clearSite(TestSite ts) { TestingUtil.clearContent(ts.cacheManagers); }
@AfterMethod public void cleanCaches() { TestingUtil.clearContent(cacheManager1, cacheManager2); }
public static void clearContent(EmbeddedCacheManager... cacheManagers) { clearContent(Arrays.asList(cacheManagers)); }
@Override protected void teardown() { TestingUtil.clearContent(cacheManager); super.teardown(); }
public static void clearContent(List<? extends EmbeddedCacheManager> cacheManagers) { for (EmbeddedCacheManager cm : cacheManagers) { try { clearContent(cm); } catch (Throwable e) { log.warn("Problems clearing cache manager " + cm, e); } } }
@AfterMethod(alwaysRun=true) protected void clearContent() { if (cleanupAfterTest()) TestingUtil.clearContent(cacheManager); }
@AfterMethod(alwaysRun = true) protected void clearContent() throws Throwable { if (cleanupAfterTest()) { log.debug("*** Test method complete; clearing contents on all caches."); TestingUtil.clearContent(cacheManagers); } else { TestingUtil.clearContent(cacheManagers); TestingUtil.killCacheManagers(cacheManagers); TestResourceTracker.cleanUpResources(getTestName()); cacheManagers.clear(); } }
/** * Invoke a task using a cache manager. This method guarantees that the * cache manager used in the task will be cleaned up after the task has * completed, regardless of the task outcome. * * @param c task to execute */ public static void withCacheManager(CacheManagerCallable c) { try { c.call(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } finally { if (c.clearBeforeKill()) { TestingUtil.clearContent(c.cm); } TestingUtil.killCacheManagers(c.cm); } }
@AfterClass(alwaysRun = true) protected void destroy() { if (cleanupAfterTest()) { TestingUtil.clearContent(cacheManagers); TestingUtil.killCacheManagers(cacheManagers); } for (EmbeddedCacheManager cm : cacheManagers) { String nodeName = cm.getCacheManagerConfiguration().transport().nodeName(); assertTrue("Invalid node name for test " + getCurrentTestShortName() + ": " + nodeName, nodeName != null && nodeName.contains(getCurrentTestShortName())); } cacheManagers.clear(); listeners.clear(); }