brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #573: Do not runtime-inherit catalog item
Date Thu, 02 Mar 2017 16:07:19 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/573#discussion_r103960527
  
    --- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
---
    @@ -792,6 +796,85 @@ public void testConfigParameterWithEntitySpecAsDefault() throws Exception
{
         }
         
         @Test
    +    public void testManuallyAddSpec() throws Exception {
    +        String yaml = Joiner.on("\n").join(
    +                "services:",
    +                "- type: "+TestEntity.class.getName());
    +
    +        Entity app = createStartWaitAndLogApplication(yaml);
    +        TestEntity entity1 = (TestEntity) Iterables.getOnlyElement(app.getChildren());
    +
    +        TestEntity entity2 = entity1.addChild(EntitySpec.create(TestEntity.class));
    +        entity2.start(Collections.<Location>emptyList());
    +        
    +        Entities.dumpInfo(app);
    +        
    +        LOG.info("E1 keys: "+entity1.getEntityType().getConfigKeys());
    +        LOG.info("E2 keys: "+entity2.getEntityType().getConfigKeys());
    +        Assert.assertEquals(entity2.getEntityType().getConfigKeys(), entity1.getEntityType().getConfigKeys());
    +    }
    +    
    +    @Test
    +    public void testManuallyAddSpecFromCatalog() throws Exception {
    +        addCatalogItems(
    +            "brooklyn.catalog:",
    +            "  itemType: entity",
    +            "  items:",
    +            "  - id: test-entity",
    +            "    item:",
    +            "      type: "+TestEntity.class.getName());
    +        
    +        String yaml = Joiner.on("\n").join(
    +                "services:",
    +                "- type: test-entity");
    +
    +        Entity app = createStartWaitAndLogApplication(yaml);
    +        TestEntity entity1 = (TestEntity) Iterables.getOnlyElement(app.getChildren());
    +
    +        TestEntity entity2 = entity1.addChild(EntitySpec.create(TestEntity.class));
    +        entity2.start(Collections.<Location>emptyList());
    +        
    +        Entities.dumpInfo(app);
    +        
    +        LOG.info("E1 keys: "+entity1.getEntityType().getConfigKeys());
    +        LOG.info("E2 keys: "+entity2.getEntityType().getConfigKeys());
    +        Assert.assertEquals(entity2.getEntityType().getConfigKeys(), entity1.getEntityType().getConfigKeys());
    --- End diff --
    
    Can you assert the `catalogItemId` of the entities as well.


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