Updating deprecate EntityTestUtils to EntityAsserts
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/42089916 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/42089916 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/42089916 Branch: refs/heads/master Commit: 42089916e7e39d285a20a6cf6fe21101c256cecb Parents: 6a60dd4 Author: Kiuby88 <[email protected]> Authored: Thu May 12 15:05:30 2016 +0200 Committer: Kiuby88 <[email protected]> Committed: Thu May 12 15:05:30 2016 +0200 ---------------------------------------------------------------------- .../core/entity/DependentConfigurationTest.java | 5 +- .../core/mgmt/rebind/RebindEnricherTest.java | 12 +- .../core/mgmt/rebind/RebindEntityTest.java | 15 ++- .../core/mgmt/rebind/RebindFeedTest.java | 18 +-- .../core/mgmt/rebind/RebindFeedWithHaTest.java | 10 +- .../stock/CustomAggregatingEnricherTest.java | 116 +++++++++---------- .../stock/EnricherWithDeferredSupplierTest.java | 4 +- .../brooklyn/enricher/stock/EnrichersTest.java | 81 +++++++------ ...SensorPropagatingEnricherDeprecatedTest.java | 17 ++- .../stock/SensorPropagatingEnricherTest.java | 36 +++--- .../stock/TransformingEnricherTest.java | 5 +- .../enricher/stock/reducer/ReducerTest.java | 46 ++++---- .../entity/group/DynamicClusterTest.java | 10 +- .../entity/group/GroupPickUpEntitiesTest.java | 15 ++- .../brooklyn/entity/stock/DataEntityTest.java | 5 +- .../feed/function/FunctionFeedTest.java | 11 +- .../feed/http/HttpFeedIntegrationTest.java | 11 +- .../feed/shell/ShellFeedIntegrationTest.java | 7 +- .../BrooklynEntityMirrorIntegrationTest.java | 17 ++- .../brooklynnode/BrooklynNodeRestTest.java | 10 +- .../blueprints/AbstractBlueprintTest.java | 10 +- .../policy/jclouds/os/CreateUserPolicyTest.java | 5 +- .../autoscaling/AutoScalerPolicyRebindTest.java | 6 +- .../enricher/HttpLatencyDetectorTest.java | 11 +- .../policy/enricher/RebindEnricherTest.java | 18 +-- .../policy/ha/ServiceFailureDetectorTest.java | 40 +++---- .../brooklyn/policy/ha/ServiceReplacerTest.java | 6 +- .../BrooklynClusterIntegrationTest.java | 10 +- .../BrooklynNodeIntegrationTest.java | 10 +- .../brooklynnode/SelectMasterEffectorTest.java | 15 +-- .../brooklyn/entity/java/EntityPollingTest.java | 13 +-- .../entity/java/VanillaJavaAppRebindTest.java | 18 ++- .../entity/machine/MachineEntityRebindTest.java | 6 +- ...ctSoftwareProcessRestartIntegrationTest.java | 27 +++-- .../base/SoftwareProcessEntityRebindTest.java | 10 +- .../base/SoftwareProcessEntityTest.java | 18 +-- ...ftwareProcessAndChildrenIntegrationTest.java | 4 +- ...laWindowsProcessWinrmExitStatusLiveTest.java | 18 +-- .../base/lifecycle/ScriptHelperTest.java | 10 +- .../location/MachineDetailsEc2LiveTest.java | 4 +- .../MachineDetailsGoogleComputeLiveTest.java | 4 +- .../test/mysql/AbstractToyMySqlEntityTest.java | 8 +- .../brooklyn/feed/jmx/RebindJmxFeedTest.java | 9 +- .../WindowsPerformanceCounterFeedTest.java | 8 +- .../winrm/AdvertiseWinrmLoginPolicyTest.java | 4 +- 45 files changed, 345 insertions(+), 398 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/core/entity/DependentConfigurationTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/entity/DependentConfigurationTest.java b/core/src/test/java/org/apache/brooklyn/core/entity/DependentConfigurationTest.java index 6d73c6d..079e45e 100644 --- a/core/src/test/java/org/apache/brooklyn/core/entity/DependentConfigurationTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/entity/DependentConfigurationTest.java @@ -39,7 +39,6 @@ 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.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.core.task.BasicTask; @@ -325,7 +324,7 @@ public class DependentConfigurationTest extends BrooklynAppUnitTestSupport { .build()); ServiceStateLogic.setExpectedState(entity, Lifecycle.ON_FIRE); - EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); try { assertDoneEventually(t); @@ -349,7 +348,7 @@ public class DependentConfigurationTest extends BrooklynAppUnitTestSupport { @Test public void testAttributeWhenReadyAbortsWhenAlreadyOnFireByDefault() throws Exception { ServiceStateLogic.setExpectedState(entity, Lifecycle.ON_FIRE); - EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); + EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE); final Task<String> t = submit(DependentConfiguration.builder() .attributeWhenReady(entity, TestEntity.NAME) http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java index 2db5862..bc63aef 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java @@ -36,6 +36,7 @@ import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; import org.apache.brooklyn.core.enricher.AbstractEnricher; 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.EntityPredicates; import org.apache.brooklyn.core.location.SimulatedLocation; @@ -46,7 +47,6 @@ import org.apache.brooklyn.core.test.entity.TestEntityImpl; import org.apache.brooklyn.enricher.stock.Enrichers; 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.MutableSet; import org.apache.brooklyn.util.core.flags.SetFromFlag; import org.apache.brooklyn.util.text.Identifiers; @@ -93,7 +93,7 @@ public class RebindEnricherTest extends RebindTestFixtureWithApp { TestEntity newEntity = (TestEntity) Iterables.find(newApp.getChildren(), Predicates.instanceOf(TestEntity.class)); newEntity.sensors().set(METRIC1, "myval"); - EntityTestUtils.assertAttributeEqualsEventually(newApp, METRIC1, "myval"); + EntityAsserts.assertAttributeEqualsEventually(newApp, METRIC1, "myval"); } @Test @@ -107,7 +107,7 @@ public class RebindEnricherTest extends RebindTestFixtureWithApp { TestEntity newEntity = (TestEntity) Iterables.find(newApp.getChildren(), Predicates.instanceOf(TestEntity.class)); newEntity.sensors().set(METRIC1, "myval"); - EntityTestUtils.assertAttributeEqualsEventually(newApp, METRIC1, "myval"); + EntityAsserts.assertAttributeEqualsEventually(newApp, METRIC1, "myval"); } @Test @@ -121,7 +121,7 @@ public class RebindEnricherTest extends RebindTestFixtureWithApp { TestEntity newEntity = (TestEntity) Iterables.find(newApp.getChildren(), Predicates.instanceOf(TestEntity.class)); newEntity.sensors().set(METRIC1, "myval"); - EntityTestUtils.assertAttributeEqualsEventually(newApp, METRIC2, "myval"); + EntityAsserts.assertAttributeEqualsEventually(newApp, METRIC2, "myval"); } @SuppressWarnings("unchecked") @@ -139,7 +139,7 @@ public class RebindEnricherTest extends RebindTestFixtureWithApp { newEntity.sensors().set(METRIC1, "myval"); newEntity.sensors().set(METRIC2, "myval2"); - EntityTestUtils.assertAttributeEventually(newApp, METRIC2, Predicates.or(Predicates.equalTo("myval,myval2"), Predicates.equalTo("myval2,myval"))); + EntityAsserts.assertAttributeEventually(newApp, METRIC2, Predicates.or(Predicates.equalTo("myval,myval2"), Predicates.equalTo("myval2,myval"))); } @Test @@ -162,7 +162,7 @@ public class RebindEnricherTest extends RebindTestFixtureWithApp { for (Entity member : newCluster.getMembers()) { ((EntityInternal)member).sensors().set(METRIC1, "myval"+(i++)); } - EntityTestUtils.assertAttributeEventually(newApp, METRIC2, Predicates.or(Predicates.equalTo("myval1,myval2"), Predicates.equalTo("myval2,myval1"))); + EntityAsserts.assertAttributeEventually(newApp, METRIC2, Predicates.or(Predicates.equalTo("myval1,myval2"), Predicates.equalTo("myval2,myval1"))); } @Test http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java index 032f36d..12411ac 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java @@ -18,8 +18,6 @@ */ package org.apache.brooklyn.core.mgmt.rebind; -import static org.apache.brooklyn.test.EntityTestUtils.assertAttributeEquals; -import static org.apache.brooklyn.test.EntityTestUtils.assertConfigEquals; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; @@ -56,6 +54,7 @@ import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.BasicConfigKey; import org.apache.brooklyn.core.entity.AbstractEntity; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.EntityPredicates; import org.apache.brooklyn.core.entity.trait.Resizable; import org.apache.brooklyn.core.entity.trait.Startable; @@ -261,9 +260,9 @@ public class RebindEntityTest extends RebindTestFixtureWithApp { newApp = rebind(); MyEntityReffingOthers newE = (MyEntityReffingOthers) Iterables.find(newApp.getChildren(), Predicates.instanceOf(MyEntityReffingOthers.class)); MyEntity newOtherE = (MyEntity) Iterables.find(newApp.getChildren(), Predicates.instanceOf(MyEntity.class)); - - assertAttributeEquals(newE, MyEntityReffingOthers.ENTITY_REF_SENSOR, newOtherE); - assertConfigEquals(newE, MyEntityReffingOthers.ENTITY_REF_CONFIG, newOtherE); + + EntityAsserts.assertAttributeEquals(newE, MyEntityReffingOthers.ENTITY_REF_SENSOR, newOtherE); + EntityAsserts.assertConfigEquals(newE, MyEntityReffingOthers.ENTITY_REF_CONFIG, newOtherE); } @Test @@ -348,9 +347,9 @@ public class RebindEntityTest extends RebindTestFixtureWithApp { newApp = rebind(); MyEntityReffingOthers newE = (MyEntityReffingOthers) Iterables.find(newApp.getChildren(), Predicates.instanceOf(MyEntityReffingOthers.class)); MyLocation newLoc = (MyLocation) Iterables.getOnlyElement(newApp.getLocations()); - - assertAttributeEquals(newE, MyEntityReffingOthers.LOCATION_REF_SENSOR, newLoc); - assertConfigEquals(newE, MyEntityReffingOthers.LOCATION_REF_CONFIG, newLoc); + + EntityAsserts.assertAttributeEquals(newE, MyEntityReffingOthers.LOCATION_REF_SENSOR, newLoc); + EntityAsserts.assertConfigEquals(newE, MyEntityReffingOthers.LOCATION_REF_CONFIG, newLoc); } @Test http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedTest.java index 1be1bb5..6efafec 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedTest.java @@ -31,6 +31,7 @@ import org.apache.brooklyn.api.sensor.Feed; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.mgmt.internal.BrooklynGarbageCollector; import org.apache.brooklyn.core.sensor.Sensors; import org.apache.brooklyn.core.test.entity.TestEntity; @@ -44,7 +45,6 @@ import org.apache.brooklyn.feed.ssh.SshFeed; import org.apache.brooklyn.feed.ssh.SshPollConfig; import org.apache.brooklyn.feed.ssh.SshValueFunctions; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.core.http.BetterMockWebServer; import org.apache.brooklyn.util.core.task.BasicExecutionManager; @@ -105,8 +105,8 @@ public class RebindFeedTest extends RebindTestFixtureWithApp { public void testHttpFeedRegisteredInInitIsPersistedAndFeedsStop() throws Exception { TestEntity origEntity = origApp.createAndManageChild(EntitySpec.create(TestEntity.class).impl(MyEntityWithHttpFeedImpl.class) .configure(MyEntityWithHttpFeedImpl.BASE_URL, baseUrl)); - EntityTestUtils.assertAttributeEqualsEventually(origEntity, SENSOR_INT, (Integer)200); - EntityTestUtils.assertAttributeEqualsEventually(origEntity, SENSOR_STRING, "{\"foo\":\"myfoo\"}"); + EntityAsserts.assertAttributeEqualsEventually(origEntity, SENSOR_INT, (Integer)200); + EntityAsserts.assertAttributeEqualsEventually(origEntity, SENSOR_STRING, "{\"foo\":\"myfoo\"}"); assertEquals(origEntity.feeds().getFeeds().size(), 1); final long taskCountBefore = ((BasicExecutionManager)origManagementContext.getExecutionManager()).getNumIncompleteTasks(); @@ -124,8 +124,8 @@ public class RebindFeedTest extends RebindTestFixtureWithApp { // Expect the feed to still be polling newEntity.sensors().set(SENSOR_INT, null); newEntity.sensors().set(SENSOR_STRING, null); - EntityTestUtils.assertAttributeEqualsEventually(newEntity, SENSOR_INT, (Integer)200); - EntityTestUtils.assertAttributeEqualsEventually(newEntity, SENSOR_STRING, "{\"foo\":\"myfoo\"}"); + EntityAsserts.assertAttributeEqualsEventually(newEntity, SENSOR_INT, (Integer)200); + EntityAsserts.assertAttributeEqualsEventually(newEntity, SENSOR_STRING, "{\"foo\":\"myfoo\"}"); // Now test that everything in the origApp stops, including feeds Entities.unmanage(origApp); @@ -143,7 +143,7 @@ public class RebindFeedTest extends RebindTestFixtureWithApp { @Test public void testFunctionFeedRegisteredInInitIsPersisted() throws Exception { TestEntity origEntity = origApp.createAndManageChild(EntitySpec.create(TestEntity.class).impl(MyEntityWithFunctionFeedImpl.class)); - EntityTestUtils.assertAttributeEqualsEventually(origEntity, SENSOR_INT, (Integer)1); + EntityAsserts.assertAttributeEqualsEventually(origEntity, SENSOR_INT, (Integer) 1); assertEquals(origEntity.feeds().getFeeds().size(), 2); newApp = rebind(); @@ -154,7 +154,7 @@ public class RebindFeedTest extends RebindTestFixtureWithApp { // Expect the feed to still be polling newEntity.sensors().set(SENSOR_INT, null); - EntityTestUtils.assertAttributeEqualsEventually(newEntity, SENSOR_INT, (Integer)1); + EntityAsserts.assertAttributeEqualsEventually(newEntity, SENSOR_INT, (Integer)1); } @Test(groups="Integration") @@ -167,7 +167,7 @@ public class RebindFeedTest extends RebindTestFixtureWithApp { origApp.start(ImmutableList.<Location>of()); - EntityTestUtils.assertAttributeEqualsEventually(origEntity, SENSOR_INT, (Integer)0); + EntityAsserts.assertAttributeEqualsEventually(origEntity, SENSOR_INT, (Integer)0); assertEquals(origEntity.feeds().getFeeds().size(), 1); newApp = rebind(); @@ -178,7 +178,7 @@ public class RebindFeedTest extends RebindTestFixtureWithApp { // Expect the feed to still be polling newEntity.sensors().set(SENSOR_INT, null); - EntityTestUtils.assertAttributeEqualsEventually(newEntity, SENSOR_INT, (Integer)0); + EntityAsserts.assertAttributeEqualsEventually(newEntity, SENSOR_INT, (Integer)0); } @Test http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedWithHaTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedWithHaTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedWithHaTest.java index 502e098..44870bd 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedWithHaTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedWithHaTest.java @@ -30,10 +30,10 @@ import org.apache.brooklyn.api.mgmt.Task; import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.api.sensor.Feed; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.core.http.BetterMockWebServer; import org.apache.brooklyn.util.core.task.BasicExecutionManager; import org.apache.brooklyn.util.repeat.Repeater; @@ -87,8 +87,8 @@ public class RebindFeedWithHaTest extends RebindTestFixtureWithApp { public void testHttpFeedCleansUpAfterHaDisabledAndRunsAtFailover() throws Exception { TestEntity origEntity = origApp.createAndManageChild(EntitySpec.create(TestEntity.class).impl(RebindFeedTest.MyEntityWithHttpFeedImpl.class) .configure(RebindFeedTest.MyEntityWithHttpFeedImpl.BASE_URL, baseUrl)); - EntityTestUtils.assertAttributeEqualsEventually(origEntity, SENSOR_INT, (Integer)200); - EntityTestUtils.assertAttributeEqualsEventually(origEntity, SENSOR_STRING, "{\"foo\":\"myfoo\"}"); + EntityAsserts.assertAttributeEqualsEventually(origEntity, SENSOR_INT, (Integer) 200); + EntityAsserts.assertAttributeEqualsEventually(origEntity, SENSOR_STRING, "{\"foo\":\"myfoo\"}"); assertEquals(origEntity.feeds().getFeeds().size(), 1); origManagementContext.getRebindManager().forcePersistNow(); @@ -119,8 +119,8 @@ public class RebindFeedWithHaTest extends RebindTestFixtureWithApp { // Expect the feed to still be polling newEntity.sensors().set(SENSOR_INT, null); newEntity.sensors().set(SENSOR_STRING, null); - EntityTestUtils.assertAttributeEqualsEventually(newEntity, SENSOR_INT, (Integer)200); - EntityTestUtils.assertAttributeEqualsEventually(newEntity, SENSOR_STRING, "{\"foo\":\"myfoo\"}"); + EntityAsserts.assertAttributeEqualsEventually(newEntity, SENSOR_INT, (Integer)200); + EntityAsserts.assertAttributeEqualsEventually(newEntity, SENSOR_STRING, "{\"foo\":\"myfoo\"}"); } @Test(groups="Integration", invocationCount=50) http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/enricher/stock/CustomAggregatingEnricherTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/enricher/stock/CustomAggregatingEnricherTest.java b/core/src/test/java/org/apache/brooklyn/enricher/stock/CustomAggregatingEnricherTest.java index 9216381..678bfe1 100644 --- a/core/src/test/java/org/apache/brooklyn/enricher/stock/CustomAggregatingEnricherTest.java +++ b/core/src/test/java/org/apache/brooklyn/enricher/stock/CustomAggregatingEnricherTest.java @@ -25,13 +25,12 @@ 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.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.location.SimulatedLocation; import org.apache.brooklyn.core.sensor.BasicAttributeSensor; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.enricher.stock.Enrichers; import org.apache.brooklyn.entity.group.BasicGroup; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -76,7 +75,7 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .computingSum() .fromChildren() .build()); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, target, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, target, null); } @Test @@ -89,7 +88,7 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .defaultValueForUnreportedSensors(11) .valueToReportIfNoSensors(40) .build()); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 40); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 40); } @Test @@ -102,7 +101,7 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .defaultValueForUnreportedSensors(11) .valueToReportIfNoSensors(40) .build()); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 11); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 11); } @Test @@ -113,7 +112,7 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .computingSum() .fromHardcodedProducers(ImmutableList.of(entity)) .build()); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, target, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, target, null); } @Test @@ -124,7 +123,7 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .computingSum() .fromHardcodedProducers(ImmutableList.of(entity)) .build()); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, target, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, target, null); } @Test @@ -137,7 +136,7 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .build()); entity.sensors().set(intSensor, 1); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 1); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 1); } @Test @@ -150,7 +149,7 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .build()); entity.sensors().set(intSensor, null); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, target, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, target, null); } @Test @@ -164,16 +163,16 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .valueToReportIfNoSensors(5) .build()); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 3); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 3); entity.sensors().set(intSensor, null); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, target, 3); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, target, 3); entity.sensors().set(intSensor, 1); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 1); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 1); entity.sensors().set(intSensor, 7); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 7); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 7); } @Test @@ -190,13 +189,13 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .build()); producer3.sensors().set(intSensor, 1); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 1); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 1); producer1.sensors().set(intSensor, 2); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 3); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 3); producer2.sensors().set(intSensor, 4); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 7); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 7); } @Test @@ -210,10 +209,10 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .fromHardcodedProducers(ImmutableList.of(producer1)) .build()); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, doubleSensor, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, doubleSensor, null); producer1.sensors().set(intSensor, null); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, doubleSensor, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, doubleSensor, null); } @Test @@ -229,13 +228,13 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .valueToReportIfNoSensors(5) .build()); - EntityTestUtils.assertAttributeEqualsEventually(entity, doubleSensor, 3d); + EntityAsserts.assertAttributeEqualsEventually(entity, doubleSensor, 3d); producer1.sensors().set(intSensor, null); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, doubleSensor, 3d); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, doubleSensor, 3d); producer1.sensors().set(intSensor, 4); - EntityTestUtils.assertAttributeEqualsEventually(entity, doubleSensor, 4d); + EntityAsserts.assertAttributeEqualsEventually(entity, doubleSensor, 4d); } @Test @@ -249,7 +248,7 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .valueToReportIfNoSensors(5) .build()); - EntityTestUtils.assertAttributeEqualsEventually(entity, doubleSensor, 5d); + EntityAsserts.assertAttributeEqualsEventually(entity, doubleSensor, 5d); } @Test @@ -261,7 +260,7 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .fromChildren() .build()); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, doubleSensor, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, doubleSensor, null); } @Test @@ -277,19 +276,19 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .fromHardcodedProducers(ImmutableList.of(producer1, producer2, producer3)) .build()); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, doubleSensor, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 50), entity, doubleSensor, null); producer1.sensors().set(intSensor, 3); - EntityTestUtils.assertAttributeEqualsEventually(entity, doubleSensor, 3d); + EntityAsserts.assertAttributeEqualsEventually(entity, doubleSensor, 3d); producer2.sensors().set(intSensor, 1); - EntityTestUtils.assertAttributeEqualsEventually(entity, doubleSensor, 2d); + EntityAsserts.assertAttributeEqualsEventually(entity, doubleSensor, 2d); producer3.sensors().set(intSensor, 5); - EntityTestUtils.assertAttributeEqualsEventually(entity, doubleSensor, 3d); + EntityAsserts.assertAttributeEqualsEventually(entity, doubleSensor, 3d); producer2.sensors().set(intSensor, 4); - EntityTestUtils.assertAttributeEqualsEventually(entity, doubleSensor, 4d); + EntityAsserts.assertAttributeEqualsEventually(entity, doubleSensor, 4d); } @Test @@ -307,16 +306,16 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .valueToReportIfNoSensors(0) .build()); - EntityTestUtils.assertAttributeEqualsEventually(entity, doubleSensor, 0d); + EntityAsserts.assertAttributeEqualsEventually(entity, doubleSensor, 0d); producer1.sensors().set(intSensor, 3); - EntityTestUtils.assertAttributeEqualsEventually(entity, doubleSensor, 1d); + EntityAsserts.assertAttributeEqualsEventually(entity, doubleSensor, 1d); producer2.sensors().set(intSensor, 3); - EntityTestUtils.assertAttributeEqualsEventually(entity, doubleSensor, 2d); + EntityAsserts.assertAttributeEqualsEventually(entity, doubleSensor, 2d); producer3.sensors().set(intSensor, 3); - EntityTestUtils.assertAttributeEqualsEventually(entity, doubleSensor, 3d); + EntityAsserts.assertAttributeEqualsEventually(entity, doubleSensor, 3d); } @Test @@ -335,18 +334,18 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .valueToReportIfNoSensors(0) .build()); - EntityTestUtils.assertAttributeEqualsEventually(group, target, 0); + EntityAsserts.assertAttributeEqualsEventually(group, target, 0); group.addMember(p1); p1.sensors().set(intSensor, 1); - EntityTestUtils.assertAttributeEqualsEventually(group, target, 1); + EntityAsserts.assertAttributeEqualsEventually(group, target, 1); group.addMember(p2); p2.sensors().set(intSensor, 2); - EntityTestUtils.assertAttributeEqualsEventually(group, target, 3); + EntityAsserts.assertAttributeEqualsEventually(group, target, 3); group.removeMember(p2); - EntityTestUtils.assertAttributeEqualsEventually(group, target, 1); + EntityAsserts.assertAttributeEqualsEventually(group, target, 1); } @Test(groups = "Integration", invocationCount=50) @@ -371,13 +370,13 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .build()); - EntityTestUtils.assertAttributeEqualsEventually(group, target, 1); + EntityAsserts.assertAttributeEqualsEventually(group, target, 1); p2.sensors().set(intSensor, 2); - EntityTestUtils.assertAttributeEqualsEventually(group, target, 3); + EntityAsserts.assertAttributeEqualsEventually(group, target, 3); group.removeMember(p2); - EntityTestUtils.assertAttributeEqualsEventually(group, target, 1); + EntityAsserts.assertAttributeEqualsEventually(group, target, 1); } @Test @@ -398,13 +397,13 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .build()); - EntityTestUtils.assertAttributeEqualsEventually(app, target, 1); + EntityAsserts.assertAttributeEqualsEventually(app, target, 1); p2.sensors().set(intSensor, 2); - EntityTestUtils.assertAttributeEqualsEventually(app, target, 3); + EntityAsserts.assertAttributeEqualsEventually(app, target, 3); group.removeMember(p2); - EntityTestUtils.assertAttributeEqualsEventually(app, target, 1); + EntityAsserts.assertAttributeEqualsEventually(app, target, 1); } @Test @@ -427,10 +426,10 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .entityFilter(Predicates.equalTo((Entity)p1)) .build()); - EntityTestUtils.assertAttributeEqualsEventually(group, target, 1); + EntityAsserts.assertAttributeEqualsEventually(group, target, 1); group.addMember(p3); - EntityTestUtils.assertAttributeEqualsContinually(ImmutableMap.of("timeout", SHORT_WAIT_MS), group, target, 1); + EntityAsserts.assertAttributeEqualsContinually(ImmutableMap.of("timeout", SHORT_WAIT_MS), group, target, 1); } @Test @@ -444,18 +443,18 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .valueToReportIfNoSensors(0) .build()); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 0); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 0); TestEntity p1 = entity.createAndManageChild(EntitySpec.create(TestEntity.class)); p1.sensors().set(intSensor, 1); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 1); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 1); TestEntity p2 = entity.createAndManageChild(EntitySpec.create(TestEntity.class)); p2.sensors().set(intSensor, 2); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 3); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 3); Entities.unmanage(p2); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 1); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 1); } @Test @@ -472,13 +471,13 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .build()); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 1); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 1); p2.sensors().set(intSensor, 2); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 3); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 3); Entities.unmanage(p2); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 1); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 1); } @Test @@ -495,14 +494,13 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .fromChildren() .build()); - - EntityTestUtils.assertAttributeEqualsEventually(app, target, 1); + EntityAsserts.assertAttributeEqualsEventually(app, target, 1); p2.sensors().set(intSensor, 2); - EntityTestUtils.assertAttributeEqualsEventually(app, target, 3); + EntityAsserts.assertAttributeEqualsEventually(app, target, 3); Entities.unmanage(p2); - EntityTestUtils.assertAttributeEqualsEventually(app, target, 1); + EntityAsserts.assertAttributeEqualsEventually(app, target, 1); } @Test @@ -518,11 +516,11 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .entityFilter(Predicates.equalTo((Entity)p1)) .build()); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 1); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 1); TestEntity p2 = entity.createAndManageChild(EntitySpec.create(TestEntity.class)); p2.sensors().set(intSensor, 2); - EntityTestUtils.assertAttributeEqualsContinually(ImmutableMap.of("timeout", SHORT_WAIT_MS), entity, target, 1); + EntityAsserts.assertAttributeEqualsContinually(ImmutableMap.of("timeout", SHORT_WAIT_MS), entity, target, 1); } @Test @@ -544,10 +542,10 @@ public class CustomAggregatingEnricherTest extends BrooklynAppUnitTestSupport { .defaultValueForUnreportedSensors(0) .build()); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 1); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 1); // Event by producer producer1.sensors().set(intSensor, 2); - EntityTestUtils.assertAttributeEqualsEventually(entity, target, 5); + EntityAsserts.assertAttributeEqualsEventually(entity, target, 5); } } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/enricher/stock/EnricherWithDeferredSupplierTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/enricher/stock/EnricherWithDeferredSupplierTest.java b/core/src/test/java/org/apache/brooklyn/enricher/stock/EnricherWithDeferredSupplierTest.java index 9727403..31a29fd 100644 --- a/core/src/test/java/org/apache/brooklyn/enricher/stock/EnricherWithDeferredSupplierTest.java +++ b/core/src/test/java/org/apache/brooklyn/enricher/stock/EnricherWithDeferredSupplierTest.java @@ -31,6 +31,7 @@ import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; import org.apache.brooklyn.core.effector.EffectorTasks; 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.EntityPredicates; import org.apache.brooklyn.core.location.SimulatedLocation; @@ -38,7 +39,6 @@ import org.apache.brooklyn.core.mgmt.BrooklynTaskTags; import org.apache.brooklyn.core.sensor.BasicAttributeSensor; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.core.task.DeferredSupplier; import org.apache.brooklyn.util.core.task.TaskBuilder; import org.apache.brooklyn.util.exceptions.Exceptions; @@ -76,7 +76,7 @@ public class EnricherWithDeferredSupplierTest extends BrooklynAppUnitTestSupport .from(new EntityDeferredSupplier("myproducer").newTask()) .build()); - EntityTestUtils.assertAttributeEqualsEventually(target, sensor, 3); + EntityAsserts.assertAttributeEqualsEventually(target, sensor, 3); } // TODO This is a cut-down version of DslComponent, from the camp project http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/enricher/stock/EnrichersTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/enricher/stock/EnrichersTest.java b/core/src/test/java/org/apache/brooklyn/enricher/stock/EnrichersTest.java index 371d2b5..6e5cc16 100644 --- a/core/src/test/java/org/apache/brooklyn/enricher/stock/EnrichersTest.java +++ b/core/src/test/java/org/apache/brooklyn/enricher/stock/EnrichersTest.java @@ -28,14 +28,13 @@ import org.apache.brooklyn.api.sensor.Enricher; import org.apache.brooklyn.api.sensor.SensorEvent; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.entity.EntityAdjuncts; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.entity.RecordingSensorEventListener; 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.enricher.stock.Enrichers; import org.apache.brooklyn.entity.group.BasicGroup; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.CollectionFunctionals; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.collections.MutableMap; @@ -94,7 +93,7 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { entity.sensors().set(NUM1, 2); entity.sensors().set(NUM2, 3); - EntityTestUtils.assertAttributeEqualsEventually(entity, NUM3, 5); + EntityAsserts.assertAttributeEqualsEventually(entity, NUM3, 5); } @Test @@ -107,7 +106,7 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { entity.sensors().set(NUM1, 2); entity.sensors().set(NUM2, 3); - EntityTestUtils.assertAttributeEqualsEventually(entity, NUM3, 1); + EntityAsserts.assertAttributeEqualsEventually(entity, NUM3, 1); } @Test(groups="Integration") // because takes a second @@ -127,10 +126,10 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { entity.sensors().set(NUM1, 123); entity.sensors().set(NUM2, 3); - EntityTestUtils.assertAttributeEqualsEventually(entity, NUM3, 126); + EntityAsserts.assertAttributeEqualsEventually(entity, NUM3, 126); entity.sensors().set(NUM1, 2); - EntityTestUtils.assertAttributeEqualsContinually(entity, NUM3, 126); + EntityAsserts.assertAttributeEqualsContinually(entity, NUM3, 126); } @Test @@ -143,7 +142,7 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { .build()); entity2.sensors().set(NUM1, 2); - EntityTestUtils.assertAttributeEqualsEventually(entity, NUM1, 2); + EntityAsserts.assertAttributeEqualsEventually(entity, NUM1, 2); } @Test @@ -155,7 +154,7 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { .build()); entity.sensors().set(STR1, "myval"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR2, "myvalmysuffix"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR2, "myvalmysuffix"); } @Test @@ -167,7 +166,7 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { .build()); entity.sensors().set(NUM1, 123); - EntityTestUtils.assertAttributeEqualsEventually(entity, LONG1, Long.valueOf(1)); + EntityAsserts.assertAttributeEqualsEventually(entity, LONG1, Long.valueOf(1)); } @Test @@ -182,7 +181,7 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { .build()); entity.sensors().set(STR1, "myval"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR2, "myvalmysuffix"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR2, "myvalmysuffix"); } @Test(groups="Integration") // because takes a second @@ -202,14 +201,14 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { entity.sensors().set(STR1, "myval"); Asserts.eventually(Suppliers.ofInstance(record), CollectionFunctionals.sizeEquals(1)); - EntityTestUtils.assertAttributeEquals(entity, STR2, "myval"); + EntityAsserts.assertAttributeEquals(entity, STR2, "myval"); entity.sensors().set(STR1, "ignoredval"); - EntityTestUtils.assertAttributeEqualsContinually(entity, STR2, "myval"); + EntityAsserts.assertAttributeEqualsContinually(entity, STR2, "myval"); entity.sensors().set(STR1, "myval2"); Asserts.eventually(Suppliers.ofInstance(record), CollectionFunctionals.sizeEquals(2)); - EntityTestUtils.assertAttributeEquals(entity, STR2, "myval2"); + EntityAsserts.assertAttributeEquals(entity, STR2, "myval2"); entity.sensors().set(STR1, "myval2"); entity.sensors().set(STR1, "myval2"); @@ -230,12 +229,12 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { entity.sensors().set(STR1, "myval"); Asserts.eventually(Suppliers.ofInstance(record), CollectionFunctionals.sizeEquals(1)); - EntityTestUtils.assertAttributeEquals(entity, STR2, "myval"); + EntityAsserts.assertAttributeEquals(entity, STR2, "myval"); entity.sensors().set(STR1, "myval2"); entity.sensors().set(STR1, "myval2"); entity.sensors().set(STR1, "myval3"); - EntityTestUtils.assertAttributeEqualsContinually(entity, STR2, "myval3"); + EntityAsserts.assertAttributeEqualsContinually(entity, STR2, "myval3"); Asserts.assertThat(record.getEvents(), CollectionFunctionals.sizeEquals(3)); } @@ -247,10 +246,10 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { .build()); entity2.sensors().set(STR1, "myval"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR1, "myval"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR1, "myval"); entity2.sensors().set(STR1, null); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR1, null); + EntityAsserts.assertAttributeEqualsEventually(entity, STR1, null); } @Test @@ -261,7 +260,7 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { .build()); entity2.sensors().set(STR1, "myval"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR2, "myval"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR2, "myval"); } // FIXME What is default? members? children? fail? @@ -280,7 +279,7 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { child1.sensors().set(NUM1, 1); entity.sensors().set(NUM1, 2); entity2.sensors().set(NUM1, 3); - EntityTestUtils.assertAttributeEqualsEventually(group, NUM2, 5); + EntityAsserts.assertAttributeEqualsEventually(group, NUM2, 5); } @Test @@ -298,7 +297,7 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { entity.sensors().set(NUM1, 1); child1.sensors().set(NUM1, 2); child2.sensors().set(NUM1, 3); - EntityTestUtils.assertAttributeEqualsEventually(group, NUM2, 5); + EntityAsserts.assertAttributeEqualsEventually(group, NUM2, 5); } @Test @@ -319,15 +318,15 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { entity.sensors().set(STR1, "1"); entity2.sensors().set(STR1, "2"); - EntityTestUtils.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of("1", "2")); + EntityAsserts.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of("1", "2")); entity.sensors().set(STR1, "3"); entity2.sensors().set(STR1, null); - EntityTestUtils.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of("3")); + EntityAsserts.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of("3")); entity.sensors().set(STR1, ""); entity2.sensors().set(STR1, "4"); - EntityTestUtils.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of("4")); + EntityAsserts.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of("4")); } @Test @@ -345,16 +344,16 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { }}) .build()); - EntityTestUtils.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of()); + EntityAsserts.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of()); entity.sensors().set(NUM1, 1); - EntityTestUtils.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of(1)); + EntityAsserts.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of(1)); entity.sensors().set(NUM1, null); - EntityTestUtils.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of()); + EntityAsserts.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of()); entity.sensors().set(NUM1, 2); - EntityTestUtils.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of(2)); + EntityAsserts.assertAttributeEqualsEventually(group, SET1, ImmutableSet.<Object>of(2)); } @Test @@ -368,7 +367,7 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { .build()); entity.sensors().set(NUM1, 123); - EntityTestUtils.assertAttributeEqualsEventually(group, LONG1, Long.valueOf(1)); + EntityAsserts.assertAttributeEqualsEventually(group, LONG1, Long.valueOf(1)); } @Test(groups="Integration") // because takes a second @@ -389,10 +388,10 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { .build()); entity.sensors().set(NUM1, 123); - EntityTestUtils.assertAttributeEqualsEventually(group, LONG1, Long.valueOf(123)); + EntityAsserts.assertAttributeEqualsEventually(group, LONG1, Long.valueOf(123)); entity.sensors().set(NUM1, 987654); - EntityTestUtils.assertAttributeEqualsContinually(group, LONG1, Long.valueOf(123)); + EntityAsserts.assertAttributeEqualsContinually(group, LONG1, Long.valueOf(123)); } @Test public void testUpdatingMap1() { @@ -419,14 +418,14 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { @SuppressWarnings({ "rawtypes", "unchecked" }) protected void doUpdatingMapChecks(AttributeSensor mapSensor) { - EntityTestUtils.assertAttributeEqualsEventually(entity, mapSensor, MutableMap.<String,String>of()); + EntityAsserts.assertAttributeEqualsEventually(entity, mapSensor, MutableMap.<String,String>of()); entity.sensors().set(LONG1, -1L); - EntityTestUtils.assertAttributeEqualsEventually(entity, mapSensor, MutableMap.<String,String>of( + EntityAsserts.assertAttributeEqualsEventually(entity, mapSensor, MutableMap.<String,String>of( LONG1.getName(), "-1 is not allowed")); entity.sensors().set(LONG1, 1L); - EntityTestUtils.assertAttributeEqualsEventually(entity, mapSensor, MutableMap.<String,String>of()); + EntityAsserts.assertAttributeEqualsEventually(entity, mapSensor, MutableMap.<String,String>of()); } private static AttributeSensor<Object> LIST_SENSOR = Sensors.newSensor(Object.class, "sensor.list"); @@ -439,15 +438,15 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { .build()); // null values ignored, and it quotes entity.sensors().set(LIST_SENSOR, MutableList.<String>of("a", "\"b").append(null)); - EntityTestUtils.assertAttributeEqualsEventually(entity, TestEntity.NAME, "\"a\",\"\\\"b\""); + EntityAsserts.assertAttributeEqualsEventually(entity, TestEntity.NAME, "\"a\",\"\\\"b\""); // empty list causes "" entity.sensors().set(LIST_SENSOR, MutableList.<String>of().append(null)); - EntityTestUtils.assertAttributeEqualsEventually(entity, TestEntity.NAME, ""); + EntityAsserts.assertAttributeEqualsEventually(entity, TestEntity.NAME, ""); // null causes null entity.sensors().set(LIST_SENSOR, null); - EntityTestUtils.assertAttributeEqualsEventually(entity, TestEntity.NAME, null); + EntityAsserts.assertAttributeEqualsEventually(entity, TestEntity.NAME, null); } @Test @@ -462,11 +461,11 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { .quote(false) .build()); // in this case, it should be immediately available upon adding the enricher - EntityTestUtils.assertAttributeEquals(entity, TestEntity.NAME, "a:\"b"); + EntityAsserts.assertAttributeEquals(entity, TestEntity.NAME, "a:\"b"); // empty list causes null here, because below the minimum entity.sensors().set(LIST_SENSOR, MutableList.<String>of().append(null)); - EntityTestUtils.assertAttributeEqualsEventually(entity, TestEntity.NAME, null); + EntityAsserts.assertAttributeEqualsEventually(entity, TestEntity.NAME, null); } @Test @@ -480,15 +479,15 @@ public class EnrichersTest extends BrooklynAppUnitTestSupport { .build()); // null values ignored, and it quotes entity.sensors().set(LIST_SENSOR, MutableList.<String>of("a", "b")); - EntityTestUtils.assertAttributeEqualsEventually(entity, TestEntity.NAME, "a,b"); + EntityAsserts.assertAttributeEqualsEventually(entity, TestEntity.NAME, "a,b"); // empty list causes "" entity.sensors().set(LIST_SENSOR, MutableList.<String>of("x")); - EntityTestUtils.assertAttributeEqualsEventually(entity, TestEntity.NAME, null); + EntityAsserts.assertAttributeEqualsEventually(entity, TestEntity.NAME, null); // null causes null entity.sensors().set(LIST_SENSOR, MutableList.<String>of("a", "b", "c", "d", "e")); - EntityTestUtils.assertAttributeEqualsEventually(entity, TestEntity.NAME, "a,b,c,d"); + EntityAsserts.assertAttributeEqualsEventually(entity, TestEntity.NAME, "a,b,c,d"); } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/enricher/stock/SensorPropagatingEnricherDeprecatedTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/enricher/stock/SensorPropagatingEnricherDeprecatedTest.java b/core/src/test/java/org/apache/brooklyn/enricher/stock/SensorPropagatingEnricherDeprecatedTest.java index 2f7eca9..1377078 100644 --- a/core/src/test/java/org/apache/brooklyn/enricher/stock/SensorPropagatingEnricherDeprecatedTest.java +++ b/core/src/test/java/org/apache/brooklyn/enricher/stock/SensorPropagatingEnricherDeprecatedTest.java @@ -24,12 +24,11 @@ import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.api.sensor.SensorEvent; import org.apache.brooklyn.api.sensor.SensorEventListener; +import org.apache.brooklyn.core.entity.EntityAsserts; 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.enricher.stock.SensorPropagatingEnricher; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.javalang.AtomicReferences; import org.testng.annotations.BeforeMethod; @@ -55,11 +54,11 @@ public class SensorPropagatingEnricherDeprecatedTest extends BrooklynAppUnitTest // name propagated entity.sensors().set(TestEntity.NAME, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); + EntityAsserts.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); // sequence not propagated entity.sensors().set(TestEntity.SEQUENCE, 2); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 100), app, TestEntity.SEQUENCE, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 100), app, TestEntity.SEQUENCE, null); } @Test @@ -70,8 +69,8 @@ public class SensorPropagatingEnricherDeprecatedTest extends BrooklynAppUnitTest entity.sensors().set(TestEntity.NAME, "foo"); entity.sensors().set(TestEntity.SEQUENCE, 2); - EntityTestUtils.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(app, TestEntity.SEQUENCE, 2); + EntityAsserts.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); + EntityAsserts.assertAttributeEqualsEventually(app, TestEntity.SEQUENCE, 2); // notification-sensor propagated final AtomicReference<Integer> notif = new AtomicReference<Integer>(); @@ -89,11 +88,11 @@ public class SensorPropagatingEnricherDeprecatedTest extends BrooklynAppUnitTest // name propagated entity.sensors().set(TestEntity.NAME, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); + EntityAsserts.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); // sequence not propagated entity.sensors().set(TestEntity.SEQUENCE, 2); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 100), app, TestEntity.SEQUENCE, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 100), app, TestEntity.SEQUENCE, null); } @Test @@ -103,6 +102,6 @@ public class SensorPropagatingEnricherDeprecatedTest extends BrooklynAppUnitTest // name propagated as different attribute entity.sensors().set(TestEntity.NAME, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(app, ANOTHER_ATTRIBUTE, "foo"); + EntityAsserts.assertAttributeEqualsEventually(app, ANOTHER_ATTRIBUTE, "foo"); } } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/enricher/stock/SensorPropagatingEnricherTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/enricher/stock/SensorPropagatingEnricherTest.java b/core/src/test/java/org/apache/brooklyn/enricher/stock/SensorPropagatingEnricherTest.java index 4343127..42eeda7 100644 --- a/core/src/test/java/org/apache/brooklyn/enricher/stock/SensorPropagatingEnricherTest.java +++ b/core/src/test/java/org/apache/brooklyn/enricher/stock/SensorPropagatingEnricherTest.java @@ -25,12 +25,12 @@ import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.api.sensor.EnricherSpec; import org.apache.brooklyn.api.sensor.SensorEvent; import org.apache.brooklyn.api.sensor.SensorEventListener; +import org.apache.brooklyn.core.entity.EntityAsserts; import org.apache.brooklyn.core.sensor.BasicNotificationSensor; 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.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.javalang.AtomicReferences; @@ -61,11 +61,11 @@ public class SensorPropagatingEnricherTest extends BrooklynAppUnitTestSupport { // name propagated entity.sensors().set(TestEntity.NAME, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); + EntityAsserts.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); // sequence not propagated entity.sensors().set(TestEntity.SEQUENCE, 2); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 100), app, TestEntity.SEQUENCE, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 100), app, TestEntity.SEQUENCE, null); } @Test @@ -78,7 +78,7 @@ public class SensorPropagatingEnricherTest extends BrooklynAppUnitTestSupport { .build()); // name propagated - EntityTestUtils.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); + EntityAsserts.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); } @Test @@ -92,8 +92,8 @@ public class SensorPropagatingEnricherTest extends BrooklynAppUnitTestSupport { entity.sensors().set(TestEntity.NAME, "foo"); entity.sensors().set(TestEntity.SEQUENCE, 2); - EntityTestUtils.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(app, TestEntity.SEQUENCE, 2); + EntityAsserts.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); + EntityAsserts.assertAttributeEqualsEventually(app, TestEntity.SEQUENCE, 2); // notification-sensor propagated final AtomicReference<Integer> notif = new AtomicReference<Integer>(); @@ -117,7 +117,7 @@ public class SensorPropagatingEnricherTest extends BrooklynAppUnitTestSupport { entity.sensors().set(dynamicAttribute, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(app, dynamicAttribute, "foo"); + EntityAsserts.assertAttributeEqualsEventually(app, dynamicAttribute, "foo"); // notification-sensor propagated final AtomicReference<String> notif = new AtomicReference<String>(); @@ -138,11 +138,11 @@ public class SensorPropagatingEnricherTest extends BrooklynAppUnitTestSupport { // name propagated entity.sensors().set(TestEntity.NAME, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); + EntityAsserts.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); // sequence not propagated entity.sensors().set(TestEntity.SEQUENCE, 2); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 100), app, TestEntity.SEQUENCE, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 100), app, TestEntity.SEQUENCE, null); } @Test @@ -156,7 +156,7 @@ public class SensorPropagatingEnricherTest extends BrooklynAppUnitTestSupport { // name propagated as different attribute entity.sensors().set(TestEntity.NAME, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(app, ANOTHER_ATTRIBUTE, "foo"); + EntityAsserts.assertAttributeEqualsEventually(app, ANOTHER_ATTRIBUTE, "foo"); } @Test @@ -169,11 +169,11 @@ public class SensorPropagatingEnricherTest extends BrooklynAppUnitTestSupport { // name propagated entity.sensors().set(TestEntity.NAME, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); + EntityAsserts.assertAttributeEqualsEventually(app, TestEntity.NAME, "foo"); // sequence not propagated entity.sensors().set(TestEntity.SEQUENCE, 2); - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 100), app, TestEntity.SEQUENCE, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 100), app, TestEntity.SEQUENCE, null); } @Test @@ -189,14 +189,14 @@ public class SensorPropagatingEnricherTest extends BrooklynAppUnitTestSupport { // name propagated as alternative sensor entity.sensors().set(TestEntity.NAME, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(app, ANOTHER_ATTRIBUTE, "foo"); + EntityAsserts.assertAttributeEqualsEventually(app, ANOTHER_ATTRIBUTE, "foo"); // sequence also propagated entity.sensors().set(TestEntity.SEQUENCE, 2); - EntityTestUtils.assertAttributeEqualsEventually(app, TestEntity.SEQUENCE, 2); + EntityAsserts.assertAttributeEqualsEventually(app, TestEntity.SEQUENCE, 2); // name not propagated as original sensor - EntityTestUtils.assertAttributeEqualsContinually(MutableMap.of("timeout", 100), app, TestEntity.NAME, null); + EntityAsserts.assertAttributeEqualsContinually(MutableMap.of("timeout", 100), app, TestEntity.NAME, null); } @Test @@ -224,7 +224,7 @@ public class SensorPropagatingEnricherTest extends BrooklynAppUnitTestSupport { .from(entity) .build()); entity.sensors().set(origSensor, "myval"); - EntityTestUtils.assertAttributeEqualsEventually(app, targetSensor, "myval"); + EntityAsserts.assertAttributeEqualsEventually(app, targetSensor, "myval"); } @Test @@ -261,8 +261,8 @@ public class SensorPropagatingEnricherTest extends BrooklynAppUnitTestSupport { .propagating(ImmutableMap.of(sourceSensorFromYaml, targetSensor)) .from(app) .build()); - EntityTestUtils.assertAttributeEqualsEventually(app, targetSensor, entity.sensors().get(TestEntity.NAME)); + EntityAsserts.assertAttributeEqualsEventually(app, targetSensor, entity.sensors().get(TestEntity.NAME)); entity.sensors().set(TestEntity.NAME, "newName"); - EntityTestUtils.assertAttributeEqualsEventually(app, targetSensor, "newName"); + EntityAsserts.assertAttributeEqualsEventually(app, targetSensor, "newName"); } } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/enricher/stock/TransformingEnricherTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/enricher/stock/TransformingEnricherTest.java b/core/src/test/java/org/apache/brooklyn/enricher/stock/TransformingEnricherTest.java index 74ea6ff..a236edb 100644 --- a/core/src/test/java/org/apache/brooklyn/enricher/stock/TransformingEnricherTest.java +++ b/core/src/test/java/org/apache/brooklyn/enricher/stock/TransformingEnricherTest.java @@ -20,12 +20,11 @@ package org.apache.brooklyn.enricher.stock; 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.location.SimulatedLocation; import org.apache.brooklyn.core.sensor.BasicAttributeSensor; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.enricher.stock.Enrichers; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.math.MathFunctions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,6 +65,6 @@ public class TransformingEnricherTest extends BrooklynAppUnitTestSupport { .computing((Function)MathFunctions.times(2)) // TODO doesn't match strongly typed int->long .build()); - EntityTestUtils.assertAttributeEqualsEventually(producer, target, 6L); + EntityAsserts.assertAttributeEqualsEventually(producer, target, 6L); } } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/enricher/stock/reducer/ReducerTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/enricher/stock/reducer/ReducerTest.java b/core/src/test/java/org/apache/brooklyn/enricher/stock/reducer/ReducerTest.java index 2b9f32b..cdc26c2 100644 --- a/core/src/test/java/org/apache/brooklyn/enricher/stock/reducer/ReducerTest.java +++ b/core/src/test/java/org/apache/brooklyn/enricher/stock/reducer/ReducerTest.java @@ -25,16 +25,14 @@ import javax.annotation.Nullable; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.api.sensor.EnricherSpec; +import org.apache.brooklyn.core.entity.EntityAsserts; 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.enricher.stock.Enrichers; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.exceptions.Exceptions; -import org.apache.brooklyn.util.text.StringFunctions; -import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -69,13 +67,13 @@ public class ReducerTest extends BrooklynAppUnitTestSupport { ) ); - EntityTestUtils.assertAttributeEquals(entity, STR3, null); + EntityAsserts.assertAttributeEquals(entity, STR3, null); entity.sensors().set(STR1, "foo"); - EntityTestUtils.assertAttributeEqualsContinually(entity, STR3, null); + EntityAsserts.assertAttributeEqualsContinually(entity, STR3, null); entity.sensors().set(STR2, "bar"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR3, "foobar"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR3, "foobar"); } @Test @@ -88,13 +86,13 @@ public class ReducerTest extends BrooklynAppUnitTestSupport { .build() ); - EntityTestUtils.assertAttributeEquals(entity, STR3, null); + EntityAsserts.assertAttributeEquals(entity, STR3, null); entity.sensors().set(STR1, "foo"); - EntityTestUtils.assertAttributeEqualsContinually(entity, STR3, null); + EntityAsserts.assertAttributeEqualsContinually(entity, STR3, null); entity.sensors().set(STR2, "bar"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR3, "foobar"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR3, "foobar"); } @Test @@ -107,13 +105,13 @@ public class ReducerTest extends BrooklynAppUnitTestSupport { .build() ); - EntityTestUtils.assertAttributeEquals(entity, INT1, null); + EntityAsserts.assertAttributeEquals(entity, INT1, null); entity.sensors().set(STR1, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(entity, INT1, 3); + EntityAsserts.assertAttributeEqualsEventually(entity, INT1, 3); entity.sensors().set(STR2, "bar"); - EntityTestUtils.assertAttributeEqualsEventually(entity, INT1, 6); + EntityAsserts.assertAttributeEqualsEventually(entity, INT1, 6); } @Test @@ -126,13 +124,13 @@ public class ReducerTest extends BrooklynAppUnitTestSupport { .build() ); - EntityTestUtils.assertAttributeEquals(entity, STR3, null); + EntityAsserts.assertAttributeEquals(entity, STR3, null); entity.sensors().set(STR1, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR3, "foo-null"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR3, "foo-null"); entity.sensors().set(STR2, "bar"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR3, "foo-bar"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR3, "foo-bar"); } @Test @@ -144,13 +142,13 @@ public class ReducerTest extends BrooklynAppUnitTestSupport { .publishing(STR3) .build() ); - EntityTestUtils.assertAttributeEquals(entity, STR3, null); + EntityAsserts.assertAttributeEquals(entity, STR3, null); entity.sensors().set(STR1, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR3, "foo, null"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR3, "foo, null"); entity.sensors().set(STR2, "bar"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR3, "foo, bar"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR3, "foo, bar"); } @Test @@ -163,13 +161,13 @@ public class ReducerTest extends BrooklynAppUnitTestSupport { .publishing(STR3) .build() ); - EntityTestUtils.assertAttributeEquals(entity, STR3, null); + EntityAsserts.assertAttributeEquals(entity, STR3, null); entity.sensors().set(STR1, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR3, "foo, null"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR3, "foo, null"); entity.sensors().set(STR2, "bar"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR3, "foo, bar"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR3, "foo, bar"); } @Test @@ -182,13 +180,13 @@ public class ReducerTest extends BrooklynAppUnitTestSupport { .build() ); - EntityTestUtils.assertAttributeEquals(entity, STR3, null); + EntityAsserts.assertAttributeEquals(entity, STR3, null); entity.sensors().set(STR1, "foo"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR3, "hello, foo and null"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR3, "hello, foo and null"); entity.sensors().set(STR2, "bar"); - EntityTestUtils.assertAttributeEqualsEventually(entity, STR3, "hello, foo and bar"); + EntityAsserts.assertAttributeEqualsEventually(entity, STR3, "hello, foo and bar"); } @Test http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java index b58c630..5624038 100644 --- a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java +++ b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java @@ -49,6 +49,7 @@ import org.apache.brooklyn.api.mgmt.Task; import org.apache.brooklyn.api.sensor.SensorEvent; 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.RecordingSensorEventListener; import org.apache.brooklyn.core.entity.factory.EntityFactory; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; @@ -63,7 +64,6 @@ import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.core.test.entity.TestEntityImpl; import org.apache.brooklyn.entity.stock.BasicEntity; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.collections.MutableSet; import org.apache.brooklyn.util.collections.QuorumCheck.QuorumChecks; @@ -169,7 +169,7 @@ public class DynamicClusterTest extends BrooklynAppUnitTestSupport { .configure(DynamicCluster.INITIAL_SIZE, 0)); cluster.start(ImmutableList.of(loc)); - EntityTestUtils.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); assertTrue(cluster.getAttribute(Attributes.SERVICE_UP)); } @@ -279,7 +279,7 @@ public class DynamicClusterTest extends BrooklynAppUnitTestSupport { app.subscriptions().subscribe(cluster, Attributes.SERVICE_STATE_ACTUAL, r); cluster.start(ImmutableList.of(loc)); - EntityTestUtils.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); for (SensorEvent<Lifecycle> evt: r.getEvents()) { if (evt.getValue()==Lifecycle.ON_FIRE) Assert.fail("Should not have published " + Lifecycle.ON_FIRE + " during normal start up: " + r.getEvents()); @@ -1020,7 +1020,7 @@ public class DynamicClusterTest extends BrooklynAppUnitTestSupport { .configure(DynamicCluster.INITIAL_SIZE, 2)); cluster.start(ImmutableList.of(loc)); - EntityTestUtils.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); assertTrue(cluster.getAttribute(Attributes.SERVICE_UP)); } @@ -1045,7 +1045,7 @@ public class DynamicClusterTest extends BrooklynAppUnitTestSupport { .configure(DynamicCluster.INITIAL_SIZE, 3)); cluster.start(ImmutableList.of(loc)); - EntityTestUtils.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); + EntityAsserts.assertAttributeEqualsEventually(cluster, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); assertTrue(cluster.getAttribute(Attributes.SERVICE_UP)); assertEquals(cluster.getMembers().size(), 3); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/entity/group/GroupPickUpEntitiesTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/GroupPickUpEntitiesTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/GroupPickUpEntitiesTest.java index 68db69a..81ca90d 100644 --- a/core/src/test/java/org/apache/brooklyn/entity/group/GroupPickUpEntitiesTest.java +++ b/core/src/test/java/org/apache/brooklyn/entity/group/GroupPickUpEntitiesTest.java @@ -26,14 +26,13 @@ import org.apache.brooklyn.api.policy.PolicySpec; import org.apache.brooklyn.api.sensor.SensorEvent; import org.apache.brooklyn.api.sensor.SensorEventListener; 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.trait.Startable; import org.apache.brooklyn.core.policy.AbstractPolicy; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.group.BasicGroup; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.javalang.Boxing; import org.testng.Assert; import org.testng.annotations.BeforeMethod; @@ -61,31 +60,31 @@ public class GroupPickUpEntitiesTest extends BrooklynAppUnitTestSupport { @Test public void testGroupFindsElement() { Assert.assertEquals(group.getMembers().size(), 0); - EntityTestUtils.assertAttributeEquals(group, BasicGroup.GROUP_SIZE, 0); + EntityAsserts.assertAttributeEquals(group, BasicGroup.GROUP_SIZE, 0); final TestEntity e1 = app.createAndManageChild(EntitySpec.create(TestEntity.class)); - EntityTestUtils.assertAttributeEquals(group, BasicGroup.GROUP_SIZE, 0); + EntityAsserts.assertAttributeEquals(group, BasicGroup.GROUP_SIZE, 0); e1.sensors().set(Startable.SERVICE_UP, true); e1.sensors().set(TestEntity.NAME, "bob"); - EntityTestUtils.assertAttributeEqualsEventually(group, BasicGroup.GROUP_SIZE, 1); + EntityAsserts.assertAttributeEqualsEventually(group, BasicGroup.GROUP_SIZE, 1); Asserts.assertEqualsIgnoringOrder(group.getAttribute(BasicGroup.GROUP_MEMBERS), ImmutableList.of(e1)); final TestEntity e2 = app.createAndManageChild(EntitySpec.create(TestEntity.class)); - EntityTestUtils.assertAttributeEquals(group, BasicGroup.GROUP_SIZE, 1); + EntityAsserts.assertAttributeEquals(group, BasicGroup.GROUP_SIZE, 1); Assert.assertEquals(group.getMembers().size(), 1); Assert.assertTrue(group.getMembers().contains(e1)); e2.sensors().set(Startable.SERVICE_UP, true); e2.sensors().set(TestEntity.NAME, "fred"); - EntityTestUtils.assertAttributeEquals(group, BasicGroup.GROUP_SIZE, 1); + EntityAsserts.assertAttributeEquals(group, BasicGroup.GROUP_SIZE, 1); e2.sensors().set(TestEntity.NAME, "BOB"); - EntityTestUtils.assertAttributeEqualsEventually(group, BasicGroup.GROUP_SIZE, 2); + EntityAsserts.assertAttributeEqualsEventually(group, BasicGroup.GROUP_SIZE, 2); Asserts.succeedsEventually(new Runnable() { public void run() { // must use "succeedsEventually" because size + members attributes are set sequentially in another thread; http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/entity/stock/DataEntityTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/entity/stock/DataEntityTest.java b/core/src/test/java/org/apache/brooklyn/entity/stock/DataEntityTest.java index 5d19d43..366645d 100644 --- a/core/src/test/java/org/apache/brooklyn/entity/stock/DataEntityTest.java +++ b/core/src/test/java/org/apache/brooklyn/entity/stock/DataEntityTest.java @@ -28,14 +28,13 @@ import org.apache.brooklyn.api.location.LocationSpec; import org.apache.brooklyn.api.mgmt.ManagementContext; 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.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.location.SimulatedLocation; import org.apache.brooklyn.core.sensor.Sensors; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; -import org.apache.brooklyn.entity.stock.DataEntity; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableMap; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -87,7 +86,7 @@ public class DataEntityTest { reference.set("new"); - EntityTestUtils.assertAttributeEqualsEventually(entity, stringSensor, "new"); + EntityAsserts.assertAttributeEqualsEventually(entity, stringSensor, "new"); } @Test http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/42089916/core/src/test/java/org/apache/brooklyn/feed/function/FunctionFeedTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/feed/function/FunctionFeedTest.java b/core/src/test/java/org/apache/brooklyn/feed/function/FunctionFeedTest.java index d2e82aa..19fc3d6 100644 --- a/core/src/test/java/org/apache/brooklyn/feed/function/FunctionFeedTest.java +++ b/core/src/test/java/org/apache/brooklyn/feed/function/FunctionFeedTest.java @@ -36,16 +36,13 @@ import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.api.sensor.Feed; import org.apache.brooklyn.api.sensor.SensorEvent; import org.apache.brooklyn.api.sensor.SensorEventListener; +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.FunctionFeed; -import org.apache.brooklyn.feed.function.FunctionFeedTest; -import org.apache.brooklyn.feed.function.FunctionPollConfig; import org.apache.brooklyn.test.Asserts; -import org.apache.brooklyn.test.EntityTestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -150,7 +147,7 @@ public class FunctionFeedTest extends BrooklynAppUnitTestSupport { .onSuccess(new AddOneFunction())) .build(); - EntityTestUtils.assertAttributeEqualsEventually(entity, SENSOR_INT, 124); + EntityAsserts.assertAttributeEqualsEventually(entity, SENSOR_INT, 124); } @Test @@ -186,7 +183,7 @@ public class FunctionFeedTest extends BrooklynAppUnitTestSupport { .onFailure(Functions.constant(-1))) .build(); - EntityTestUtils.assertAttributeEqualsEventually(entity, SENSOR_INT, -1); + EntityAsserts.assertAttributeEqualsEventually(entity, SENSOR_INT, -1); } @Test @@ -201,7 +198,7 @@ public class FunctionFeedTest extends BrooklynAppUnitTestSupport { .onException(Functions.constant(-1))) .build(); - EntityTestUtils.assertAttributeEqualsEventually(entity, SENSOR_INT, -1); + EntityAsserts.assertAttributeEqualsEventually(entity, SENSOR_INT, -1); } @Test
