brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #403: Adds DynamicFabric.includeInitialChildren...
Date Tue, 08 Nov 2016 10:07:12 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/403#discussion_r86957911
  
    --- Diff: core/src/test/java/org/apache/brooklyn/entity/group/DynamicRegionsFabricTest.java
---
    @@ -60,16 +64,98 @@ public void setUp() throws Exception {
         }
     
         @Test
    -    public void testUsesInitialLocations() throws Exception {
    +    public void testUsesInitialLocationsFromStartEffectorArgs() throws Exception {
             app.start(ImmutableList.of(loc1, loc2));
     
    -        assertEquals(fabric.getChildren().size(), 2, "children="+fabric.getChildren());
    -        assertEquals(fabric.getMembers().size(), 2, "members="+fabric.getMembers());
    -        assertEqualsIgnoringOrder(fabric.getChildren(), fabric.getMembers());
    -        assertEqualsIgnoringOrder(getLocationsOfChildren(fabric), ImmutableList.of(loc1,
loc2));
    +        assertFabricChildren(fabric, 2, ImmutableList.of(loc1, loc2));
    +    }
    +    
    +    @Test
    +    @SuppressWarnings("deprecation")
    +    public void testUsesInitialLocationsFromAppSpec() throws Exception {
    +        TestApplication app2 = mgmt.getEntityManager().createEntity(EntitySpec.create(TestApplication.class)
    +            .configure(BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION, true)
    +            .child(EntitySpec.create(DynamicRegionsFabric.class)
    +                .configure("memberSpec", EntitySpec.create(TestEntity.class)))
    +            .locations(ImmutableList.of(loc1, loc2)));
    +        DynamicRegionsFabric fabric2 = (DynamicRegionsFabric) Iterables.getOnlyElement(app2.getChildren());
    +        app2.start(ImmutableList.<Location>of());
    +        
    +        assertFabricChildren(fabric2, 2, ImmutableList.of(loc1, loc2));
         }
         
         @Test
    +    @SuppressWarnings("deprecation")
    +    public void testUsesInitialLocationsFromEntitySpec() throws Exception {
    --- End diff --
    
    Not quite the same. In `testUsesInitialLocationsFromAppSpec` we set the locations on the
app's spec. In `testUsesInitialLocationsFromEntitySpec` we set the locations on the fabric's
spec.
    
    Could refactor to remove duplication, but I think that it's probably simpler to have the
7 lines duplicated rather than a delegate method with an if-else block (given setting the
location is buried in the 5 lines required to build the spec).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message