Java Code Examples for org.apache.brooklyn.core.entity.Entities#destroyAll()

The following examples show how to use org.apache.brooklyn.core.entity.Entities#destroyAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ManagementPlaneIdTest.java    From brooklyn-server with Apache License 2.0 6 votes vote down vote up
@Test
public void testPlaneIdBackedUp() throws Exception {
    final LocalManagementContext origMgmt = createManagementContext(PersistMode.AUTO, HighAvailabilityMode.AUTO);
    checkPlaneIdPersisted(origMgmt);
    Entities.destroyAll(origMgmt);

    LocalManagementContext rebindMgmt = createManagementContextWithBackups(PersistMode.AUTO, HighAvailabilityMode.AUTO);

    assertEquals(origMgmt.getManagementPlaneIdMaybe(), rebindMgmt.getManagementPlaneIdMaybe());

    String backupContainer = BrooklynServerPaths.newBackupPersistencePathResolver(rebindMgmt).resolve();
    
    File[] promotionFolders = new File(backupContainer).listFiles(new FilenameFilter() {
        @Override
        public boolean accept(File dir, String name) {
            return name.contains("promotion");
        }
    });
    
    assertEquals(promotionFolders.length, 1);
    
    File planeIdFile = new File(promotionFolders[0], BrooklynMementoPersisterToObjectStore.PLANE_ID_FILE_NAME);
    String planeId = readFile(planeIdFile);
    assertEquals(origMgmt.getManagementPlaneIdMaybe().get(), planeId);
}
 
Example 2
Source File: RebindTestFixture.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
    if (origApp != null) Entities.destroyAll(origApp.getManagementContext());
    if (newApp != null) Entities.destroyAll(newApp.getManagementContext());
    if (newManagementContext != null) Entities.destroyAll(newManagementContext);
    origApp = null;
    newApp = null;
    newManagementContext = null;

    if (origManagementContext != null) Entities.destroyAll(origManagementContext);
    if (mementoDir != null) FileBasedObjectStore.deleteCompletely(mementoDir);
    if (mementoDirBackup != null) FileBasedObjectStore.deleteCompletely(mementoDir);
    origManagementContext = null;
}
 
Example 3
Source File: BrooklynMementoPersisterTestFixture.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
@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(false);
    if (objectStore!=null) objectStore.deleteCompletely();
    persister = null;
}
 
Example 4
Source File: ClassLoaderFromBrooklynClassLoadingContextTest.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
    if (mgmt != null) {
        Entities.destroyAll(mgmt);
        mgmt = null;
    }
}
 
Example 5
Source File: SshTasksTest.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
    if (mgmt != null) Entities.destroyAll(mgmt);
    mgmt = null;
    tempDir = Os.deleteRecursively(tempDir).asNullOrThrowing();
    checkExpectedFailure();
}
 
Example 6
Source File: AbstractCloudFoundryPaasLocationLiveTest.java    From SeaCloudsPlatform with Apache License 2.0 5 votes vote down vote up
@AfterMethod
public void tearDown() throws Exception {
    if (app != null) {
        Entities.destroyAllCatching(app.getManagementContext());
    }
    if (managementContext != null){
        Entities.destroyAll(managementContext);
    }
}
 
Example 7
Source File: SaltConfigsTest.java    From brooklyn-library with Apache License 2.0 5 votes vote down vote up
@AfterMethod(alwaysRun=true)
public void tearDown() {
    if ( app != null) {
        Entities.destroyAll(app.getManagementContext());
        app = null;
    }
}
 
Example 8
Source File: CatalogYamlRebindTest.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
protected void recreateOrigManagementContextWithOsgi() {
    // replace with OSGi context
    Entities.destroyAll(origManagementContext);
    try {
        useOsgi = true;
        tearDown();
        setUp();
    } catch (Exception e) {
        throw Exceptions.propagate(e);
    } finally {
        useOsgi = false;
    }
}
 
Example 9
Source File: InPlaceExternalConfigSupplierTest.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
    try {
        if (mgmt != null) Entities.destroyAll(mgmt);
    } finally {
        mgmt = null;
    }
}
 
Example 10
Source File: JBoss7ServerNonInheritingIntegrationTest.java    From brooklyn-library with Apache License 2.0 5 votes vote down vote up
@AfterMethod(alwaysRun=true)
@Override
public void tearDown() throws Exception {
    super.tearDown();
    if (app != null) Entities.destroyAll(app.getManagementContext());
    if (keystoreFile != null) keystoreFile.delete();
}
 
Example 11
Source File: BrooklynRestApiTest.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
protected void destroyManagementContext() {
    if (manager!=null) {
        Entities.destroyAll(manager);
        resourceClasses = null;
        resourceBeans = null;
        manager = null;
    }
}
 
Example 12
Source File: XmlMementoSerializerTest.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
@Test
public void testLocation() throws Exception {
    final TestApplication app = TestApplication.Factory.newManagedInstanceForTests();
    ManagementContext managementContext = app.getManagementContext();
    try {
        final Location loc = managementContext.getLocationManager().createLocation(LocationSpec.create(SimulatedLocation.class));
        serializer.setLookupContext(newEmptyLookupManagementContext(managementContext, true).add(loc));
        assertSerializeAndDeserialize(loc);
    } finally {
        Entities.destroyAll(managementContext);
    }
}
 
Example 13
Source File: JcloudsObjectStoreAccessorWriterTest.java    From brooklyn-server with Apache License 2.0 4 votes vote down vote up
@Override @AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
    super.tearDown();
    if (mgmt!=null) Entities.destroyAll(mgmt);
    if (store!=null) store.deleteCompletely();
}
 
Example 14
Source File: JcloudsByonLocationResolverTest.java    From brooklyn-server with Apache License 2.0 4 votes vote down vote up
@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
    if (managementContext != null) Entities.destroyAll(managementContext);
}
 
Example 15
Source File: AwsAvailabilityZoneExtensionTest.java    From brooklyn-server with Apache License 2.0 4 votes vote down vote up
@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
    if (mgmt != null) Entities.destroyAll(mgmt);
}
 
Example 16
Source File: SameServerEntityTest.java    From brooklyn-server with Apache License 2.0 4 votes vote down vote up
@AfterMethod(alwaysRun=true)
public void tearDown() {
    if (app != null) Entities.destroyAll(mgmt);
}
 
Example 17
Source File: ReloadBrooklynPropertiesTest.java    From brooklyn-server with Apache License 2.0 4 votes vote down vote up
@AfterMethod(alwaysRun=true)
public void teardown() {
    if (brooklynMgmt!=null) Entities.destroyAll(brooklynMgmt);
}
 
Example 18
Source File: EntityCleanupLongevityTestFixture.java    From brooklyn-server with Apache License 2.0 4 votes vote down vote up
@AfterMethod(alwaysRun=true)
public void tearDown() {
    if (managementContext != null) Entities.destroyAll(managementContext);
}
 
Example 19
Source File: HotStandbyTest.java    From brooklyn-server with Apache License 2.0 4 votes vote down vote up
public void tearDownThisOnly() throws Exception {
    if (ha != null) ha.stop();
    if (mgmt!=null) mgmt.getRebindManager().stop();
    if (mgmt != null) Entities.destroyAll(mgmt);
}
 
Example 20
Source File: HttpLatencyDetectorTest.java    From brooklyn-server with Apache License 2.0 4 votes vote down vote up
@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
    if (server != null) server.shutdown();
    if (app != null) Entities.destroyAll(app.getManagementContext());
}