brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [24/27] brooklyn-server git commit: expand tests for completeness
Date Fri, 30 Jun 2017 14:03:12 GMT
expand tests for completeness


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

Branch: refs/heads/master
Commit: 178aeeecbc68eb91b5cb0f91806c7689e0e40973
Parents: fb3dcbe
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Thu Jun 29 09:53:31 2017 +0100
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Thu Jun 29 09:53:31 2017 +0100

----------------------------------------------------------------------
 .../camp/brooklyn/ReferencedYamlTest.java       | 78 ++++++++++++++++++--
 1 file changed, 72 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/178aeeec/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 50888a8..3480368 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
@@ -96,6 +96,24 @@ public class ReferencedYamlTest extends AbstractYamlTest {
             "  id: yaml.reference",
             "  version: " + TEST_VERSION,
             "  itemType: entity",
+            "  item: classpath://yaml-ref-entity.yaml");
+        
+        String entityName = "YAML -> catalog item -> yaml url";
+        Entity app = createAndStartApplication(
+            "services:",
+            "- name: " + entityName,
+            "  type: " + ver("yaml.reference"));
+        
+        checkChildEntitySpec(app, entityName);
+    }
+    
+    @Test
+    public void testCatalogReferencingYamlUrlAsType() throws Exception {
+        addCatalogItems(
+            "brooklyn.catalog:",
+            "  id: yaml.reference",
+            "  version: " + TEST_VERSION,
+            "  itemType: entity",
             "  item:",
             "    type: classpath://yaml-ref-entity.yaml");
         
@@ -152,7 +170,7 @@ public class ReferencedYamlTest extends AbstractYamlTest {
     }
     
     @Test(groups="WIP") // references to earlier items only work with short form syntax
-    public void testYamlReferencingEarlierItemLongForm() throws Exception {
+    public void testYamlReferencingEarlierItemLongFormEntity() throws Exception {
         addCatalogItems(
             "brooklyn.catalog:",
             "  itemType: entity",
@@ -165,6 +183,33 @@ public class ReferencedYamlTest extends AbstractYamlTest {
             "  - id: yaml.reference",
             "    version: " + TEST_VERSION,
             "    item:",
+            // deliberately: discouraged syntax for itemType entity
+            "      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  // references work fine with templates because we don't parse templates
+    public void testYamlReferencingEarlierItemLongFormTemplate() throws Exception {
+        addCatalogItems(
+            "brooklyn.catalog:",
+            "  itemType: template",
+            "  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");
 
@@ -178,7 +223,7 @@ public class ReferencedYamlTest extends AbstractYamlTest {
     }
 
     @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 {
+    public void testYamlReferencingEarlierItemInUrl() throws Exception {
         addCatalogItems(
             "brooklyn.catalog:",
             "  itemType: entity",
@@ -186,13 +231,34 @@ public class ReferencedYamlTest extends AbstractYamlTest {
             "  - id: yaml.basic",
             "    version: " + TEST_VERSION,
             "    item:",
-            "      services:",
-            "      - type: org.apache.brooklyn.entity.stock.BasicApplication",
+            "      type: org.apache.brooklyn.entity.stock.BasicApplication",
+            "  - id: yaml.reference",
+            "    version: " + TEST_VERSION,
+            "    item: classpath://yaml-ref-catalog.yaml");  // this references yaml.basic
above
+
+        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 testYamlReferencingEarlierItemInUrlAsType() throws Exception {
+        addCatalogItems(
+            "brooklyn.catalog:",
+            "  itemType: entity",
+            "  items:",
+            "  - id: yaml.basic",
+            "    version: " + TEST_VERSION,
+            "    item:",
+            "      type: org.apache.brooklyn.entity.stock.BasicApplication",
             "  - id: yaml.reference",
             "    version: " + TEST_VERSION,
             "    item:",
-            "      services:",
-            "      - type: classpath://yaml-ref-catalog.yaml");  // this references yaml.basic
above
+            "      type: classpath://yaml-ref-catalog.yaml");  // this references yaml.basic
above
 
         String entityName = "YAML -> catalog item -> yaml url";
         Entity app = createAndStartApplication(


Mime
View raw message