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

    https://github.com/apache/brooklyn-server/pull/139#discussion_r63777405
  
    --- Diff: 
camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
 ---
    @@ -804,6 +808,52 @@ public void testHardcodedCatalog() throws Exception {
                     "- type: vanilla");
         }
     
    +    @Test
    +    public void testItemWithBrooklynParameters() throws Exception {
    +        String id = "inline_version.app";
    +        String version = TEST_VERSION;
    +        addCatalogItems(
    +                "brooklyn.catalog:",
    +                "  id: " + id,
    +                "  version: " + TEST_VERSION,
    +                "  item:",
    +                "    brooklyn.parameters:",
    +                "    - name: test.myconf",
    +                "      type:  string",
    +                "      default: myval",
    +                "    services:",
    +                "    - type: " + BasicApplication.class.getName(),
    +                "      brooklyn.config:",
    +                "        myconf2: $brooklyn:config(\"test.myconf\")",
    +                "        myconf2.from.root: 
$brooklyn:root().config(\"test.myconf\")",
    +                "      brooklyn.children:",
    +                "      - type: "+BasicEntity.class.getName(),
    +                "        brooklyn.config:",
    +                "          myconf3: $brooklyn:config(\"test.myconf\")",
    +                "          myconf3.from.root: 
$brooklyn:root().config(\"test.myconf\")");
    +
    +        RegisteredType catalogItem = mgmt().getTypeRegistry().get(id, 
version);
    +        assertEquals(catalogItem.getVersion(), version);
    +        
    +        String yaml = "name: simple-app-yaml\n" +
    +                "location: localhost\n" +
    +                "services: \n" +
    +                "  - type: "+id+":"+version;
    +        Entity app = createAndStartApplication(yaml);
    +        Entity child = Iterables.getOnlyElement(app.getChildren());
    +        ConfigKey<?> configKey = 
app.getEntityType().getConfigKey("test.myconf");
    +        assertNotNull(configKey);
    +        assertEquals(app.config().get(configKey), "myval");
    +        
assertEquals(app.config().get(ConfigKeys.newStringConfigKey("myconf2.from.root")),
 "myval");
    +        
assertEquals(child.config().get(ConfigKeys.newStringConfigKey("myconf3.from.root")),
 "myval");
    +        
assertEquals(app.config().get(ConfigKeys.newStringConfigKey("myconf2")), 
"myval");
    --- End diff --
    
    The assertion for `myconf3` is commented out, because it fails. When we 
address BROOKLYN-267, then we can uncomment that.


---
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