@Test public void testCount() { @SuppressWarnings("unused") SoftwareProcess r1 = app.createAndManageChild(EntitySpec.create(SoftwareProcess.class, RestMockSimpleEntity.class)); SoftwareProcess r2 = app.createAndManageChild(EntitySpec.create(SoftwareProcess.class, RestMockSimpleEntity.class)); Entities.start(app, Arrays.<Location>asList(loc)); Entities.dumpInfo(app); log.info("r2loc: "+r2.getLocations()); log.info("props: "+((LocationInternal)r2.getLocations().iterator().next()).config().getBag().getAllConfig()); Map<Location, Integer> counts = new EntityLocationUtils(mgmt).countLeafEntitiesByLocatedLocations(); log.info("count: "+counts); assertEquals(ImmutableList.copyOf(counts.values()), ImmutableList.of(2), "counts="+counts); }
public Map<Location, Integer> countLeafEntitiesByLocatedLocations() { Map<Location, Integer> result = new LinkedHashMap<Location, Integer>(); for (Entity e: context.getApplications()) { countLeafEntitiesByLocatedLocations(e, null, result); } return result; }
EntityLocationUtils { public Map<Location, Integer> countLeafEntitiesByLocatedLocations() { Map<Location, Integer> result = new LinkedHashMap<Location, Integer>(); for (Entity e: context.getApplications()) { countLeafEntitiesByLocatedLocations(e, null, result); } return result; } }
EntityLocationUtils { public Map<Location, Integer> countLeafEntitiesByLocatedLocations() { Map<Location, Integer> result = new LinkedHashMap<Location, Integer>(); for (Entity e: context.getApplications()) { countLeafEntitiesByLocatedLocations(e, null, result); } return result; } EntityLocationUtils(ManagementContext ctx); }
EntityLocationUtils { public Map<Location, Integer> countLeafEntitiesByLocatedLocations() { Map<Location, Integer> result = new LinkedHashMap<Location, Integer>(); for (Entity e: context.getApplications()) { countLeafEntitiesByLocatedLocations(e, null, result); } return result; } EntityLocationUtils(ManagementContext ctx); Map<Location, Integer> countLeafEntitiesByLocatedLocations(); }
EntityLocationUtils { public Map<Location, Integer> countLeafEntitiesByLocatedLocations() { Map<Location, Integer> result = new LinkedHashMap<Location, Integer>(); for (Entity e: context.getApplications()) { countLeafEntitiesByLocatedLocations(e, null, result); } return result; } EntityLocationUtils(ManagementContext ctx); Map<Location, Integer> countLeafEntitiesByLocatedLocations();  }