brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject brooklyn-server git commit: add test for entity reference, and test tidy
Date Mon, 17 Jul 2017 10:19:04 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 4d256e402 -> 2dbfe7cdb


add test for entity reference, and test tidy


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/2dbfe7cd
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/2dbfe7cd
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/2dbfe7cd

Branch: refs/heads/master
Commit: 2dbfe7cdb98b02089a8257b0ab8978053e591f7f
Parents: 4d256e4
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Mon Jul 17 11:18:03 2017 +0100
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Mon Jul 17 11:18:03 2017 +0100

----------------------------------------------------------------------
 .../camp/brooklyn/spi/dsl/DslYamlTest.java      | 32 +++++++++++++++++++-
 .../camp/brooklyn/spi/dsl/TagsYamlTest.java     |  4 +--
 2 files changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2dbfe7cd/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java
index f7ec4c8..c995c11 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java
@@ -41,6 +41,7 @@ import org.apache.brooklyn.core.test.entity.TestApplication;
 import org.apache.brooklyn.entity.stock.BasicApplication;
 import org.apache.brooklyn.entity.stock.BasicEntity;
 import org.apache.brooklyn.test.Asserts;
+import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.exceptions.CompoundRuntimeException;
 import org.apache.brooklyn.util.guava.Maybe;
 import org.testng.annotations.Test;
@@ -279,6 +280,18 @@ public class DslYamlTest extends AbstractYamlTest {
     }
 
     @Test
+    public void testDslConfigInMap() throws Exception {
+        final Entity app = createAndStartApplication(
+                "services:",
+                "- type: " + BasicApplication.class.getName(),
+                "  brooklyn.config:",
+                "    source: myvalue",
+                "    dest:",
+                "      key: $brooklyn:config(\"source\")");
+        assertEquals(getConfigEventually(app, DEST), MutableMap.of("key", "myvalue"));
+    }
+
+    @Test
     public void testDslConfigOnEntity() throws Exception {
         final Entity app = createAndStartApplication(
                 "services:",
@@ -306,7 +319,7 @@ public class DslYamlTest extends AbstractYamlTest {
     }
 
     @Test
-    public void testDslConfigOnEntityWithDeferredArg() throws Exception {
+    public void testDslConfigOnEntityWithDeferredArgAsEntityId() throws Exception {
         final Entity app = createAndStartApplication(
                 "services:",
                 "- type: " + BasicApplication.class.getName(),
@@ -323,6 +336,23 @@ public class DslYamlTest extends AbstractYamlTest {
     }
 
     @Test
+    public void testDslConfigOnEntityWithDeferredArgAsEntity() throws Exception {
+        final Entity app = createAndStartApplication(
+                "services:",
+                "- type: " + BasicApplication.class.getName(),
+                "  brooklyn.config:",
+                "    entityValue: $brooklyn:entity(\"sourceEntity\")",
+                "    configName: source",
+                "    dest: $brooklyn:entity(config(\"entityValue\")).config(config(\"configName\"))",
+                "  brooklyn.children:",
+                "  - type: " + BasicEntity.class.getName(),
+                "    id: sourceEntity",
+                "    brooklyn.config:",
+                "      source: myvalue");
+        assertEquals(getConfigEventually(app, DEST), "myvalue");
+    }
+
+    @Test
     public void testDslAttributeWhenReady() throws Exception {
         final Entity app = createAndStartApplication(
                 "services:",

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2dbfe7cd/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/TagsYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/TagsYamlTest.java
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/TagsYamlTest.java
index b384a8b..f6d06d3 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/TagsYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/TagsYamlTest.java
@@ -64,7 +64,7 @@ public class TagsYamlTest extends AbstractYamlTest {
                     "  brooklyn.tags:",
                     "    tag1: true",
                     "    tag2: 2");
-            fail("Should throw IllegalArgumentException exception.");
+            fail("Should throw IllegalArgumentException exception; instead got: "+app);
         } catch (CompoundRuntimeException e) {
             Asserts.assertStringContainsAtLeastOne(Exceptions.getFirstInteresting(e).getMessage(),"brooklyn.tags
must be a list, is: ");
         }
@@ -112,7 +112,7 @@ public class TagsYamlTest extends AbstractYamlTest {
                     "      type: "+TagsTestObject.class.getName(),
                     "      constructor.args:",
                     "      - $brooklyn:attributeWhenReady(\"host.name\")");
-            fail("Should throw IllegalArgumentException exception.");
+            fail("Should throw IllegalArgumentException exception; instead got "+app);
         } catch (CompoundRuntimeException e) {
             Asserts.assertStringContainsAtLeastOne(Exceptions.getFirstInteresting(e).getMessage(),"brooklyn.tags
should not contain DeferredSupplier. A DeferredSupplier is made when using $brooklyn:attributeWhenReady");
         }


Mime
View raw message