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 6E8E6200C46 for ; Wed, 29 Mar 2017 12:10:32 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6CDFC160B8A; Wed, 29 Mar 2017 10:10:32 +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 B6252160B7C for ; Wed, 29 Mar 2017 12:10:31 +0200 (CEST) Received: (qmail 75350 invoked by uid 500); 29 Mar 2017 10:10:31 -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 75338 invoked by uid 99); 29 Mar 2017 10:10:30 -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; Wed, 29 Mar 2017 10:10:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8FD73DFDCD; Wed, 29 Mar 2017 10:10:30 +0000 (UTC) From: bostko To: dev@brooklyn.apache.org Reply-To: dev@brooklyn.apache.org References: In-Reply-To: Subject: [GitHub] brooklyn-server pull request #612: BROOKLYN-460: Brooklyn Camp syntax for ad... Content-Type: text/plain Message-Id: <20170329101030.8FD73DFDCD@git1-us-west.apache.org> Date: Wed, 29 Mar 2017 10:10:30 +0000 (UTC) archived-at: Wed, 29 Mar 2017 10:10:32 -0000 Github user bostko commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/612#discussion_r108639142 --- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java --- @@ -66,6 +71,63 @@ public void testDslSelf() throws Exception { } @Test + public void testDslSingleTag() throws Exception { + final Entity app = createAndStartApplication( + "services:", + "- type: " + BasicApplication.class.getName(), + " brooklyn.tags:", + " - hi"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("hi"))); + } + + @Test + public void testDslMultipleTags() throws Exception { + final Entity app = createAndStartApplication( + "services:", + "- type: " + BasicApplication.class.getName(), + " brooklyn.tags:", + " - tag1", + " - tAg2"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("tag1"))); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("tAg2"))); + } + + @Test + public void testDslTagsFailNonList() throws Exception { + try { + final Entity app = createAndStartApplication( + "services:", + "- type: " + BasicApplication.class.getName(), + " brooklyn.tags:", + " tag1: true", + " tag2: 2"); + assertTrue(getTagsEventually(app).contains(BrooklynTags.newNotesTag("test tag 1"))); + fail("Should throw IllegalArgumentException exception."); + } catch (CompoundRuntimeException e) { + Asserts.assertStringContainsAtLeastOne(Exceptions.getFirstInteresting(e).getMessage(),"brooklyn.tags must be a list, is: "); + } + } + + @Test + public void testDslFailObjectTags() throws Exception { + try { + final Entity app = createAndStartApplication( + "services:", + "- type: " + BasicApplication.class.getName(), + " brooklyn.tags:", + " - tag1", + " - $brooklyn:object:", --- End diff -- I introduced only String tags since normally only types defined in `org.apache.brooklyn.core.mgmt.BrooklynTags` are used for tags. --- 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. ---