@BeforeMethod(alwaysRun = true) public void setUp() throws Exception { localManagementContext = newPersistingManagementContext(); if (persister == null) { persister = localManagementContext.getRebindManager().getPersister(); } if (objectStore == null && persister instanceof BrooklynMementoPersisterToObjectStore) { objectStore = ((BrooklynMementoPersisterToObjectStore) persister).getObjectStore(); } app = ApplicationBuilder.newManagedApp( EntitySpec.create(TestApplication.class), localManagementContext); location = localManagementContext .getLocationManager() .createLocation( LocationSpec.create(SshMachineLocation.class).configure("address", "localhost")); entity = app.createAndManageChild(EntitySpec.create(TestEntity.class).location(location)); enricher = app.addEnricher(Enrichers.builder().propagatingAll().from(entity).build()); app.addPolicy(policy = new TestPolicy()); }
static File getPersistenceDir(ManagementContext managementContext) { BrooklynMementoPersisterToObjectStore persister = (BrooklynMementoPersisterToObjectStore) managementContext.getRebindManager().getPersister(); FileBasedObjectStore store = (FileBasedObjectStore) persister.getObjectStore(); return store.getBaseDir(); }