You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2017/06/30 14:03:11 UTC

[23/27] brooklyn-server git commit: add another catalog internal reference failure case and the corresponding working case

add another catalog internal reference failure case and the corresponding working case


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

Branch: refs/heads/master
Commit: fb3dcbebd876fbfbdf18598de359c954525fcb3d
Parents: 758b359
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Jun 28 16:47:24 2017 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Wed Jun 28 16:47:24 2017 +0100

----------------------------------------------------------------------
 .../camp/brooklyn/ReferencedYamlTest.java       | 52 +++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/fb3dcbeb/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencedYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencedYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencedYamlTest.java
index fc56564..50888a8 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencedYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ReferencedYamlTest.java
@@ -127,6 +127,56 @@ public class ReferencedYamlTest extends AbstractYamlTest {
         checkChildEntitySpec(app, entityName);
     }
 
+    @Test
+    public void testYamlReferencingEarlierItemShortForm() throws Exception {
+        addCatalogItems(
+            "brooklyn.catalog:",
+            "  itemType: entity",
+            "  items:",
+            "  - id: yaml.basic",
+            "    version: " + TEST_VERSION,
+            "    item:",
+            "      type: org.apache.brooklyn.entity.stock.BasicEntity",
+            "  - id: yaml.reference",
+            "    version: " + TEST_VERSION,
+            "    item:",
+            "      type: yaml.basic");
+
+        String entityName = "YAML -> catalog item -> yaml url";
+        Entity app = createAndStartApplication(
+            "services:",
+            "- name: " + entityName,
+            "  type: " + ver("yaml.reference"));
+        
+        checkChildEntitySpec(app, entityName);
+    }
+    
+    @Test(groups="WIP") // references to earlier items only work with short form syntax
+    public void testYamlReferencingEarlierItemLongForm() throws Exception {
+        addCatalogItems(
+            "brooklyn.catalog:",
+            "  itemType: entity",
+            "  items:",
+            "  - id: yaml.basic",
+            "    version: " + TEST_VERSION,
+            "    item:",
+            "      services:",
+            "      - type: org.apache.brooklyn.entity.stock.BasicEntity",
+            "  - id: yaml.reference",
+            "    version: " + TEST_VERSION,
+            "    item:",
+            "      services:",
+            "      - type: yaml.basic");
+
+        String entityName = "YAML -> catalog item -> yaml url";
+        Entity app = createAndStartApplication(
+            "services:",
+            "- name: " + entityName,
+            "  type: " + ver("yaml.reference"));
+        
+        checkChildEntitySpec(app, entityName);
+    }
+
     @Test(groups="WIP") //Not able to use caller provided catalog items when referencing entity specs (as opposed to catalog meta)
     public void testYamlUrlReferencingCallerCatalogItem() throws Exception {
         addCatalogItems(
@@ -152,7 +202,7 @@ public class ReferencedYamlTest extends AbstractYamlTest {
         
         checkChildEntitySpec(app, entityName);
     }
-
+    
     private void checkChildEntitySpec(Entity app, String entityName) {
         Collection<Entity> children = app.getChildren();
         Assert.assertEquals(children.size(), 1);