private void testLocationUnmanagedOnStop(LocationSpec<? extends Location> locationSpec) {
    EntitySpec<BasicApplication> appSpec =
        EntitySpec.create(BasicApplication.class)
            .location(locationSpec)
            .child(
                EntitySpec.create(EmptySoftwareProcess.class)
                    .configure(BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION, Boolean.TRUE)
                    .configure(EmptySoftwareProcess.USE_SSH_MONITORING, Boolean.FALSE));

    BasicApplication app = mgmt.getEntityManager().createEntity(appSpec);
    Entity child = Iterables.getOnlyElement(app.getChildren());

    Assert.assertEquals(child.getLocations(), ImmutableList.of());

    app.start(ImmutableList.<Location>of());
    Location appLocation = Iterables.getOnlyElement(app.getLocations());
    assertOwned(app, appLocation);
    Location entityLocation = Iterables.getOnlyElement(child.getLocations());
    // No owner tag because it's created by SoftwareProcess, not by Brooklyn internals
    assertNotOwned(entityLocation);
    app.stop();

    Assert.assertEquals(child.getLocations(), ImmutableList.of());

    Assert.assertFalse(mgmt.getEntityManager().isManaged(child));
    Assert.assertFalse(mgmt.getEntityManager().isManaged(app));
    Set<Location> locs = ImmutableSet.copyOf(mgmt.getLocationManager().getLocations());
    Assert.assertFalse(
        locs.contains(entityLocation), locs + " should not contain " + entityLocation);
    Assert.assertFalse(locs.contains(appLocation), locs + " should not contain " + appLocation);
  }
  @Override
  public void initApp() {
    StringConfigMap config = getManagementContext().getConfig();

    GeoscalingDnsService geoDns =
        addChild(
            EntitySpec.create(GeoscalingDnsService.class)
                .displayName("GeoScaling DNS")
                .configure(
                    "username",
                    checkNotNull(config.getFirst("brooklyn.geoscaling.username"), "username"))
                .configure(
                    "password",
                    checkNotNull(config.getFirst("brooklyn.geoscaling.password"), "password"))
                .configure(
                    "primaryDomainName",
                    checkNotNull(
                        config.getFirst("brooklyn.geoscaling.primaryDomain"), "primaryDomain"))
                .configure("smartSubdomainName", "brooklyn"));

    DynamicRegionsFabric webFabric =
        addChild(
            EntitySpec.create(DynamicRegionsFabric.class)
                .displayName("Web Fabric")
                .configure(DynamicRegionsFabric.FACTORY, new ElasticJavaWebAppService.Factory())

                // specify the WAR file to use
                .configure(
                    JavaWebAppService.ROOT_WAR, Entities.getRequiredUrlConfig(this, WAR_PATH)));

    // tell GeoDNS what to monitor
    geoDns.setTargetEntityProvider(webFabric);
  }
 @Test
 public void testUnresolvedCatalogItemParameters() {
   // Insert template which is not instantiatable during catalog addition due to
   // missing dependencies, but the spec can be created (the
   // dependencies are already parsed).
   addCatalogItems(
       "brooklyn.catalog:",
       "  version: " + TEST_VERSION,
       "  items:",
       "  - id: " + SYMBOLIC_NAME,
       "    itemType: template",
       "    item:",
       "      services:",
       "      - type: basic-app",
       "  - id: basic-app",
       "    itemType: entity",
       "    item:",
       "      type: " + ConfigAppForTest.class.getName());
   EntitySpec<? extends Application> spec =
       createAppSpec("services:", "- type: " + ver(SYMBOLIC_NAME));
   List<SpecParameter<?>> params = spec.getParameters();
   assertEquals(
       params.size(),
       4,
       "Wrong number of params: "
           + params); // sample + defaultDisplayName + destroy_on_stop + start.latch
   assertEquals(
       ImmutableSet.copyOf(params),
       ImmutableSet.copyOf(BasicSpecParameter.fromClass(mgmt(), ConfigAppForTest.class)));
 }
 @Test
 public void testStartsWhenNoStartableChildren() {
   BasicStartable startable =
       app.createAndManageChild(
           EntitySpec.create(BasicStartable.class).child(EntitySpec.create(BasicEntity.class)));
   app.start(ImmutableList.of(app.newSimulatedLocation()));
   EntityAsserts.assertAttributeEquals(
       startable, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
 }
  @Test
  public void testDefaultIsAllLocations() throws Exception {
    BasicStartable startable = app.addChild(EntitySpec.create(BasicStartable.class));
    TestEntity entity = startable.addChild(EntitySpec.create(TestEntity.class));
    TestEntity entity2 = startable.addChild(EntitySpec.create(TestEntity.class));
    app.start(ImmutableList.of(loc1, loc2));

    assertEqualsIgnoringOrder(entity.getLocations(), ImmutableSet.of(loc1, loc2));
    assertEqualsIgnoringOrder(entity2.getLocations(), ImmutableSet.of(loc1, loc2));
  }
 @Test
 public void testAppServiceParameters() throws Exception {
   EntitySpec<? extends Application> spec =
       createAppSpec(
           "services:",
           "- type: " + BasicApplication.class.getName(),
           "  brooklyn.parameters:",
           "  - simple");
   List<SpecParameter<?>> inputs = spec.getParameters();
   assertEquals(inputs.size(), 4);
   SpecParameter<?> firstInput = inputs.get(0);
   assertEquals(firstInput.getLabel(), "simple");
 }
示例#7
0
  @Override
  public void init() {
    LOG.info("Starting Calico network id {}", getId());
    super.init();

    EntitySpec<?> agentSpec =
        EntitySpec.create(config().get(CALICO_NODE_SPEC)).configure(CalicoNode.SDN_PROVIDER, this);
    String calicoVersion = config().get(CALICO_VERSION);
    if (Strings.isNonBlank(calicoVersion)) {
      agentSpec.configure(SoftwareProcess.SUGGESTED_VERSION, calicoVersion);
    }
    sensors().set(SDN_AGENT_SPEC, agentSpec);
  }
 @Override
 @BeforeMethod(alwaysRun = true)
 public void setUp() throws Exception {
   super.setUp();
   origCluster =
       origApp.createAndManageChild(
           EntitySpec.create(DynamicCluster.class)
               .configure("memberSpec", EntitySpec.create(TestEntity.class)));
   origEntity = origApp.createAndManageChild(EntitySpec.create(TestEntity.class));
   origLoc =
       origManagementContext
           .getLocationManager()
           .createLocation(LocationSpec.create(SimulatedLocation.class));
 }
  private Response launch(String yaml, EntitySpec<? extends Application> spec) {
    try {
      Application app = EntityManagementUtils.createUnstarted(mgmt(), spec);
      CreationResult<Application, Void> result = EntityManagementUtils.start(app);

      boolean isEntitled =
          Entitlements.isEntitled(
              mgmt().getEntitlementManager(),
              Entitlements.INVOKE_EFFECTOR,
              EntityAndItem.of(app, StringAndArgument.of(Startable.START.getName(), null)));

      if (!isEntitled) {
        throw WebResourceUtils.unauthorized(
            "User '%s' is not authorized to start application %s",
            Entitlements.getEntitlementContext().user(), spec.getType());
      }

      log.info("Launched from YAML: " + yaml + " -> " + app + " (" + result.task() + ")");

      URI ref = URI.create(app.getApplicationId());
      ResponseBuilder response = created(ref);
      if (result.task() != null) response.entity(TaskTransformer.FROM_TASK.apply(result.task()));
      return response.build();
    } catch (ConstraintViolationException e) {
      throw new UserFacingException(e);
    } catch (Exception e) {
      throw Exceptions.propagate(e);
    }
  }
  // TODO BROOKLYN-272, Disabled, because fails non-deterministically in jenkins: BROOKLYN-256
  //    java.lang.AssertionError: Expected: eventually IsEqualTo([starting, running, stopping,
  // stopped]); got most recently: [starting, running, starting, running, stopping, stopped] (waited
  // 1s 11ms 498us 762ns, checked 100)
  //        at org.apache.brooklyn.test.Asserts.fail(Asserts.java:721)
  //        at org.apache.brooklyn.test.Asserts.eventually(Asserts.java:791)
  //        at org.apache.brooklyn.test.Asserts.eventually(Asserts.java:751)
  //        at
  // org.apache.brooklyn.entity.stock.BasicStartableTest.testTransitionsThroughLifecycles(BasicStartableTest.java:170)
  @Test(groups = {"Broken"})
  public void testTransitionsThroughLifecycles() throws Exception {
    BasicStartable startable = app.addChild(EntitySpec.create(BasicStartable.class));
    EntityAsserts.assertAttributeEqualsEventually(
        app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED);

    final RecordingSensorEventListener<Lifecycle> listener =
        new RecordingSensorEventListener<Lifecycle>(true);
    mgmt.getSubscriptionContext(startable)
        .subscribe(startable, Attributes.SERVICE_STATE_ACTUAL, listener);

    app.start(ImmutableList.of(loc1));
    app.config().set(StartableApplication.DESTROY_ON_STOP, false);
    app.stop();

    Iterable<Lifecycle> expected =
        Lists.newArrayList(
            Lifecycle.STARTING, Lifecycle.RUNNING, Lifecycle.STOPPING, Lifecycle.STOPPED);
    Asserts.eventually(
        new Supplier<Iterable<Lifecycle>>() {
          @Override
          public Iterable<Lifecycle> get() {
            return MutableList.copyOf(listener.getEventValuesSortedByTimestamp());
          }
        },
        Predicates.equalTo(expected));
  }
  /** Test that a core can be created and used with SolrJ client. */
  @Test(groups = "Integration")
  public void testConnection() throws Exception {
    solr =
        app.createAndManageChild(
            EntitySpec.create(SolrServer.class)
                .configure(
                    SolrServer.SOLR_CORE_CONFIG,
                    ImmutableMap.of("example", "classpath://solr/example.tgz")));
    app.start(ImmutableList.of(testLocation));

    EntityAsserts.assertAttributeEqualsEventually(solr, Startable.SERVICE_UP, true);

    SolrJSupport client = new SolrJSupport(solr, "example");

    Iterable<SolrDocument> results = client.getDocuments();
    assertTrue(Iterables.isEmpty(results));

    client.addDocument(MutableMap.<String, Object>of("id", "1", "description", "first"));
    client.addDocument(MutableMap.<String, Object>of("id", "2", "description", "second"));
    client.addDocument(MutableMap.<String, Object>of("id", "3", "description", "third"));
    client.commit();

    results = client.getDocuments();
    assertEquals(Iterables.size(results), 3);
  }
  @BeforeMethod(alwaysRun = true)
  public void setUp() throws Exception {
    events = new CopyOnWriteArrayList<SensorEvent<FailureDescriptor>>();

    managementContext = new LocalManagementContextForTests();
    app = ApplicationBuilder.newManagedApp(TestApplication.class, managementContext);
    e1 = app.createAndManageChild(EntitySpec.create(TestEntity.class));
    e1.sensors().set(TestEntity.SERVICE_UP, true);
    ServiceStateLogic.setExpectedState(e1, Lifecycle.RUNNING);

    app.getManagementContext()
        .getSubscriptionManager()
        .subscribe(
            e1,
            HASensors.ENTITY_FAILED,
            new SensorEventListener<FailureDescriptor>() {
              @Override
              public void onEvent(SensorEvent<FailureDescriptor> event) {
                events.add(event);
              }
            });
    app.getManagementContext()
        .getSubscriptionManager()
        .subscribe(
            e1,
            HASensors.ENTITY_RECOVERED,
            new SensorEventListener<FailureDescriptor>() {
              @Override
              public void onEvent(SensorEvent<FailureDescriptor> event) {
                events.add(event);
              }
            });
  }
 @BeforeMethod(alwaysRun = true)
 @Override
 public void setUp() throws Exception {
   super.setUp();
   loc = new LocalhostMachineProvisioningLocation();
   entity = app.createAndManageChild(EntitySpec.create(TestEntity.class));
   app.start(ImmutableList.of(loc));
 }
  @Override
  protected void doTest(Location loc) throws Exception {
    RiakNode entity =
        app.createAndManageChild(
            EntitySpec.create(RiakNode.class).configure(RiakNode.SUGGESTED_VERSION, "2.1.1"));
    app.start(ImmutableList.of(loc));

    EntityTestUtils.assertAttributeEqualsEventually(entity, RiakNode.SERVICE_UP, true);
  }
  @Test
  public void testAppSpecInheritsCatalogRootParameters() {
    addCatalogItems(
        "brooklyn.catalog:",
        "  id: " + SYMBOLIC_NAME,
        "  version: " + TEST_VERSION,
        "  itemType: entity",
        "  item:",
        "    type: " + BasicApplication.class.getName(),
        "    brooklyn.parameters:",
        "    - simple");

    EntitySpec<? extends Application> spec =
        createAppSpec("services:", "- type: " + ver(SYMBOLIC_NAME));
    List<SpecParameter<?>> params = spec.getParameters();
    assertEquals(params.size(), 4);
    assertTrue(Iterables.tryFind(params, nameEqualTo("simple")).isPresent());
    assertTrue(Iterables.tryFind(params, labelEqualTo("simple")).isPresent());
  }
 @BeforeMethod(alwaysRun = true)
 @Override
 public void setUp() throws Exception {
   catalogPersistenceWasEnabled =
       BrooklynFeatureEnablement.isEnabled(
           BrooklynFeatureEnablement.FEATURE_CATALOG_PERSISTENCE_PROPERTY);
   BrooklynFeatureEnablement.enable(
       BrooklynFeatureEnablement.FEATURE_CATALOG_PERSISTENCE_PROPERTY);
   super.setUp();
   origApp.createAndManageChild(EntitySpec.create(TestEntity.class));
 }
示例#17
0
 @Override
 public void addHost(DockerHost host) {
   SshMachineLocation machine = host.getDynamicLocation().getMachine();
   EntitySpec<?> spec =
       EntitySpec.create(sensors().get(SDN_AGENT_SPEC))
           .configure(CalicoNode.DOCKER_HOST, host)
           .configure(CalicoNode.ETCD_NODE, host.sensors().get(DockerHost.ETCD_NODE));
   CalicoNode agent = (CalicoNode) getAgents().addChild(spec);
   getAgents().addMember(agent);
   agent.start(ImmutableList.of(machine));
   if (LOG.isDebugEnabled()) LOG.debug("{} added calico plugin {}", this, agent);
 }
  /** Test that a node starts and sets SERVICE_UP correctly. */
  @Test(groups = "Integration")
  public void canStartupAndShutdown() {
    solr = app.createAndManageChild(EntitySpec.create(SolrServer.class));
    app.start(ImmutableList.of(testLocation));

    EntityAsserts.assertAttributeEqualsEventually(solr, Startable.SERVICE_UP, true);
    Entities.dumpInfo(app);

    solr.stop();

    EntityAsserts.assertAttributeEqualsEventually(solr, Startable.SERVICE_UP, false);
  }
  @BeforeMethod(alwaysRun = true)
  @Override
  public void setUp() throws Exception {
    super.setUp();

    entities = Lists.newArrayList();
    for (int i = 0; i < 10; i++) {
      entities.add(app.createAndManageChild(EntitySpec.create(TestEntity.class)));
    }
    entity = entities.get(0);

    app.start(ImmutableList.of(loc));
  }
  @Test
  public void testAppliesFilterToEntities() throws Exception {
    final List<Object> contexts = Lists.newCopyOnWriteArrayList();

    LocationsFilter filter =
        new LocationsFilter() {
          private static final long serialVersionUID = 7078046521812992013L;

          @Override
          public List<Location> filterForContext(List<Location> locations, Object context) {
            contexts.add(context);
            assertEquals(locations, ImmutableList.of(loc1, loc2));
            if (context instanceof Entity) {
              String entityName = ((Entity) context).getDisplayName();
              if ("1".equals(entityName)) {
                return ImmutableList.<Location>of(loc1);
              } else if ("2".equals(entityName)) {
                return ImmutableList.<Location>of(loc2);
              } else {
                return ImmutableList.<Location>of();
              }
            } else {
              return ImmutableList.<Location>of();
            }
          }
        };
    BasicStartable startable =
        app.addChild(
            EntitySpec.create(BasicStartable.class)
                .configure(BasicStartable.LOCATIONS_FILTER, filter));
    TestEntity entity = startable.addChild(EntitySpec.create(TestEntity.class).displayName("1"));
    TestEntity entity2 = startable.addChild(EntitySpec.create(TestEntity.class).displayName("2"));
    app.start(ImmutableList.of(loc1, loc2));

    assertEqualsIgnoringOrder(entity.getLocations(), ImmutableSet.of(loc1));
    assertEqualsIgnoringOrder(entity2.getLocations(), ImmutableSet.of(loc2));
    assertEqualsIgnoringOrder(contexts, ImmutableList.of(entity, entity2));
  }
  @BeforeMethod(alwaysRun = true)
  public void setUp() throws Exception {
    jmxObjectName = new ObjectName(objectName);

    // Create an entity and configure it with the above JMX service
    app = TestApplication.Factory.newManagedInstanceForTests();
    entity =
        app.createAndManageChild(EntitySpec.create(TestEntity.class).impl(TestEntityWithJmx.class));
    app.start(ImmutableList.of(new SimulatedLocation()));

    jmxHelper = new JmxHelper(entity);

    jmxService = new JmxService(entity);
  }
  @Test
  public void testChildEntitiyHasParameters() {
    addCatalogItems(
        "brooklyn.catalog:",
        "  id: " + SYMBOLIC_NAME,
        "  version: " + TEST_VERSION,
        "  itemType: entity",
        "  item:",
        "    type: " + ConfigEntityForTest.class.getName(),
        "    brooklyn.children:",
        "    - type: " + ConfigEntityForTest.class.getName(),
        "      brooklyn.parameters:",
        "      - simple");

    CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION);
    @SuppressWarnings({"rawtypes", "unchecked"})
    EntitySpec<?> parentSpec = (EntitySpec<?>) catalog.createSpec((CatalogItem) item);
    EntitySpec<?> spec = parentSpec.getChildren().get(0);
    List<SpecParameter<?>> params = spec.getParameters();
    assertEquals(params.size(), 3);
    assertTrue(Iterables.tryFind(params, nameEqualTo("simple")).isPresent());
    assertTrue(Iterables.tryFind(params, labelEqualTo("simple")).isPresent());
  }
  @Test
  public void testIgnoresUnstartableEntities() throws Exception {
    final AtomicReference<Exception> called = new AtomicReference<Exception>();
    LocationsFilter filter =
        new LocationsFilter() {
          private static final long serialVersionUID = -5625121945234751178L;

          @Override
          public List<Location> filterForContext(List<Location> locations, Object context) {
            called.set(new Exception());
            return locations;
          }
        };
    BasicStartable startable =
        app.addChild(
            EntitySpec.create(BasicStartable.class)
                .configure(BasicStartable.LOCATIONS_FILTER, filter));
    BasicEntity entity = startable.addChild(EntitySpec.create(BasicEntity.class));
    app.start(ImmutableList.of(loc1, loc2));

    assertEqualsIgnoringOrder(entity.getLocations(), ImmutableSet.of());
    assertNull(called.get());
  }
示例#24
0
  public List<String> scanFrameworks(JsonArray frameworks) {
    List<String> frameworkNames = MutableList.<String>of();
    for (int i = 0; i < frameworks.size(); i++) {
      JsonObject task = frameworks.get(i).getAsJsonObject();
      String id = task.get("id").getAsString();
      JsonElement pidObj = task.get("pid");
      String pid = null;
      if (pidObj != null && !pidObj.isJsonNull()) {
        pid = pidObj.getAsString();
      }
      String name = task.get("name").getAsString();
      String url = task.get("webui_url").getAsString();
      frameworkNames.add(name);

      Optional<Entity> entity =
          Iterables.tryFind(
              sensors().get(MESOS_FRAMEWORKS).getMembers(),
              Predicates.compose(
                  Predicates.equalTo(id), EntityFunctions.attribute(MesosFramework.FRAMEWORK_ID)));
      if (entity.isPresent()) continue;

      EntitySpec<? extends MesosFramework> frameworkSpec =
          EntitySpec.create(
                  FRAMEWORKS.containsKey(name)
                      ? FRAMEWORKS.get(name)
                      : EntitySpec.create(MesosFramework.class))
              .configure(MesosFramework.FRAMEWORK_ID, id)
              .configure(MesosFramework.FRAMEWORK_PID, pid)
              .configure(MesosFramework.FRAMEWORK_NAME, name)
              .configure(MesosFramework.FRAMEWORK_URL, url)
              .configure(MesosFramework.MESOS_CLUSTER, this)
              .displayName(String.format("%s Framework", Strings.toInitialCapOnly(name)));
      MesosFramework added = sensors().get(MESOS_FRAMEWORKS).addMemberChild(frameworkSpec);
      added.start(ImmutableList.<Location>of());
    }
    return frameworkNames;
  }
  @Override
  protected void doTest(Location loc) throws Exception {
    MySqlNode mysql =
        app.createAndManageChild(
            EntitySpec.create(MySqlNode.class)
                .configure(
                    DatastoreCommon.CREATION_SCRIPT_CONTENTS, MySqlIntegrationTest.CREATION_SCRIPT)
                .configure("test.table.name", "COMMENTS"));

    app.start(ImmutableList.of(loc));

    new VogellaExampleAccess(
            "com.mysql.jdbc.Driver", mysql.getAttribute(DatastoreCommon.DATASTORE_URL))
        .readModifyAndRevertDataBase();
  }
  public static void main(String[] argv) {
    List<String> args = Lists.newArrayList(argv);
    String port = CommandLineUtil.getCommandLineOption(args, "--port", "8081+");
    String locations =
        CommandLineUtil.getCommandLineOption(
            args, "--locations", Joiner.on(",").join(DEFAULT_LOCATIONS));

    BrooklynLauncher launcher =
        BrooklynLauncher.newInstance()
            .application(
                EntitySpec.create(StartableApplication.class, GlobalWebFabricExample.class)
                    .displayName("Brooklyn Global Web Fabric Example"))
            .webconsolePort(port)
            .locations(Arrays.asList(locations))
            .start();

    Entities.dumpInfo(launcher.getApplications());
  }
@ImplementedBy(BrooklynClusterImpl.class)
public interface BrooklynCluster extends DynamicCluster {

  ConfigKey<EntitySpec<?>> MEMBER_SPEC =
      ConfigKeys.newConfigKeyWithDefault(
          DynamicCluster.MEMBER_SPEC, EntitySpec.create(BrooklynNode.class));

  AttributeSensor<BrooklynNode> MASTER_NODE =
      Sensors.newSensor(
          BrooklynNode.class,
          "brooklyncluster.master",
          "Pointer to the child node with MASTER state in the cluster");

  interface SelectMasterEffector {
    ConfigKey<String> NEW_MASTER_ID =
        ConfigKeys.newStringConfigKey(
            "brooklyncluster.new_master_id", "The ID of the node to become master", null);
    Effector<Void> SELECT_MASTER =
        Effectors.effector(Void.class, "selectMaster")
            .description("Select a new master in the cluster")
            .parameter(NEW_MASTER_ID)
            .buildAbstract();
  }

  Effector<Void> SELECT_MASTER = SelectMasterEffector.SELECT_MASTER;

  interface UpgradeClusterEffector {
    ConfigKey<String> DOWNLOAD_URL = BrooklynNode.DOWNLOAD_URL.getConfigKey();
    ConfigKey<Map<String, Object>> EXTRA_CONFIG = BrooklynNodeUpgradeEffectorBody.EXTRA_CONFIG;

    Effector<Void> UPGRADE_CLUSTER =
        Effectors.effector(Void.class, "upgradeCluster")
            .description(
                "Upgrade the cluster with new distribution version, "
                    + "by provisioning new nodes with the new version, failing over, "
                    + "and then deprovisioning the original nodes")
            .parameter(BrooklynNode.SUGGESTED_VERSION)
            .parameter(DOWNLOAD_URL)
            .parameter(EXTRA_CONFIG)
            .buildAbstract();
  }

  Effector<Void> UPGRADE_CLUSTER = UpgradeClusterEffector.UPGRADE_CLUSTER;
}
  @Test
  public void testEntityCreatingItsEnricherDoesNotReCreateItUnlessUniqueTagDifferent()
      throws Exception {
    TestEntity e1 =
        origApp.createAndManageChild(
            EntitySpec.create(TestEntity.class, MyTestEntityWithEnricher.class));
    Collection<Enricher> e1e = e1.getEnrichers();
    log.info("enrichers1: " + e1e);
    Entities.dumpInfo(e1);
    assertEquals(e1e.size(), 5);

    newApp = (TestApplication) rebind();
    Entity e2 =
        Iterables.getOnlyElement(
            Entities.descendants(newApp, EntityPredicates.idEqualTo(e1.getId())));
    Collection<Enricher> e2e = e2.getEnrichers();
    log.info("enrichers2: " + e2e);
    Entities.dumpInfo(e2);

    assertEquals(e2e.size(), e1e.size() + 1);
  }
 @Override
 public void init() {
   super.init();
   checkNotNull(
       getConfig(HOSTNAME_SENSOR),
       "%s requires value for %s",
       getClass().getName(),
       HOSTNAME_SENSOR);
   DynamicGroup entities =
       addChild(
           EntitySpec.create(DynamicGroup.class)
               .configure(DynamicGroup.ENTITY_FILTER, getEntityFilter()));
   setAttribute(ENTITIES, entities);
   setAttribute(A_RECORDS, ImmutableMap.<String, String>of());
   setAttribute(CNAME_RECORDS, ImmutableMultimap.<String, String>of());
   setAttribute(PTR_RECORDS, ImmutableMap.<String, String>of());
   setAttribute(ADDRESS_MAPPINGS, ImmutableMultimap.<String, String>of());
   synchronized (serialMutex) {
     setAttribute(SERIAL, System.currentTimeMillis());
   }
 }
 public RabbitQueue createQueue(Map properties) {
   RabbitQueue result = addChild(EntitySpec.create(RabbitQueue.class).configure(properties));
   result.create();
   return result;
 }