You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ri...@apache.org on 2014/12/09 16:48:09 UTC

[3/9] incubator-brooklyn git commit: Make embedded wars optional

Make embedded wars optional

Modifies code that relies on war files as an embedded resource to
gracefully handle cases where the files are missing. Limited to tests,
which will cause TestNG to skip the test if the resource is missing.
Required for our source distribution, as Apache convention is to not
ship binaries in releases.

Conflicts:
	software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
	software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java
	software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java
	software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/a184a0f8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/a184a0f8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/a184a0f8

Branch: refs/heads/0.7.0-M2-incubating
Commit: a184a0f8799b0e5a06315fa21a8d122e8ef93f55
Parents: d9d3f3b
Author: Richard Downer <ri...@apache.org>
Authored: Wed Nov 26 16:22:56 2014 +0000
Committer: Richard Downer <ri...@apache.org>
Committed: Tue Dec 9 14:34:03 2014 +0000

----------------------------------------------------------------------
 .../test/java/brooklyn/test/HttpService.java    |  5 ++-
 .../nginx/NginxClusterIntegrationTest.java      | 12 ++++--
 .../nginx/NginxHttpsSslIntegrationTest.java     | 12 ++++--
 .../proxy/nginx/NginxIntegrationTest.java       | 18 +++++----
 .../proxy/nginx/NginxLightIntegrationTest.java  |  3 --
 .../proxy/nginx/NginxRebindIntegrationTest.java | 12 ++++--
 .../nginx/NginxRebindWithHaIntegrationTest.java | 12 ++++--
 .../nginx/NginxUrlMappingIntegrationTest.java   | 41 +++++++++-----------
 .../proxy/nginx/NginxWebClusterEc2LiveTest.java |  8 ++--
 .../AbstractWebAppFixtureIntegrationTest.java   |  2 +
 ...lledDynamicWebAppClusterIntegrationTest.java | 22 ++++++-----
 .../ControlledDynamicWebAppClusterTest.java     | 17 ++++----
 ...ElasticJavaWebAppServiceIntegrationTest.java |  8 +++-
 ...namicWebAppClusterRebindIntegrationTest.java | 13 ++++---
 ...namicWebAppClusterRebindIntegrationTest.java | 12 +++---
 .../webapp/jboss/Jboss6ServerEc2LiveTest.java   | 10 +++--
 .../jboss/Jboss6ServerIntegrationTest.java      | 11 ++++--
 .../webapp/jboss/Jboss7DockerLiveTest.java      |  8 +++-
 .../webapp/jboss/Jboss7ServerEc2LiveTest.java   | 12 ++++--
 .../Jboss7ServerGoogleComputeLiveTest.java      | 12 ++++--
 .../jboss/Jboss7ServerIntegrationTest.java      | 19 ++++-----
 .../Jboss7ServerRebindIntegrationTest.java      | 14 ++++---
 .../webapp/tomcat/TomcatServerEc2LiveTest.java  | 12 ++++--
 .../tomcat/TomcatServerSoftlayerLiveTest.java   | 12 ++++--
 ...omcatServerWebAppFixtureIntegrationTest.java |  2 +
 .../brooklyn/launcher/WebAppRunnerTest.java     |  9 ++++-
 26 files changed, 196 insertions(+), 122 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/core/src/test/java/brooklyn/test/HttpService.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/test/HttpService.java b/core/src/test/java/brooklyn/test/HttpService.java
index aa9a338..2dd8849 100644
--- a/core/src/test/java/brooklyn/test/HttpService.java
+++ b/core/src/test/java/brooklyn/test/HttpService.java
@@ -60,7 +60,8 @@ public class HttpService {
 
     private static final Logger log = LoggerFactory.getLogger(HttpService.class);
 
-    public static final String ROOT_WAR_URL = "classpath://hello-world.war";
+    public static final String ROOT_WAR_PATH = "/hello-world.war";
+    public static final String ROOT_WAR_URL = "classpath:" + ROOT_WAR_PATH;
     public static final String SERVER_KEYSTORE = "classpath://server.ks";
     
     private final boolean httpsEnabled;
@@ -109,6 +110,8 @@ public class HttpService {
     }
 
     public HttpService start() throws Exception {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), ROOT_WAR_PATH);
+
         try {
             if (httpsEnabled) {
                 //by default the server is configured with a http connector, this needs to be removed since we are going

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxClusterIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxClusterIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxClusterIntegrationTest.java
index bf653f1..31c3a4b 100644
--- a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxClusterIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxClusterIntegrationTest.java
@@ -24,6 +24,7 @@ import static org.testng.Assert.assertTrue;
 import java.util.Collections;
 import java.util.List;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.BeforeMethod;
@@ -62,7 +63,6 @@ public class NginxClusterIntegrationTest extends BrooklynAppLiveTestSupport {
 
     private static final long TIMEOUT_MS = 60*1000;
     
-    private String war;
     private Location localhostProvisioningLoc;
     private EntityManager entityManager;
     private LoadBalancerCluster loadBalancerCluster;
@@ -73,7 +73,6 @@ public class NginxClusterIntegrationTest extends BrooklynAppLiveTestSupport {
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        war = "classpath://hello-world.war";
         localhostProvisioningLoc = app.newLocalhostProvisioningLocation();
         
         urlMappings = app.createAndManageChild(EntitySpec.create(BasicGroup.class)
@@ -83,6 +82,11 @@ public class NginxClusterIntegrationTest extends BrooklynAppLiveTestSupport {
         nginxSpec = EntitySpec.create(NginxController.class);
     }
 
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     @Test(groups = "Integration")
     public void testCreatesNginxInstancesAndResizes() {
         loadBalancerCluster = app.createAndManageChild(EntitySpec.create(LoadBalancerCluster.class)
@@ -107,7 +111,7 @@ public class NginxClusterIntegrationTest extends BrooklynAppLiveTestSupport {
         DynamicCluster serverPool = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class))
                 .configure("initialSize", 1)
-                .configure(JavaWebAppService.ROOT_WAR, war.toString()));
+                .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         
         loadBalancerCluster = app.createAndManageChild(EntitySpec.create(LoadBalancerCluster.class)
                 .configure("serverPool", serverPool)
@@ -129,7 +133,7 @@ public class NginxClusterIntegrationTest extends BrooklynAppLiveTestSupport {
         DynamicCluster c1 = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class))
                 .configure("initialSize", 1)
-                .configure(JavaWebAppService.NAMED_WARS, ImmutableList.of(war)));
+                .configure(JavaWebAppService.NAMED_WARS, ImmutableList.of(getTestWar())));
 
         UrlMapping urlMapping = entityManager.createEntity(EntitySpec.create(UrlMapping.class)
                 .configure("domain", "localhost")

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxHttpsSslIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxHttpsSslIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxHttpsSslIntegrationTest.java
index 826bd0f..8ba88b7 100644
--- a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxHttpsSslIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxHttpsSslIntegrationTest.java
@@ -23,6 +23,7 @@ import static org.testng.Assert.assertTrue;
 
 import java.io.File;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -41,7 +42,6 @@ import brooklyn.entity.webapp.jboss.JBoss7Server;
 import brooklyn.location.Location;
 import brooklyn.test.Asserts;
 import brooklyn.test.HttpTestUtils;
-import brooklyn.test.entity.TestApplication;
 
 import com.google.common.collect.ImmutableList;
 
@@ -56,7 +56,6 @@ public class NginxHttpsSslIntegrationTest extends BrooklynAppLiveTestSupport {
     private DynamicCluster cluster;
     private Location localLoc;
 
-    private static final String WAR_URL = "classpath://hello-world.war";
     private static final String CERTIFICATE_URL = "classpath://ssl/certs/localhost/server.crt";
     private static final String KEY_URL = "classpath://ssl/certs/localhost/server.key";
     
@@ -67,6 +66,11 @@ public class NginxHttpsSslIntegrationTest extends BrooklynAppLiveTestSupport {
         localLoc = mgmt.getLocationRegistry().resolve("localhost");
     }
 
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     /**
      * Test that the Nginx proxy starts up and sets SERVICE_UP correctly.
      */
@@ -75,7 +79,7 @@ public class NginxHttpsSslIntegrationTest extends BrooklynAppLiveTestSupport {
         cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
             .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class))
             .configure("initialSize", 1)
-            .configure(JavaWebAppService.ROOT_WAR, WAR_URL));
+            .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         
         ProxySslConfig ssl = ProxySslConfig.builder()
                 .certificateSourceUrl(CERTIFICATE_URL)
@@ -132,7 +136,7 @@ public class NginxHttpsSslIntegrationTest extends BrooklynAppLiveTestSupport {
         cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
             .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class))
             .configure("initialSize", 1)
-            .configure(JavaWebAppService.ROOT_WAR, WAR_URL));
+            .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         
         ProxySslConfig ssl = ProxySslConfig.builder()
                 .certificateDestination(getFile("ssl/certs/localhost/server.crt"))

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxIntegrationTest.java
index 2dd5567..74d6dcf 100644
--- a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxIntegrationTest.java
@@ -27,6 +27,7 @@ import static org.testng.Assert.assertTrue;
 
 import java.util.Map;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.BeforeMethod;
@@ -56,8 +57,6 @@ import com.google.common.collect.Iterables;
 public class NginxIntegrationTest extends BrooklynAppLiveTestSupport {
     private static final Logger log = LoggerFactory.getLogger(NginxIntegrationTest.class);
 
-    static final String HELLO_WAR_URL = "classpath://hello-world.war";
-
     private NginxController nginx;
     private DynamicCluster serverPool;
     private Location localLoc;
@@ -69,6 +68,11 @@ public class NginxIntegrationTest extends BrooklynAppLiveTestSupport {
         localLoc = mgmt.getLocationRegistry().resolve("localhost");
     }
 
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     /**
      * Test that the Nginx proxy starts up and sets SERVICE_UP correctly.
      */
@@ -120,7 +124,7 @@ public class NginxIntegrationTest extends BrooklynAppLiveTestSupport {
         serverPool = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class))
                 .configure("initialSize", 1)
-                .configure(JavaWebAppService.ROOT_WAR, HELLO_WAR_URL));
+                .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         
         nginx = app.createAndManageChild(EntitySpec.create(NginxController.class)
                 .configure("serverPool", serverPool)
@@ -162,7 +166,7 @@ public class NginxIntegrationTest extends BrooklynAppLiveTestSupport {
         serverPool = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class))
                 .configure("initialSize", 1)
-                .configure(JavaWebAppService.ROOT_WAR, HELLO_WAR_URL));
+                .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
 
         nginx = app.createAndManageChild(EntitySpec.create(NginxController.class)
                 .configure("serverPool", serverPool)
@@ -205,7 +209,7 @@ public class NginxIntegrationTest extends BrooklynAppLiveTestSupport {
         serverPool = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class))
                 .configure("initialSize", 1)
-                .configure(JavaWebAppService.ROOT_WAR, HELLO_WAR_URL));
+                .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         
         nginx = app.createAndManageChild(EntitySpec.create(NginxController.class)
                 .configure("serverPool", serverPool)
@@ -281,7 +285,7 @@ public class NginxIntegrationTest extends BrooklynAppLiveTestSupport {
         serverPool = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class))
                 .configure("initialSize", 1)
-                .configure(JavaWebAppService.ROOT_WAR, HELLO_WAR_URL));
+                .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         
         nginx = app.createAndManageChild(EntitySpec.create(NginxController.class)
                 .configure("serverPool", serverPool));
@@ -341,7 +345,7 @@ public class NginxIntegrationTest extends BrooklynAppLiveTestSupport {
         serverPool = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class))
                 .configure("initialSize", 1)
-                .configure(JavaWebAppService.ROOT_WAR, HELLO_WAR_URL));
+                .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         
         nginx = app.createAndManageChild(EntitySpec.create(NginxController.class)
                 .configure("serverPool", serverPool));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxLightIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxLightIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxLightIntegrationTest.java
index 4605735..b55e598 100644
--- a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxLightIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxLightIntegrationTest.java
@@ -44,9 +44,6 @@ public class NginxLightIntegrationTest extends BrooklynAppUnitTestSupport {
     private NginxController nginx;
     private DynamicCluster cluster;
 
-    private URL war;
-    private static final String WAR_URL = "classpath://hello-world.war";
-    
     // FIXME Fails because getting addEntity callback for group members while nginx is still starting,
     // so important nginx fields are still null. Therefore get NPE for cluster members, and thus targets
     // is of size zero.

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java
index 364ef47..1965212 100644
--- a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java
@@ -30,6 +30,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
@@ -65,7 +66,6 @@ public class NginxRebindIntegrationTest extends RebindTestFixtureWithApp {
 
     private static final Logger LOG = LoggerFactory.getLogger(NginxRebindIntegrationTest.class);
 
-    private URL warUrl;
     private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
     private List<WebAppMonitor> webAppMonitors = new CopyOnWriteArrayList<WebAppMonitor>();
     private ExecutorService executor;
@@ -81,11 +81,15 @@ public class NginxRebindIntegrationTest extends RebindTestFixtureWithApp {
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
         super.setUp();
-        warUrl = getClass().getClassLoader().getResource("hello-world.war");
         localhostProvisioningLocation = origManagementContext.getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class));
         executor = Executors.newCachedThreadPool();
     }
 
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     @AfterMethod(alwaysRun=true)
     public void tearDown() throws Exception {
         for (WebAppMonitor monitor : webAppMonitors) {
@@ -156,7 +160,7 @@ public class NginxRebindIntegrationTest extends RebindTestFixtureWithApp {
         
         // Set up nginx with a server pool
         DynamicCluster origServerPool = origApp.createAndManageChild(EntitySpec.create(DynamicCluster.class)
-                .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).configure("war", warUrl.toString()))
+                .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).configure("war", getTestWar()))
                 .configure("initialSize", 1));
         
         NginxController origNginx = origApp.createAndManageChild(EntitySpec.create(NginxController.class)
@@ -229,7 +233,7 @@ public class NginxRebindIntegrationTest extends RebindTestFixtureWithApp {
                 .configure("childrenAsMembers", true));
         
         DynamicCluster origServerPool = origApp.createAndManageChild(EntitySpec.create(DynamicCluster.class)
-                .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).configure("war", warUrl.toString()))
+                .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).configure("war", getTestWar()))
                 .configure("initialSize", 1)); 
 
         UrlMapping origMapping = origApp.getManagementContext().getEntityManager().createEntity(EntitySpec.create(UrlMapping.class)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindWithHaIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindWithHaIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindWithHaIntegrationTest.java
index 6575d0b..6a32428 100644
--- a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindWithHaIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindWithHaIntegrationTest.java
@@ -26,6 +26,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -69,7 +70,6 @@ public class NginxRebindWithHaIntegrationTest extends RebindTestFixtureWithApp {
 
     private static final Logger LOG = LoggerFactory.getLogger(NginxRebindWithHaIntegrationTest.class);
 
-    private URL warUrl;
     private List<WebAppMonitor> webAppMonitors = new CopyOnWriteArrayList<WebAppMonitor>();
     private ExecutorService executor;
     private LocalhostMachineProvisioningLocation loc;
@@ -83,11 +83,15 @@ public class NginxRebindWithHaIntegrationTest extends RebindTestFixtureWithApp {
         // to set things like correct Java on path.
         return true;
     }
-    
+
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
         super.setUp();
-        warUrl = getClass().getClassLoader().getResource("hello-world.war");
         loc = origManagementContext.getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class)
             .configure("address", Networking.getLocalHost())
             .configure(SshTool.PROP_TOOL_CLASS, RecordingSshjTool.class.getName()));
@@ -123,7 +127,7 @@ public class NginxRebindWithHaIntegrationTest extends RebindTestFixtureWithApp {
     @Test(groups = "Integration")
     public void testChangeModeFailureStopsTasksButHappyUponResumption() throws Exception {
         DynamicCluster origServerPool = origApp.createAndManageChild(EntitySpec.create(DynamicCluster.class)
-                .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(TomcatServer.class).configure("war", warUrl.toString()))
+                .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(TomcatServer.class).configure("war", getTestWar()))
                 .configure("initialSize", 1));
         
         NginxController origNginx = origApp.createAndManageChild(EntitySpec.create(NginxController.class)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxUrlMappingIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxUrlMappingIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxUrlMappingIntegrationTest.java
index 2ed881e..d1f2fcb 100644
--- a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxUrlMappingIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxUrlMappingIntegrationTest.java
@@ -19,19 +19,18 @@
 package brooklyn.entity.proxy.nginx;
 
 import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
 import java.net.Inet4Address;
 import java.net.InetAddress;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.BeforeMethod;
@@ -71,23 +70,16 @@ public class NginxUrlMappingIntegrationTest extends BrooklynAppLiveTestSupport {
     
     private static final Logger log = LoggerFactory.getLogger(NginxUrlMappingIntegrationTest.class);
 
-    private static final String WAR_URL = "classpath://hello-world.war";
-    
     private NginxController nginx;
-    private DynamicCluster cluster;
     private Group urlMappingsGroup;
     private EntityManager entityManager;
     private LocalhostMachineProvisioningLocation localLoc;
     
-    private URL war;
-
     @BeforeMethod(alwaysRun=true)
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        war = getClass().getClassLoader().getResource("hello-world.war");
-        assertNotNull(war, "Unable to locate hello-world.war resource");
-        
+
         urlMappingsGroup = app.createAndManageChild(EntitySpec.create(BasicGroup.class)
                 .configure("childrenAsMembers", true));
         entityManager = app.getManagementContext().getEntityManager();
@@ -95,6 +87,11 @@ public class NginxUrlMappingIntegrationTest extends BrooklynAppLiveTestSupport {
         localLoc = new LocalhostMachineProvisioningLocation();
     }
 
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     protected void checkExtraLocalhosts() throws Exception {
         Set<String> failedHosts = Sets.newLinkedHashSet();
         List<String> allHosts = ImmutableList.of("localhost", "localhost1", "localhost2", "localhost3", "localhost4");
@@ -125,7 +122,7 @@ public class NginxUrlMappingIntegrationTest extends BrooklynAppLiveTestSupport {
         DynamicCluster c0 = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure("initialSize", 1)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).configure("httpPort", "8100+"))
-                .configure(JavaWebAppService.ROOT_WAR, WAR_URL));
+                .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         UrlMapping u0 = entityManager.createEntity(EntitySpec.create(UrlMapping.class)
                 .configure("domain", "localhost1")
                 .configure("target", c0)
@@ -136,7 +133,7 @@ public class NginxUrlMappingIntegrationTest extends BrooklynAppLiveTestSupport {
         DynamicCluster c1 = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure("initialSize", 1)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).configure("httpPort", "8100+"))
-                .configure(JavaWebAppService.NAMED_WARS, ImmutableList.of(WAR_URL)));
+                .configure(JavaWebAppService.NAMED_WARS, ImmutableList.of(getTestWar())));
         UrlMapping u1 = entityManager.createEntity(EntitySpec.create(UrlMapping.class)
                 .configure("domain", "localhost2")
                 .configure("path", "/hello-world($|/.*)")
@@ -160,7 +157,7 @@ public class NginxUrlMappingIntegrationTest extends BrooklynAppLiveTestSupport {
         app.start(ImmutableList.of(localLoc));
         final int port = nginx.getAttribute(NginxController.PROXY_HTTP_PORT);
         for (Entity member : c2.getMembers()) {
-            ((JBoss7Server)member).deploy(war.toString(), "c2.war");
+            ((JBoss7Server)member).deploy(getTestWar(), "c2.war");
         }
     
         Entities.dumpInfo(app);
@@ -236,10 +233,10 @@ public class NginxUrlMappingIntegrationTest extends BrooklynAppLiveTestSupport {
         final int port = nginx.getAttribute(NginxController.PROXY_HTTP_PORT);
         
         for (Entity child : c0.getMembers()) {
-            ((JBoss7Server)child).deploy(war.toString(), "atC0.war");
+            ((JBoss7Server)child).deploy(getTestWar(), "atC0.war");
         }
         for (Entity child : c1.getMembers()) {
-            ((JBoss7Server)child).deploy(war.toString(), "atC1.war");
+            ((JBoss7Server)child).deploy(getTestWar(), "atC1.war");
         }
 
         // Confirm routes requests to the correct cluster
@@ -262,7 +259,7 @@ public class NginxUrlMappingIntegrationTest extends BrooklynAppLiveTestSupport {
         DynamicCluster c0 = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure("initialSize", 1)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).configure("httpPort", "8100+"))
-                .configure(JavaWebAppService.ROOT_WAR, war.toString()));
+                .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         UrlMapping u0 = entityManager.createEntity(EntitySpec.create(UrlMapping.class)
                 .configure("domain", "localhost2")
                 .configure("target", c0)
@@ -296,12 +293,12 @@ public class NginxUrlMappingIntegrationTest extends BrooklynAppLiveTestSupport {
         DynamicCluster coreCluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure("initialSize", 1)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).configure("httpPort", "8100+"))
-                .configure(JavaWebAppService.ROOT_WAR, war.toString()));
+                .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         
         DynamicCluster c1 = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure("initialSize", 1)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).configure("httpPort", "8100+"))
-                .configure(JavaWebAppService.NAMED_WARS, ImmutableList.of(war.toString())));
+                .configure(JavaWebAppService.NAMED_WARS, ImmutableList.of(getTestWar())));
         UrlMapping u1 = entityManager.createEntity(EntitySpec.create(UrlMapping.class)
                 .configure("domain", "localhost1")
                 .configure("target", c1)
@@ -338,7 +335,7 @@ public class NginxUrlMappingIntegrationTest extends BrooklynAppLiveTestSupport {
         DynamicCluster c0 = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure("initialSize", 1)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).configure("httpPort", "8100+"))
-                .configure(JavaWebAppService.ROOT_WAR, WAR_URL));
+                .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         UrlMapping u0 = entityManager.createEntity(EntitySpec.create(UrlMapping.class)
                 .configure("domain", "localhost1")
                 .configure("target", c0)
@@ -391,7 +388,7 @@ public class NginxUrlMappingIntegrationTest extends BrooklynAppLiveTestSupport {
         final DynamicCluster c1 = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure("initialSize", 1)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).configure("httpPort", "8100+"))
-                .configure(JavaWebAppService.ROOT_WAR, war.toString()));
+                .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         final UrlMapping u1 = entityManager.createEntity(EntitySpec.create(UrlMapping.class)
                 .configure("domain", "localhost1")
                 .configure("target", c1)
@@ -474,7 +471,7 @@ public class NginxUrlMappingIntegrationTest extends BrooklynAppLiveTestSupport {
         final int port = nginx.getAttribute(NginxController.PROXY_HTTP_PORT);
         
         for (Entity child : c0.getMembers()) {
-            ((JBoss7Server)child).deploy(war.toString(), "atC0.war");
+            ((JBoss7Server)child).deploy(getTestWar(), "atC0.war");
         }
 
         // Confirm routes requests to the correct cluster
@@ -497,7 +494,7 @@ public class NginxUrlMappingIntegrationTest extends BrooklynAppLiveTestSupport {
         DynamicCluster c0 = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
                 .configure("initialSize", 1)
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class).configure("httpPort", "8100+"))
-                .configure(JavaWebAppService.ROOT_WAR, WAR_URL));
+                .configure(JavaWebAppService.ROOT_WAR, getTestWar()));
         UrlMapping u0 = entityManager.createEntity(EntitySpec.create(UrlMapping.class)
                 .configure("domain", "localhost1")
                 .configure("target", c0)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxWebClusterEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxWebClusterEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxWebClusterEc2LiveTest.java
index 12df430..2e90749 100644
--- a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxWebClusterEc2LiveTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxWebClusterEc2LiveTest.java
@@ -22,6 +22,7 @@ import static org.testng.Assert.assertNotNull;
 
 import java.net.URL;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
@@ -74,11 +75,12 @@ public class NginxWebClusterEc2LiveTest {
     public void shutdown() {
         if (app != null) Entities.destroyAll(app.getManagementContext());
     }
-    
+
     @Test(groups = "Live")
     public void testProvisionAwsCluster() {
-        String warName = "hello-world.war";
-        URL war = getClass().getClassLoader().getResource(warName);
+        String warName = "/hello-world.war";
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), warName);
+        URL war = getClass().getResource(warName);
         assertNotNull(war, "Unable to locate resource "+warName);
         
         cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/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 4569a59..8af8c9c 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
@@ -34,6 +34,7 @@ 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;
@@ -405,6 +406,7 @@ public abstract class AbstractWebAppFixtureIntegrationTest {
      */
     @DataProvider(name = "entitiesWithWarAndURL")
     public Object[][] entitiesWithWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world-no-mapping.war");
         List<Object[]> result = Lists.newArrayList();
         
         for (Object[] entity : basicEntities()) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterIntegrationTest.java
index 4d97b40..ad19b6b 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterIntegrationTest.java
@@ -21,10 +21,10 @@ package brooklyn.entity.webapp;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 
-import java.net.URL;
 import java.util.List;
 import java.util.concurrent.Callable;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.BeforeMethod;
@@ -58,25 +58,27 @@ public class ControlledDynamicWebAppClusterIntegrationTest extends BrooklynAppLi
 
     private static final int TIMEOUT_MS = 10*1000;
     
-    private URL warUrl;
     private LocalhostMachineProvisioningLocation loc;
     private List<LocalhostMachineProvisioningLocation> locs;
     
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
         super.setUp();
-        String warPath = "hello-world.war";
-        warUrl = getClass().getClassLoader().getResource(warPath);
-        
+
         loc = app.newLocalhostProvisioningLocation();
         locs = ImmutableList.of(loc);
     }
-    
+
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     @Test(groups="Integration")
     public void testConfiguresController() {
         ControlledDynamicWebAppCluster cluster = app.createAndManageChild(EntitySpec.create(ControlledDynamicWebAppCluster.class)
                 .configure("initialSize", 1)
-                .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", warUrl.toString())));
+                .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", getTestWar())));
         app.start(locs);
 
         String url = cluster.getController().getAttribute(NginxController.ROOT_URL);
@@ -88,7 +90,7 @@ public class ControlledDynamicWebAppClusterIntegrationTest extends BrooklynAppLi
     public void testSetsToplevelHostnameFromController() {
         ControlledDynamicWebAppCluster cluster = app.createAndManageChild(EntitySpec.create(ControlledDynamicWebAppCluster.class)
                 .configure("initialSize", 1)
-                .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", warUrl.toString())));
+                .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", getTestWar())));
         app.start(locs);
 
         String expectedHostname = cluster.getController().getAttribute(LoadBalancer.HOSTNAME);
@@ -108,7 +110,7 @@ public class ControlledDynamicWebAppClusterIntegrationTest extends BrooklynAppLi
         ControlledDynamicWebAppCluster cluster = app.createAndManageChild(EntitySpec.create(ControlledDynamicWebAppCluster.class)
                 .configure("initialSize", 1)
                 .configure(ControlledDynamicWebAppCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class)
-                        .configure(JBoss7Server.ROOT_WAR, warUrl.toString()))
+                        .configure(JBoss7Server.ROOT_WAR, getTestWar()))
                 .configure(ControlledDynamicWebAppCluster.WEB_CLUSTER_SPEC, EntitySpec.create(DynamicWebAppCluster.class)
                         .displayName("mydisplayname")));
         app.start(locs);
@@ -147,7 +149,7 @@ public class ControlledDynamicWebAppClusterIntegrationTest extends BrooklynAppLi
     public void testTomcatAbsoluteRedirect() {
         final ControlledDynamicWebAppCluster cluster = app.createAndManageChild(EntitySpec.create(ControlledDynamicWebAppCluster.class)
             .configure(ControlledDynamicWebAppCluster.MEMBER_SPEC, EntitySpec.create(TomcatServer.class)
-                    .configure(TomcatServer.ROOT_WAR, "classpath://hello-world.war"))
+            .configure(TomcatServer.ROOT_WAR, getTestWar()))
             .configure("initialSize", 1)
             .configure(AbstractController.SERVICE_UP_URL_PATH, "hello/redirectAbsolute")
         );

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterTest.java
index 54509b7..1fb0d84 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterTest.java
@@ -23,6 +23,7 @@ import static org.testng.Assert.assertEquals;
 import java.net.URL;
 import java.util.List;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.BeforeMethod;
@@ -51,20 +52,22 @@ import com.google.common.collect.Lists;
 public class ControlledDynamicWebAppClusterTest extends BrooklynAppUnitTestSupport {
     private static final Logger log = LoggerFactory.getLogger(ControlledDynamicWebAppClusterTest.class);
 
-    private URL warUrl;
     private LocalhostMachineProvisioningLocation loc;
     private List<LocalhostMachineProvisioningLocation> locs;
     
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
         super.setUp();
-        String warPath = "hello-world.war";
-        warUrl = getClass().getClassLoader().getResource(warPath);
-        
+
         loc = app.newLocalhostProvisioningLocation();
         locs = ImmutableList.of(loc);
     }
-    
+
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     @Test
     public void testUsesCustomController() {
         AbstractController controller = app.createAndManageChild(EntitySpec.create(TrackingAbstractController.class).displayName("mycustom"));
@@ -72,7 +75,7 @@ public class ControlledDynamicWebAppClusterTest extends BrooklynAppUnitTestSuppo
         ControlledDynamicWebAppCluster cluster = app.createAndManageChild(EntitySpec.create(ControlledDynamicWebAppCluster.class)
                 .configure("initialSize", 0)
                 .configure(ControlledDynamicWebAppCluster.CONTROLLER, controller)
-                .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", warUrl.toString())));
+                .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", getTestWar())));
         app.start(locs);
 
         EntityTestUtils.assertAttributeEqualsEventually(controller, AbstractController.SERVICE_UP, true);
@@ -89,7 +92,7 @@ public class ControlledDynamicWebAppClusterTest extends BrooklynAppUnitTestSuppo
         ControlledDynamicWebAppCluster cluster = app.createAndManageChild(EntitySpec.create(ControlledDynamicWebAppCluster.class)
                 .configure("initialSize", 0)
                 .configure(ControlledDynamicWebAppCluster.CONTROLLER_SPEC, controllerSpec)
-                .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", warUrl.toString())));
+                .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", getTestWar())));
         app.start(locs);
         LoadBalancer controller = cluster.getController();
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
index eb90157..de8c0d9 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
@@ -18,6 +18,7 @@
  */
 package brooklyn.entity.webapp;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
@@ -48,10 +49,15 @@ public class ElasticJavaWebAppServiceIntegrationTest {
         if (app != null) Entities.destroyAll(app.getManagementContext());
     }
 
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     @Test(groups = "Integration")
     public void testFactory() {
         ElasticJavaWebAppService svc =
-            new ElasticJavaWebAppService.Factory().newEntity(MutableMap.of("war", "classpath://hello-world.war"), app);
+            new ElasticJavaWebAppService.Factory().newEntity(MutableMap.of("war", getTestWar()), app);
         Entities.manage(svc);
         app.start(ImmutableList.of(loc));
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/ControlledDynamicWebAppClusterRebindIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/ControlledDynamicWebAppClusterRebindIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/ControlledDynamicWebAppClusterRebindIntegrationTest.java
index 777742e..ce45794 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/ControlledDynamicWebAppClusterRebindIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/ControlledDynamicWebAppClusterRebindIntegrationTest.java
@@ -21,16 +21,15 @@ package brooklyn.entity.webapp.jboss;
 import static brooklyn.test.EntityTestUtils.assertAttributeEqualsEventually;
 import static brooklyn.test.HttpTestUtils.assertHttpStatusCodeEquals;
 import static brooklyn.test.HttpTestUtils.assertHttpStatusCodeEventuallyEquals;
-import static com.google.common.base.Preconditions.checkNotNull;
 import static org.testng.Assert.assertEquals;
 
 import java.io.File;
-import java.net.URL;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
@@ -61,7 +60,6 @@ public class ControlledDynamicWebAppClusterRebindIntegrationTest {
     
     static { TimeExtras.init(); }
 
-    private URL warUrl;
     private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
     private TestApplication origApp;
     private TestApplication newApp;
@@ -74,8 +72,6 @@ public class ControlledDynamicWebAppClusterRebindIntegrationTest {
     
     @BeforeMethod(alwaysRun=true)
     public void setUp() {
-        String warPath = "hello-world.war";
-        warUrl = checkNotNull(getClass().getClassLoader().getResource(warPath), "warUrl");
         executor = Executors.newCachedThreadPool();
 
         mementoDir = Files.createTempDir();
@@ -97,6 +93,11 @@ public class ControlledDynamicWebAppClusterRebindIntegrationTest {
         if (mementoDir != null) RebindTestUtils.deleteMementoDir(mementoDir);
     }
 
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     private TestApplication rebind() throws Exception {
         RebindTestUtils.waitForPersisted(origApp);
         
@@ -120,7 +121,7 @@ public class ControlledDynamicWebAppClusterRebindIntegrationTest {
         NginxController origNginx = origApp.createAndManageChild(EntitySpec.create(NginxController.class).configure("domain", "localhost"));
 
         origApp.createAndManageChild(EntitySpec.create(ControlledDynamicWebAppCluster.class)
-                .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", warUrl.toString()))
+                .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", getTestWar()))
                 .configure("initialSize", 1)
                 .configure("controller", origNginx));
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/DynamicWebAppClusterRebindIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/DynamicWebAppClusterRebindIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/DynamicWebAppClusterRebindIntegrationTest.java
index 0005f49..c1624d9 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/DynamicWebAppClusterRebindIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/DynamicWebAppClusterRebindIntegrationTest.java
@@ -30,6 +30,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
@@ -56,7 +57,6 @@ import com.google.common.io.Files;
 public class DynamicWebAppClusterRebindIntegrationTest {
     private static final Logger LOG = LoggerFactory.getLogger(DynamicWebAppClusterRebindIntegrationTest.class);
     
-    private URL warUrl;
     private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
     private TestApplication origApp;
     private TestApplication newApp;
@@ -69,9 +69,6 @@ public class DynamicWebAppClusterRebindIntegrationTest {
     
     @BeforeMethod(groups = "Integration")
     public void setUp() {
-        String warPath = "hello-world.war";
-        warUrl = getClass().getClassLoader().getResource(warPath);
-        
         executor = Executors.newCachedThreadPool();
 
         mementoDir = Files.createTempDir();
@@ -92,6 +89,11 @@ public class DynamicWebAppClusterRebindIntegrationTest {
         if (mementoDir != null) RebindTestUtils.deleteMementoDir(mementoDir);
     }
 
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     private TestApplication rebind() throws Exception {
         RebindTestUtils.waitForPersisted(origApp);
         
@@ -113,7 +115,7 @@ public class DynamicWebAppClusterRebindIntegrationTest {
     @Test(groups = "Integration")
     public void testRebindsToRunningCluster() throws Exception {
         DynamicWebAppCluster origCluster = origApp.createAndManageChild(EntitySpec.create(DynamicWebAppCluster.class)
-                .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", warUrl.toString()))
+                .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", getTestWar()))
                 .configure("initialSize", 1));
         
         origApp.start(ImmutableList.of(localhostProvisioningLocation));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java
index 92d07c3..8dc7c70 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java
@@ -23,6 +23,7 @@ import static org.testng.Assert.assertNotNull;
 
 import java.net.URL;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.testng.annotations.Test;
 
 import brooklyn.entity.AbstractEc2LiveTest;
@@ -38,12 +39,15 @@ import com.google.common.collect.ImmutableList;
  */
 public class Jboss6ServerEc2LiveTest extends AbstractEc2LiveTest {
     
-    private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
-    
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world-no-mapping.war");
+        return "classpath://hello-world-no-mapping.war";
+    }
+
     @Override
     protected void doTest(Location loc) throws Exception {
         final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class)
-                .configure("war", warUrl.toString()));
+                .configure("war", getTestWar()));
         
         app.start(ImmutableList.of(loc));
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java
index e3fd800..922b9eb 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java
@@ -23,6 +23,7 @@ import static org.testng.Assert.assertNotNull;
 
 import java.net.URL;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -49,18 +50,20 @@ public class Jboss6ServerIntegrationTest extends BrooklynAppLiveTestSupport {
     // Port increment for JBoss 6.
     public static final int PORT_INCREMENT = 400;
 
-    private URL warUrl;
     private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
     
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
         super.setUp();
-        String warPath = "hello-world-no-mapping.war";
-        warUrl = getClass().getClassLoader().getResource(warPath);
 
         localhostProvisioningLocation = app.newLocalhostProvisioningLocation();
     }
 
+    public String getTestWarWithNoMapping() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world-no-mapping.war");
+        return "classpath://hello-world-no-mapping.war";
+    }
+
     @Test(groups = "Integration")
     public void testJmxmp() throws Exception {
         runTest(UsesJmx.JmxAgentModes.JMXMP);
@@ -80,7 +83,7 @@ public class Jboss6ServerIntegrationTest extends BrooklynAppLiveTestSupport {
         final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class)
                 .configure(JBoss6Server.PORT_INCREMENT, PORT_INCREMENT)
                 .configure(UsesJmx.JMX_AGENT_MODE, jmxAgentMode)
-                .configure("war", warUrl.toString()));
+                .configure("war", getTestWarWithNoMapping()));
 
         app.start(ImmutableList.of(localhostProvisioningLocation));
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java
index e29b9b7..decfced 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java
@@ -23,6 +23,7 @@ import brooklyn.entity.software.AbstractDockerLiveTest;
 import brooklyn.location.Location;
 import brooklyn.test.Asserts;
 import brooklyn.test.HttpTestUtils;
+import brooklyn.test.TestResourceUnavailableException;
 import com.google.common.collect.ImmutableList;
 import org.testng.annotations.Test;
 
@@ -36,12 +37,15 @@ import static org.testng.Assert.assertNotNull;
  */
 public class Jboss7DockerLiveTest extends AbstractDockerLiveTest {
 
-   private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
+   public String getTestWar() {
+      TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+      return "classpath://hello-world.war";
+   }
 
    @Override
    protected void doTest(Location loc) throws Exception {
       final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-              .configure("war", warUrl.toString()));
+              .configure("war", getTestWar()));
 
       app.start(ImmutableList.of(loc));
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java
index d041e18..904388c 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java
@@ -23,6 +23,7 @@ import static org.testng.Assert.assertNotNull;
 
 import java.net.URL;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.testng.annotations.Test;
 
 import brooklyn.entity.AbstractEc2LiveTest;
@@ -37,13 +38,16 @@ import com.google.common.collect.ImmutableList;
  * A simple test of installing+running on AWS-EC2, using various OS distros and versions. 
  */
 public class Jboss7ServerEc2LiveTest extends AbstractEc2LiveTest {
-    
-    private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
-    
+
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     @Override
     protected void doTest(Location loc) throws Exception {
         final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                .configure("war", warUrl.toString()));
+                .configure("war", getTestWar()));
         
         app.start(ImmutableList.of(loc));
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerGoogleComputeLiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerGoogleComputeLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerGoogleComputeLiveTest.java
index 3563aa9..e067c59 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerGoogleComputeLiveTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerGoogleComputeLiveTest.java
@@ -23,6 +23,7 @@ import static org.testng.Assert.assertNotNull;
 
 import java.net.URL;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.testng.annotations.Test;
 
 import brooklyn.entity.AbstractGoogleComputeLiveTest;
@@ -37,13 +38,16 @@ import com.google.common.collect.ImmutableList;
  * A simple test of installing+running on AWS-EC2, using various OS distros and versions. 
  */
 public class Jboss7ServerGoogleComputeLiveTest extends AbstractGoogleComputeLiveTest {
-    
-    private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
-    
+
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     @Override
     protected void doTest(Location loc) throws Exception {
         final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                .configure("war", warUrl.toString()));
+                .configure("war", getTestWar()));
         
         app.start(ImmutableList.of(loc));
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
index a6cf0b8..de2fac3 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
@@ -23,10 +23,10 @@ import static org.testng.Assert.assertNotNull;
 
 import java.io.File;
 import java.io.FileOutputStream;
-import java.net.URL;
+
 import java.security.KeyStore;
 import java.security.cert.Certificate;
-
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
@@ -54,16 +54,12 @@ import com.google.common.collect.ImmutableSet;
 public class Jboss7ServerIntegrationTest {
     private static final Logger LOG = LoggerFactory.getLogger(Jboss7ServerIntegrationTest.class);
     
-    private URL warUrl;
     private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
     private TestApplication app;
     private File keystoreFile;
     
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
-        String warPath = "hello-world.war";
-        warUrl = getClass().getClassLoader().getResource(warPath);
-
         localhostProvisioningLocation = new LocalhostMachineProvisioningLocation();
         app = ApplicationBuilder.newManagedApp(TestApplication.class);
         keystoreFile = createTemporaryKeyStore("myname", "mypass");
@@ -95,10 +91,15 @@ public class Jboss7ServerIntegrationTest {
         }
     }
     
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     @Test(groups = "Integration")
     public void testHttp() throws Exception {
         final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                .configure("war", warUrl.toString()));
+                .configure("war", getTestWar()));
         
         app.start(ImmutableList.of(localhostProvisioningLocation));
         
@@ -126,7 +127,7 @@ public class Jboss7ServerIntegrationTest {
     @Test(groups = {"Integration"})
     public void testHttps() throws Exception {
         final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                .configure("war", warUrl.toString())
+                .configure("war", getTestWar())
                 .configure(JBoss7Server.ENABLED_PROTOCOLS, ImmutableSet.of("https"))
                 .configure(JBoss7Server.HTTPS_SSL_CONFIG, new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
         
@@ -163,7 +164,7 @@ public class Jboss7ServerIntegrationTest {
     @Test(groups = {"Integration"})
     public void testHttpAndHttps() throws Exception {
         final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                .configure("war", warUrl.toString())
+                .configure("war", getTestWar())
                 .configure(JBoss7Server.ENABLED_PROTOCOLS, ImmutableSet.of("http", "https"))
                 .configure(JBoss7Server.HTTPS_SSL_CONFIG, new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerRebindIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerRebindIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerRebindIntegrationTest.java
index 9a1bd5e..2705690 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerRebindIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerRebindIntegrationTest.java
@@ -20,12 +20,12 @@ package brooklyn.entity.webapp.jboss;
 
 import static org.testng.Assert.assertEquals;
 
-import java.net.URL;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
@@ -52,7 +52,6 @@ import com.google.common.collect.Iterables;
 public class Jboss7ServerRebindIntegrationTest extends RebindTestFixtureWithApp {
     private static final Logger LOG = LoggerFactory.getLogger(Jboss7ServerRebindIntegrationTest.class);
     
-    private URL warUrl;
     private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
     private TestApplication newApp;
     private List<WebAppMonitor> webAppMonitors = new CopyOnWriteArrayList<WebAppMonitor>();
@@ -62,8 +61,6 @@ public class Jboss7ServerRebindIntegrationTest extends RebindTestFixtureWithApp
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        String warPath = "hello-world.war";
-        warUrl = getClass().getClassLoader().getResource(warPath);
         executor = Executors.newCachedThreadPool();
         localhostProvisioningLocation = (LocalhostMachineProvisioningLocation) origManagementContext.getLocationRegistry().resolve("localhost");
     }
@@ -78,6 +75,11 @@ public class Jboss7ServerRebindIntegrationTest extends RebindTestFixtureWithApp
         super.tearDown();
     }
 
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     private WebAppMonitor newWebAppMonitor(String url) {
         WebAppMonitor monitor = new WebAppMonitor(url)
 //                .delayMillis(0)
@@ -91,7 +93,7 @@ public class Jboss7ServerRebindIntegrationTest extends RebindTestFixtureWithApp
     public void testRebindsToRunningServer() throws Exception {
         // Start an app-server, and wait for it to be fully up
         JBoss7Server origServer = origApp.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                    .configure("war", warUrl.toString()));
+                    .configure("war", getTestWar()));
         
         origApp.start(ImmutableList.of(localhostProvisioningLocation));
         
@@ -111,7 +113,7 @@ public class Jboss7ServerRebindIntegrationTest extends RebindTestFixtureWithApp
         HttpTestUtils.assertHttpStatusCodeEventuallyEquals(newRootUrl, 200);
 
         // confirm that deploy() effector affects the correct jboss server 
-        newServer.deploy(warUrl.toString(), "myhello.war");
+        newServer.deploy(getTestWar(), "myhello.war");
         HttpTestUtils.assertHttpStatusCodeEventuallyEquals(newRootUrl+"myhello", 200);
         
         // check we see evidence of the enrichers and sensor-feeds having an effect.

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerEc2LiveTest.java
index db7e373..ec7f0a1 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerEc2LiveTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerEc2LiveTest.java
@@ -23,6 +23,7 @@ import static org.testng.Assert.assertNotNull;
 
 import java.net.URL;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.testng.annotations.Test;
 
 import brooklyn.entity.AbstractEc2LiveTest;
@@ -37,13 +38,16 @@ import com.google.common.collect.ImmutableList;
  * A simple test of installing+running on AWS-EC2, using various OS distros and versions. 
  */
 public class TomcatServerEc2LiveTest extends AbstractEc2LiveTest {
-    
-    private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
-    
+
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     @Override
     protected void doTest(Location loc) throws Exception {
         final TomcatServer server = app.createAndManageChild(EntitySpec.create(TomcatServer.class)
-                .configure("war", warUrl.toString()));
+                .configure("war", getTestWar()));
         
         app.start(ImmutableList.of(loc));
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerSoftlayerLiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerSoftlayerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerSoftlayerLiveTest.java
index 9409cf5..7772a39 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerSoftlayerLiveTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerSoftlayerLiveTest.java
@@ -23,6 +23,7 @@ import static org.testng.Assert.assertNotNull;
 
 import java.net.URL;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.testng.annotations.Test;
 
 import brooklyn.entity.AbstractSoftlayerLiveTest;
@@ -37,13 +38,16 @@ import com.google.common.collect.ImmutableList;
  * A simple test of installing+running on Softlayer, using various OS distros and versions. 
  */
 public class TomcatServerSoftlayerLiveTest extends AbstractSoftlayerLiveTest {
-    
-    private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
-    
+
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
     @Override
     protected void doTest(Location loc) throws Exception {
         final TomcatServer server = app.createAndManageChild(EntitySpec.create(TomcatServer.class)
-                .configure("war", warUrl.toString()));
+                .configure("war", getTestWar()));
         
         app.start(ImmutableList.of(loc));
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
index 9942dd3..d171332 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
@@ -26,6 +26,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -68,6 +69,7 @@ public class TomcatServerWebAppFixtureIntegrationTest extends AbstractWebAppFixt
     // as parent, but with spring travel
     @DataProvider(name = "entitiesWithWarAndURL")
     public Object[][] entitiesWithWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
         List<Object[]> result = Lists.newArrayList();
         
         for (Object[] entity : basicEntities()) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a184a0f8/usage/launcher/src/test/java/brooklyn/launcher/WebAppRunnerTest.java
----------------------------------------------------------------------
diff --git a/usage/launcher/src/test/java/brooklyn/launcher/WebAppRunnerTest.java b/usage/launcher/src/test/java/brooklyn/launcher/WebAppRunnerTest.java
index 2fbd131..23018c3 100644
--- a/usage/launcher/src/test/java/brooklyn/launcher/WebAppRunnerTest.java
+++ b/usage/launcher/src/test/java/brooklyn/launcher/WebAppRunnerTest.java
@@ -24,6 +24,7 @@ import static org.testng.Assert.fail;
 import java.util.List;
 import java.util.Map;
 
+import brooklyn.test.TestResourceUnavailableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
@@ -94,9 +95,11 @@ public class WebAppRunnerTest {
     public static void assertBrooklynEventuallyAt(String url) {
         HttpTestUtils.assertContentEventuallyContainsText(url, "Brooklyn Web Console");
     }
-    
+
     @Test
     public void testStartSecondaryWar() throws Exception {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+
         if (!Networking.isPortAvailable(8090))
             fail("Another process is using port 8090 which is required for this test.");
         BrooklynWebServer server = createWebServer(
@@ -117,6 +120,8 @@ public class WebAppRunnerTest {
 
     @Test
     public void testStartSecondaryWarAfter() throws Exception {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+
         if (!Networking.isPortAvailable(8090))
             fail("Another process is using port 8090 which is required for this test.");
         BrooklynWebServer server = createWebServer(MutableMap.of("port", 8090, "war", "brooklyn.war"));
@@ -137,6 +142,8 @@ public class WebAppRunnerTest {
 
     @Test
     public void testStartWithLauncher() throws Exception {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+
         BrooklynLauncher launcher = BrooklynLauncher.newInstance()
                 .brooklynProperties("brooklyn.webconsole.security.provider","brooklyn.rest.security.provider.AnyoneSecurityProvider")
                 .webapp("/hello", "hello-world.war")