You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2014/07/18 12:00:39 UTC

[03/10] git commit: Load URL referenced YAMLs.

Load URL referenced YAMLs.

Allow URL references to YAML files in addition to catalog IDs and java types.
Currently limited to services (PlatformComponentTemplate level).

In the case of more than one service in the referenced plan just use the wrapped app as a child.
The template referencing the yaml will override the name, IDs of the child. Locations, policies,
effectors, ect. will be appended to the child's config. Do the same for catalog item references.


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

Branch: refs/heads/master
Commit: 201717a367a501a5ee174656780a2e3555f04edd
Parents: b982e6f
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Wed Jul 16 11:55:40 2014 +0300
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Wed Jul 16 13:20:22 2014 +0300

----------------------------------------------------------------------
 .../camp/brooklyn/BrooklynCampConstants.java    |   5 +
 .../BrooklynAssemblyTemplateInstantiator.java   |  72 +++++++++--
 .../spi/creation/BrooklynEntityMatcher.java     |  21 +--
 .../camp/brooklyn/AbstractYamlTest.java         |  26 +++-
 .../brooklyn/camp/brooklyn/CatalogYamlTest.java |   8 --
 .../camp/brooklyn/ReferencedYamlTest.java       | 127 +++++++++++++++++++
 usage/camp/src/test/resources/yaml-ref-app.yaml |  21 +++
 .../src/test/resources/yaml-ref-catalog.yaml    |  21 +++
 .../src/test/resources/yaml-ref-entity.yaml     |  21 +++
 9 files changed, 291 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/201717a3/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/BrooklynCampConstants.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/BrooklynCampConstants.java b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/BrooklynCampConstants.java
index 9fcd5be..5a17cfe 100644
--- a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/BrooklynCampConstants.java
+++ b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/BrooklynCampConstants.java
@@ -18,6 +18,10 @@
  */
 package io.brooklyn.camp.brooklyn;
 
+import java.util.Set;
+
+import com.google.common.collect.ImmutableSet;
+
 import io.brooklyn.camp.CampPlatform;
 import brooklyn.config.BrooklynServerConfig;
 import brooklyn.config.ConfigKey;
@@ -39,4 +43,5 @@ public class BrooklynCampConstants {
 
     public static final ConfigKey<CampPlatform> CAMP_PLATFORM = BrooklynServerConfig.CAMP_PLATFORM;
 
+    public static final Set<String> YAML_URL_PROTOCOL_WHITELIST = ImmutableSet.of("classpath", "http");
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/201717a3/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
index d57a99b..d7eaeb3 100644
--- a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
+++ b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
@@ -19,15 +19,16 @@
 package io.brooklyn.camp.brooklyn.spi.creation;
 
 import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.AbstractResource;
+import io.brooklyn.camp.brooklyn.BrooklynCampConstants;
 import io.brooklyn.camp.spi.Assembly;
 import io.brooklyn.camp.spi.AssemblyTemplate;
 import io.brooklyn.camp.spi.AssemblyTemplate.Builder;
 import io.brooklyn.camp.spi.PlatformComponentTemplate;
 import io.brooklyn.camp.spi.collection.ResolvableLink;
 import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-import io.brooklyn.camp.spi.pdp.AssemblyTemplateConstructor;
 
+import java.io.IOException;
+import java.io.InputStreamReader;
 import java.io.Reader;
 import java.io.StringReader;
 import java.util.List;
@@ -43,22 +44,24 @@ import brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
 import brooklyn.catalog.BrooklynCatalog;
 import brooklyn.catalog.CatalogItem;
 import brooklyn.catalog.internal.BasicBrooklynCatalog.BrooklynLoaderTracker;
+import brooklyn.config.BrooklynServerConfig;
 import brooklyn.entity.Application;
 import brooklyn.entity.Entity;
 import brooklyn.entity.basic.BasicApplicationImpl;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.basic.EntityLocal;
-import brooklyn.entity.basic.StartableApplication;
 import brooklyn.entity.proxying.EntitySpec;
 import brooklyn.entity.trait.Startable;
 import brooklyn.management.ManagementContext;
 import brooklyn.management.Task;
 import brooklyn.management.classloading.BrooklynClassLoadingContext;
 import brooklyn.management.classloading.JavaBrooklynClassLoadingContext;
+import brooklyn.util.ResourceUtils;
 import brooklyn.util.collections.MutableList;
 import brooklyn.util.collections.MutableMap;
 import brooklyn.util.exceptions.Exceptions;
 import brooklyn.util.flags.TypeCoercions;
+import brooklyn.util.net.Urls;
 
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
@@ -211,16 +214,26 @@ public class BrooklynAssemblyTemplateInstantiator implements AssemblyTemplateSpe
                          
             if (log.isTraceEnabled()) log.trace("Building CAMP template services: type="+brooklynType+"; item="+item+"; loader="+loader+"; template="+template+"; encounteredCatalogTypes="+encounteredCatalogTypes);
 
-            EntitySpec<?> spec;
-            if (item == null || item.getJavaType() != null || entityResolver.isJavaTypePrefix()) {
-                spec = entityResolver.resolveSpec();
-            } else if (recursiveButTryJava) {
-                if (entityResolver.tryLoadEntityClass().isAbsent()) {
-                    throw new IllegalStateException("Recursive reference to " + brooklynType + " (and cannot be resolved as a Java type)");
+            EntitySpec<?> spec = null;
+            if (BrooklynCampConstants.YAML_URL_PROTOCOL_WHITELIST.contains(Urls.getProtocol(brooklynType))) {
+                spec = tryResolveYamlURLReferenceSpec(brooklynType, loader, encounteredCatalogTypes);
+                if (spec != null) {
+                    entityResolver.populateSpec(spec);
+                }
+            }
+            
+            if (spec == null) {
+                if (item == null || item.getJavaType() != null || entityResolver.isJavaTypePrefix()) {
+                    spec = entityResolver.resolveSpec();
+                } else if (recursiveButTryJava) {
+                    if (entityResolver.tryLoadEntityClass().isAbsent()) {
+                        throw new IllegalStateException("Recursive reference to " + brooklynType + " (and cannot be resolved as a Java type)");
+                    }
+                    spec = entityResolver.resolveSpec();
+                } else {
+                    spec = resolveCatalogYamlReferenceSpec(mgmt, item, encounteredCatalogTypes);
+                    entityResolver.populateSpec(spec);
                 }
-                spec = entityResolver.resolveSpec();
-            } else {
-                spec = resolveCatalogYamlReferenceSpec(platform, mgmt, item, encounteredCatalogTypes);
             }
 
             BrooklynClassLoadingContext newLoader = entityResolver.loader;
@@ -231,16 +244,47 @@ public class BrooklynAssemblyTemplateInstantiator implements AssemblyTemplateSpe
         return result;
     }
 
-    private EntitySpec<?> resolveCatalogYamlReferenceSpec(CampPlatform platform,
+    private EntitySpec<?> tryResolveYamlURLReferenceSpec(
+            String brooklynType, BrooklynClassLoadingContext itemLoader, 
+            Set<String> encounteredCatalogTypes) {
+        ManagementContext mgmt = itemLoader.getManagementContext();
+        Reader yaml;
+        try {
+            ResourceUtils ru = ResourceUtils.create(this);
+            yaml = new InputStreamReader(ru.getResourceFromUrl(brooklynType), "UTF-8");
+        } catch (Exception e) {
+            log.warn("AssemblyTemplate type " + brooklynType + " which looks like a URL can't be fetched.", e);
+            return null;
+        }
+        try {
+            return resolveYamlSpec(mgmt, encounteredCatalogTypes, yaml, itemLoader);
+        } finally {
+            try {
+                yaml.close();
+            } catch (IOException e) {
+                throw Exceptions.propagate(e);
+            }
+        }
+    }
+
+    private EntitySpec<?> resolveCatalogYamlReferenceSpec(
             ManagementContext mgmt,
             CatalogItem<Entity, EntitySpec<?>> item,
             Set<String> encounteredCatalogTypes) {
         
         String yaml = item.getPlanYaml();
         Reader input = new StringReader(yaml);
+        BrooklynClassLoadingContext itemLoader = item.newClassLoadingContext(mgmt);
+        
+        return resolveYamlSpec(mgmt, encounteredCatalogTypes, input, itemLoader);
+    }
+
+    private EntitySpec<?> resolveYamlSpec(ManagementContext mgmt,
+            Set<String> encounteredCatalogTypes, Reader input,
+            BrooklynClassLoadingContext itemLoader) {
+        CampPlatform platform = BrooklynServerConfig.getCampPlatform(mgmt).get();
         
         AssemblyTemplate at;
-        BrooklynClassLoadingContext itemLoader = item.newClassLoadingContext(mgmt);
         BrooklynLoaderTracker.setLoader(itemLoader);
         try {
             at = platform.pdp().registerDeploymentPlan(input);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/201717a3/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
index 218b6ea..28a3b2e 100644
--- a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
+++ b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
@@ -18,7 +18,7 @@
  */
 package io.brooklyn.camp.brooklyn.spi.creation;
 
-import io.brooklyn.camp.brooklyn.BrooklynCampPlatform;
+import io.brooklyn.camp.brooklyn.BrooklynCampConstants;
 import io.brooklyn.camp.spi.PlatformComponentTemplate;
 import io.brooklyn.camp.spi.PlatformComponentTemplate.Builder;
 import io.brooklyn.camp.spi.pdp.AssemblyTemplateConstructor;
@@ -41,6 +41,7 @@ import brooklyn.util.config.ConfigBag;
 import brooklyn.util.exceptions.Exceptions;
 import brooklyn.util.flags.FlagUtils;
 import brooklyn.util.flags.FlagUtils.FlagConfigKeyAndValueRecord;
+import brooklyn.util.net.Urls;
 import brooklyn.util.text.Strings;
 
 import com.google.common.collect.Lists;
@@ -66,18 +67,22 @@ public class BrooklynEntityMatcher implements PdpMatcher {
      * or null if not supported */
     protected String lookupType(Object deploymentPlanItem) {
         if (deploymentPlanItem instanceof Service) {
-            String name = ((Service)deploymentPlanItem).getName();
+            Service service = (Service)deploymentPlanItem;
+            
+            String name = service.getName();
             if (mgmt.getCatalog().getCatalogItem(name) != null) {
                 return name;
             }
-        }
-        if (deploymentPlanItem instanceof Service) {
-            String serviceType = ((Service)deploymentPlanItem).getServiceType();
+
+            String serviceType = service.getServiceType();
             BrooklynClassLoadingContext loader = BasicBrooklynCatalog.BrooklynLoaderTracker.getLoader();
             if (loader == null) loader = JavaBrooklynClassLoadingContext.newDefault(mgmt);
-            if (!BrooklynComponentTemplateResolver.Factory.supportsType(loader, serviceType))
-                return null;
-            return serviceType;
+            if (BrooklynComponentTemplateResolver.Factory.supportsType(loader, serviceType))
+                return serviceType;
+
+            if (BrooklynCampConstants.YAML_URL_PROTOCOL_WHITELIST.contains(Urls.getProtocol(serviceType))) {
+                return serviceType;
+            }
         }
         return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/201717a3/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlTest.java b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlTest.java
index f27e0ca..13f5f14 100644
--- a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlTest.java
+++ b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlTest.java
@@ -25,11 +25,14 @@ import java.io.Reader;
 import java.io.StringReader;
 import java.util.Set;
 
+import org.codehaus.groovy.util.StringUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 
+import com.google.common.base.Joiner;
+
 import brooklyn.entity.Entity;
 import brooklyn.entity.basic.BrooklynTaskTags;
 import brooklyn.entity.basic.Entities;
@@ -92,6 +95,10 @@ public abstract class AbstractYamlTest {
         return new StringReader(builder.toString());
     }
     
+    protected Entity createAndStartApplication(String... multiLineYaml) throws Exception {
+        return createAndStartApplication(join(multiLineYaml));
+    }
+    
     protected Entity createAndStartApplication(String input) throws Exception {
         return createAndStartApplication(new StringReader(input));
     }
@@ -121,7 +128,24 @@ public abstract class AbstractYamlTest {
         return app;
     }
 
+    protected void addCatalogItem(String... catalogYaml) {
+        addCatalogItem(join(catalogYaml));
+    }
+
+    protected void addCatalogItem(String catalogYaml) {
+        mgmt().getCatalog().addItem(catalogYaml);
+    }
+
+    protected void deleteCatalogEntity(String catalogItem) {
+        mgmt().getCatalog().deleteCatalogItem(catalogItem);
+    }
+    
     protected Logger getLogger() {
         return LOG;
     }
-}
\ No newline at end of file
+
+    private String join(String[] catalogYaml) {
+        return Joiner.on("\n").join(catalogYaml);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/201717a3/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/CatalogYamlTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/CatalogYamlTest.java b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/CatalogYamlTest.java
index 48de5ed..6eb8b1e 100644
--- a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/CatalogYamlTest.java
+++ b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/CatalogYamlTest.java
@@ -145,12 +145,4 @@ public class CatalogYamlTest extends AbstractYamlTest {
         addCatalogItem(catalogYaml);
     }
 
-    private void addCatalogItem(String catalogYaml) {
-        mgmt().getCatalog().addItem(catalogYaml);
-    }
-
-    private void deleteCatalogEntity(String catalogItem) {
-        mgmt().getCatalog().deleteCatalogItem(catalogItem);
-    }
-    
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/201717a3/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/ReferencedYamlTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/ReferencedYamlTest.java b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/ReferencedYamlTest.java
new file mode 100644
index 0000000..d70497d
--- /dev/null
+++ b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/ReferencedYamlTest.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package io.brooklyn.camp.brooklyn;
+
+import java.util.Collection;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.Entity;
+import brooklyn.entity.basic.BasicApplication;
+import brooklyn.entity.basic.BasicEntity;
+import brooklyn.test.entity.TestEntity;
+
+import com.google.common.collect.Iterables;
+
+public class ReferencedYamlTest extends AbstractYamlTest {
+    
+    @Test
+    public void testReferenceEntityYamlAsPlatformComponent() throws Exception {
+        String entityName = "Reference child name";
+        Entity app = createAndStartApplication(
+            "services:",
+            "- name: " + entityName,
+            "  type: classpath://yaml-ref-entity.yaml");
+        
+        checkChildEntitySpec(app, entityName);
+    }
+
+    @Test
+    public void testReferenceAppYamlAsPlatformComponent() throws Exception {
+        Entity app = createAndStartApplication(
+            "services:",
+            "- name: Reference child name",
+            "  type: classpath://yaml-ref-app.yaml");
+        
+        Assert.assertEquals(app.getChildren().size(), 0);
+        Assert.assertEquals(app.getDisplayName(), "Reference child name");
+
+        //child is a proxy so equality test won't do
+        Assert.assertEquals(app.getEntityType().getName(), BasicApplication.class.getName());
+    }
+
+    //the test fails, since the current code doesn't allow for nested yaml references
+    @Test(enabled = false)
+    public void testReferenceYamlAsChild() throws Exception {
+        String entityName = "Reference child name";
+        Entity createAndStartApplication = createAndStartApplication(
+            "services:",
+            "- type: brooklyn.entity.basic.BasicEntity",
+            "  brooklyn.children:",
+            "  - name: " + entityName,
+            "    type: classpath://yaml-ref-entity.yaml");
+        
+        checkGrandchildEntitySpec(createAndStartApplication, entityName);
+    }
+
+    @Test
+    public void testCatalogReferencingYamlUrl() throws Exception {
+        addCatalogItem(
+            "brooklyn.catalog:",
+            "  id: yaml.reference",
+            "services:",
+            "- type: classpath://yaml-ref-entity.yaml");
+        
+        String entityName = "YAML -> catalog item -> yaml url";
+        Entity app = createAndStartApplication(
+            "services:",
+            "- name: " + entityName,
+            "  type: yaml.reference");
+        
+        checkChildEntitySpec(app, entityName);
+    }
+
+    @Test
+    public void testYamlUrlReferencingCatalog() throws Exception {
+        addCatalogItem(
+            "brooklyn.catalog:",
+            "  id: yaml.basic",
+            "services:",
+            "- type: brooklyn.entity.basic.BasicEntity");
+        
+        String entityName = "YAML -> yaml url -> catalog item";
+        Entity app = createAndStartApplication(
+            "services:",
+            "- name: " + entityName,
+            "  type: classpath://yaml-ref-catalog.yaml");
+        
+        checkChildEntitySpec(app, entityName);
+    }
+
+    private void checkChildEntitySpec(Entity app, String entityName) {
+        Collection<Entity> children = app.getChildren();
+        Assert.assertEquals(children.size(), 1);
+        Entity child = Iterables.getOnlyElement(children);
+        Assert.assertEquals(child.getDisplayName(), entityName);
+        Assert.assertEquals(child.getEntityType().getName(), BasicEntity.class.getName());
+    }
+
+    private void checkGrandchildEntitySpec(Entity createAndStartApplication, String entityName) {
+        Collection<Entity> children = createAndStartApplication.getChildren();
+        Assert.assertEquals(children.size(), 1);
+        Entity child = Iterables.getOnlyElement(children);
+        Collection<Entity> grandChildren = child.getChildren();
+        Assert.assertEquals(grandChildren.size(), 1);
+        Entity grandChild = Iterables.getOnlyElement(grandChildren);
+        Assert.assertEquals(grandChild.getDisplayName(), entityName);
+        Assert.assertEquals(grandChild.getEntityType().getName(), BasicEntity.class.getName());
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/201717a3/usage/camp/src/test/resources/yaml-ref-app.yaml
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/resources/yaml-ref-app.yaml b/usage/camp/src/test/resources/yaml-ref-app.yaml
new file mode 100644
index 0000000..a26a4ab
--- /dev/null
+++ b/usage/camp/src/test/resources/yaml-ref-app.yaml
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+name: Basic app
+services:
+- name: service
+  type: brooklyn.entity.basic.BasicApplication
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/201717a3/usage/camp/src/test/resources/yaml-ref-catalog.yaml
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/resources/yaml-ref-catalog.yaml b/usage/camp/src/test/resources/yaml-ref-catalog.yaml
new file mode 100644
index 0000000..220deb9
--- /dev/null
+++ b/usage/camp/src/test/resources/yaml-ref-catalog.yaml
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+name: Basic app
+services:
+- name: service
+  type: yaml.basic
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/201717a3/usage/camp/src/test/resources/yaml-ref-entity.yaml
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/resources/yaml-ref-entity.yaml b/usage/camp/src/test/resources/yaml-ref-entity.yaml
new file mode 100644
index 0000000..8d27427
--- /dev/null
+++ b/usage/camp/src/test/resources/yaml-ref-entity.yaml
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+name: Basic entity
+services:
+- name: service
+  type: brooklyn.entity.basic.BasicEntity
\ No newline at end of file