brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [03/10] add builder for LocalManagementContextForTests and use in more places to speed things up, also adding conveniences for the BrooklynProperties.Factory.Builder
Date Mon, 25 Aug 2014 06:37:47 GMT
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLocationResolverTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLocationResolverTest.java
b/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLocationResolverTest.java
index 5533b8a..92b09d1 100644
--- a/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLocationResolverTest.java
+++ b/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLocationResolverTest.java
@@ -34,6 +34,7 @@ import org.testng.annotations.Test;
 import brooklyn.config.BrooklynProperties;
 import brooklyn.location.cloud.CloudLocationConfig;
 import brooklyn.management.internal.LocalManagementContext;
+import brooklyn.test.entity.LocalManagementContextForTests;
 
 public class JcloudsLocationResolverTest {
 
@@ -45,7 +46,7 @@ public class JcloudsLocationResolverTest {
 
     @BeforeMethod(alwaysRun = true)
     public void setUp() throws Exception {
-        managementContext = new LocalManagementContext(BrooklynProperties.Factory.newEmpty());
+        managementContext = LocalManagementContextForTests.newInstance();
         brooklynProperties = managementContext.getBrooklynProperties();
 
         brooklynProperties.put("brooklyn.location.jclouds.aws-ec2.identity", "aws-ec2-id");

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLocationTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLocationTest.java
b/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLocationTest.java
index 24fde38..b41f24e 100644
--- a/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLocationTest.java
+++ b/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLocationTest.java
@@ -46,6 +46,7 @@ import brooklyn.location.basic.LocationConfigKeys;
 import brooklyn.location.geo.HostGeoInfo;
 import brooklyn.management.internal.LocalManagementContext;
 import brooklyn.test.Asserts;
+import brooklyn.test.entity.LocalManagementContextForTests;
 import brooklyn.util.collections.MutableMap;
 import brooklyn.util.config.ConfigBag;
 import brooklyn.util.exceptions.CompoundRuntimeException;
@@ -71,6 +72,7 @@ public class JcloudsLocationTest implements JcloudsLocationConfig {
     public static final RuntimeException BAIL_OUT_FOR_TESTING = 
             new RuntimeException("early termination for test");
     
+    @SuppressWarnings("serial")
     public static class BailOutJcloudsLocation extends JcloudsLocation {
         public static final ConfigKey<Function<ConfigBag,Void>> BUILD_TEMPLATE_INTERCEPTOR
= ConfigKeys.newConfigKey(new TypeToken<Function<ConfigBag,Void>>() {}, "buildtemplateinterceptor");
         
@@ -104,6 +106,7 @@ public class JcloudsLocationTest implements JcloudsLocationConfig {
         }
     }
 
+    @SuppressWarnings("serial")
     public static class CountingBailOutJcloudsLocation extends BailOutJcloudsLocation {
         int buildTemplateCount = 0;
         @Override
@@ -113,6 +116,7 @@ public class JcloudsLocationTest implements JcloudsLocationConfig {
         }
     }
     
+    @SuppressWarnings("serial")
     public static class BailOutWithTemplateJcloudsLocation extends JcloudsLocation {
         ConfigBag lastConfigBag;
         Template template;
@@ -154,6 +158,7 @@ public class JcloudsLocationTest implements JcloudsLocationConfig {
         return newSampleBailOutJcloudsLocationForTesting(ImmutableMap.<ConfigKey<?>,Object>of());
     }
     
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     protected BailOutJcloudsLocation newSampleBailOutJcloudsLocationForTesting(Map<?,?>
config) {
         Map<ConfigKey<?>,?> allConfig = MutableMap.<ConfigKey<?>,Object>builder()
                 .put(IMAGE_ID, "bogus")
@@ -174,6 +179,7 @@ public class JcloudsLocationTest implements JcloudsLocationConfig {
         return newSampleBailOutWithTemplateJcloudsLocation(ImmutableMap.<ConfigKey<?>,Object>of());
     }
 
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     protected BailOutWithTemplateJcloudsLocation newSampleBailOutWithTemplateJcloudsLocation(Map<?,?>
config) {
         String identity = (String) brooklynProperties.get("brooklyn.location.jclouds.aws-ec2.identity");
         if (identity == null) identity = (String) brooklynProperties.get("brooklyn.jclouds.aws-ec2.identity");
@@ -181,8 +187,8 @@ public class JcloudsLocationTest implements JcloudsLocationConfig {
         if (credential == null) credential = (String) brooklynProperties.get("brooklyn.jclouds.aws-ec2.credential");
         
         Map<ConfigKey<?>,?> allConfig = MutableMap.<ConfigKey<?>,Object>builder()
-                .put(CLOUD_PROVIDER, AbstractJcloudsTest.AWS_EC2_PROVIDER)
-                .put(CLOUD_REGION_ID, AbstractJcloudsTest.AWS_EC2_USEAST_REGION_NAME)
+                .put(CLOUD_PROVIDER, AbstractJcloudsLiveTest.AWS_EC2_PROVIDER)
+                .put(CLOUD_REGION_ID, AbstractJcloudsLiveTest.AWS_EC2_USEAST_REGION_NAME)
                 .put(IMAGE_ID, US_EAST_IMAGE_ID) // so it runs faster, without loading all
EC2 images
                 .put(ACCESS_IDENTITY, identity)
                 .put(ACCESS_CREDENTIAL, credential)
@@ -222,7 +228,7 @@ public class JcloudsLocationTest implements JcloudsLocationConfig {
     
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
-        managementContext = new LocalManagementContext();
+        managementContext = LocalManagementContextForTests.newInstance(BrooklynProperties.Factory.builderEmpty().build());
         brooklynProperties = managementContext.getBrooklynProperties();
     }
     
@@ -479,6 +485,7 @@ public class JcloudsLocationTest implements JcloudsLocationConfig {
     }
 
     
+    @SuppressWarnings("serial")
     public static class FakeLocalhostWithParentJcloudsLocation extends JcloudsLocation {
         public static final ConfigKey<Function<ConfigBag,Void>> BUILD_TEMPLATE_INTERCEPTOR
= ConfigKeys.newConfigKey(new TypeToken<Function<ConfigBag,Void>>() {}, "buildtemplateinterceptor");
         
@@ -522,6 +529,7 @@ public class JcloudsLocationTest implements JcloudsLocationConfig {
         Assert.assertEquals(geo.longitude, -20d, 0.00001);
     }
 
+    @SuppressWarnings("unchecked")
     @Test
     public void testInheritsGeoFromLocationMetadataProperties() throws Exception {
         // in location-metadata.properties:

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLoginLiveTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLoginLiveTest.java
b/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLoginLiveTest.java
index 5a5084d..3cc3efe 100644
--- a/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLoginLiveTest.java
+++ b/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsLoginLiveTest.java
@@ -39,7 +39,7 @@ import com.google.common.collect.ImmutableMap;
 /**
  * Tests different login options for ssh keys, passwords, etc.
  */
-public class JcloudsLoginLiveTest extends AbstractJcloudsTest {
+public class JcloudsLoginLiveTest extends AbstractJcloudsLiveTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(JcloudsLoginLiveTest.class);
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsMinRamLiveTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsMinRamLiveTest.java
b/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsMinRamLiveTest.java
index ca66d75..ee072f2 100644
--- a/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsMinRamLiveTest.java
+++ b/locations/jclouds/src/test/java/brooklyn/location/jclouds/JcloudsMinRamLiveTest.java
@@ -26,7 +26,7 @@ import brooklyn.util.collections.MutableMap;
 
 import com.google.common.collect.ImmutableMap;
 
-public class JcloudsMinRamLiveTest extends AbstractJcloudsTest {
+public class JcloudsMinRamLiveTest extends AbstractJcloudsLiveTest {
 
     private static final Logger log = LoggerFactory.getLogger(JcloudsMinRamLiveTest.class);
     

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/locations/jclouds/src/test/java/brooklyn/location/jclouds/LiveTestEntity.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/brooklyn/location/jclouds/LiveTestEntity.java
b/locations/jclouds/src/test/java/brooklyn/location/jclouds/LiveTestEntity.java
index b9e0dff..feb4aca 100644
--- a/locations/jclouds/src/test/java/brooklyn/location/jclouds/LiveTestEntity.java
+++ b/locations/jclouds/src/test/java/brooklyn/location/jclouds/LiveTestEntity.java
@@ -23,24 +23,23 @@ import java.util.Collection;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Predicates;
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
 import brooklyn.entity.basic.Lifecycle;
 import brooklyn.entity.proxying.ImplementedBy;
 import brooklyn.location.Location;
-import brooklyn.location.MachineLocation;
 import brooklyn.location.MachineProvisioningLocation;
 import brooklyn.location.NoMachinesAvailableException;
 import brooklyn.test.entity.TestEntity;
 import brooklyn.test.entity.TestEntityImpl;
 
+import com.google.common.base.Predicates;
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+
 @ImplementedBy(LiveTestEntity.LiveTestEntityImpl.class)
 public interface LiveTestEntity extends TestEntity {
 
-    MachineProvisioningLocation getProvisioningLocation();
+    MachineProvisioningLocation<?> getProvisioningLocation();
     JcloudsSshMachineLocation getObtainedLocation();
 
     public static class LiveTestEntityImpl extends TestEntityImpl implements LiveTestEntity
{
@@ -78,7 +77,7 @@ public interface LiveTestEntity extends TestEntity {
             setAttribute(SERVICE_STATE, Lifecycle.STOPPED);
         }
 
-        public MachineProvisioningLocation getProvisioningLocation() {
+        public MachineProvisioningLocation<?> getProvisioningLocation() {
             return provisioningLocation;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/locations/jclouds/src/test/java/brooklyn/location/jclouds/RebindJcloudsLocationLiveTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/brooklyn/location/jclouds/RebindJcloudsLocationLiveTest.java
b/locations/jclouds/src/test/java/brooklyn/location/jclouds/RebindJcloudsLocationLiveTest.java
index 955b70e..14aa1fa 100644
--- a/locations/jclouds/src/test/java/brooklyn/location/jclouds/RebindJcloudsLocationLiveTest.java
+++ b/locations/jclouds/src/test/java/brooklyn/location/jclouds/RebindJcloudsLocationLiveTest.java
@@ -23,29 +23,26 @@ import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
 
 import java.io.File;
-import java.util.List;
 
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.io.Files;
-
 import brooklyn.entity.basic.ApplicationBuilder;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.proxying.EntitySpec;
 import brooklyn.entity.rebind.RebindTestUtils;
-import brooklyn.location.MachineLocation;
 import brooklyn.location.OsDetails;
 import brooklyn.management.internal.LocalManagementContext;
 import brooklyn.test.entity.TestApplication;
-import brooklyn.util.collections.MutableMap;
 import brooklyn.util.config.ConfigBag;
 
-public class RebindJcloudsLocationLiveTest extends AbstractJcloudsTest {
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.common.io.Files;
+
+public class RebindJcloudsLocationLiveTest extends AbstractJcloudsLiveTest {
 
     public static final String AWS_EC2_REGION_NAME = AWS_EC2_USEAST_REGION_NAME;
     public static final String AWS_EC2_LOCATION_SPEC = "jclouds:" + AWS_EC2_PROVIDER + ":"
+ AWS_EC2_REGION_NAME;
@@ -132,17 +129,18 @@ public class RebindJcloudsLocationLiveTest extends AbstractJcloudsTest
{
     }
 
     private void assertConfigBagEquals(ConfigBag actual, ConfigBag expected, String errmsg)
{
-        // TODO Can we include all of these things (e.g. when locations are entities, so
flagged fields not treated special)?
-        List<String> configToIgnore = ImmutableList.of("id", "template", "usedPorts",
"machineCreationSemaphore", "config");
-        MutableMap<Object, Object> actualMap = MutableMap.builder().putAll(actual.getAllConfig())
-                .removeAll(configToIgnore)
-                .build();
-        MutableMap<Object, Object> expectedMap = MutableMap.builder().putAll(expected.getAllConfig())
-                .removeAll(configToIgnore)
-                .build();
-        
         // TODO revisit the strong assertion that configBags are equal
-        //assertEquals(actualMap, expectedMap, errmsg+"; actualBag="+actualMap+"; expectedBag="+expectedMap);
+        
+//        // TODO Can we include all of these things (e.g. when locations are entities, so
flagged fields not treated special)?
+//        List<String> configToIgnore = ImmutableList.of("id", "template", "usedPorts",
"machineCreationSemaphore", "config");
+//        MutableMap<Object, Object> actualMap = MutableMap.builder().putAll(actual.getAllConfig())
+//                .removeAll(configToIgnore)
+//                .build();
+//        MutableMap<Object, Object> expectedMap = MutableMap.builder().putAll(expected.getAllConfig())
+//                .removeAll(configToIgnore)
+//                .build();
+//        
+//        assertEquals(actualMap, expectedMap, errmsg+"; actualBag="+actualMap+"; expectedBag="+expectedMap);
     }
     
     private TestApplication rebind() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/locations/jclouds/src/test/java/brooklyn/location/jclouds/SimpleJcloudsLocationUserLoginAndConfigLiveTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/brooklyn/location/jclouds/SimpleJcloudsLocationUserLoginAndConfigLiveTest.java
b/locations/jclouds/src/test/java/brooklyn/location/jclouds/SimpleJcloudsLocationUserLoginAndConfigLiveTest.java
index e5a7998..193f108 100644
--- a/locations/jclouds/src/test/java/brooklyn/location/jclouds/SimpleJcloudsLocationUserLoginAndConfigLiveTest.java
+++ b/locations/jclouds/src/test/java/brooklyn/location/jclouds/SimpleJcloudsLocationUserLoginAndConfigLiveTest.java
@@ -20,7 +20,6 @@ package brooklyn.location.jclouds;
 
 import java.io.ByteArrayOutputStream;
 import java.util.Arrays;
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -40,7 +39,7 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Maps;
 
-public class SimpleJcloudsLocationUserLoginAndConfigLiveTest extends AbstractJcloudsTest
{
+public class SimpleJcloudsLocationUserLoginAndConfigLiveTest extends AbstractJcloudsLiveTest
{
 
     // FIXME And tidy up this one
     

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/locations/jclouds/src/test/java/brooklyn/location/jclouds/SingleMachineProvisioningLocationJcloudsLiveTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/brooklyn/location/jclouds/SingleMachineProvisioningLocationJcloudsLiveTest.java
b/locations/jclouds/src/test/java/brooklyn/location/jclouds/SingleMachineProvisioningLocationJcloudsLiveTest.java
index e088da4..a40660a 100644
--- a/locations/jclouds/src/test/java/brooklyn/location/jclouds/SingleMachineProvisioningLocationJcloudsLiveTest.java
+++ b/locations/jclouds/src/test/java/brooklyn/location/jclouds/SingleMachineProvisioningLocationJcloudsLiveTest.java
@@ -34,7 +34,7 @@ import brooklyn.entity.basic.ConfigKeys;
 import brooklyn.location.MachineLocation;
 import brooklyn.location.basic.SingleMachineProvisioningLocation;
 
-public class SingleMachineProvisioningLocationJcloudsLiveTest extends AbstractJcloudsTest
{
+public class SingleMachineProvisioningLocationJcloudsLiveTest extends AbstractJcloudsLiveTest
{
 private static final Logger log = LoggerFactory.getLogger(SingleMachineProvisioningLocation.class);
     
     private SingleMachineProvisioningLocation<JcloudsSshMachineLocation> location;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/locations/jclouds/src/test/java/brooklyn/location/jclouds/StandaloneJcloudsLiveTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/brooklyn/location/jclouds/StandaloneJcloudsLiveTest.java
b/locations/jclouds/src/test/java/brooklyn/location/jclouds/StandaloneJcloudsLiveTest.java
index 30f887d..d8b3915 100644
--- a/locations/jclouds/src/test/java/brooklyn/location/jclouds/StandaloneJcloudsLiveTest.java
+++ b/locations/jclouds/src/test/java/brooklyn/location/jclouds/StandaloneJcloudsLiveTest.java
@@ -64,8 +64,8 @@ public class StandaloneJcloudsLiveTest {
     
     public static final Logger LOG = LoggerFactory.getLogger(StandaloneJcloudsLiveTest.class);
     
-    private static final String PROVIDER = AbstractJcloudsTest.AWS_EC2_PROVIDER;
-    private static final String REGION = AbstractJcloudsTest.AWS_EC2_USEAST_REGION_NAME;
+    private static final String PROVIDER = AbstractJcloudsLiveTest.AWS_EC2_PROVIDER;
+    private static final String REGION = AbstractJcloudsLiveTest.AWS_EC2_USEAST_REGION_NAME;
     private static final String PRIVATE_IMAGE_ID = "us-east-1/ami-f95cf390";
     
     static BrooklynProperties globals = BrooklynProperties.Factory.newDefault();

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/locations/jclouds/src/test/java/brooklyn/location/jclouds/networking/JcloudsPortForwardingLiveTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/brooklyn/location/jclouds/networking/JcloudsPortForwardingLiveTest.java
b/locations/jclouds/src/test/java/brooklyn/location/jclouds/networking/JcloudsPortForwardingLiveTest.java
index c8f4c4b..c9d8393 100644
--- a/locations/jclouds/src/test/java/brooklyn/location/jclouds/networking/JcloudsPortForwardingLiveTest.java
+++ b/locations/jclouds/src/test/java/brooklyn/location/jclouds/networking/JcloudsPortForwardingLiveTest.java
@@ -30,7 +30,7 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import brooklyn.config.ConfigKey;
-import brooklyn.location.jclouds.AbstractJcloudsTest;
+import brooklyn.location.jclouds.AbstractJcloudsLiveTest;
 import brooklyn.location.jclouds.JcloudsLocation;
 import brooklyn.location.jclouds.JcloudsSshMachineLocation;
 import brooklyn.location.jclouds.networking.JcloudsPortForwarderExtension;
@@ -48,7 +48,7 @@ import com.google.common.net.HostAndPort;
 /**
  * Tests different login options for ssh keys, passwords, etc.
  */
-public class JcloudsPortForwardingLiveTest extends AbstractJcloudsTest {
+public class JcloudsPortForwardingLiveTest extends AbstractJcloudsLiveTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(JcloudsPortForwardingLiveTest.class);
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/locations/jclouds/src/test/java/brooklyn/location/jclouds/pool/JcloudsMachinePoolLiveTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/brooklyn/location/jclouds/pool/JcloudsMachinePoolLiveTest.java
b/locations/jclouds/src/test/java/brooklyn/location/jclouds/pool/JcloudsMachinePoolLiveTest.java
index db126ca..4a08217 100644
--- a/locations/jclouds/src/test/java/brooklyn/location/jclouds/pool/JcloudsMachinePoolLiveTest.java
+++ b/locations/jclouds/src/test/java/brooklyn/location/jclouds/pool/JcloudsMachinePoolLiveTest.java
@@ -32,10 +32,10 @@ import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import brooklyn.location.jclouds.AbstractJcloudsTest;
+import brooklyn.location.jclouds.AbstractJcloudsLiveTest;
 import brooklyn.location.jclouds.JcloudsLocation;
 
-public class JcloudsMachinePoolLiveTest extends AbstractJcloudsTest {
+public class JcloudsMachinePoolLiveTest extends AbstractJcloudsLiveTest {
 
     public static final Logger log = LoggerFactory.getLogger(JcloudsMachinePoolLiveTest.class);
     

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/locations/jclouds/src/test/java/brooklyn/location/jclouds/zone/AwsAvailabilityZoneExtensionTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/brooklyn/location/jclouds/zone/AwsAvailabilityZoneExtensionTest.java
b/locations/jclouds/src/test/java/brooklyn/location/jclouds/zone/AwsAvailabilityZoneExtensionTest.java
index 1933679..19804e5 100644
--- a/locations/jclouds/src/test/java/brooklyn/location/jclouds/zone/AwsAvailabilityZoneExtensionTest.java
+++ b/locations/jclouds/src/test/java/brooklyn/location/jclouds/zone/AwsAvailabilityZoneExtensionTest.java
@@ -30,7 +30,7 @@ import org.testng.annotations.Test;
 
 import brooklyn.entity.basic.Entities;
 import brooklyn.location.Location;
-import brooklyn.location.jclouds.AbstractJcloudsTest;
+import brooklyn.location.jclouds.AbstractJcloudsLiveTest;
 import brooklyn.location.jclouds.JcloudsLocation;
 import brooklyn.location.jclouds.JcloudsSshMachineLocation;
 import brooklyn.management.internal.LocalManagementContext;
@@ -43,10 +43,10 @@ import com.google.common.collect.Lists;
 
 public class AwsAvailabilityZoneExtensionTest {
 
-    public static final String PROVIDER = AbstractJcloudsTest.AWS_EC2_PROVIDER;
-    public static final String REGION_NAME = AbstractJcloudsTest.AWS_EC2_USEAST_REGION_NAME;
+    public static final String PROVIDER = AbstractJcloudsLiveTest.AWS_EC2_PROVIDER;
+    public static final String REGION_NAME = AbstractJcloudsLiveTest.AWS_EC2_USEAST_REGION_NAME;
     public static final String LOCATION_SPEC = PROVIDER + (REGION_NAME == null ? "" : ":"
+ REGION_NAME);
-    public static final String SMALL_HARDWARE_ID = AbstractJcloudsTest.AWS_EC2_SMALL_HARDWARE_ID;
+    public static final String SMALL_HARDWARE_ID = AbstractJcloudsLiveTest.AWS_EC2_SMALL_HARDWARE_ID;
     
     public static final String US_EAST_IMAGE_ID = "us-east-1/ami-7d7bfc14"; // centos 6.3
     

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/policy/src/test/java/brooklyn/entity/brooklyn/BrooklynMetricsTest.java
----------------------------------------------------------------------
diff --git a/policy/src/test/java/brooklyn/entity/brooklyn/BrooklynMetricsTest.java b/policy/src/test/java/brooklyn/entity/brooklyn/BrooklynMetricsTest.java
index 1e8b314..39be9d4 100644
--- a/policy/src/test/java/brooklyn/entity/brooklyn/BrooklynMetricsTest.java
+++ b/policy/src/test/java/brooklyn/entity/brooklyn/BrooklynMetricsTest.java
@@ -33,6 +33,7 @@ import brooklyn.event.AttributeSensor;
 import brooklyn.event.SensorEventListener;
 import brooklyn.location.basic.SimulatedLocation;
 import brooklyn.test.Asserts;
+import brooklyn.test.entity.LocalManagementContextForTests;
 import brooklyn.test.entity.TestApplication;
 import brooklyn.test.entity.TestEntity;
 
@@ -49,7 +50,7 @@ public class BrooklynMetricsTest {
     @BeforeMethod(alwaysRun=true)
     public void setUp() {
         loc = new SimulatedLocation();
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
+        app = TestApplication.Factory.newManagedInstanceForTests();
         brooklynMetrics = app.createAndManageChild(EntitySpec.create(BrooklynMetrics.class).configure("updatePeriod",
10L));
         Entities.manage(brooklynMetrics);
     }
@@ -90,7 +91,6 @@ public class BrooklynMetricsTest {
         final long tasksSubmitted = getAttribute(brooklynMetrics, BrooklynMetrics.TOTAL_TASKS_SUBMITTED,
0);
         final long eventsPublished = getAttribute(brooklynMetrics, BrooklynMetrics.TOTAL_EVENTS_PUBLISHED,
0);
         final long eventsDelivered = getAttribute(brooklynMetrics, BrooklynMetrics.TOTAL_EVENTS_DELIVERED,
0);
-        final long subscriptions = getAttribute(brooklynMetrics, BrooklynMetrics.NUM_SUBSCRIPTIONS,
0);
 
         // Invoking an effector increments effector/task count
         e.myEffector();

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/software/base/src/test/java/brooklyn/entity/basic/SameServerEntityTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/basic/SameServerEntityTest.java b/software/base/src/test/java/brooklyn/entity/basic/SameServerEntityTest.java
index 84d1266..97b2163 100644
--- a/software/base/src/test/java/brooklyn/entity/basic/SameServerEntityTest.java
+++ b/software/base/src/test/java/brooklyn/entity/basic/SameServerEntityTest.java
@@ -49,7 +49,7 @@ public class SameServerEntityTest {
     @BeforeMethod(alwaysRun=true)
     public void setUp() {
         loc = new LocalhostMachineProvisioningLocation();
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
+        app = TestApplication.Factory.newManagedInstanceForTests();
         mgmt = app.getManagementContext();
         entity = app.createAndManageChild(EntitySpec.create(SameServerEntity.class));
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/software/base/src/test/java/brooklyn/entity/basic/VanillaSoftwareProcessAndChildrenIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/basic/VanillaSoftwareProcessAndChildrenIntegrationTest.java
b/software/base/src/test/java/brooklyn/entity/basic/VanillaSoftwareProcessAndChildrenIntegrationTest.java
index 7056874..37f569a 100644
--- a/software/base/src/test/java/brooklyn/entity/basic/VanillaSoftwareProcessAndChildrenIntegrationTest.java
+++ b/software/base/src/test/java/brooklyn/entity/basic/VanillaSoftwareProcessAndChildrenIntegrationTest.java
@@ -67,7 +67,7 @@ public class VanillaSoftwareProcessAndChildrenIntegrationTest {
 
     @BeforeMethod(alwaysRun=true)
     public void setup() {
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
+        app = TestApplication.Factory.newManagedInstanceForTests();
         localhost = app.getManagementContext().getLocationRegistry().resolve("localhost");
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/software/base/src/test/java/brooklyn/entity/software/SoftwareEffectorTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/software/SoftwareEffectorTest.java
b/software/base/src/test/java/brooklyn/entity/software/SoftwareEffectorTest.java
index 0c8f2b5..6558b3c 100644
--- a/software/base/src/test/java/brooklyn/entity/software/SoftwareEffectorTest.java
+++ b/software/base/src/test/java/brooklyn/entity/software/SoftwareEffectorTest.java
@@ -28,7 +28,6 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import brooklyn.entity.Effector;
-import brooklyn.entity.basic.ApplicationBuilder;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.effector.Effectors;
 import brooklyn.entity.software.SshEffectorTasks.SshEffectorBody;
@@ -52,7 +51,7 @@ public class SoftwareEffectorTest {
     
     @BeforeMethod(alwaysRun=true)
     public void setup() throws Exception {
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
+        app = TestApplication.Factory.newManagedInstanceForTests();
         mgmt = app.getManagementContext();
         
         LocalhostMachineProvisioningLocation lhc = mgmt.getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/software/base/src/test/java/brooklyn/entity/software/SshEffectorTasksTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/software/SshEffectorTasksTest.java
b/software/base/src/test/java/brooklyn/entity/software/SshEffectorTasksTest.java
index aa25a9d..b922733 100644
--- a/software/base/src/test/java/brooklyn/entity/software/SshEffectorTasksTest.java
+++ b/software/base/src/test/java/brooklyn/entity/software/SshEffectorTasksTest.java
@@ -60,7 +60,7 @@ public class SshEffectorTasksTest {
 
     @BeforeMethod(alwaysRun=true)
     public void setup() throws Exception {
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
+        app = TestApplication.Factory.newManagedInstanceForTests();
         mgmt = app.getManagementContext();
         
         LocalhostMachineProvisioningLocation lhc = mgmt.getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/software/base/src/test/java/brooklyn/entity/software/ssh/SshCommandIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/software/ssh/SshCommandIntegrationTest.java
b/software/base/src/test/java/brooklyn/entity/software/ssh/SshCommandIntegrationTest.java
index 3a49492..09af6c2 100644
--- a/software/base/src/test/java/brooklyn/entity/software/ssh/SshCommandIntegrationTest.java
+++ b/software/base/src/test/java/brooklyn/entity/software/ssh/SshCommandIntegrationTest.java
@@ -28,7 +28,6 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import brooklyn.entity.Effector;
-import brooklyn.entity.basic.ApplicationBuilder;
 import brooklyn.entity.basic.Attributes;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.basic.EntityLocal;
@@ -56,7 +55,7 @@ public class SshCommandIntegrationTest {
     
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
+        app = TestApplication.Factory.newManagedInstanceForTests();
         entity = app.createAndManageChild(EntitySpec.create(TestEntity.class).location(app.newLocalhostProvisioningLocation().obtain()));
         app.start(ImmutableList.<Location>of());
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/software/base/src/test/java/brooklyn/event/feed/jmx/JmxFeedTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/event/feed/jmx/JmxFeedTest.java b/software/base/src/test/java/brooklyn/event/feed/jmx/JmxFeedTest.java
index 00fd235..9b8c916 100644
--- a/software/base/src/test/java/brooklyn/event/feed/jmx/JmxFeedTest.java
+++ b/software/base/src/test/java/brooklyn/event/feed/jmx/JmxFeedTest.java
@@ -131,7 +131,7 @@ public class JmxFeedTest {
         jmxObjectName = new ObjectName(objectName);
         
         // Create an entity and configure it with the above JMX service
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
+        app = TestApplication.Factory.newManagedInstanceForTests();
         entity = app.createAndManageChild(EntitySpec.create(TestEntity.class).impl(TestEntityWithJmx.class));
         app.start(ImmutableList.of(new SimulatedLocation()));
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9f439dd8/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlTest.java b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlTest.java
index beb0129..d9186a3 100644
--- a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlTest.java
+++ b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlTest.java
@@ -25,14 +25,11 @@ import java.io.Reader;
 import java.io.StringReader;
 import java.util.Set;
 
-import org.codehaus.groovy.util.StringUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 
-import com.google.common.base.Joiner;
-
 import brooklyn.entity.Entity;
 import brooklyn.entity.basic.BrooklynTaskTags;
 import brooklyn.entity.basic.Entities;
@@ -42,6 +39,8 @@ import brooklyn.management.internal.LocalManagementContext;
 import brooklyn.test.entity.LocalManagementContextForTests;
 import brooklyn.util.ResourceUtils;
 
+import com.google.common.base.Joiner;
+
 public abstract class AbstractYamlTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractYamlTest.class);
@@ -70,7 +69,8 @@ public abstract class AbstractYamlTest {
     }
 
     protected LocalManagementContext newTestManagementContext() {
-        return new LocalManagementContextForTests();
+        // TODO they don't all need osgi, just a few do, so could speed it up by specifying
when they do
+        return LocalManagementContextForTests.newInstanceWithOsgi();
     }
     
     @AfterMethod(alwaysRun = true)


Mime
View raw message