Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/612#discussion_r108634898
--- 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 --
Does this fail because it can't parse the DSL, or because it has evaluated
it as a `TagsTestObject` instance, which is not a string?
If the latter, why forbid it? Tags can be any object in the java API.
---
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.
---