http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java index 11defe8..ca3ac2b 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java @@ -23,6 +23,7 @@ import static org.testng.Assert.assertNotNull; import java.net.URL; +import org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.test.TestResourceUnavailableException; import org.testng.annotations.Test; @@ -30,7 +31,6 @@ import brooklyn.entity.AbstractEc2LiveTest; import brooklyn.entity.proxying.EntitySpec; import brooklyn.location.Location; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; import com.google.common.collect.ImmutableList;
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java index 911109c..cb3ffdf 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java @@ -23,6 +23,7 @@ import static org.testng.Assert.assertNotNull; import java.net.URL; +import org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.test.TestResourceUnavailableException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -32,7 +33,6 @@ import brooklyn.entity.java.UsesJmx; import brooklyn.entity.proxying.EntitySpec; import brooklyn.location.basic.LocalhostMachineProvisioningLocation; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; import com.google.common.collect.ImmutableList; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java index 78f6153..46fdb80 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java @@ -23,6 +23,7 @@ import static org.testng.Assert.assertNotNull; import java.net.URL; +import org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.test.TestResourceUnavailableException; import org.testng.annotations.Test; @@ -30,7 +31,6 @@ import brooklyn.entity.AbstractEc2LiveTest; import brooklyn.entity.proxying.EntitySpec; import brooklyn.location.Location; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; import com.google.common.collect.ImmutableList; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java index a15e35d..813b38d 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java @@ -22,9 +22,12 @@ import brooklyn.entity.proxying.EntitySpec; import brooklyn.entity.software.AbstractDockerLiveTest; import brooklyn.location.Location; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; + +import org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.test.TestResourceUnavailableException; + import com.google.common.collect.ImmutableList; + import org.testng.annotations.Test; import java.net.URL; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java index 31647e6..a31a147 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java @@ -35,8 +35,10 @@ import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest; import brooklyn.entity.webapp.HttpsSslConfig; import brooklyn.location.basic.LocalhostMachineProvisioningLocation; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; + +import org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.test.TestResourceUnavailableException; + import brooklyn.test.entity.TestApplication; import com.google.common.collect.ImmutableList; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java index d580a73..c855ccd 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java @@ -25,7 +25,10 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import org.apache.brooklyn.test.EntityTestUtils; +import org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.test.TestResourceUnavailableException; +import org.apache.brooklyn.test.WebAppMonitor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.AfterMethod; @@ -37,9 +40,6 @@ import brooklyn.entity.proxying.EntitySpec; import brooklyn.entity.rebind.RebindOptions; import brooklyn.entity.rebind.RebindTestFixtureWithApp; import brooklyn.location.basic.LocalhostMachineProvisioningLocation; -import brooklyn.test.EntityTestUtils; -import brooklyn.test.HttpTestUtils; -import brooklyn.test.WebAppMonitor; import brooklyn.test.entity.TestApplication; import com.google.common.base.Predicates; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/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 d28b1b7..e5cdcf5 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 org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.test.TestResourceUnavailableException; import org.testng.annotations.Test; @@ -30,7 +31,6 @@ import brooklyn.entity.AbstractGoogleComputeLiveTest; import brooklyn.entity.proxying.EntitySpec; import brooklyn.location.Location; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; import com.google.common.collect.ImmutableList; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppEc2LiveTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppEc2LiveTest.java index b2b5937..ace298f 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppEc2LiveTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppEc2LiveTest.java @@ -22,12 +22,12 @@ import static brooklyn.entity.webapp.nodejs.NodeJsWebAppFixtureIntegrationTest.A import static brooklyn.entity.webapp.nodejs.NodeJsWebAppFixtureIntegrationTest.APP_NAME; import static brooklyn.entity.webapp.nodejs.NodeJsWebAppFixtureIntegrationTest.GIT_REPO_URL; +import org.apache.brooklyn.test.HttpTestUtils; import org.testng.annotations.Test; import brooklyn.entity.AbstractEc2LiveTest; import brooklyn.entity.proxying.EntitySpec; import brooklyn.location.Location; -import brooklyn.test.HttpTestUtils; import com.google.common.collect.ImmutableList; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java index d567448..14c3ca1 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java @@ -29,13 +29,15 @@ import brooklyn.location.Location; import brooklyn.location.basic.PortRanges; import brooklyn.management.ManagementContext; import brooklyn.test.Asserts; -import brooklyn.test.EntityTestUtils; -import brooklyn.test.HttpTestUtils; import brooklyn.test.entity.TestApplication; import brooklyn.util.collections.MutableMap; import brooklyn.util.net.Urls; import brooklyn.util.time.Duration; + import com.google.common.collect.ImmutableList; + +import org.apache.brooklyn.test.EntityTestUtils; +import org.apache.brooklyn.test.HttpTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.AfterMethod; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSoftlayerLiveTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSoftlayerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSoftlayerLiveTest.java index ae87086..4919906 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSoftlayerLiveTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSoftlayerLiveTest.java @@ -22,12 +22,12 @@ import static brooklyn.entity.webapp.nodejs.NodeJsWebAppFixtureIntegrationTest.A import static brooklyn.entity.webapp.nodejs.NodeJsWebAppFixtureIntegrationTest.APP_NAME; import static brooklyn.entity.webapp.nodejs.NodeJsWebAppFixtureIntegrationTest.GIT_REPO_URL; +import org.apache.brooklyn.test.HttpTestUtils; import org.testng.annotations.Test; import brooklyn.entity.AbstractSoftlayerLiveTest; import brooklyn.entity.proxying.EntitySpec; import brooklyn.location.Location; -import brooklyn.test.HttpTestUtils; import com.google.common.collect.ImmutableList; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerEc2LiveTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerEc2LiveTest.java index ecb7356..b8ffa32 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerEc2LiveTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerEc2LiveTest.java @@ -27,7 +27,8 @@ import brooklyn.entity.proxying.EntitySpec; import brooklyn.entity.webapp.tomcat.Tomcat8Server; import brooklyn.location.Location; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; + +import org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.test.TestResourceUnavailableException; import com.google.common.collect.ImmutableList; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSoftlayerLiveTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSoftlayerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSoftlayerLiveTest.java index 7268d10..d88191b 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSoftlayerLiveTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/Tomcat8ServerSoftlayerLiveTest.java @@ -27,7 +27,8 @@ import brooklyn.entity.proxying.EntitySpec; import brooklyn.entity.webapp.tomcat.Tomcat8Server; import brooklyn.location.Location; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; + +import org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.test.TestResourceUnavailableException; import com.google.common.collect.ImmutableList; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/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 5282e3a..467e3c4 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 org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.test.TestResourceUnavailableException; import org.testng.annotations.Test; @@ -30,7 +31,6 @@ import brooklyn.entity.AbstractEc2LiveTest; import brooklyn.entity.proxying.EntitySpec; import brooklyn.location.Location; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; import com.google.common.collect.ImmutableList; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/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 13db672..ab23e7f 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 org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.test.TestResourceUnavailableException; import org.testng.annotations.Test; @@ -30,7 +31,6 @@ import brooklyn.entity.AbstractSoftlayerLiveTest; import brooklyn.entity.proxying.EntitySpec; import brooklyn.location.Location; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; import com.google.common.collect.ImmutableList; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/EnrichersSlightlySimplerYamlTest.java ---------------------------------------------------------------------- diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/EnrichersSlightlySimplerYamlTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/EnrichersSlightlySimplerYamlTest.java index b416be5..e231432 100644 --- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/EnrichersSlightlySimplerYamlTest.java +++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/EnrichersSlightlySimplerYamlTest.java @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; +import org.apache.brooklyn.test.EntityTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -35,7 +36,6 @@ import brooklyn.entity.basic.EntityInternal; import brooklyn.entity.group.DynamicCluster; import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; import brooklyn.event.basic.Sensors; -import brooklyn.test.EntityTestUtils; import brooklyn.util.collections.CollectionFunctionals; import brooklyn.util.collections.MutableList; import brooklyn.util.math.MathPredicates; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsIntegrationTest.java ---------------------------------------------------------------------- diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsIntegrationTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsIntegrationTest.java index 007c830..a55881c 100644 --- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsIntegrationTest.java +++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppsIntegrationTest.java @@ -19,7 +19,6 @@ package org.apache.brooklyn.camp.brooklyn; import static com.google.common.base.Preconditions.checkNotNull; - import io.brooklyn.camp.spi.Assembly; import io.brooklyn.camp.spi.AssemblyTemplate; import io.brooklyn.camp.spi.PlatformComponent; @@ -35,6 +34,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatform; import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatformLauncherNoServer; +import org.apache.brooklyn.test.EntityTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -55,7 +55,6 @@ import brooklyn.management.Task; import brooklyn.policy.Policy; import brooklyn.policy.autoscaling.AutoScalerPolicy; import brooklyn.test.Asserts; -import brooklyn.test.EntityTestUtils; import brooklyn.util.ResourceUtils; import brooklyn.util.collections.MutableMap; import brooklyn.util.exceptions.Exceptions; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java ---------------------------------------------------------------------- diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java index 23aa759..275aa0a 100644 --- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java +++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ReloadBrooklynPropertiesTest.java @@ -26,6 +26,7 @@ import java.io.Reader; import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants; import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatformLauncherNoServer; +import org.apache.brooklyn.test.EntityTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -37,7 +38,6 @@ import brooklyn.entity.Entity; import brooklyn.entity.basic.Entities; import brooklyn.entity.trait.Startable; import brooklyn.management.ManagementContext; -import brooklyn.test.EntityTestUtils; import brooklyn.util.ResourceUtils; import brooklyn.util.exceptions.Exceptions; import brooklyn.util.stream.Streams; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/VanillaBashNetcatYamlTest.java ---------------------------------------------------------------------- diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/VanillaBashNetcatYamlTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/VanillaBashNetcatYamlTest.java index bde5016..5e97099 100644 --- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/VanillaBashNetcatYamlTest.java +++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/VanillaBashNetcatYamlTest.java @@ -19,6 +19,7 @@ package org.apache.brooklyn.camp.brooklyn; import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants; +import org.apache.brooklyn.test.EntityTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -34,7 +35,6 @@ import brooklyn.entity.effector.Effectors; import brooklyn.event.AttributeSensor; import brooklyn.event.basic.Sensors; import brooklyn.management.Task; -import brooklyn.test.EntityTestUtils; import brooklyn.util.collections.MutableMap; import brooklyn.util.net.Networking; import brooklyn.util.text.StringPredicates; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/jsgui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java b/usage/jsgui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java index cd538cc..799b181 100644 --- a/usage/jsgui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java +++ b/usage/jsgui/src/test/java/org/apache/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java @@ -18,6 +18,7 @@ */ package org.apache.brooklyn.rest.jsgui; +import org.apache.brooklyn.test.HttpTestUtils; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.ContextHandler; import org.testng.annotations.AfterMethod; @@ -28,7 +29,6 @@ import brooklyn.entity.basic.Entities; import brooklyn.management.ManagementContext; import brooklyn.rest.BrooklynRestApiLauncherTestFixture; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; /** Convenience and demo for launching programmatically. */ public class BrooklynJavascriptGuiLauncherTest { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/launcher/src/test/java/brooklyn/entity/brooklynnode/BrooklynEntityMirrorIntegrationTest.java ---------------------------------------------------------------------- diff --git a/usage/launcher/src/test/java/brooklyn/entity/brooklynnode/BrooklynEntityMirrorIntegrationTest.java b/usage/launcher/src/test/java/brooklyn/entity/brooklynnode/BrooklynEntityMirrorIntegrationTest.java index a523019..a84e1ea 100644 --- a/usage/launcher/src/test/java/brooklyn/entity/brooklynnode/BrooklynEntityMirrorIntegrationTest.java +++ b/usage/launcher/src/test/java/brooklyn/entity/brooklynnode/BrooklynEntityMirrorIntegrationTest.java @@ -21,6 +21,8 @@ package brooklyn.entity.brooklynnode; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; +import org.apache.brooklyn.test.EntityTestUtils; +import org.apache.brooklyn.test.HttpTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -38,8 +40,6 @@ import brooklyn.management.ManagementContext; import brooklyn.management.ha.HighAvailabilityMode; import brooklyn.rest.filter.BrooklynPropertiesSecurityFilter; import brooklyn.test.Asserts; -import brooklyn.test.EntityTestUtils; -import brooklyn.test.HttpTestUtils; import brooklyn.test.entity.LocalManagementContextForTests; import brooklyn.test.entity.TestApplication; import brooklyn.util.exceptions.Exceptions; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/launcher/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeRestTest.java ---------------------------------------------------------------------- diff --git a/usage/launcher/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeRestTest.java b/usage/launcher/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeRestTest.java index 34d7b07..6899aeb 100644 --- a/usage/launcher/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeRestTest.java +++ b/usage/launcher/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeRestTest.java @@ -21,6 +21,8 @@ package brooklyn.entity.brooklynnode; import java.net.URI; import java.util.concurrent.Callable; +import org.apache.brooklyn.test.EntityTestUtils; +import org.apache.brooklyn.test.HttpTestUtils; import org.apache.http.client.HttpClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,8 +40,6 @@ import brooklyn.launcher.SimpleYamlLauncherForTests; import brooklyn.launcher.camp.SimpleYamlLauncher; import brooklyn.location.Location; import brooklyn.management.Task; -import brooklyn.test.EntityTestUtils; -import brooklyn.test.HttpTestUtils; import brooklyn.test.entity.TestApplication; import brooklyn.test.entity.TestEntity; import brooklyn.util.collections.Jsonya; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/launcher/src/test/java/brooklyn/launcher/BrooklynLauncherTest.java ---------------------------------------------------------------------- diff --git a/usage/launcher/src/test/java/brooklyn/launcher/BrooklynLauncherTest.java b/usage/launcher/src/test/java/brooklyn/launcher/BrooklynLauncherTest.java index 0886390..6f7d955 100644 --- a/usage/launcher/src/test/java/brooklyn/launcher/BrooklynLauncherTest.java +++ b/usage/launcher/src/test/java/brooklyn/launcher/BrooklynLauncherTest.java @@ -32,6 +32,7 @@ import java.net.URI; import java.nio.charset.Charset; import java.util.Properties; +import org.apache.brooklyn.test.HttpTestUtils; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; @@ -48,7 +49,6 @@ import brooklyn.location.basic.LocalhostMachineProvisioningLocation; import brooklyn.management.ManagementContext; import brooklyn.management.internal.LocalManagementContext; import brooklyn.management.internal.ManagementContextInternal; -import brooklyn.test.HttpTestUtils; import brooklyn.test.entity.LocalManagementContextForTests; import brooklyn.test.entity.TestApplication; import brooklyn.test.entity.TestApplicationImpl; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/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 c89b399..6260bba 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 org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.test.TestResourceUnavailableException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,7 +35,6 @@ import brooklyn.config.BrooklynProperties; import brooklyn.entity.basic.Entities; import brooklyn.management.internal.LocalManagementContext; import brooklyn.management.internal.ManagementContextInternal; -import brooklyn.test.HttpTestUtils; import brooklyn.util.collections.MutableMap; import brooklyn.util.net.Networking; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/launcher/src/test/java/brooklyn/launcher/blueprints/AbstractBlueprintTest.java ---------------------------------------------------------------------- diff --git a/usage/launcher/src/test/java/brooklyn/launcher/blueprints/AbstractBlueprintTest.java b/usage/launcher/src/test/java/brooklyn/launcher/blueprints/AbstractBlueprintTest.java index 63a8bfb..d0d5de4 100644 --- a/usage/launcher/src/test/java/brooklyn/launcher/blueprints/AbstractBlueprintTest.java +++ b/usage/launcher/src/test/java/brooklyn/launcher/blueprints/AbstractBlueprintTest.java @@ -26,6 +26,7 @@ import java.io.StringReader; import java.util.Collection; import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatformLauncherAbstract; +import org.apache.brooklyn.test.EntityTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.AfterMethod; @@ -46,7 +47,6 @@ import brooklyn.launcher.camp.BrooklynCampPlatformLauncher; import brooklyn.management.ManagementContext; import brooklyn.management.internal.LocalManagementContext; import brooklyn.test.Asserts; -import brooklyn.test.EntityTestUtils; import brooklyn.util.ResourceUtils; import brooklyn.util.os.Os; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/qa/src/test/java/org/apache/brooklyn/qa/brooklynnode/SoftlayerObtainPrivateLiveTest.java ---------------------------------------------------------------------- diff --git a/usage/qa/src/test/java/org/apache/brooklyn/qa/brooklynnode/SoftlayerObtainPrivateLiveTest.java b/usage/qa/src/test/java/org/apache/brooklyn/qa/brooklynnode/SoftlayerObtainPrivateLiveTest.java index 17df429..c550279 100644 --- a/usage/qa/src/test/java/org/apache/brooklyn/qa/brooklynnode/SoftlayerObtainPrivateLiveTest.java +++ b/usage/qa/src/test/java/org/apache/brooklyn/qa/brooklynnode/SoftlayerObtainPrivateLiveTest.java @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.Map; import java.util.Set; +import org.apache.brooklyn.test.EntityTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.AfterMethod; @@ -42,7 +43,6 @@ import brooklyn.launcher.BrooklynLauncher; import brooklyn.location.Location; import brooklyn.location.jclouds.JcloudsLocationConfig; import brooklyn.management.ManagementContext; -import brooklyn.test.EntityTestUtils; import brooklyn.test.entity.LocalManagementContextForTests; import brooklyn.test.entity.TestApplication; import brooklyn.util.BrooklynMavenArtifacts; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/qa/src/test/java/org/apache/brooklyn/qa/load/LoadTest.java ---------------------------------------------------------------------- diff --git a/usage/qa/src/test/java/org/apache/brooklyn/qa/load/LoadTest.java b/usage/qa/src/test/java/org/apache/brooklyn/qa/load/LoadTest.java index d6c479c..a642790 100644 --- a/usage/qa/src/test/java/org/apache/brooklyn/qa/load/LoadTest.java +++ b/usage/qa/src/test/java/org/apache/brooklyn/qa/load/LoadTest.java @@ -19,6 +19,8 @@ package org.apache.brooklyn.qa.load; import org.apache.brooklyn.qa.load.SimulatedTheeTierApp; +import org.apache.brooklyn.test.PerformanceTestUtils; + import static org.testng.Assert.assertEquals; import java.io.File; @@ -45,7 +47,6 @@ import brooklyn.location.Location; import brooklyn.management.ManagementContext; import brooklyn.management.ha.HighAvailabilityMode; import brooklyn.management.internal.LocalManagementContext; -import brooklyn.test.PerformanceTestUtils; import brooklyn.util.os.Os; import brooklyn.util.time.Duration; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/rest-client/src/test/java/org/apache/brooklyn/rest/client/BrooklynApiRestClientTest.java ---------------------------------------------------------------------- diff --git a/usage/rest-client/src/test/java/org/apache/brooklyn/rest/client/BrooklynApiRestClientTest.java b/usage/rest-client/src/test/java/org/apache/brooklyn/rest/client/BrooklynApiRestClientTest.java index c36a456..d3586af 100644 --- a/usage/rest-client/src/test/java/org/apache/brooklyn/rest/client/BrooklynApiRestClientTest.java +++ b/usage/rest-client/src/test/java/org/apache/brooklyn/rest/client/BrooklynApiRestClientTest.java @@ -23,6 +23,7 @@ import java.util.Map; import javax.ws.rs.core.Response; +import org.apache.brooklyn.test.HttpTestUtils; import org.eclipse.jetty.server.Server; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +43,6 @@ import brooklyn.rest.BrooklynRestApiLauncherTest; import brooklyn.rest.domain.ApplicationSummary; import brooklyn.rest.domain.CatalogLocationSummary; import brooklyn.rest.security.provider.TestSecurityProvider; -import brooklyn.test.HttpTestUtils; import brooklyn.test.entity.TestEntity; @Test http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/rest-server/src/test/java/brooklyn/entity/brooklynnode/DeployBlueprintTest.java ---------------------------------------------------------------------- diff --git a/usage/rest-server/src/test/java/brooklyn/entity/brooklynnode/DeployBlueprintTest.java b/usage/rest-server/src/test/java/brooklyn/entity/brooklynnode/DeployBlueprintTest.java index 42f0785..4ee9562 100644 --- a/usage/rest-server/src/test/java/brooklyn/entity/brooklynnode/DeployBlueprintTest.java +++ b/usage/rest-server/src/test/java/brooklyn/entity/brooklynnode/DeployBlueprintTest.java @@ -24,6 +24,7 @@ import java.net.URI; import java.util.List; import java.util.Map; +import org.apache.brooklyn.test.HttpTestUtils; import org.eclipse.jetty.server.Server; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +38,6 @@ import brooklyn.entity.proxying.EntitySpec; import brooklyn.event.feed.http.JsonFunctions; import brooklyn.management.EntityManager; import brooklyn.rest.BrooklynRestApiLauncherTestFixture; -import brooklyn.test.HttpTestUtils; import brooklyn.util.guava.Functionals; import com.google.common.base.Function; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/rest-server/src/test/java/brooklyn/rest/BrooklynRestApiLauncherTest.java ---------------------------------------------------------------------- diff --git a/usage/rest-server/src/test/java/brooklyn/rest/BrooklynRestApiLauncherTest.java b/usage/rest-server/src/test/java/brooklyn/rest/BrooklynRestApiLauncherTest.java index 0412118..1992c90 100644 --- a/usage/rest-server/src/test/java/brooklyn/rest/BrooklynRestApiLauncherTest.java +++ b/usage/rest-server/src/test/java/brooklyn/rest/BrooklynRestApiLauncherTest.java @@ -24,6 +24,7 @@ import static brooklyn.rest.BrooklynRestApiLauncher.StartMode.WEB_XML; import java.util.concurrent.Callable; +import org.apache.brooklyn.test.HttpTestUtils; import org.apache.http.HttpStatus; import org.eclipse.jetty.server.Server; import org.testng.annotations.Test; @@ -31,7 +32,6 @@ import org.testng.annotations.Test; import brooklyn.rest.security.provider.AnyoneSecurityProvider; import brooklyn.rest.util.BrooklynRestResourceUtilsTest.SampleNoOpApplication; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; public class BrooklynRestApiLauncherTest extends BrooklynRestApiLauncherTestFixture { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceTest.java ---------------------------------------------------------------------- diff --git a/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceTest.java b/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceTest.java index 8645e38..95e02ac 100644 --- a/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceTest.java +++ b/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceTest.java @@ -34,6 +34,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; +import org.apache.brooklyn.test.HttpTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -82,7 +83,6 @@ import brooklyn.rest.testing.mocks.RestMockApp; import brooklyn.rest.testing.mocks.RestMockAppBuilder; import brooklyn.rest.testing.mocks.RestMockSimpleEntity; import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; import brooklyn.util.collections.CollectionFunctionals; import brooklyn.util.exceptions.Exceptions; import brooklyn.util.time.Duration; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/rest-server/src/test/java/brooklyn/rest/resources/EntityResourceTest.java ---------------------------------------------------------------------- diff --git a/usage/rest-server/src/test/java/brooklyn/rest/resources/EntityResourceTest.java b/usage/rest-server/src/test/java/brooklyn/rest/resources/EntityResourceTest.java index 60932a6..c5d0c57 100644 --- a/usage/rest-server/src/test/java/brooklyn/rest/resources/EntityResourceTest.java +++ b/usage/rest-server/src/test/java/brooklyn/rest/resources/EntityResourceTest.java @@ -25,6 +25,7 @@ import java.util.Map; import javax.annotation.Nullable; import javax.ws.rs.core.MediaType; +import org.apache.brooklyn.test.HttpTestUtils; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.type.TypeReference; import org.slf4j.Logger; @@ -42,7 +43,6 @@ import brooklyn.rest.domain.EntitySpec; import brooklyn.rest.domain.TaskSummary; import brooklyn.rest.testing.BrooklynRestResourceTest; import brooklyn.rest.testing.mocks.RestMockSimpleEntity; -import brooklyn.test.HttpTestUtils; import brooklyn.test.entity.TestEntity; import brooklyn.util.collections.MutableList; import brooklyn.util.exceptions.Exceptions; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceIntegrationTest.java ---------------------------------------------------------------------- diff --git a/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceIntegrationTest.java b/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceIntegrationTest.java index e412b6b..0664a89 100644 --- a/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceIntegrationTest.java +++ b/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceIntegrationTest.java @@ -20,6 +20,7 @@ package brooklyn.rest.resources; import java.net.URI; +import org.apache.brooklyn.test.HttpTestUtils; import org.apache.http.client.HttpClient; import org.eclipse.jetty.server.Server; import org.testng.Assert; @@ -35,7 +36,6 @@ import brooklyn.management.ManagementContext; import brooklyn.rest.BrooklynRestApiLauncher; import brooklyn.rest.BrooklynRestApiLauncherTestFixture; import brooklyn.rest.testing.mocks.RestMockSimpleEntity; -import brooklyn.test.HttpTestUtils; import brooklyn.test.entity.LocalManagementContextForTests; import brooklyn.util.collections.MutableList; import brooklyn.util.http.HttpTool; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceTest.java ---------------------------------------------------------------------- diff --git a/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceTest.java b/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceTest.java index 6d074c0..e6d9123 100644 --- a/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceTest.java +++ b/usage/rest-server/src/test/java/brooklyn/rest/resources/SensorResourceTest.java @@ -25,6 +25,7 @@ import java.util.Map; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.apache.brooklyn.test.HttpTestUtils; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -40,7 +41,6 @@ import brooklyn.rest.domain.ApplicationSpec; import brooklyn.rest.domain.EntitySpec; import brooklyn.rest.testing.BrooklynRestResourceTest; import brooklyn.rest.testing.mocks.RestMockSimpleEntity; -import brooklyn.test.HttpTestUtils; import brooklyn.util.collections.MutableMap; import brooklyn.util.stream.Streams; import brooklyn.util.text.StringFunctions; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/rest-server/src/test/java/brooklyn/rest/resources/ServerResourceIntegrationTest.java ---------------------------------------------------------------------- diff --git a/usage/rest-server/src/test/java/brooklyn/rest/resources/ServerResourceIntegrationTest.java b/usage/rest-server/src/test/java/brooklyn/rest/resources/ServerResourceIntegrationTest.java index 311afaf..9818436 100644 --- a/usage/rest-server/src/test/java/brooklyn/rest/resources/ServerResourceIntegrationTest.java +++ b/usage/rest-server/src/test/java/brooklyn/rest/resources/ServerResourceIntegrationTest.java @@ -25,6 +25,7 @@ import java.net.URI; import java.util.Collections; import java.util.Map; +import org.apache.brooklyn.test.HttpTestUtils; import org.apache.http.HttpStatus; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.HttpClient; @@ -38,7 +39,6 @@ import brooklyn.management.internal.ManagementContextInternal; import brooklyn.rest.BrooklynRestApiLauncher; import brooklyn.rest.BrooklynRestApiLauncherTestFixture; import brooklyn.rest.security.provider.TestSecurityProvider; -import brooklyn.test.HttpTestUtils; import brooklyn.util.http.HttpTool; import brooklyn.util.http.HttpToolResponse; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/rest-server/src/test/java/brooklyn/rest/resources/ServerShutdownTest.java ---------------------------------------------------------------------- diff --git a/usage/rest-server/src/test/java/brooklyn/rest/resources/ServerShutdownTest.java b/usage/rest-server/src/test/java/brooklyn/rest/resources/ServerShutdownTest.java index 061599e..83114cd 100644 --- a/usage/rest-server/src/test/java/brooklyn/rest/resources/ServerShutdownTest.java +++ b/usage/rest-server/src/test/java/brooklyn/rest/resources/ServerShutdownTest.java @@ -27,6 +27,7 @@ import java.util.concurrent.atomic.AtomicReference; import javax.ws.rs.core.MultivaluedMap; +import org.apache.brooklyn.test.EntityTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.AfterClass; @@ -51,7 +52,6 @@ import brooklyn.management.Task; import brooklyn.rest.resources.ServerResourceTest.StopLatchEntity; import brooklyn.rest.testing.BrooklynRestResourceTest; import brooklyn.test.Asserts; -import brooklyn.test.EntityTestUtils; import brooklyn.test.entity.TestApplication; import brooklyn.util.exceptions.Exceptions; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/test-support/src/main/java/brooklyn/test/EntityTestUtils.java ---------------------------------------------------------------------- diff --git a/usage/test-support/src/main/java/brooklyn/test/EntityTestUtils.java b/usage/test-support/src/main/java/brooklyn/test/EntityTestUtils.java deleted file mode 100644 index ae7b269..0000000 --- a/usage/test-support/src/main/java/brooklyn/test/EntityTestUtils.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.test; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import java.util.Collection; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicReference; - -import brooklyn.config.ConfigKey; -import brooklyn.entity.Entity; -import brooklyn.entity.Group; -import brooklyn.entity.basic.EntityLocal; -import brooklyn.event.AttributeSensor; -import brooklyn.event.SensorEvent; -import brooklyn.event.SensorEventListener; -import brooklyn.management.SubscriptionHandle; - -import com.google.common.annotations.Beta; -import com.google.common.base.Objects; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - -public class EntityTestUtils { - - // TODO would be nice to have this... perhaps moving this class, or perhaps this whole project, to core/src/test ? -// public static LocalManagementContext newManagementContext() { return new LocalManagementContextForTests(); } - - // TODO Delete methods from TestUtils, to just have them here (or switch so TestUtils delegates here, - // and deprecate methods in TestUtils until deleted). - - public static <T> void assertAttributeEquals(Entity entity, AttributeSensor<T> attribute, T expected) { - assertEquals(entity.getAttribute(attribute), expected, "entity="+entity+"; attribute="+attribute); - } - - public static <T> void assertConfigEquals(Entity entity, ConfigKey<T> configKey, T expected) { - assertEquals(entity.getConfig(configKey), expected, "entity="+entity+"; configKey="+configKey); - } - - public static <T> void assertAttributeEqualsEventually(final Entity entity, final AttributeSensor<T> attribute, final T expected) { - assertAttributeEqualsEventually(Maps.newLinkedHashMap(), entity, attribute, expected); - } - - public static <T> void assertAttributeEqualsEventually(Map<?,?> flags, final Entity entity, final AttributeSensor<T> attribute, final T expected) { - // Not using assertAttributeEventually(predicate) so get nicer error message - Asserts.succeedsEventually((Map)flags, new Runnable() { - @Override public void run() { - assertAttributeEquals(entity, attribute, expected); - }}); - } - - public static <T> T assertAttributeEventuallyNonNull(final Entity entity, final AttributeSensor<T> attribute) { - return assertAttributeEventuallyNonNull(Maps.newLinkedHashMap(), entity, attribute); - } - - public static <T> T assertAttributeEventuallyNonNull(Map<?,?> flags, final Entity entity, final AttributeSensor<T> attribute) { - return assertAttributeEventually(flags, entity, attribute, Predicates.notNull()); - } - - public static <T> T assertAttributeEventually(final Entity entity, final AttributeSensor<T> attribute, Predicate<? super T> predicate) { - return assertAttributeEventually(ImmutableMap.of(), entity, attribute, predicate); - } - - public static <T> T assertAttributeEventually(Map<?,?> flags, final Entity entity, final AttributeSensor<T> attribute, final Predicate<? super T> predicate) { - final AtomicReference<T> result = new AtomicReference<T>(); - Asserts.succeedsEventually((Map)flags, new Runnable() { - @Override public void run() { - T val = entity.getAttribute(attribute); - assertTrue(predicate.apply(val), "val="+val); - result.set(val); - }}); - return result.get(); - } - - public static <T> T assertAttribute(final Entity entity, final AttributeSensor<T> attribute, final Predicate<? super T> predicate) { - T val = entity.getAttribute(attribute); - assertTrue(predicate.apply(val), "val="+val); - return val; - } - - public static <T extends Entity> void assertPredicateEventuallyTrue(final T entity, final Predicate<? super T> predicate) { - assertPredicateEventuallyTrue(Maps.newLinkedHashMap(), entity, predicate); - } - - public static <T extends Entity> void assertPredicateEventuallyTrue(Map<?,?> flags, final T entity, final Predicate<? super T> predicate) { - Asserts.succeedsEventually((Map)flags, new Runnable() { - @Override public void run() { - assertTrue(predicate.apply(entity)); - }}); - } - - public static <T> void assertAttributeEqualsContinually(final Entity entity, final AttributeSensor<T> attribute, final T expected) { - assertAttributeEqualsContinually(Maps.newLinkedHashMap(), entity, attribute, expected); - } - - public static <T> void assertAttributeEqualsContinually(Map<?,?> flags, final Entity entity, final AttributeSensor<T> attribute, final T expected) { - Asserts.succeedsContinually(flags, new Runnable() { - @Override public void run() { - assertAttributeEquals(entity, attribute, expected); - }}); - } - - public static void assertGroupSizeEqualsEventually(final Group group, int expected) { - assertGroupSizeEqualsEventually(ImmutableMap.of(), group, expected); - } - - public static void assertGroupSizeEqualsEventually(Map<?,?> flags, final Group group, final int expected) { - Asserts.succeedsEventually((Map)flags, new Runnable() { - @Override public void run() { - Collection<Entity> members = group.getMembers(); - assertEquals(members.size(), expected, "members="+members); - }}); - } - - /** checks that the entity's value for this attribute changes, by registering a subscription and checking the value */ - public static void assertAttributeChangesEventually(final Entity entity, final AttributeSensor<?> attribute) { - final Object origValue = entity.getAttribute(attribute); - final AtomicBoolean changed = new AtomicBoolean(); - SubscriptionHandle handle = ((EntityLocal)entity).subscribe(entity, attribute, new SensorEventListener<Object>() { - @Override public void onEvent(SensorEvent<Object> event) { - if (!Objects.equal(origValue, event.getValue())) { - changed.set(true); - } - }}); - try { - Asserts.succeedsEventually(new Runnable() { - @Override public void run() { - assertTrue(changed.get(), entity+" -> "+attribute+" not changed"); - }}); - } finally { - ((EntityLocal)entity).unsubscribe(entity, handle); - } - } - - /** alternate version of {@link #assertAttributeChangesEventually(Entity, AttributeSensor)} not using subscriptions and - * with simpler code, for comparison */ - @Beta - public static <T> void assertAttributeChangesEventually2(final Entity entity, final AttributeSensor<T> attribute) { - assertAttributeEventually(entity, attribute, - Predicates.not(Predicates.equalTo(entity.getAttribute(attribute)))); - } - - @Beta - public static <T> void assertAttributeNever(final Entity entity, final AttributeSensor<T> attribute, T... disallowed) { - final Set<T> reject = Sets.newHashSet(disallowed); - Asserts.succeedsContinually(new Runnable() { - @Override - public void run() { - T val = entity.getAttribute(attribute); - assertFalse(reject.contains(val), - "Attribute " + attribute + " on " + entity + " has disallowed value " + val); - } - }); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/test-support/src/main/java/brooklyn/test/HttpTestUtils.java ---------------------------------------------------------------------- diff --git a/usage/test-support/src/main/java/brooklyn/test/HttpTestUtils.java b/usage/test-support/src/main/java/brooklyn/test/HttpTestUtils.java deleted file mode 100644 index 71eff35..0000000 --- a/usage/test-support/src/main/java/brooklyn/test/HttpTestUtils.java +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.test; - -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLConnection; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLSession; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.Assert; - -import brooklyn.util.collections.MutableMap; -import brooklyn.util.crypto.SslTrustUtils; -import brooklyn.util.exceptions.Exceptions; -import brooklyn.util.stream.Streams; -import brooklyn.util.time.Time; - -import com.google.common.base.Throwables; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; - -/** - * Utility methods to aid testing HTTP. - * - * @author aled - */ -public class HttpTestUtils { - - // TODO Delete methods from TestUtils, to just have them here (or switch so TestUtils delegates here, - // and deprecate methods in TestUtils until deleted). - - private static final Logger LOG = LoggerFactory.getLogger(HttpTestUtils.class); - - static final ExecutorService executor = Executors.newCachedThreadPool(); - - /** - * Connects to the given url and returns the connection. - * Caller should {@code connection.getInputStream().close()} the result of this - * (especially if they are making heavy use of this method). - */ - public static URLConnection connectToUrl(String u) throws Exception { - final URL url = new URL(u); - final AtomicReference<Exception> exception = new AtomicReference<Exception>(); - - // sometimes openConnection hangs, so run in background - Future<URLConnection> f = executor.submit(new Callable<URLConnection>() { - public URLConnection call() { - try { - HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { - @Override public boolean verify(String s, SSLSession sslSession) { - return true; - } - }); - URLConnection connection = url.openConnection(); - TrustingSslSocketFactory.configure(connection); - connection.connect(); - - connection.getContentLength(); // Make sure the connection is made. - return connection; - } catch (Exception e) { - exception.set(e); - LOG.debug("Error connecting to url "+url+" (propagating): "+e, e); - } - return null; - } - }); - try { - URLConnection result = null; - try { - result = f.get(60, TimeUnit.SECONDS); - } catch (InterruptedException e) { - throw e; - } catch (Exception e) { - LOG.debug("Error connecting to url "+url+", probably timed out (rethrowing): "+e); - throw new IllegalStateException("Connect to URL not complete within 60 seconds, for url "+url+": "+e); - } - if (exception.get() != null) { - LOG.debug("Error connecting to url "+url+", thread caller of "+exception, new Throwable("source of rethrown error "+exception)); - throw exception.get(); - } else { - return result; - } - } finally { - f.cancel(true); - } - } - - public static void assertHealthyStatusCode(int code) { - if (code>=200 && code<=299) return; - Assert.fail("Wrong status code: "+code); - } - - public static int getHttpStatusCode(String url) throws Exception { - URLConnection connection = connectToUrl(url); - long startTime = System.currentTimeMillis(); - int status = ((HttpURLConnection) connection).getResponseCode(); - - // read fully if possible, then close everything, trying to prevent cached threads at server - consumeAndCloseQuietly((HttpURLConnection) connection); - - if (LOG.isDebugEnabled()) - LOG.debug("connection to {} ({}ms) gives {}", new Object[] { url, (System.currentTimeMillis()-startTime), status }); - return status; - } - - /** - * Asserts that gets back any "valid" response - i.e. not an exception. This could be an unauthorized, - * a redirect, a 404, or anything else that implies there is web-server listening on that port. - */ - public static void assertUrlReachable(String url) { - try { - getHttpStatusCode(url); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new RuntimeException("Interrupted for "+url+" (in assertion that is reachable)", e); - } catch (Exception e) { - throw new IllegalStateException("Server at "+url+" failed to respond (in assertion that is reachable): "+e, e); - } - } - - public static void assertUrlUnreachable(String url) { - try { - int statusCode = getHttpStatusCode(url); - fail("Expected url "+url+" unreachable, but got status code "+statusCode); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new RuntimeException("Interrupted for "+url+" (in assertion that unreachable)", e); - } catch (Exception e) { - IOException cause = Exceptions.getFirstThrowableOfType(e, IOException.class); - if (cause != null) { - // success; clean shutdown transitioning from 400 to error - } else { - Throwables.propagate(e); - } - } - } - - public static void assertUrlUnreachableEventually(final String url) { - assertUrlUnreachableEventually(Maps.newLinkedHashMap(), url); - } - - public static void assertUrlUnreachableEventually(Map flags, final String url) { - Asserts.succeedsEventually(flags, new Runnable() { - public void run() { - assertUrlUnreachable(url); - } - }); - } - - public static void assertHttpStatusCodeEquals(String url, int... acceptableReturnCodes) { - List<Integer> acceptableCodes = Lists.newArrayList(); - for (int code : acceptableReturnCodes) { - acceptableCodes.add((Integer)code); - } - try { - int actualCode = getHttpStatusCode(url); - assertTrue(acceptableCodes.contains(actualCode), "code="+actualCode+"; expected="+acceptableCodes+"; url="+url); - - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new RuntimeException("Interrupted for "+url+" (in assertion that result code is "+acceptableCodes+")", e); - } catch (Exception e) { - throw new IllegalStateException("Server at "+url+" failed to respond (in assertion that result code is "+acceptableCodes+"): "+e, e); - } - } - - public static void assertHttpStatusCodeEventuallyEquals(final String url, final int expectedCode) { - assertHttpStatusCodeEventuallyEquals(Maps.newLinkedHashMap(), url, expectedCode); - } - - public static void assertHttpStatusCodeEventuallyEquals(Map flags, final String url, final int expectedCode) { - Asserts.succeedsEventually(flags, new Runnable() { - public void run() { - assertHttpStatusCodeEquals(url, expectedCode); - } - }); - } - - public static void assertContentContainsText(final String url, final String phrase, final String ...additionalPhrases) { - try { - String contents = getContent(url); - Assert.assertTrue(contents != null && contents.length() > 0); - for (String text: Lists.asList(phrase, additionalPhrases)) { - if (!contents.contains(text)) { - LOG.warn("CONTENTS OF URL "+url+" MISSING TEXT: "+text+"\n"+contents); - Assert.fail("URL "+url+" does not contain text: "+text); - } - } - } catch (Exception e) { - throw Throwables.propagate(e); - } - } - - public static void assertContentNotContainsText(final String url, final String phrase, final String ...additionalPhrases) { - try { - String contents = getContent(url); - Assert.assertTrue(contents != null); - for (String text: Lists.asList(phrase, additionalPhrases)) { - if (contents.contains(text)) { - LOG.warn("CONTENTS OF URL "+url+" HAS TEXT: "+text+"\n"+contents); - Assert.fail("URL "+url+" contain text: "+text); - } - } - } catch (Exception e) { - throw Throwables.propagate(e); - } - } - - public static void assertErrorContentContainsText(final String url, final String phrase, final String ...additionalPhrases) { - try { - String contents = getErrorContent(url); - Assert.assertTrue(contents != null && contents.length() > 0); - for (String text: Lists.asList(phrase, additionalPhrases)) { - if (!contents.contains(text)) { - LOG.warn("CONTENTS OF URL "+url+" MISSING TEXT: "+text+"\n"+contents); - Assert.fail("URL "+url+" does not contain text: "+text); - } - } - } catch (Exception e) { - throw Throwables.propagate(e); - } - } - - - public static void assertErrorContentNotContainsText(final String url, final String phrase, final String ...additionalPhrases) { - try { - String err = getErrorContent(url); - Assert.assertTrue(err != null); - for (String text: Lists.asList(phrase, additionalPhrases)) { - if (err.contains(text)) { - LOG.warn("CONTENTS OF URL "+url+" HAS TEXT: "+text+"\n"+err); - Assert.fail("URL "+url+" contain text: "+text); - } - } - } catch (Exception e) { - throw Throwables.propagate(e); - } - } - - public static void assertContentEventuallyContainsText(final String url, final String phrase, final String ...additionalPhrases) { - assertContentEventuallyContainsText(MutableMap.of(), url, phrase, additionalPhrases); - } - - public static void assertContentEventuallyContainsText(Map flags, final String url, final String phrase, final String ...additionalPhrases) { - Asserts.succeedsEventually(flags, new Runnable() { - public void run() { - assertContentContainsText(url, phrase, additionalPhrases); - } - }); - } - - public static void assertContentMatches(String url, String regex) { - String contents = getContent(url); - Assert.assertNotNull(contents); - Assert.assertTrue(contents.matches(regex), "Contents does not match expected regex ("+regex+"): "+contents); - } - - public static void assertContentEventuallyMatches(final String url, final String regex) { - Asserts.succeedsEventually(new Runnable() { - @Override - public void run() { - assertContentMatches(url, regex); - } - }); - } - - public static String getErrorContent(String url) { - try { - HttpURLConnection connection = (HttpURLConnection) connectToUrl(url); - long startTime = System.currentTimeMillis(); - - String err; - int status; - try { - InputStream errStream = connection.getErrorStream(); - err = Streams.readFullyString(errStream); - status = connection.getResponseCode(); - } finally { - closeQuietly(connection); - } - - if (LOG.isDebugEnabled()) - LOG.debug("read of err {} ({}ms) complete; http code {}", new Object[] { url, Time.makeTimeStringRounded(System.currentTimeMillis()-startTime), status}); - return err; - - } catch (Exception e) { - throw Exceptions.propagate(e); - } - } - - public static String getContent(String url) { - try { - return Streams.readFullyString(SslTrustUtils.trustAll(new URL(url).openConnection()).getInputStream()); - } catch (Exception e) { - throw Throwables.propagate(e); - } - } - - /** - * Schedules (with the given executor) a poller that repeatedly accesses the given url, to confirm it always gives - * back the expected status code. - * - * Expected usage is to query the future, such as: - * - * <pre> - * {@code - * Future<?> future = assertAsyncHttpStatusCodeContinuallyEquals(executor, url, 200); - * // do other stuff... - * if (future.isDone()) future.get(); // get exception if it's failed - * } - * </pre> - * - * For stopping it, you can either do future.cancel(true), or you can just do executor.shutdownNow(). - * - * TODO Look at difference between this and WebAppMonitor, to decide if this should be kept. - */ - public static ListenableFuture<?> assertAsyncHttpStatusCodeContinuallyEquals(ListeningExecutorService executor, final String url, final int expectedStatusCode) { - return executor.submit(new Runnable() { - @Override public void run() { - // TODO Need to drop logging; remove sleep when that's done. - while (!Thread.currentThread().isInterrupted()) { - assertHttpStatusCodeEquals(url, expectedStatusCode); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - return; // graceful return - } - } - } - }); - } - - /** - * Consumes the input stream entirely and then cleanly closes the connection. - * Ignores all exceptions completely, not even logging them! - * - * Consuming the stream fully is useful for preventing idle TCP connections. - * See {@linkplain http://docs.oracle.com/javase/8/docs/technotes/guides/net/http-keepalive.html}. - */ - public static void consumeAndCloseQuietly(HttpURLConnection connection) { - try { Streams.readFully(connection.getInputStream()); } catch (Exception e) {} - closeQuietly(connection); - } - - /** - * Closes all streams of the connection, and disconnects it. Ignores all exceptions completely, - * not even logging them! - */ - public static void closeQuietly(HttpURLConnection connection) { - try { connection.disconnect(); } catch (Exception e) {} - try { connection.getInputStream().close(); } catch (Exception e) {} - try { connection.getOutputStream().close(); } catch (Exception e) {} - try { connection.getErrorStream().close(); } catch (Exception e) {} - } -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/test-support/src/main/java/brooklyn/test/NetworkingTestUtils.java ---------------------------------------------------------------------- diff --git a/usage/test-support/src/main/java/brooklyn/test/NetworkingTestUtils.java b/usage/test-support/src/main/java/brooklyn/test/NetworkingTestUtils.java deleted file mode 100644 index c55b4d3..0000000 --- a/usage/test-support/src/main/java/brooklyn/test/NetworkingTestUtils.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.test; - -import static org.testng.Assert.assertTrue; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import brooklyn.util.exceptions.Exceptions; -import brooklyn.util.net.Networking; -import brooklyn.util.time.Duration; - -import com.google.common.collect.ImmutableMap; - -public class NetworkingTestUtils { - - private static final Logger LOG = LoggerFactory.getLogger(NetworkingTestUtils.class); - - public static void assertPortsAvailableEventually(final Map<String, Integer> ports) { - // If we get into a TCP TIMED-WAIT state, it could take 4 minutes for the port to come available. - // Could that be causing our integration tests to fail sometimes when run in the suite?! - // Let's wait for the required ports in setup, rather than running+failing the test. - assertPortsAvailableEventually(ports, Duration.minutes(4)); - } - - public static void assertPortsAvailableEventually(final Map<String, Integer> ports, final Duration timeout) { - Asserts.succeedsEventually(ImmutableMap.of("timeout", Duration.minutes(4)), new Runnable() { - private boolean logged = false; - public void run() { - try { - assertPortsAvailable(ports); - } catch (Throwable t) { - if (!logged) { - LOG.warn("Port(s) not available; waiting for up to "+timeout+" ("+Exceptions.getFirstInteresting(t)+")"); - logged = true; - } - throw Exceptions.propagate(t); - } - }}); - LOG.debug("Ports are available: "+ports); - } - - public static void assertPortsAvailable(final Map<String, Integer> ports) { - for (Map.Entry<String, Integer> entry : ports.entrySet()) { - String errmsg = "port "+entry.getValue()+" not available for "+entry.getKey(); - assertTrue(Networking.isPortAvailable(entry.getValue()), errmsg); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9e04407d/usage/test-support/src/main/java/brooklyn/test/PerformanceTestUtils.java ---------------------------------------------------------------------- diff --git a/usage/test-support/src/main/java/brooklyn/test/PerformanceTestUtils.java b/usage/test-support/src/main/java/brooklyn/test/PerformanceTestUtils.java deleted file mode 100644 index 0bf4ba0..0000000 --- a/usage/test-support/src/main/java/brooklyn/test/PerformanceTestUtils.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.test; - -import java.lang.management.ManagementFactory; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; - -import javax.management.MBeanServer; -import javax.management.ObjectName; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import brooklyn.util.time.Duration; -import brooklyn.util.time.Time; - -import com.google.common.base.Stopwatch; - -public class PerformanceTestUtils { - - private static final Logger LOG = LoggerFactory.getLogger(PerformanceTestUtils.class); - - private static boolean hasLoggedProcessCpuTimeUnavailable; - - public static long getProcessCpuTime() { - try { - MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); - ObjectName osMBeanName = ObjectName.getInstance(ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME); - return (Long) mbeanServer.getAttribute(osMBeanName, "ProcessCpuTime"); - } catch (Exception e) { - if (!hasLoggedProcessCpuTimeUnavailable) { - hasLoggedProcessCpuTimeUnavailable = true; - LOG.warn("ProcessCPuTime not available in local JVM MXBean "+ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME+" (only available in sun JVM?)"); - } - return -1; - } - } - - /** - * Creates a background thread that will log.info the CPU fraction usage repeatedly, sampling at the given period. - * Callers <em>must</em> cancel the returned future, e.g. {@code future.cancel(true)}, otherwise it will keep - * logging until the JVM exits. - */ - public static Future<?> sampleProcessCpuTime(final Duration period, final String loggingContext) { - final ExecutorService executor = Executors.newSingleThreadExecutor(new ThreadFactory() { - @Override public Thread newThread(Runnable r) { - Thread thread = new Thread(r, "brooklyn-sampleProcessCpuTime-"+loggingContext); - thread.setDaemon(true); // let the JVM exit - return thread; - }}); - Future<?> future = executor.submit(new Runnable() { - @Override public void run() { - try { - long prevCpuTime = getProcessCpuTime(); - if (prevCpuTime == -1) { - LOG.warn("ProcessCPuTime not available; cannot sample; aborting"); - return; - } - while (true) { - Stopwatch stopwatch = Stopwatch.createStarted(); - Thread.sleep(period.toMilliseconds()); - long currentCpuTime = getProcessCpuTime(); - - long elapsedTime = stopwatch.elapsed(TimeUnit.MILLISECONDS); - double fractionCpu = (elapsedTime > 0) ? ((double)currentCpuTime-prevCpuTime) / TimeUnit.MILLISECONDS.toNanos(elapsedTime) : -1; - prevCpuTime = currentCpuTime; - - LOG.info("CPU fraction over last {} was {} ({})", new Object[] { - Time.makeTimeStringRounded(elapsedTime), fractionCpu, loggingContext}); - } - } catch (InterruptedException e) { - return; // graceful termination - } finally { - executor.shutdownNow(); - } - }}); - return future; - } -}
