Skip to content

Commit

Permalink
Use Dumper.dumpInfo instead of Entities.dumpInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
aledsage committed Oct 19, 2017
1 parent 7017d80 commit 84eb1d0
Show file tree
Hide file tree
Showing 29 changed files with 87 additions and 79 deletions.
Expand Up @@ -27,6 +27,7 @@
import org.apache.brooklyn.api.mgmt.Task;
import org.apache.brooklyn.camp.spi.Assembly;
import org.apache.brooklyn.camp.spi.AssemblyTemplate;
import org.apache.brooklyn.core.entity.Dumper;
import org.apache.brooklyn.core.entity.Entities;
import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
import org.apache.brooklyn.core.mgmt.internal.BrooklynShutdownHooks;
Expand Down Expand Up @@ -109,7 +110,7 @@ public Application launchAppYaml(Reader input, boolean waitForTasksToComplete) {
}

log.info("Application started from YAML: "+app);
Entities.dumpInfo(app);
Dumper.dumpInfo(app);
return (Application)app;
} catch (Exception e) {
throw Exceptions.propagate(e);
Expand Down
Expand Up @@ -34,7 +34,7 @@
import org.apache.brooklyn.camp.brooklyn.spi.creation.CampTypePlanTransformer;
import org.apache.brooklyn.camp.spi.PlatformRootSummary;
import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
import org.apache.brooklyn.core.entity.Entities;
import org.apache.brooklyn.core.entity.Dumper;
import org.apache.brooklyn.core.entity.StartableApplication;
import org.apache.brooklyn.core.entity.trait.Startable;
import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
Expand Down Expand Up @@ -185,7 +185,7 @@ protected Entity createStartWaitAndLogApplication(Reader input) throws Exception
waitForApplicationTasks(app);

getLogger().info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

return app;
}
Expand Down
Expand Up @@ -22,7 +22,7 @@

import org.apache.brooklyn.api.entity.Entity;
import org.apache.brooklyn.core.config.ConfigKeys;
import org.apache.brooklyn.core.entity.Entities;
import org.apache.brooklyn.core.entity.Dumper;
import org.apache.brooklyn.core.entity.EntityInternal;
import org.apache.brooklyn.entity.group.DynamicCluster;
import org.apache.brooklyn.entity.software.base.SoftwareProcess;
Expand Down Expand Up @@ -53,7 +53,7 @@ public void testCatalogNoParameter() throws Exception {
public void testCatalogParameterFromSuperYamlType() throws Exception {
addCatalogItems( loadYaml("config-nested-test.bom") );
Entity ent = doTestWithBlueprint( "services: [ { type: test-map-parameter } ]", false);
Entities.dumpInfo(ent);
Dumper.dumpInfo(ent);
}

@Test
Expand All @@ -77,7 +77,7 @@ protected void checkTemplates(EntityInternal ent) {
public void testCatalogParameterFromSuperYamlTypeInCluster() throws Exception {
addCatalogItems( loadYaml("config-nested-test.bom") );
Entity cluster = makeBlueprint("services: [ { type: test-cluster-with-map-parameter } ]");
Entities.dumpInfo(cluster.getApplication());
Dumper.dumpInfo(cluster.getApplication());
Entity parentInCluster = Iterables.getOnlyElement( ((DynamicCluster)cluster).getMembers() );
Entity target = Iterables.getOnlyElement(parentInCluster.getChildren());
checkEntity( target, false );
Expand All @@ -88,7 +88,7 @@ public void testCatalogParameterFromSuperYamlTypeInCluster() throws Exception {
public void testCatalogParameterFromSuperYamlTypeAsSoftware() throws Exception {
addCatalogItems( loadYaml("config-nested-test.bom") );
Entity ent = doTestWithBlueprint( "services: [ { type: test-map-parameter-software } ]", false);
Entities.dumpInfo(ent);
Dumper.dumpInfo(ent);
}

@Test
Expand Down
Expand Up @@ -29,7 +29,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;

import org.apache.brooklyn.api.entity.Entity;
import org.apache.brooklyn.api.entity.EntitySpec;
Expand All @@ -46,7 +45,7 @@
import org.apache.brooklyn.core.config.ConstraintViolationException;
import org.apache.brooklyn.core.entity.AbstractEntity;
import org.apache.brooklyn.core.entity.BrooklynConfigKeys;
import org.apache.brooklyn.core.entity.Entities;
import org.apache.brooklyn.core.entity.Dumper;
import org.apache.brooklyn.core.location.PortRanges;
import org.apache.brooklyn.core.sensor.Sensors;
import org.apache.brooklyn.core.test.entity.TestEntity;
Expand Down Expand Up @@ -875,7 +874,7 @@ public void testManuallyAdd() throws Exception {
TestEntity entity2 = entity1.addChild(EntitySpec.create(TestEntity.class));
entity2.start(Collections.<Location>emptyList());

Entities.dumpInfo(app);
Dumper.dumpInfo(app);

LOG.info("E1 keys: "+entity1.getEntityType().getConfigKeys());
LOG.info("E2 keys: "+entity2.getEntityType().getConfigKeys());
Expand Down Expand Up @@ -904,7 +903,7 @@ public void testManuallyAddWithParentFromCatalog() throws Exception {
TestEntity entity2 = entity1.addChild(EntitySpec.create(TestEntity.class));
entity2.start(Collections.<Location>emptyList());

Entities.dumpInfo(app);
Dumper.dumpInfo(app);

LOG.info("E1 keys: "+entity1.getEntityType().getConfigKeys());
LOG.info("E2 keys: "+entity2.getEntityType().getConfigKeys());
Expand Down Expand Up @@ -941,7 +940,7 @@ public void testManuallyAddInTaskOfOtherEntity() throws Exception {
})
.get();

Entities.dumpInfo(app);
Dumper.dumpInfo(app);

LOG.info("E1 keys: "+entity1.getEntityType().getConfigKeys());
LOG.info("E2 keys: "+entity2.getEntityType().getConfigKeys());
Expand Down
Expand Up @@ -39,6 +39,7 @@
import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.core.config.ConfigKeys;
import org.apache.brooklyn.core.entity.Attributes;
import org.apache.brooklyn.core.entity.Dumper;
import org.apache.brooklyn.core.entity.Entities;
import org.apache.brooklyn.core.entity.EntityAsserts;
import org.apache.brooklyn.core.entity.EntityInternal;
Expand Down Expand Up @@ -101,7 +102,7 @@ protected Entity setupAndCheckTestEntityInBasicYamlWith(String... extras) throws
Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Assert.assertTrue(app.getChildren().iterator().hasNext(), "Expected app to have child entity");
Entity entity = app.getChildren().iterator().next();
Expand Down
Expand Up @@ -28,7 +28,7 @@
import org.apache.brooklyn.core.config.ConfigKeys;
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.Dumper;
import org.apache.brooklyn.core.entity.EntityAsserts;
import org.apache.brooklyn.core.location.Locations;
import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess;
Expand Down Expand Up @@ -77,7 +77,7 @@ public void testProvisioningProperties() throws Exception {
waitForApplicationTasks(app);

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

EmptySoftwareProcess entity = (EmptySoftwareProcess) app.getChildren().iterator().next();
Map<String, Object> pp = entity.getConfig(EmptySoftwareProcess.PROVISIONING_PROPERTIES);
Expand All @@ -99,7 +99,7 @@ public void testWithAppAndEntityLocations() throws Exception {
" sshToolClass: "+RecordingSshTool.class.getName(),
"location: byon:(hosts=\"127.0.0.1\", name=loopback on app)");
waitForApplicationTasks(app);
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Location appLocation = Iterables.getOnlyElement(app.getLocations());
Assert.assertEquals(appLocation.getDisplayName(), "loopback on app");
Expand Down
Expand Up @@ -26,6 +26,7 @@
import org.apache.brooklyn.api.sensor.AttributeSensor;
import org.apache.brooklyn.api.sensor.Enricher;
import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.core.entity.Dumper;
import org.apache.brooklyn.core.entity.Entities;
import org.apache.brooklyn.core.entity.EntityAdjuncts;
import org.apache.brooklyn.core.entity.EntityAsserts;
Expand Down Expand Up @@ -60,7 +61,7 @@ public void testWithAppEnricher() throws Exception {
Assert.assertEquals(app.getDisplayName(), "test-app-with-enricher");

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Assert.assertEquals(EntityAdjuncts.getNonSystemEnrichers(app).size(), 1);
final Enricher enricher = EntityAdjuncts.getNonSystemEnrichers(app).iterator().next();
Expand Down Expand Up @@ -95,7 +96,7 @@ public void testWithEntityEnricher() throws Exception {
Assert.assertEquals(app.getDisplayName(), "test-entity-with-enricher");

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Assert.assertEquals(EntityAdjuncts.getNonSystemEnrichers(app).size(), 0);
Assert.assertEquals(app.getChildren().size(), 1);
Expand Down Expand Up @@ -139,7 +140,7 @@ public void testWithEntityEnricherAndParameters() throws Exception {

log.info("App started:");
final Entity parentEntity = app.getChildren().iterator().next();
Entities.dumpInfo(app);
Dumper.dumpInfo(app);
Assert.assertTrue(parentEntity instanceof TestEntity, "Expected parent entity to be TestEntity, found:" + parentEntity);
parentEntity.sensors().set(TestEntity.SEQUENCE, 1234);
Asserts.eventually(Entities.attributeSupplier(parentEntity, Sensors.newStringSensor("main.uri")), Predicates.<String>equalTo("http://www.example.org:1234/"));
Expand Down Expand Up @@ -177,7 +178,7 @@ public void testWithTransformerValueFunctionUsingDsl() throws Exception {

log.info("App started:");
final TestEntity entity = (TestEntity) app.getChildren().iterator().next();
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

entity.sensors().set(sourceSensor, "STANDBY"); // trigger enricher
EntityAsserts.assertAttributeEqualsEventually(entity, targetSensor, "not master");
Expand Down Expand Up @@ -213,7 +214,7 @@ public void testWithTransformerEventFunctionUsingDsl() throws Exception {

log.info("App started:");
final TestEntity entity = (TestEntity) app.getChildren().iterator().next();
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

entity.sensors().set(otherSensor, "myval");
entity.sensors().set(sourceSensor, "any-val"); // trigger enricher
Expand All @@ -231,7 +232,7 @@ public void testPropagatingEnricher() throws Exception {
Assert.assertEquals(app.getDisplayName(), "test-propagating-enricher");

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);
TestEntity entity = (TestEntity)app.getChildren().iterator().next();
entity.sensors().set(TestEntity.NAME, "New Name");
Asserts.eventually(Entities.attributeSupplier(app, TestEntity.NAME), Predicates.<String>equalTo("New Name"));
Expand All @@ -256,7 +257,7 @@ public void testPropogateChildSensor() throws Exception {
waitForApplicationTasks(app);

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);
Assert.assertEquals(app.getChildren().size(), 1);
final Entity parentEntity = app.getChildren().iterator().next();
Assert.assertTrue(parentEntity instanceof TestEntity, "Expected parent entity to be TestEntity, found:" + parentEntity);
Expand Down
Expand Up @@ -44,6 +44,7 @@
import org.apache.brooklyn.core.config.ConfigKeys;
import org.apache.brooklyn.core.effector.Effectors;
import org.apache.brooklyn.core.entity.Attributes;
import org.apache.brooklyn.core.entity.Dumper;
import org.apache.brooklyn.core.entity.Entities;
import org.apache.brooklyn.core.entity.EntityFunctions;
import org.apache.brooklyn.core.entity.EntityInternal;
Expand Down Expand Up @@ -88,12 +89,12 @@ protected Entity setupAndCheckTestEntityInBasicYamlWith(String ...extras) throws
Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml", extras));
waitForApplicationTasks(app);

Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Assert.assertTrue(app.getChildren().iterator().hasNext(), "Expected app to have child entity");
Entity entity = app.getChildren().iterator().next();
Expand Down Expand Up @@ -238,7 +239,7 @@ public void testEmptyConfig() throws Exception {
Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Entity entity = app.getChildren().iterator().next();
Assert.assertNotNull(entity, "Expected app to have child entity");
Expand Down Expand Up @@ -269,7 +270,7 @@ public void testEmptyStructuredConfig() throws Exception {
Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Entity entity = app.getChildren().iterator().next();
Assert.assertNotNull(entity, "Expected app to have child entity");
Expand All @@ -293,7 +294,7 @@ public void testSensor() throws Exception {
Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Entity entity = app.getChildren().iterator().next();
Assert.assertNotNull(entity, "Expected app to have child entity");
Expand All @@ -313,7 +314,7 @@ public void testSensorOnArbitraryClass() throws Exception {
waitForApplicationTasks(app);

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

TestEntity entity = (TestEntity) app.getChildren().iterator().next();
Object object = entity.getConfig(TestEntity.CONF_OBJECT);
Expand Down Expand Up @@ -413,7 +414,7 @@ public void testWithInitConfig() throws Exception {
Assert.assertNotNull(testWithConfigInit, "Expected app to contain TestEntityWithInitConfig child");
Assert.assertEquals(testWithConfigInit.getEntityCachedOnInit(), testEntity);
log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);
}

@Test
Expand Down Expand Up @@ -448,7 +449,7 @@ public void testMultipleReferences() throws Exception {
final Entity app = createAndStartApplication(loadYaml("test-referencing-entities.yaml"));
waitForApplicationTasks(app);

Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Assert.assertEquals(app.getDisplayName(), "test-referencing-entities");

Expand Down
Expand Up @@ -23,6 +23,7 @@
import org.apache.brooklyn.api.entity.Entity;
import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.core.config.ConfigKeys;
import org.apache.brooklyn.core.entity.Dumper;
import org.apache.brooklyn.core.entity.Entities;
import org.apache.brooklyn.core.entity.EntityPredicates;
import org.apache.brooklyn.core.sensor.Sensors;
Expand Down Expand Up @@ -157,7 +158,7 @@ public void testRefToRelative() throws Exception {
" id: "+duplicatedId,
" name: entity2.2");

Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Entity entity1 = Iterables.find(Entities.descendantsAndSelf(app), EntityPredicates.displayNameEqualTo("entity1"));
Entity entity1_1 = Iterables.find(Entities.descendantsAndSelf(app), EntityPredicates.displayNameEqualTo("entity1.1"));
Expand Down
Expand Up @@ -27,6 +27,7 @@
import org.apache.brooklyn.api.mgmt.Task;
import org.apache.brooklyn.camp.spi.Assembly;
import org.apache.brooklyn.camp.spi.AssemblyTemplate;
import org.apache.brooklyn.core.entity.Dumper;
import org.apache.brooklyn.core.entity.Entities;
import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
Expand Down Expand Up @@ -101,7 +102,7 @@ public void testJavaWebAppDeployAndRebind() throws Exception {

Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(mgmt().getExecutionManager(), app);
for (Task<?> t: tasks) t.blockUntilEnded();
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Application app2 = rebind(app);
Assert.assertEquals(app2.getChildren().size(), 2);
Expand All @@ -118,7 +119,7 @@ public void testJavaWebWithMemberSpecRebind() throws Exception {

Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(mgmt().getExecutionManager(), app);
for (Task<?> t: tasks) t.blockUntilEnded();
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Application app2 = rebind(app);
Assert.assertEquals(app2.getChildren().size(), 2);
Expand Down
Expand Up @@ -22,6 +22,7 @@
import java.util.concurrent.Callable;

import org.apache.brooklyn.api.entity.Entity;
import org.apache.brooklyn.core.entity.Dumper;
import org.apache.brooklyn.core.entity.Entities;
import org.apache.brooklyn.core.test.entity.TestEntity;
import org.apache.brooklyn.entity.stock.BasicEntity;
Expand All @@ -44,7 +45,7 @@ protected Entity setupAndCheckTestEntityInBasicYamlWith(String ...extras) throws
Assert.assertEquals(app.getDisplayName(), "test-entity-reference-map-template");

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Assert.assertEquals(Iterables.size(app.getChildren()), 3, "Expected app to have child entity");
Iterable<BasicEntity> basicEntities = Iterables.filter(app.getChildren(), BasicEntity.class);
Expand Down
Expand Up @@ -32,7 +32,7 @@
import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
import org.apache.brooklyn.core.config.ConfigKeys;
import org.apache.brooklyn.core.entity.Entities;
import org.apache.brooklyn.core.entity.Dumper;
import org.apache.brooklyn.core.mgmt.ManagementContextInjectable;
import org.apache.brooklyn.core.test.entity.TestEntity;
import org.apache.brooklyn.util.collections.MutableList;
Expand Down Expand Up @@ -213,7 +213,7 @@ protected Entity setupAndCheckTestEntityInBasicYamlWith(String ...extras) throws
Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");

log.info("App started:");
Entities.dumpInfo(app);
Dumper.dumpInfo(app);

Assert.assertTrue(app.getChildren().iterator().hasNext(), "Expected app to have child entity");
Entity entity = app.getChildren().iterator().next();
Expand Down

0 comments on commit 84eb1d0

Please sign in to comment.