http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedIntegrationTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedIntegrationTest.java b/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedIntegrationTest.java index ee7e226..ca5dd07 100644 --- a/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedIntegrationTest.java +++ b/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedIntegrationTest.java @@ -27,16 +27,13 @@ import org.apache.brooklyn.api.entity.EntityLocal; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.sensor.AttributeSensor; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.location.PortRanges; import org.apache.brooklyn.core.sensor.Sensors; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.core.test.HttpService; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.feed.http.HttpFeed; -import org.apache.brooklyn.feed.http.HttpPollConfig; -import org.apache.brooklyn.feed.http.HttpValueFunctions; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -91,7 +88,7 @@ public class HttpFeedIntegrationTest extends BrooklynAppUnitTestSupport { .onSuccess(HttpValueFunctions.stringContentsFunction())) .build(); - EntityTestUtils.assertAttributeEqualsEventually(entity, SENSOR_INT, 200); + EntityAsserts.assertAttributeEqualsEventually(entity, SENSOR_INT, 200); Asserts.succeedsEventually(new Runnable() { public void run() { String val = entity.getAttribute(SENSOR_STRING); @@ -121,7 +118,7 @@ public class HttpFeedIntegrationTest extends BrooklynAppUnitTestSupport { .onSuccess(HttpValueFunctions.stringContentsFunction())) .build(); - EntityTestUtils.assertAttributeEqualsEventually(entity, SENSOR_INT, 200); + EntityAsserts.assertAttributeEqualsEventually(entity, SENSOR_INT, 200); Asserts.succeedsEventually(new Runnable() { public void run() { String val = entity.getAttribute(SENSOR_STRING); @@ -149,7 +146,7 @@ public class HttpFeedIntegrationTest extends BrooklynAppUnitTestSupport { .onException(Functions.constant("Failed!"))) .build(); - EntityTestUtils.assertAttributeEqualsEventually(entity, SENSOR_INT, 401); + EntityAsserts.assertAttributeEqualsEventually(entity, SENSOR_INT, 401); Asserts.succeedsEventually(new Runnable() { public void run() { String val = entity.getAttribute(SENSOR_STRING);
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/feed/shell/ShellFeedIntegrationTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/feed/shell/ShellFeedIntegrationTest.java b/core/src/test/java/org/apache/brooklyn/feed/shell/ShellFeedIntegrationTest.java index 9cf568b..7b6f0fe 100644 --- a/core/src/test/java/org/apache/brooklyn/feed/shell/ShellFeedIntegrationTest.java +++ b/core/src/test/java/org/apache/brooklyn/feed/shell/ShellFeedIntegrationTest.java @@ -26,19 +26,16 @@ import java.util.concurrent.TimeUnit; import org.apache.brooklyn.api.entity.EntityLocal; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.sensor.AttributeSensor; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.entity.EntityInternal.FeedSupport; import org.apache.brooklyn.core.sensor.Sensors; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.feed.function.FunctionFeedTest; -import org.apache.brooklyn.feed.shell.ShellFeed; -import org.apache.brooklyn.feed.shell.ShellFeedIntegrationTest; -import org.apache.brooklyn.feed.shell.ShellPollConfig; import org.apache.brooklyn.feed.ssh.SshPollValue; import org.apache.brooklyn.feed.ssh.SshValueFunctions; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.stream.Streams; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -90,7 +87,7 @@ public class ShellFeedIntegrationTest extends BrooklynAppUnitTestSupport { .onFailure(SshValueFunctions.exitStatus())) .build(); - EntityTestUtils.assertAttributeEqualsEventually(entity, SENSOR_INT, 123); + EntityAsserts.assertAttributeEqualsEventually(entity, SENSOR_INT, 123); } @Test(groups="Integration") http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/launcher/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynEntityMirrorIntegrationTest.java ---------------------------------------------------------------------- diff --git a/launcher/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynEntityMirrorIntegrationTest.java b/launcher/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynEntityMirrorIntegrationTest.java index 524e752..921de9e 100644 --- a/launcher/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynEntityMirrorIntegrationTest.java +++ b/launcher/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynEntityMirrorIntegrationTest.java @@ -21,8 +21,8 @@ package org.apache.brooklyn.entity.brooklynnode; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.time.Duration; @@ -35,15 +35,12 @@ import org.testng.annotations.Test; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.mgmt.ManagementContext; -import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; -import org.apache.brooklyn.entity.brooklynnode.BrooklynEntityMirror; import org.apache.brooklyn.launcher.BrooklynWebServer; -import org.apache.brooklyn.rest.filter.BrooklynPropertiesSecurityFilter; /** * Test for EntityMirror, launching an in-memory server and ensuring we can mirror. @@ -122,15 +119,15 @@ public class BrooklynEntityMirrorIntegrationTest { getBaseUri()+"/v1/applications/"+serviceId+"/entities/"+serviceId) ); - EntityTestUtils.assertAttributeEqualsEventually(mirror, TestApplication.MY_ATTRIBUTE, "austria"); - EntityTestUtils.assertAttributeEqualsEventually(mirror, BrooklynEntityMirror.MIRROR_CATALOG_ITEM_ID, catalogItemId); + EntityAsserts.assertAttributeEqualsEventually(mirror, TestApplication.MY_ATTRIBUTE, "austria"); + EntityAsserts.assertAttributeEqualsEventually(mirror, BrooklynEntityMirror.MIRROR_CATALOG_ITEM_ID, catalogItemId); assertTrue(mirror.getAttribute(BrooklynEntityMirror.MIRROR_SUMMARY) != null, "entity summary is null"); log.info("Sensors mirrored are: "+((EntityInternal)mirror).getAllAttributes()); serverApp.sensors().set(TestApplication.MY_ATTRIBUTE, "bermuda"); serverApp.setCatalogItemId(catalogItemIdGA); - EntityTestUtils.assertAttributeEqualsEventually(mirror, TestApplication.MY_ATTRIBUTE, "bermuda"); - EntityTestUtils.assertAttributeEqualsEventually(mirror, BrooklynEntityMirror.MIRROR_CATALOG_ITEM_ID, catalogItemIdGA); + EntityAsserts.assertAttributeEqualsEventually(mirror, TestApplication.MY_ATTRIBUTE, "bermuda"); + EntityAsserts.assertAttributeEqualsEventually(mirror, BrooklynEntityMirror.MIRROR_CATALOG_ITEM_ID, catalogItemIdGA); serverApp.stop(); assertUnmanagedEventually(mirror); @@ -160,11 +157,11 @@ public class BrooklynEntityMirrorIntegrationTest { getBaseUri()+"/v1/applications/"+serviceId+"/entities/"+serviceId) ); - EntityTestUtils.assertAttributeEqualsEventually(mirror, TestApplication.MY_ATTRIBUTE, "austria"); + EntityAsserts.assertAttributeEqualsEventually(mirror, TestApplication.MY_ATTRIBUTE, "austria"); log.info("Sensors mirrored are: "+((EntityInternal)mirror).getAllAttributes()); serverApp.sensors().set(TestApplication.MY_ATTRIBUTE, "bermuda"); - EntityTestUtils.assertAttributeEqualsEventually(mirror, TestApplication.MY_ATTRIBUTE, "bermuda"); + EntityAsserts.assertAttributeEqualsEventually(mirror, TestApplication.MY_ATTRIBUTE, "bermuda"); serverApp.stop(); assertUnmanagedEventually(mirror); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/launcher/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeRestTest.java ---------------------------------------------------------------------- diff --git a/launcher/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeRestTest.java b/launcher/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeRestTest.java index 14970e9..ca8f699 100644 --- a/launcher/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeRestTest.java +++ b/launcher/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeRestTest.java @@ -21,7 +21,7 @@ package org.apache.brooklyn.entity.brooklynnode; import java.net.URI; import java.util.concurrent.Callable; -import org.apache.brooklyn.test.EntityTestUtils; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.util.collections.Jsonya; import org.apache.brooklyn.util.collections.MutableMap; @@ -74,7 +74,7 @@ public class BrooklynNodeRestTest { URI uri = bn.getAttribute(BrooklynNode.WEB_CONSOLE_URI); Assert.assertNotNull(uri); - EntityTestUtils.assertAttributeEqualsEventually(bn, Attributes.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(bn, Attributes.SERVICE_UP, true); log.info("Created BrooklynNode: "+bn); // deploy @@ -103,10 +103,10 @@ public class BrooklynNodeRestTest { Entities.dumpInfo(mirror); - EntityTestUtils.assertAttributeEqualsEventually(mirror, Attributes.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(mirror, Attributes.SERVICE_UP, true); ((EntityInternal)newApp).sensors().set(TestEntity.NAME, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(mirror, TestEntity.NAME, "foo"); + EntityAsserts.assertAttributeEqualsEventually(mirror, TestEntity.NAME, "foo"); log.info("Mirror successfully validated"); // also try deploying by invoking deploy through json @@ -134,7 +134,7 @@ public class BrooklynNodeRestTest { Application newApp2 = Iterables.getOnlyElement(apps); Entities.dumpInfo(newApp2); - EntityTestUtils.assertAttributeEqualsEventually(newApp2, Attributes.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(newApp2, Attributes.SERVICE_UP, true); Assert.assertEquals(newApp2.getConfig(TestEntity.CONF_NAME), "foo"); } finally { http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java ---------------------------------------------------------------------- diff --git a/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java b/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java index e367a2f..56ac5d3 100644 --- a/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java +++ b/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java @@ -33,6 +33,7 @@ import org.apache.brooklyn.api.mgmt.ManagementContext; import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatformLauncherAbstract; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.mgmt.persist.FileBasedObjectStore; @@ -43,7 +44,6 @@ import org.apache.brooklyn.launcher.BrooklynLauncher; import org.apache.brooklyn.launcher.SimpleYamlLauncherForTests; import org.apache.brooklyn.launcher.camp.BrooklynCampPlatformLauncher; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.core.ResourceUtils; import org.apache.brooklyn.util.os.Os; import org.apache.brooklyn.util.stream.Streams; @@ -158,8 +158,8 @@ public abstract class AbstractBlueprintTest { } protected void assertNoFires(final Entity app) { - EntityTestUtils.assertAttributeEqualsEventually(app, Attributes.SERVICE_UP, true); - EntityTestUtils.assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(app, Attributes.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); Asserts.succeedsEventually(new Runnable() { public void run() { @@ -168,8 +168,8 @@ public abstract class AbstractBlueprintTest { assertNotEquals(entity.getAttribute(Attributes.SERVICE_UP), false); if (entity instanceof SoftwareProcess) { - EntityTestUtils.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); - EntityTestUtils.assertAttributeEquals(entity, Attributes.SERVICE_UP, Boolean.TRUE); + EntityAsserts.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEquals(entity, Attributes.SERVICE_UP, Boolean.TRUE); } } }}); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyTest.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyTest.java index 33e0ed9..564ebe3 100644 --- a/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyTest.java +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/policy/jclouds/os/CreateUserPolicyTest.java @@ -29,10 +29,9 @@ import java.util.regex.Pattern; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.LocationSpec; import org.apache.brooklyn.api.policy.PolicySpec; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.policy.jclouds.os.CreateUserPolicy; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.core.internal.ssh.SshTool; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -110,7 +109,7 @@ public class CreateUserPolicyTest extends BrooklynAppUnitTestSupport { TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren()); app.start(ImmutableList.of(machine)); - String creds = EntityTestUtils.assertAttributeEventuallyNonNull(entity, CreateUserPolicy.VM_USER_CREDENTIALS); + String creds = EntityAsserts.assertAttributeEventuallyNonNull(entity, CreateUserPolicy.VM_USER_CREDENTIALS); Pattern pattern = Pattern.compile("(.*) : (.*) @ (.*):(.*)"); Matcher matcher = pattern.matcher(creds); assertTrue(matcher.matches()); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyRebindTest.java ---------------------------------------------------------------------- diff --git a/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyRebindTest.java b/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyRebindTest.java index b1fbc61..07d01ea 100644 --- a/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyRebindTest.java +++ b/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyRebindTest.java @@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.LocationSpec; import org.apache.brooklyn.api.sensor.AttributeSensor; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.location.SimulatedLocation; import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp; @@ -34,7 +35,6 @@ import org.apache.brooklyn.core.sensor.Sensors; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.entity.group.DynamicCluster; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.time.Duration; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -126,9 +126,9 @@ public class AutoScalerPolicyRebindTest extends RebindTestFixtureWithApp { assertEquals(newCluster.getCurrentSize(), (Integer)1); ((EntityInternal)newCluster).sensors().set(METRIC_SENSOR, 1000); - EntityTestUtils.assertGroupSizeEqualsEventually(newCluster, 3); + EntityAsserts.assertGroupSizeEqualsEventually(newCluster, 3); ((EntityInternal)newCluster).sensors().set(METRIC_SENSOR, 1); - EntityTestUtils.assertGroupSizeEqualsEventually(newCluster, 1); + EntityAsserts.assertGroupSizeEqualsEventually(newCluster, 1); } } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/policy/src/test/java/org/apache/brooklyn/policy/enricher/HttpLatencyDetectorTest.java ---------------------------------------------------------------------- diff --git a/policy/src/test/java/org/apache/brooklyn/policy/enricher/HttpLatencyDetectorTest.java b/policy/src/test/java/org/apache/brooklyn/policy/enricher/HttpLatencyDetectorTest.java index d361898..5c0c09f 100644 --- a/policy/src/test/java/org/apache/brooklyn/policy/enricher/HttpLatencyDetectorTest.java +++ b/policy/src/test/java/org/apache/brooklyn/policy/enricher/HttpLatencyDetectorTest.java @@ -25,11 +25,10 @@ import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.sensor.Sensors; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.policy.enricher.HttpLatencyDetector; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.core.http.BetterMockWebServer; import org.slf4j.Logger; @@ -97,7 +96,7 @@ public class HttpLatencyDetectorTest { .build()); // nothing until url is set - EntityTestUtils.assertAttributeEqualsContinually( + EntityAsserts.assertAttributeEqualsContinually( MutableMap.of("timeout", 200), entity, HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_MOST_RECENT, null); @@ -130,7 +129,7 @@ public class HttpLatencyDetectorTest { .build()); // nothing until url is set - EntityTestUtils.assertAttributeEqualsContinually( + EntityAsserts.assertAttributeEqualsContinually( MutableMap.of("timeout", 200), entity, HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_MOST_RECENT, null); @@ -140,8 +139,8 @@ public class HttpLatencyDetectorTest { } protected void assertLatencyAttributesNonNull(Entity entity) { - EntityTestUtils.assertAttributeEventuallyNonNull(entity, HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_MOST_RECENT); - EntityTestUtils.assertAttributeEventuallyNonNull(entity, HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_IN_WINDOW); + EntityAsserts.assertAttributeEventuallyNonNull(entity, HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_MOST_RECENT); + EntityAsserts.assertAttributeEventuallyNonNull(entity, HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_IN_WINDOW); log.info("Latency to "+entity.getAttribute(TEST_URL)+" is "+entity.getAttribute(HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_MOST_RECENT)); log.info("Mean latency to "+entity.getAttribute(TEST_URL)+" is "+entity.getAttribute(HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_IN_WINDOW)); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/policy/src/test/java/org/apache/brooklyn/policy/enricher/RebindEnricherTest.java ---------------------------------------------------------------------- diff --git a/policy/src/test/java/org/apache/brooklyn/policy/enricher/RebindEnricherTest.java b/policy/src/test/java/org/apache/brooklyn/policy/enricher/RebindEnricherTest.java index 434eb99..4722439 100644 --- a/policy/src/test/java/org/apache/brooklyn/policy/enricher/RebindEnricherTest.java +++ b/policy/src/test/java/org/apache/brooklyn/policy/enricher/RebindEnricherTest.java @@ -25,17 +25,11 @@ import java.util.concurrent.TimeUnit; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.core.entity.Attributes; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp; import org.apache.brooklyn.core.sensor.Sensors; import org.apache.brooklyn.core.test.entity.TestApplication; -import org.apache.brooklyn.policy.enricher.DeltaEnricher; -import org.apache.brooklyn.policy.enricher.HttpLatencyDetector; -import org.apache.brooklyn.policy.enricher.RollingMeanEnricher; -import org.apache.brooklyn.policy.enricher.RollingTimeWindowMeanEnricher; -import org.apache.brooklyn.policy.enricher.TimeFractionDeltaEnricher; -import org.apache.brooklyn.policy.enricher.TimeWeightedDeltaEnricher; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.core.http.BetterMockWebServer; import org.apache.brooklyn.util.time.Duration; import org.apache.brooklyn.util.time.Time; @@ -69,7 +63,7 @@ public class RebindEnricherTest extends RebindTestFixtureWithApp { newApp.sensors().set(INT_METRIC, 1); newApp.sensors().set(INT_METRIC, 10); - EntityTestUtils.assertAttributeEqualsEventually(newApp, INT_METRIC2, 9); + EntityAsserts.assertAttributeEqualsEventually(newApp, INT_METRIC2, 9); } @Test @@ -93,8 +87,8 @@ public class RebindEnricherTest extends RebindTestFixtureWithApp { newApp.sensors().set(HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_MOST_RECENT, null); newApp.sensors().set(HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_IN_WINDOW, null); - EntityTestUtils.assertAttributeEventuallyNonNull(newApp, HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_MOST_RECENT); - EntityTestUtils.assertAttributeEventuallyNonNull(newApp, HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_IN_WINDOW); + EntityAsserts.assertAttributeEventuallyNonNull(newApp, HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_MOST_RECENT); + EntityAsserts.assertAttributeEventuallyNonNull(newApp, HttpLatencyDetector.REQUEST_LATENCY_IN_SECONDS_IN_WINDOW); } @Test @@ -104,7 +98,7 @@ public class RebindEnricherTest extends RebindTestFixtureWithApp { TestApplication newApp = rebind(); newApp.sensors().set(INT_METRIC, 10); - EntityTestUtils.assertAttributeEqualsEventually(newApp, DOUBLE_METRIC, 10d); + EntityAsserts.assertAttributeEqualsEventually(newApp, DOUBLE_METRIC, 10d); } @Test @@ -116,7 +110,7 @@ public class RebindEnricherTest extends RebindTestFixtureWithApp { newApp.sensors().set(INT_METRIC, 10); Time.sleep(Duration.millis(10)); newApp.sensors().set(INT_METRIC, 10); - EntityTestUtils.assertAttributeEqualsEventually(newApp, DOUBLE_METRIC, 10d); + EntityAsserts.assertAttributeEqualsEventually(newApp, DOUBLE_METRIC, 10d); } @Test http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceFailureDetectorTest.java ---------------------------------------------------------------------- diff --git a/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceFailureDetectorTest.java b/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceFailureDetectorTest.java index 7e4a83a..8f15e99 100644 --- a/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceFailureDetectorTest.java +++ b/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceFailureDetectorTest.java @@ -33,6 +33,7 @@ import org.apache.brooklyn.api.sensor.SensorEvent; import org.apache.brooklyn.api.sensor.SensorEventListener; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic; @@ -41,7 +42,6 @@ import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.time.Duration; import org.apache.brooklyn.util.time.Time; @@ -116,7 +116,7 @@ public class ServiceFailureDetectorTest { assertHasEventEventually(HASensors.ENTITY_FAILED, Predicates.<Object>equalTo(e1), null); assertEquals(events.size(), 1, "events="+events); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); } @Test @@ -132,7 +132,7 @@ public class ServiceFailureDetectorTest { assertHasEventEventually(HASensors.ENTITY_FAILED, Predicates.<Object>equalTo(e1), null); assertEquals(events.size(), 1, "events="+events); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); } @Test @@ -143,7 +143,7 @@ public class ServiceFailureDetectorTest { assertHasEventEventually(HASensors.ENTITY_FAILED, Predicates.<Object>equalTo(e1), null); assertEquals(events.size(), 1, "events="+events); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); } @Test @@ -156,13 +156,13 @@ public class ServiceFailureDetectorTest { e1.sensors().set(TestEntity.SERVICE_UP, false); assertHasEventEventually(HASensors.ENTITY_FAILED, Predicates.<Object>equalTo(e1), null); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); // And make the entity recover e1.sensors().set(TestEntity.SERVICE_UP, true); assertHasEventEventually(HASensors.ENTITY_RECOVERED, Predicates.<Object>equalTo(e1), null); assertEquals(events.size(), 2, "events="+events); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); } @Test @@ -175,13 +175,13 @@ public class ServiceFailureDetectorTest { ServiceProblemsLogic.updateProblemsIndicator(e1, "test", "foo"); assertHasEventEventually(HASensors.ENTITY_FAILED, Predicates.<Object>equalTo(e1), null); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); // And make the entity recover ServiceProblemsLogic.clearProblemsIndicator(e1, "test"); assertHasEventEventually(HASensors.ENTITY_RECOVERED, Predicates.<Object>equalTo(e1), null); assertEquals(events.size(), 2, "events="+events); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); } @@ -193,7 +193,7 @@ public class ServiceFailureDetectorTest { e1.sensors().set(TestEntity.SERVICE_UP, false); ServiceStateLogic.setExpectedState(e1, Lifecycle.RUNNING); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); assertNoEventsContinually(); } @@ -205,7 +205,7 @@ public class ServiceFailureDetectorTest { e1.sensors().set(TestEntity.SERVICE_UP, false); ServiceStateLogic.setExpectedState(e1, Lifecycle.RUNNING); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); assertHasEventEventually(HASensors.ENTITY_FAILED, Predicates.<Object>equalTo(e1), null); } @@ -217,7 +217,7 @@ public class ServiceFailureDetectorTest { // Make the entity fail e1.sensors().set(TestEntity.SERVICE_UP, true); ServiceStateLogic.setExpectedState(e1, Lifecycle.RUNNING); - EntityTestUtils.assertAttributeEqualsEventually(e1, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(e1, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); e1.sensors().set(TestEntity.SERVICE_UP, false); assertEquals(e1.getAttribute(TestEntity.SERVICE_STATE_ACTUAL), Lifecycle.RUNNING); @@ -231,14 +231,14 @@ public class ServiceFailureDetectorTest { // Make the entity fail e1.sensors().set(TestEntity.SERVICE_UP, true); ServiceStateLogic.setExpectedState(e1, Lifecycle.RUNNING); - EntityTestUtils.assertAttributeEqualsEventually(e1, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(e1, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); e1.sensors().set(TestEntity.SERVICE_UP, false); assertEquals(e1.getAttribute(TestEntity.SERVICE_STATE_ACTUAL), Lifecycle.RUNNING); Time.sleep(Duration.millis(100)); assertEquals(e1.getAttribute(TestEntity.SERVICE_STATE_ACTUAL), Lifecycle.RUNNING); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); } @Test(groups="Integration") // Has a 1 second wait @@ -250,19 +250,19 @@ public class ServiceFailureDetectorTest { // Set the entity to healthy e1.sensors().set(TestEntity.SERVICE_UP, true); ServiceStateLogic.setExpectedState(e1, Lifecycle.RUNNING); - EntityTestUtils.assertAttributeEqualsEventually(e1, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(e1, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); // Make the entity fail; won't set on-fire for 1s but will publish FAILED immediately. ServiceStateLogic.ServiceProblemsLogic.updateProblemsIndicator(e1, "test", "foo"); - EntityTestUtils.assertAttributeEqualsContinually(ImmutableMap.of("timeout", 100), e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsContinually(ImmutableMap.of("timeout", 100), e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); assertHasEventEventually(HASensors.ENTITY_FAILED, Predicates.<Object>equalTo(e1), null); assertEquals(e1.getAttribute(TestEntity.SERVICE_STATE_ACTUAL), Lifecycle.RUNNING); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); // Now recover: will publish RUNNING immediately, but has 1s stabilisation for RECOVERED ServiceStateLogic.ServiceProblemsLogic.clearProblemsIndicator(e1, "test"); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); assertEquals(events.size(), 1, "events="+events); @@ -324,11 +324,11 @@ public class ServiceFailureDetectorTest { // Set the entity to healthy e1.sensors().set(TestEntity.SERVICE_UP, true); ServiceStateLogic.setExpectedState(e1, Lifecycle.RUNNING); - EntityTestUtils.assertAttributeEqualsEventually(e1, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(e1, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); // Make the entity fail; ServiceStateLogic.ServiceProblemsLogic.updateProblemsIndicator(e1, "test", "foo"); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); assertHasEventEventually(HASensors.ENTITY_FAILED, Predicates.<Object>equalTo(e1), null); //wait for at least 10 republish events (~1 sec) @@ -336,7 +336,7 @@ public class ServiceFailureDetectorTest { // Now recover ServiceStateLogic.ServiceProblemsLogic.clearProblemsIndicator(e1, "test"); - EntityTestUtils.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(e1, TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); assertHasEventEventually(HASensors.ENTITY_RECOVERED, Predicates.<Object>equalTo(e1), null); //once recovered check no more failed events emitted periodically http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceReplacerTest.java ---------------------------------------------------------------------- diff --git a/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceReplacerTest.java b/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceReplacerTest.java index 0801213..ff41f84 100644 --- a/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceReplacerTest.java +++ b/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceReplacerTest.java @@ -37,6 +37,7 @@ import org.apache.brooklyn.api.sensor.SensorEvent; import org.apache.brooklyn.api.sensor.SensorEventListener; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; @@ -48,7 +49,6 @@ import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.entity.group.DynamicCluster; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.QuorumCheck; import org.apache.brooklyn.util.core.config.ConfigBag; import org.apache.brooklyn.util.javalang.JavaClassNames; @@ -146,7 +146,7 @@ public class ServiceReplacerTest { // should not be on fire Assert.assertNotEquals(cluster.getAttribute(Attributes.SERVICE_STATE_ACTUAL), Lifecycle.ON_FIRE); // and should eventually be running - EntityTestUtils.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); log.info("started "+app+" for "+JavaClassNames.niceClassAndMethod()); @@ -161,7 +161,7 @@ public class ServiceReplacerTest { // Expect cluster to go on-fire when fails to start replacement // Note that we've set up-quorum and running-quorum to be "alwaysTrue" so that we don't get a transient onFire // when the failed node fails to start (but before it has been removed from the group to be put in quarantine). - EntityTestUtils.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); // Expect to have the second failed entity still kicking around as proof (in quarantine) // The cluster should NOT go on fire until after the 2nd failure http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynClusterIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynClusterIntegrationTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynClusterIntegrationTest.java index a5b0609..f4074c0 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynClusterIntegrationTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynClusterIntegrationTest.java @@ -23,11 +23,9 @@ import java.util.List; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; -import org.apache.brooklyn.entity.brooklynnode.BrooklynCluster; -import org.apache.brooklyn.entity.brooklynnode.BrooklynNode; import org.apache.brooklyn.entity.brooklynnode.BrooklynNode.ExistingFileBehaviour; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.javalang.JavaClassNames; import org.apache.brooklyn.util.net.Networking; import org.apache.brooklyn.util.os.Os; @@ -88,10 +86,10 @@ public class BrooklynClusterIntegrationTest extends BrooklynAppUnitTestSupport { Entity brooklynNode = Iterables.find(cluster.getMembers(), Predicates.instanceOf(BrooklynNode.class)); LOG.info("started "+app+" containing "+cluster+" for "+JavaClassNames.niceClassAndMethod()); - EntityTestUtils.assertAttributeEqualsEventually(cluster, BrooklynNode.SERVICE_UP, true); - EntityTestUtils.assertAttributeEqualsEventually(brooklynNode, BrooklynNode.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(cluster, BrooklynNode.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(brooklynNode, BrooklynNode.SERVICE_UP, true); cluster.stop(); - EntityTestUtils.assertAttributeEquals(cluster, BrooklynNode.SERVICE_UP, false); + EntityAsserts.assertAttributeEquals(cluster, BrooklynNode.SERVICE_UP, false); } } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java index 84110a6..773a492 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java @@ -37,6 +37,7 @@ import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntityLocal; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.internal.BrooklynProperties; import org.apache.brooklyn.core.location.Locations; @@ -53,7 +54,6 @@ import org.apache.brooklyn.feed.http.JsonFunctions; import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation; import org.apache.brooklyn.location.ssh.SshMachineLocation; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.test.HttpTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.core.ResourceUtils; @@ -178,10 +178,10 @@ services: app.start(locs); log.info("started "+app+" containing "+brooklynNode+" for "+JavaClassNames.niceClassAndMethod()); - EntityTestUtils.assertAttributeEqualsEventually(brooklynNode, BrooklynNode.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(brooklynNode, BrooklynNode.SERVICE_UP, true); brooklynNode.stop(); - EntityTestUtils.assertAttributeEquals(brooklynNode, BrooklynNode.SERVICE_UP, false); + EntityAsserts.assertAttributeEquals(brooklynNode, BrooklynNode.SERVICE_UP, false); } @Test(groups="Integration") @@ -691,7 +691,7 @@ services: brooklynNode.invoke(eff, Collections.<String, Object>emptyMap()).getUnchecked(); // Note can't use driver.isRunning to check shutdown; can't invoke scripts on an unmanaged entity - EntityTestUtils.assertAttributeEquals(brooklynNode, BrooklynNode.SERVICE_UP, false); + EntityAsserts.assertAttributeEquals(brooklynNode, BrooklynNode.SERVICE_UP, false); // unmanaged if the machine is destroyed - ie false on localhost (this test by default), but true in the cloud // assertFalse(Entities.isManaged(brooklynNode)); @@ -729,7 +729,7 @@ services: app.start(locs); log.info("started "+app+" containing "+brooklynNode+" for "+JavaClassNames.niceClassAndMethod()); - EntityTestUtils.assertAttributeEqualsEventually(brooklynNode, BrooklynNode.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(brooklynNode, BrooklynNode.SERVICE_UP, true); String baseUrl = brooklynNode.getAttribute(BrooklynNode.WEB_CONSOLE_URI).toString(); waitForApps(baseUrl); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/SelectMasterEffectorTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/SelectMasterEffectorTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/SelectMasterEffectorTest.java index 137e0a4..af7a3f1 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/SelectMasterEffectorTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/SelectMasterEffectorTest.java @@ -34,18 +34,15 @@ import org.apache.brooklyn.api.entity.Group; import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState; import org.apache.brooklyn.core.effector.Effectors; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.feed.AttributePollHandler; import org.apache.brooklyn.core.feed.DelegatingPollHandler; import org.apache.brooklyn.core.feed.Poller; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.core.test.entity.TestApplication; -import org.apache.brooklyn.entity.brooklynnode.BrooklynCluster; -import org.apache.brooklyn.entity.brooklynnode.BrooklynClusterImpl; -import org.apache.brooklyn.entity.brooklynnode.BrooklynNode; import org.apache.brooklyn.entity.brooklynnode.BrooklynCluster.SelectMasterEffector; import org.apache.brooklyn.entity.brooklynnode.CallbackEntityHttpClient.Request; import org.apache.brooklyn.entity.group.DynamicCluster; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.time.Duration; import org.apache.http.client.methods.HttpPost; @@ -116,7 +113,7 @@ public class SelectMasterEffectorTest extends BrooklynAppUnitTestSupport { @Test(groups="Integration") // because slow, due to sensor feeds public void testSelectMasterAfterChange() { List<Entity> nodes = makeTwoNodes(); - EntityTestUtils.assertAttributeEqualsEventually(cluster, BrooklynCluster.MASTER_NODE, (BrooklynNode)nodes.get(0)); + EntityAsserts.assertAttributeEqualsEventually(cluster, BrooklynCluster.MASTER_NODE, (BrooklynNode) nodes.get(0)); selectMaster(cluster, nodes.get(1).getId()); checkMaster(cluster, nodes.get(1)); @@ -134,7 +131,7 @@ public class SelectMasterEffectorTest extends BrooklynAppUnitTestSupport { List<Entity> nodes = makeTwoNodes(); - EntityTestUtils.assertAttributeEqualsEventually(cluster, BrooklynCluster.MASTER_NODE, (BrooklynNode)nodes.get(0)); + EntityAsserts.assertAttributeEqualsEventually(cluster, BrooklynCluster.MASTER_NODE, (BrooklynNode)nodes.get(0)); try { selectMaster(cluster, nodes.get(1).getId()); @@ -180,8 +177,8 @@ public class SelectMasterEffectorTest extends BrooklynAppUnitTestSupport { checkRequest(input, HttpPost.METHOD_NAME, "/v1/server/ha/state", "mode", "HOT_STANDBY"); Entity entity = input.getEntity(); - EntityTestUtils.assertAttributeEquals(entity, BrooklynNode.MANAGEMENT_NODE_STATE, ManagementNodeState.MASTER); - EntityTestUtils.assertAttributeEquals(entity, MockBrooklynNode.HA_PRIORITY, 0); + EntityAsserts.assertAttributeEquals(entity, BrooklynNode.MANAGEMENT_NODE_STATE, ManagementNodeState.MASTER); + EntityAsserts.assertAttributeEquals(entity, MockBrooklynNode.HA_PRIORITY, 0); setManagementState(entity, ManagementNodeState.HOT_STANDBY); @@ -241,7 +238,7 @@ public class SelectMasterEffectorTest extends BrooklynAppUnitTestSupport { private void masterFailover(Entity member) { LOG.debug("Master failover to " + member); setManagementState(member, ManagementNodeState.MASTER); - EntityTestUtils.assertAttributeEqualsEventually(cluster, BrooklynCluster.MASTER_NODE, (BrooklynNode)member); + EntityAsserts.assertAttributeEqualsEventually(cluster, BrooklynCluster.MASTER_NODE, (BrooklynNode)member); return; } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/java/EntityPollingTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/java/EntityPollingTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/java/EntityPollingTest.java index eae757a..c897c26 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/java/EntityPollingTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/java/EntityPollingTest.java @@ -24,17 +24,14 @@ import javax.management.ObjectName; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.MachineLocation; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.sensor.BasicAttributeSensor; import org.apache.brooklyn.core.test.entity.TestApplication; -import org.apache.brooklyn.entity.java.UsesJmx; -import org.apache.brooklyn.entity.java.VanillaJavaAppImpl; -import org.apache.brooklyn.entity.java.VanillaJavaAppSshDriver; import org.apache.brooklyn.entity.java.UsesJmx.JmxAgentModes; import org.apache.brooklyn.entity.software.base.SoftwareProcess; import org.apache.brooklyn.entity.software.base.test.jmx.JmxService; import org.apache.brooklyn.feed.jmx.JmxAttributePollConfig; import org.apache.brooklyn.feed.jmx.JmxFeed; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.exceptions.Exceptions; import org.slf4j.Logger; @@ -151,7 +148,7 @@ public class EntityPollingTest { app.start(ImmutableList.of(new SshMachineLocation(MutableMap.of("address", "localhost")))); // Starts with value defined when registering... - EntityTestUtils.assertAttributeEqualsEventually(entity, stringAttribute, "myval"); + EntityAsserts.assertAttributeEqualsEventually(entity, stringAttribute, "myval"); } // Test that connect will keep retrying (e.g. start script returns before the JMX server is up) @@ -174,7 +171,7 @@ public class EntityPollingTest { t.start(); app.start(ImmutableList.of(new SshMachineLocation(MutableMap.of("address", "localhost")))); - EntityTestUtils.assertAttributeEqualsEventually(entity, stringAttribute, "myval"); + EntityAsserts.assertAttributeEqualsEventually(entity, stringAttribute, "myval"); } finally { t.interrupt(); @@ -188,7 +185,7 @@ public class EntityPollingTest { app.start(ImmutableList.of(new SshMachineLocation(MutableMap.of("address", "localhost")))); - EntityTestUtils.assertAttributeEqualsEventually(entity, stringAttribute, "myval"); + EntityAsserts.assertAttributeEqualsEventually(entity, stringAttribute, "myval"); // Shutdown the MBeanServer - simulates network failure so can't connect jmxService.shutdown(); @@ -201,6 +198,6 @@ public class EntityPollingTest { jmxService = new JmxService("localhost", 40123); jmxService.registerMBean(ImmutableMap.of(attributeName, "myval2"), objectName); - EntityTestUtils.assertAttributeEqualsEventually(entity, stringAttribute, "myval2"); + EntityAsserts.assertAttributeEqualsEventually(entity, stringAttribute, "myval2"); } } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/java/VanillaJavaAppRebindTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/java/VanillaJavaAppRebindTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/java/VanillaJavaAppRebindTest.java index 6b31151..a5d0fbc 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/java/VanillaJavaAppRebindTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/java/VanillaJavaAppRebindTest.java @@ -25,15 +25,13 @@ import java.io.File; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils; import org.apache.brooklyn.core.sensor.Sensors; import org.apache.brooklyn.core.test.entity.TestApplication; -import org.apache.brooklyn.entity.java.VanillaJavaApp; -import org.apache.brooklyn.entity.java.VanillaJavaAppImpl; import org.apache.brooklyn.entity.java.JavaOptsTest.TestingJavaOptsVanillaJavaAppImpl; import org.apache.brooklyn.policy.enricher.RollingTimeWindowMeanEnricher; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.core.ResourceUtils; import org.apache.brooklyn.util.time.Duration; @@ -100,7 +98,7 @@ public class VanillaJavaAppRebindTest { rebind(); VanillaJavaApp javaProcess2 = (VanillaJavaApp) Iterables.find(app.getChildren(), Predicates.instanceOf(VanillaJavaApp.class)); - EntityTestUtils.assertAttributeEqualsEventually(javaProcess2, VanillaJavaApp.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(javaProcess2, VanillaJavaApp.SERVICE_UP, true); } @Test(groups="Integration") @@ -116,7 +114,7 @@ public class VanillaJavaAppRebindTest { long rebindTime = System.currentTimeMillis() - starttime; VanillaJavaApp javaProcess2 = (VanillaJavaApp) Iterables.find(app.getChildren(), Predicates.instanceOf(VanillaJavaApp.class)); - EntityTestUtils.assertAttributeEqualsEventually(javaProcess2, VanillaJavaApp.SERVICE_UP, false); + EntityAsserts.assertAttributeEqualsEventually(javaProcess2, VanillaJavaApp.SERVICE_UP, false); // check that it was quick (previously it hung) assertTrue(rebindTime < 30*1000, "rebindTime="+rebindTime); @@ -130,20 +128,20 @@ public class VanillaJavaAppRebindTest { app.start(ImmutableList.of(loc)); - EntityTestUtils.assertAttributeEventuallyNonNull(javaProcess, EnrichedVanillaJavaAppImpl.AVG1); - EntityTestUtils.assertAttributeEventuallyNonNull(javaProcess, EnrichedVanillaJavaAppImpl.AVG2); + EntityAsserts.assertAttributeEventuallyNonNull(javaProcess, EnrichedVanillaJavaAppImpl.AVG1); + EntityAsserts.assertAttributeEventuallyNonNull(javaProcess, EnrichedVanillaJavaAppImpl.AVG2); LOG.info("Got avg "+javaProcess.getAttribute(EnrichedVanillaJavaAppImpl.AVG1)); rebind(); VanillaJavaApp javaProcess2 = (VanillaJavaApp) Iterables.find(app.getChildren(), Predicates.instanceOf(VanillaJavaApp.class)); // check sensors working - EntityTestUtils.assertAttributeChangesEventually(javaProcess2, EnrichedVanillaJavaAppImpl.PROCESS_CPU_TIME); + EntityAsserts.assertAttributeChangesEventually(javaProcess2, EnrichedVanillaJavaAppImpl.PROCESS_CPU_TIME); LOG.info("Avg now "+javaProcess2.getAttribute(EnrichedVanillaJavaAppImpl.AVG1)); // check enrichers are functioning - EntityTestUtils.assertAttributeChangesEventually(javaProcess2, EnrichedVanillaJavaAppImpl.AVG1); - EntityTestUtils.assertAttributeChangesEventually(javaProcess2, EnrichedVanillaJavaAppImpl.AVG2); + EntityAsserts.assertAttributeChangesEventually(javaProcess2, EnrichedVanillaJavaAppImpl.AVG1); + EntityAsserts.assertAttributeChangesEventually(javaProcess2, EnrichedVanillaJavaAppImpl.AVG2); LOG.info("Avg now "+javaProcess2.getAttribute(EnrichedVanillaJavaAppImpl.AVG1)); // and check we don't have too many http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/machine/MachineEntityRebindTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/machine/MachineEntityRebindTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/machine/MachineEntityRebindTest.java index 22c2718..2480ee6 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/machine/MachineEntityRebindTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/machine/MachineEntityRebindTest.java @@ -21,10 +21,10 @@ package org.apache.brooklyn.entity.machine; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.core.entity.Attributes; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp; import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess; -import org.apache.brooklyn.test.EntityTestUtils; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; @@ -35,10 +35,10 @@ public class MachineEntityRebindTest extends RebindTestFixtureWithApp { public void testRebindToMachineEntity() throws Exception { EmptySoftwareProcess machine = origApp.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class)); origApp.start(ImmutableList.of(origManagementContext.getLocationRegistry().getLocationManaged("localhost"))); - EntityTestUtils.assertAttributeEqualsEventually(machine, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(machine, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); rebind(false); Entity machine2 = newManagementContext.getEntityManager().getEntity(machine.getId()); - EntityTestUtils.assertAttributeEqualsEventually(machine2, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(machine2, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); } } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessRestartIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessRestartIntegrationTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessRestartIntegrationTest.java index d16673d..1c68c9b 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessRestartIntegrationTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessRestartIntegrationTest.java @@ -23,13 +23,12 @@ import java.util.Map; import org.apache.brooklyn.api.effector.Effector; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic; import org.apache.brooklyn.core.test.BrooklynAppLiveTestSupport; -import org.apache.brooklyn.entity.software.base.SoftwareProcess; import org.apache.brooklyn.entity.software.base.SoftwareProcess.RestartSoftwareParameters; import org.apache.brooklyn.entity.software.base.SoftwareProcess.StopSoftwareParameters; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.CollectionFunctionals; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -71,26 +70,26 @@ public abstract class AbstractSoftwareProcessRestartIntegrationTest extends Broo // Start the app app.start(ImmutableList.of(loc)); - EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_UP, true); - EntityTestUtils.assertAttributeEqualsEventually(app, SoftwareProcess.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(app, SoftwareProcess.SERVICE_UP, true); // Stop the process Entities.invokeEffector(app, entity, SoftwareProcess.STOP, ImmutableMap.of( StopSoftwareParameters.STOP_MACHINE_MODE.getName(), StopSoftwareParameters.StopMode.NEVER)) .get(); - EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_UP, false); - EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); - EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING, false); - EntityTestUtils.assertAttributeEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, CollectionFunctionals.<String>mapSizeEquals(1)); + EntityAsserts.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_UP, false); + EntityAsserts.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); + EntityAsserts.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING, false); + EntityAsserts.assertAttributeEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, CollectionFunctionals.<String>mapSizeEquals(1)); // Restart the process Entities.invokeEffector(app, entity, restartEffector, args).get(); - EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_UP, true); - EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); - EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING, true); - EntityTestUtils.assertAttributeEqualsEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, ImmutableMap.<String, Object>of()); + EntityAsserts.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING, true); + EntityAsserts.assertAttributeEqualsEventually(entity, ServiceStateLogic.SERVICE_NOT_UP_INDICATORS, ImmutableMap.<String, Object>of()); - EntityTestUtils.assertAttributeEqualsEventually(app, SoftwareProcess.SERVICE_UP, true); - EntityTestUtils.assertAttributeEqualsEventually(app, SoftwareProcess.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(app, SoftwareProcess.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(app, SoftwareProcess.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); } } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityRebindTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityRebindTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityRebindTest.java index 76cb5c1..3592e3c 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityRebindTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityRebindTest.java @@ -36,6 +36,7 @@ import org.apache.brooklyn.api.location.NoMachinesAvailableException; import org.apache.brooklyn.api.mgmt.ManagementContext; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic; import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic.ServiceProblemsLogic; @@ -44,7 +45,6 @@ import org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.entity.software.base.SoftwareProcessEntityTest.MyService; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.core.flags.SetFromFlag; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -107,10 +107,10 @@ public class SoftwareProcessEntityRebindTest extends BrooklynAppUnitTestSupport .displayName("mylocname")); app.start(ImmutableList.of(origLoc)); assertEquals(origE.getAttribute(Attributes.SERVICE_STATE_EXPECTED).getState(), Lifecycle.RUNNING); - EntityTestUtils.assertAttributeEqualsEventually(origE, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(origE, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); ServiceProblemsLogic.updateProblemsIndicator((EntityLocal)origE, "test", "fire"); - EntityTestUtils.assertAttributeEqualsEventually(origE, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(origE, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); newApp = (TestApplication) rebind(); MyService newE = (MyService) Iterables.getOnlyElement(newApp.getChildren()); @@ -127,10 +127,10 @@ public class SoftwareProcessEntityRebindTest extends BrooklynAppUnitTestSupport .displayName("mylocname")); app.start(ImmutableList.of(origLoc)); assertEquals(origE.getAttribute(Attributes.SERVICE_STATE_EXPECTED).getState(), Lifecycle.RUNNING); - EntityTestUtils.assertAttributeEqualsEventually(origE, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(origE, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); ServiceStateLogic.setExpectedState(origE, Lifecycle.ON_FIRE); - EntityTestUtils.assertAttributeEqualsEventually(origE, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(origE, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); newApp = (TestApplication) rebind(); MyService newE = (MyService) Iterables.getOnlyElement(newApp.getChildren()); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java index 017179b..6fd330a 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java @@ -46,6 +46,7 @@ import org.apache.brooklyn.core.effector.Effectors; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.BrooklynConfigKeys; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.entity.drivers.BasicEntityDriverManager; import org.apache.brooklyn.core.entity.drivers.ReflectiveEntityDriverFactory; @@ -53,25 +54,16 @@ import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic; import org.apache.brooklyn.core.entity.trait.Startable; import org.apache.brooklyn.core.location.Locations; -import org.apache.brooklyn.core.location.PortRanges; import org.apache.brooklyn.core.location.SimulatedLocation; import org.apache.brooklyn.core.sensor.PortAttributeSensorAndConfigKey; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.core.test.entity.TestApplication; -import org.apache.brooklyn.entity.software.base.AbstractSoftwareProcessSshDriver; -import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess; -import org.apache.brooklyn.entity.software.base.EmptySoftwareProcessDriver; -import org.apache.brooklyn.entity.software.base.EmptySoftwareProcessImpl; -import org.apache.brooklyn.entity.software.base.SoftwareProcess; -import org.apache.brooklyn.entity.software.base.SoftwareProcessDriver; -import org.apache.brooklyn.entity.software.base.SoftwareProcessImpl; import org.apache.brooklyn.entity.software.base.SoftwareProcess.RestartSoftwareParameters; import org.apache.brooklyn.entity.software.base.SoftwareProcess.StopSoftwareParameters; import org.apache.brooklyn.entity.software.base.SoftwareProcess.RestartSoftwareParameters.RestartMachineMode; import org.apache.brooklyn.entity.software.base.SoftwareProcess.StopSoftwareParameters.StopMode; import org.apache.brooklyn.entity.software.base.lifecycle.MachineLifecycleEffectorTasksTest; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.core.config.ConfigBag; import org.apache.brooklyn.util.core.task.DynamicTasks; @@ -474,7 +466,7 @@ public class SoftwareProcessEntityTest extends BrooklynAppUnitTestSupport { final ReleaseLatchLocation loc = mgmt.getLocationManager().createLocation(LocationSpec.create(ReleaseLatchLocation.class)); try { app.start(ImmutableSet.of(loc)); - EntityTestUtils.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); final Task<Void> firstStop = entity.invoke(Startable.STOP, ImmutableMap.<String, Object>of()); // Wait until first task tries to release the location, at this point the entity's reference @@ -497,7 +489,7 @@ public class SoftwareProcessEntityTest extends BrooklynAppUnitTestSupport { }); // Entity state is STOPPED even though first location is still releasing - EntityTestUtils.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); + EntityAsserts.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); Asserts.succeedsContinually(new Runnable() { @Override public void run() { @@ -508,7 +500,7 @@ public class SoftwareProcessEntityTest extends BrooklynAppUnitTestSupport { loc.unblock(); // After the location is released, first task ends as well. - EntityTestUtils.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); + EntityAsserts.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); Asserts.succeedsEventually(new Runnable() { @Override public void run() { @@ -539,7 +531,7 @@ public class SoftwareProcessEntityTest extends BrooklynAppUnitTestSupport { final ReleaseLatchLocation loc = mgmt.getLocationManager().createLocation(LocationSpec.create(ReleaseLatchLocation.class)); try { app.start(ImmutableSet.of(loc)); - EntityTestUtils.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); final Task<Void> firstStop = app.invoke(Startable.STOP, ImmutableMap.<String, Object>of()); // Wait until first task tries to release the location, at this point the entity's reference http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessAndChildrenIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessAndChildrenIntegrationTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessAndChildrenIntegrationTest.java index 4dc11db..a87aada 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessAndChildrenIntegrationTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessAndChildrenIntegrationTest.java @@ -25,9 +25,9 @@ import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.entity.software.base.SoftwareProcess.ChildStartableMode; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.core.ResourceUtils; import org.apache.brooklyn.util.javalang.JavaClassNames; import org.apache.brooklyn.util.os.Os; @@ -156,7 +156,7 @@ public class VanillaSoftwareProcessAndChildrenIntegrationTest { private void checkChildComesUpSoon() { Stopwatch stopwatch = Stopwatch.createStarted(); - EntityTestUtils.assertAttributeEqualsEventually(p2, Attributes.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(p2, Attributes.SERVICE_UP, true); log.info("Took "+Time.makeTimeStringRounded(stopwatch)+" for child-process to be service-up"); } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinrmExitStatusLiveTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinrmExitStatusLiveTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinrmExitStatusLiveTest.java index 744a8db..d644d11 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinrmExitStatusLiveTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinrmExitStatusLiveTest.java @@ -25,6 +25,7 @@ import org.apache.brooklyn.api.location.MachineProvisioningLocation; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.BrooklynConfigKeys; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.internal.BrooklynProperties; @@ -33,7 +34,6 @@ import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.entity.software.base.test.location.WindowsTestFixture; import org.apache.brooklyn.location.winrm.WinRmMachineLocation; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.time.Duration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -114,13 +114,13 @@ public class VanillaWindowsProcessWinrmExitStatusLiveTest { app.start(ImmutableList.of(machine)); LOG.info("app started; asserting up"); - EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true); - EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); entity.stop(); LOG.info("stopping entity"); - EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); - EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, false); + EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); + EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, false); } @Test(groups = "Live") @@ -138,13 +138,13 @@ public class VanillaWindowsProcessWinrmExitStatusLiveTest { app.start(ImmutableList.of(machine)); LOG.info("app started; asserting up"); - EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true); - EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); entity.stop(); LOG.info("stopping entity"); - EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); - EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, false); + EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); + EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, false); } @Test(groups = "Live") http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/software/base/lifecycle/ScriptHelperTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/lifecycle/ScriptHelperTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/lifecycle/ScriptHelperTest.java index 080b5c0..7a0ddf0 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/lifecycle/ScriptHelperTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/lifecycle/ScriptHelperTest.java @@ -25,6 +25,7 @@ import java.util.concurrent.Callable; import org.apache.brooklyn.api.entity.EntityLocal; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.LocationSpec; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.trait.Startable; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.entity.software.base.SoftwareProcess; @@ -33,7 +34,6 @@ import org.apache.brooklyn.entity.software.base.SoftwareProcessEntityTest.MyServ import org.apache.brooklyn.entity.software.base.SoftwareProcessEntityTest.MyServiceImpl; import org.apache.brooklyn.feed.function.FunctionFeed; import org.apache.brooklyn.feed.function.FunctionPollConfig; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.time.Duration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -75,17 +75,17 @@ public class ScriptHelperTest extends BrooklynAppUnitTestSupport { SimulatedInessentialIsRunningDriver driver = (SimulatedInessentialIsRunningDriver) entity.getDriver(); Assert.assertTrue(driver.isRunning()); - EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING, true); - EntityTestUtils.assertAttributeEqualsEventually(entity, Startable.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING, true); + EntityAsserts.assertAttributeEqualsEventually(entity, Startable.SERVICE_UP, true); log.debug("up, now cause failure"); driver.setFailExecution(true); - EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING, false); + EntityAsserts.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING, false); log.debug("caught failure, now clear"); driver.setFailExecution(false); - EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING, true); + EntityAsserts.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING, true); } public static class MyServiceInessentialDriverImpl extends MyServiceImpl { http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/software/base/test/location/MachineDetailsEc2LiveTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/test/location/MachineDetailsEc2LiveTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/test/location/MachineDetailsEc2LiveTest.java index f541085..e96a9a7 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/test/location/MachineDetailsEc2LiveTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/test/location/MachineDetailsEc2LiveTest.java @@ -26,13 +26,13 @@ import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.location.MachineDetails; import org.apache.brooklyn.api.location.OsDetails; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.trait.Startable; import org.apache.brooklyn.core.location.BasicMachineDetails; import org.apache.brooklyn.core.location.Locations; import org.apache.brooklyn.entity.AbstractEc2LiveTest; import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess; import org.apache.brooklyn.location.ssh.SshMachineLocation; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +49,7 @@ public class MachineDetailsEc2LiveTest extends AbstractEc2LiveTest { protected void doTest(Location loc) throws Exception { Entity testEntity = app.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class)); app.start(ImmutableList.of(loc)); - EntityTestUtils.assertAttributeEqualsEventually(MutableMap.of("timeout", TIMEOUT_MS), + EntityAsserts.assertAttributeEqualsEventually(MutableMap.of("timeout", TIMEOUT_MS), testEntity, Startable.SERVICE_UP, true); SshMachineLocation sshLoc = Locations.findUniqueSshMachineLocation(testEntity.getLocations()).get(); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/software/base/src/test/java/org/apache/brooklyn/entity/software/base/test/location/MachineDetailsGoogleComputeLiveTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/test/location/MachineDetailsGoogleComputeLiveTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/test/location/MachineDetailsGoogleComputeLiveTest.java index 41b2016..8951849 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/test/location/MachineDetailsGoogleComputeLiveTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/test/location/MachineDetailsGoogleComputeLiveTest.java @@ -26,13 +26,13 @@ import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.location.MachineDetails; import org.apache.brooklyn.api.location.OsDetails; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.trait.Startable; import org.apache.brooklyn.core.location.BasicMachineDetails; import org.apache.brooklyn.core.location.Locations; import org.apache.brooklyn.entity.AbstractGoogleComputeLiveTest; import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess; import org.apache.brooklyn.location.ssh.SshMachineLocation; -import org.apache.brooklyn.test.EntityTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +47,7 @@ public class MachineDetailsGoogleComputeLiveTest extends AbstractGoogleComputeLi protected void doTest(Location loc) throws Exception { Entity testEntity = app.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class)); app.start(ImmutableList.of(loc)); - EntityTestUtils.assertAttributeEqualsEventually(testEntity, Startable.SERVICE_UP, true); + EntityAsserts.assertAttributeEqualsEventually(testEntity, Startable.SERVICE_UP, true); SshMachineLocation sshLoc = Locations.findUniqueSshMachineLocation(testEntity.getLocations()).get(); MachineDetails machine = app.getExecutionContext()
