[
https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15946876#comment-15946876
]
ASF GitHub Bot commented on BROOKLYN-460:
-----------------------------------------
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.
> Brooklyn Camp syntax for adding tags to an entity spec
> ------------------------------------------------------
>
> Key: BROOKLYN-460
> URL: https://issues.apache.org/jira/browse/BROOKLYN-460
> Project: Brooklyn
> Issue Type: New Feature
> Reporter: Valentin Aitken
> Priority: Minor
>
> Current requirement is to be able to supply String tags in an entity spec in
> YAML so it can be then retrieved via REST API with {{GET
> /v1/applications/<appId>/entities/<entityId>/tags}}.
> Example usage in a YAML blueprint:
> {noformat}
> services:
> - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
> brooklyn.tags:
> - tag1
> - tag2
> {noformat}
> Please shout if you have further requirements for {{brooklyn.tags}}.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)