Github user kiuby88 commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/136#discussion_r65149965
  
    --- Diff: 
software/base/src/test/java/org/apache/brooklyn/entity/software/base/InboundPortsUtilsTest.java
 ---
    @@ -50,4 +46,23 @@ public void 
testGetRequiredOpenPortsGetsDynamicallyAddedKeys() {
             Collection<Integer> dynamicRequiredOpenPorts = 
InboundPortsUtils.getRequiredOpenPorts(entity, ImmutableSet.<ConfigKey<?>>of(), 
true, null);
             Assert.assertEquals(dynamicRequiredOpenPorts, 
ImmutableSet.of(9999), "Expected new port to be added");
         }
    +
    +    @Test
    +    public void 
testGetRequiredOpenPortsGetsDynamicallyAddedPortBasedKeys() {
    +        TestEntity entity = 
app.createAndManageChild(EntitySpec.create(TestEntity.class));
    +
    +        PortAttributeSensorAndConfigKey newTestConfigKeyPort = 
ConfigKeys.newPortSensorAndConfigKey("new.test.config.port.string.first", 
"port", "7777+");
    +        PortAttributeSensorAndConfigKey newTestConfigKeyPort2 = 
ConfigKeys.newPortSensorAndConfigKey("new.test.config.port.string.second", 
"port");
    +
    +        ConfigKey<String> newTestConfigKeyString = 
ConfigKeys.newStringConfigKey("new.test.config.key.string");
    +        entity.config().set(newTestConfigKeyPort, 
PortRanges.fromString("8888+"));
    +        entity.config().set(newTestConfigKeyPort2, 
PortRanges.fromInteger(9999));
    +        entity.config().set(newTestConfigKeyString, "foo.bar");
    +
    +        Collection<Integer> dynamicRequiredOpenPorts = 
InboundPortsUtils.getRequiredOpenPorts(entity, ImmutableSet.<ConfigKey<?>>of(), 
true, null);
    +        Assert.assertTrue(dynamicRequiredOpenPorts.contains(8888));
    +        Assert.assertTrue(dynamicRequiredOpenPorts.contains(9999));
    --- End diff --
    
    @aledsage thanks for the deep review. I have addressing all of your 
comments.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to