You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:47:22 UTC
[30/50] [abbrv] brooklyn-library git commit: Use LocalManagementContext “ForTests”
Use LocalManagementContext “ForTests”
And extend BrooklynAppLiveTestSupport, where appropriate.
And change deprecated code to use config().set(...)
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/aba2fbed
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/aba2fbed
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/aba2fbed
Branch: refs/heads/0.7.0-incubating
Commit: aba2fbed0c749923411fe3437f3903ae9b6bed45
Parents: 060a5ad
Author: Aled Sage <al...@gmail.com>
Authored: Mon Jun 22 00:29:11 2015 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Jun 22 00:29:11 2015 +0100
----------------------------------------------------------------------
.../webapp/AbstractWebAppFixtureIntegrationTest.java | 15 ++++++++-------
.../JBoss7ServerNonInheritingIntegrationTest.java | 14 +++++++++-----
2 files changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/aba2fbed/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
index 3811849..7bc175c 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
@@ -37,7 +37,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import brooklyn.test.TestResourceUnavailableException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.AfterClass;
@@ -46,6 +45,7 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+import brooklyn.config.BrooklynProperties;
import brooklyn.entity.Application;
import brooklyn.entity.Entity;
import brooklyn.entity.basic.ApplicationBuilder;
@@ -62,10 +62,11 @@ import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
import brooklyn.management.ManagementContext;
import brooklyn.management.SubscriptionContext;
import brooklyn.management.SubscriptionHandle;
-import brooklyn.management.internal.LocalManagementContext;
import brooklyn.test.Asserts;
import brooklyn.test.EntityTestUtils;
import brooklyn.test.HttpTestUtils;
+import brooklyn.test.TestResourceUnavailableException;
+import brooklyn.test.entity.LocalManagementContextForTests;
import brooklyn.test.entity.TestApplication;
import brooklyn.util.collections.MutableMap;
import brooklyn.util.crypto.FluentKeySigner;
@@ -101,14 +102,13 @@ public abstract class AbstractWebAppFixtureIntegrationTest {
protected synchronized ManagementContext getMgmt() {
if (mgmt==null)
- mgmt = new LocalManagementContext();
+ mgmt = new LocalManagementContextForTests(BrooklynProperties.Factory.newDefault());
return mgmt;
}
@BeforeMethod(alwaysRun=true)
public void setUp() throws Exception {
- loc = getMgmt().getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class)
- .configure("name", "london"));
+ loc = getMgmt().getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class));
}
/*
@@ -143,8 +143,9 @@ public abstract class AbstractWebAppFixtureIntegrationTest {
@AfterClass(alwaysRun=true)
public synchronized void shutdownMgmt() {
- if (mgmt != null) {
- Entities.destroyAll(mgmt);
+ try {
+ if (mgmt != null) Entities.destroyAll(mgmt);
+ } finally {
mgmt = null;
}
}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/aba2fbed/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java
index 0c056ca..948a9d6 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java
@@ -22,12 +22,13 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import java.io.File;
+import java.net.URI;
-import brooklyn.test.TestResourceUnavailableException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import brooklyn.entity.BrooklynAppLiveTestSupport;
import brooklyn.entity.basic.Entities;
import brooklyn.entity.proxying.EntitySpec;
import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest;
@@ -35,6 +36,7 @@ import brooklyn.entity.webapp.HttpsSslConfig;
import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
import brooklyn.test.Asserts;
import brooklyn.test.HttpTestUtils;
+import brooklyn.test.TestResourceUnavailableException;
import brooklyn.test.entity.TestApplication;
import com.google.common.collect.ImmutableList;
@@ -43,21 +45,23 @@ import com.google.common.collect.ImmutableSet;
/**
* TODO re-write this like WebAppIntegrationTest, inheriting, rather than being jboss7 specific.
*/
-public class JBoss7ServerNonInheritingIntegrationTest {
+public class JBoss7ServerNonInheritingIntegrationTest extends BrooklynAppLiveTestSupport {
private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
- private TestApplication app;
private File keystoreFile;
@BeforeMethod(alwaysRun=true)
+ @Override
public void setUp() throws Exception {
- localhostProvisioningLocation = new LocalhostMachineProvisioningLocation();
- app = TestApplication.Factory.newManagedInstanceForTests();
+ super.setUp();
+ localhostProvisioningLocation = app.newLocalhostProvisioningLocation();
keystoreFile = AbstractWebAppFixtureIntegrationTest.createTemporaryKeyStore("myname", "mypass");
}
@AfterMethod(alwaysRun=true)
+ @Override
public void tearDown() throws Exception {
+ super.tearDown();
if (app != null) Entities.destroyAll(app.getManagementContext());
if (keystoreFile != null) keystoreFile.delete();
}