@AfterMethod(alwaysRun = true) public void tearDown() throws Exception { if (localManagementContext != null) Entities.destroyAll(localManagementContext); if (app != null) Entities.destroyAll(app.getManagementContext()); if (persister != null) persister.stop(); if (objectStore != null) objectStore.deleteCompletely(); persister = null; }
protected BrooklynMemento loadMemento() throws IOException, InterruptedException, TimeoutException { RebindTestUtils.waitForPersisted(localManagementContext); RecordingRebindExceptionHandler failFast = new RecordingRebindExceptionHandler( RebindFailureMode.FAIL_FAST, RebindFailureMode.FAIL_FAST); RebindContextImpl rebindContext = new RebindContextImpl(classLoader); RebindContextLookupContext lookupContext = new RebindContextLookupContext(localManagementContext, rebindContext, failFast); // here we force these two to be reegistered in order to resolve the enricher and policy // (normally rebind will do that after loading the manifests, but in this test we are just // looking at persistence/manifest) rebindContext.registerEntity(app.getId(), app); rebindContext.registerEntity(entity.getId(), entity); BrooklynMemento reloadedMemento = persister.loadMemento(lookupContext, failFast); return reloadedMemento; }