Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A7987200C2B for ; Thu, 2 Mar 2017 17:07:21 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A61E2160B6F; Thu, 2 Mar 2017 16:07:21 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id ED8D2160B61 for ; Thu, 2 Mar 2017 17:07:20 +0100 (CET) Received: (qmail 33502 invoked by uid 500); 2 Mar 2017 16:07:20 -0000 Mailing-List: contact dev-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list dev@brooklyn.apache.org Received: (qmail 33491 invoked by uid 99); 2 Mar 2017 16:07:19 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Mar 2017 16:07:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C8D00DFAB2; Thu, 2 Mar 2017 16:07:19 +0000 (UTC) From: neykov To: dev@brooklyn.apache.org Reply-To: dev@brooklyn.apache.org References: In-Reply-To: Subject: [GitHub] brooklyn-server pull request #573: Do not runtime-inherit catalog item Content-Type: text/plain Message-Id: <20170302160719.C8D00DFAB2@git1-us-west.apache.org> Date: Thu, 2 Mar 2017 16:07:19 +0000 (UTC) archived-at: Thu, 02 Mar 2017 16:07:21 -0000 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.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.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. ---