You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by gr...@apache.org on 2016/07/04 09:36:21 UTC
[2/3] brooklyn-server git commit: Catalog format more consistent
Catalog format more consistent
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/057760ee
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/057760ee
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/057760ee
Branch: refs/heads/master
Commit: 057760ee42c3e6112e6636b229ebdcb72fffa51b
Parents: a941963
Author: Aled Sage <al...@gmail.com>
Authored: Thu Jun 23 09:05:26 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Tue Jun 28 20:33:14 2016 +0100
----------------------------------------------------------------------
.../camp/brooklyn/ApplicationsYamlTest.java | 40 ++--
.../brooklyn/ConfigInheritanceYamlTest.java | 2 +-
.../ConfigLocationInheritanceYamlTest.java | 6 +-
.../camp/brooklyn/EntitiesYamlTest.java | 10 +-
.../camp/brooklyn/ExternalConfigYamlTest.java | 15 +-
.../LocationExternalConfigYamlTest.java | 2 +-
.../camp/brooklyn/ReferencedYamlTest.java | 24 ++-
.../brooklyn/catalog/CatalogYamlAppTest.java | 41 ++--
.../brooklyn/catalog/CatalogYamlCombiTest.java | 27 ++-
.../catalog/CatalogYamlEntityNameTest.java | 9 +-
.../brooklyn/catalog/CatalogYamlEntityTest.java | 193 ++++++++++---------
.../catalog/CatalogYamlLocationTest.java | 24 +--
.../brooklyn/catalog/CatalogYamlPolicyTest.java | 21 +-
.../brooklyn/catalog/CatalogYamlRebindTest.java | 3 +-
.../catalog/CatalogYamlTemplateTest.java | 16 +-
.../catalog/CatalogYamlVersioningTest.java | 14 +-
.../catalog/SpecParameterParsingTest.java | 2 +
.../catalog/SpecParameterUnwrappingTest.java | 88 +++++----
.../brooklyn/test/lite/CampYamlLiteTest.java | 23 +--
core/src/main/resources/catalog.bom | 3 +-
.../internal/StaticTypePlanTransformer.java | 3 +-
.../core/mgmt/rebind/RebindCatalogItemTest.java | 90 ++++++---
.../src/main/resources/etc/default.catalog.bom | 2 +-
launcher/src/test/resources/7zip-catalog.yaml | 4 +-
.../resources/rebind-test-catalog-additions.bom | 3 +-
.../src/test/resources/rebind-test-catalog.bom | 3 +-
policy/src/main/resources/catalog.bom | 3 +-
.../rest/resources/LocationResource.java | 13 +-
.../rest/resources/ApplicationResourceTest.java | 28 +--
.../rest/resources/CatalogResourceTest.java | 133 +++++++------
.../rest/resources/LocationResourceTest.java | 12 +-
.../vanilla-software-process-with-resource.yaml | 8 +-
.../main/resources/brooklyn/default.catalog.bom | 6 +-
server-cli/src/main/resources/catalog.bom | 6 +-
.../java/org/apache/brooklyn/cli/CliTest.java | 1 +
software/base/src/main/resources/catalog.bom | 3 +-
.../BrooklynNodeIntegrationTest.java | 4 +-
test-framework/src/main/resources/catalog.bom | 6 +-
.../entities/src/main/resources/catalog.bom | 3 +-
.../main/resources/yaml-ref-back-catalog.bom | 1 +
.../main/resources/yaml-ref-parent-catalog.bom | 1 +
.../src/main/resources/catalog.bom | 3 +-
.../src/main/resources/catalog.bom | 3 +-
.../src/main/resources/catalog.bom | 6 +-
44 files changed, 521 insertions(+), 387 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java
index 7a14f94..bcda335 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java
@@ -152,10 +152,11 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: simple",
" version: " + TEST_VERSION,
+ " itemType: entity",
" displayName: catalogLevel",
" item:",
- " services:",
- " - type: " + BasicApplication.class.getName());
+ " type: " + BasicApplication.class.getName());
+
Entity app = createAndStartApplication(
"name: topLevel",
"services:",
@@ -169,12 +170,13 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: simple",
" version: " + TEST_VERSION,
+ " itemType: entity",
" displayName: catalogLevel",
" item:",
- " services:",
- " - type: " + BasicApplication.class.getName(),
- " defaultDisplayName: defaultServiceName",
- " displayName: explicitServiceName");
+ " type: " + BasicApplication.class.getName(),
+ " defaultDisplayName: defaultServiceName",
+ " displayName: explicitServiceName");
+
Entity app = createAndStartApplication(
"name: topLevel",
"services:",
@@ -188,10 +190,11 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: simple",
" version: " + TEST_VERSION,
+ " itemType: entity",
" displayName: catalogLevel",
" item:",
- " services:",
- " - type: " + BasicApplication.class.getName());
+ " type: " + BasicApplication.class.getName());
+
Entity app = createAndStartApplication(
"services:",
"- type: simple:" + TEST_VERSION,
@@ -205,10 +208,11 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: simple",
" version: " + TEST_VERSION,
+ " itemType: entity",
" displayName: catalogLevel",
" item:",
- " services:",
- " - type: " + BasicApplication.class.getName());
+ " type: " + BasicApplication.class.getName());
+
Entity app = createAndStartApplication(
"services:",
"- type: simple:" + TEST_VERSION);
@@ -221,11 +225,12 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: simple",
" version: " + TEST_VERSION,
+ " itemType: entity",
" displayName: catalogLevel",
" item:",
- " services:",
- " - type: " + BasicApplication.class.getName(),
- " name: catalogServiceLevel");
+ " type: " + BasicApplication.class.getName(),
+ " name: catalogServiceLevel");
+
Entity app = createAndStartApplication(
"services:",
"- type: simple:" + TEST_VERSION);
@@ -238,8 +243,10 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: simple",
" version: " + TEST_VERSION,
+ " itemType: entity",
" item:",
" type: " + BasicEntity.class.getName());
+
Entity app = createAndStartApplication(
"services:",
"- type: simple:" + TEST_VERSION);
@@ -258,6 +265,7 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
String yaml = Joiner.on("\n").join(
"brooklyn.catalog:",
" version: 0.1.2",
+ " itemType: entity",
" items:",
" - id: app1",
" name: My App 1",
@@ -291,6 +299,7 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
String yaml1 = Joiner.on("\n").join(
"brooklyn.catalog:",
" version: 0.1.2",
+ " itemType: entity",
" name: My name in top-level metadata",
" items:",
" - id: app1",
@@ -302,6 +311,7 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
String yaml2 = Joiner.on("\n").join(
"brooklyn.catalog:",
" version: 0.1.2",
+ " itemType: entity",
" name: My name in top-level metadata",
" items:",
" - id: app2",
@@ -312,6 +322,7 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
String yaml3 = Joiner.on("\n").join(
"brooklyn.catalog:",
" version: 0.1.2",
+ " itemType: entity",
" items:",
" - id: app3a",
" name: My name in item 3a metadata",
@@ -343,6 +354,7 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
String yaml = Joiner.on("\n").join(
"brooklyn.catalog:",
" version: 0.1.2",
+ " itemType: entity",
" name: My name in top-level",
" items:",
" - id: app1",
@@ -360,6 +372,7 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
String yaml = Joiner.on("\n").join(
"brooklyn.catalog:",
" version: 0.1.2",
+ " itemType: entity",
" items:",
" - id: app1",
" name: My name in item metadata",
@@ -377,6 +390,7 @@ public class ApplicationsYamlTest extends AbstractYamlTest {
String yaml = Joiner.on("\n").join(
"brooklyn.catalog:",
" version: 0.1.2",
+ " itemType: entity",
" items:",
" - id: app1",
" item:",
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java
index 4a4721b..f562142 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java
@@ -122,8 +122,8 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: localhost-stub",
- " name: Localhost (stubbed-SSH)",
" itemType: location",
+ " name: Localhost (stubbed-SSH)",
" item:",
" type: localhost",
" brooklyn.config:",
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigLocationInheritanceYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigLocationInheritanceYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigLocationInheritanceYamlTest.java
index 6fba27f..ff5dcae 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigLocationInheritanceYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigLocationInheritanceYamlTest.java
@@ -181,8 +181,8 @@ public class ConfigLocationInheritanceYamlTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: jclouds-config-test-with-conf",
- " name: stubbed-jclouds-gce",
" itemType: location",
+ " name: stubbed-jclouds-gce",
" item:",
" type: jclouds-config-test:"+CLOUD_PROVIDER+":"+CLOUD_REGION,
" brooklyn.config:",
@@ -257,8 +257,8 @@ public class ConfigLocationInheritanceYamlTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: jclouds-config-test-with-tempateOptions-mapVal",
- " name: stubbed-jclouds-gce",
" itemType: location",
+ " name: stubbed-jclouds-gce",
" item:",
" type: jclouds-config-test:"+CLOUD_PROVIDER+":"+CLOUD_REGION,
" brooklyn.config:",
@@ -326,8 +326,8 @@ public class ConfigLocationInheritanceYamlTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: extending-jclouds-config-test-with-conf",
- " name: jclouds-config-test-with-conf",
" itemType: location",
+ " name: jclouds-config-test-with-conf",
" item:",
" type: jclouds-config-test:"+CLOUD_PROVIDER+":"+CLOUD_REGION,
" brooklyn.config:",
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
index e87a3f3..906225e 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
@@ -516,9 +516,10 @@ public class EntitiesYamlTest extends AbstractYamlTest {
public void testScopeReferences() throws Exception {
addCatalogItems(
"brooklyn.catalog:",
+ " itemType: entity",
" items:",
- " - id: ref_child",
- " item:",
+ " - id: ref_child",
+ " item:",
" type: " + ReferencingYamlTestEntity.class.getName(),
" test.reference.root: $brooklyn:root()",
" test.reference.scope_root: $brooklyn:scopeRoot()",
@@ -527,8 +528,8 @@ public class EntitiesYamlTest extends AbstractYamlTest {
" test.reference.root: $brooklyn:root()",
" test.reference.scope_root: $brooklyn:scopeRoot()",
- " - id: ref_parent",
- " item:",
+ " - id: ref_parent",
+ " item:",
" type: " + ReferencingYamlTestEntity.class.getName(),
" test.reference.root: $brooklyn:root()",
" test.reference.scope_root: $brooklyn:scopeRoot()",
@@ -538,6 +539,7 @@ public class EntitiesYamlTest extends AbstractYamlTest {
" test.reference.scope_root: $brooklyn:scopeRoot()",
" brooklyn.children:",
" - type: ref_child");
+
Entity app = createAndStartApplication(
"brooklyn.config:",
" test.reference.root: $brooklyn:root()",
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
index a5f98b3..b42d67b 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
@@ -132,8 +132,8 @@ public class ExternalConfigYamlTest extends AbstractYamlTest {
String yaml = Joiner.on("\n").join(
"brooklyn.catalog:",
" id: $brooklyn:external(\"myprovider\", \"myCatalogId\")",
- " itemType: $brooklyn:external(\"myprovider\", \"myCatalogItemType\")",
" version: $brooklyn:external(\"myprovider\", \"myCatalogVersion\")",
+ " itemType: $brooklyn:external(\"myprovider\", \"myCatalogItemType\")",
" description: $brooklyn:external(\"myprovider\", \"myCatalogDescription\")",
" displayName: $brooklyn:external(\"myprovider\", \"myCatalogDisplayName\")",
" iconUrl: $brooklyn:external(\"myprovider\", \"myCatalogIconUrl\")",
@@ -141,8 +141,7 @@ public class ExternalConfigYamlTest extends AbstractYamlTest {
" - $brooklyn:external(\"myprovider\", \"myCatalogLibraryUrl\")",
"",
" item:",
- " services:",
- " - type: brooklyn.entity.database.mysql.MySqlNode");
+ " type: brooklyn.entity.database.mysql.MySqlNode");
catalog.addItems(yaml);
@@ -163,8 +162,8 @@ public class ExternalConfigYamlTest extends AbstractYamlTest {
String yaml = Joiner.on("\n").join(
"brooklyn.catalog:",
" id: myid",
- " itemType: template",
" version: 1.2",
+ " itemType: template",
" description: myDescription",
" displayName: myDisplayName",
" iconUrl: classpath:///myIconUrl.png",
@@ -174,8 +173,7 @@ public class ExternalConfigYamlTest extends AbstractYamlTest {
" url: $brooklyn:external(\"myprovider\", \"myCatalogLibraryUrl\")",
"",
" item:",
- " services:",
- " - type: brooklyn.entity.database.mysql.MySqlNode");
+ " type: brooklyn.entity.database.mysql.MySqlNode");
catalog.addItems(yaml);
@@ -193,8 +191,8 @@ public class ExternalConfigYamlTest extends AbstractYamlTest {
String yaml = Joiner.on("\n").join(
"brooklyn.catalog:",
" id: osgi.test",
- " itemType: template",
" version: 1.3",
+ " itemType: template",
" description: CentOS 6.6 With GUI - 1.3",
" displayName: CentOS 6.6",
" iconUrl: classpath:///centos.png",
@@ -202,8 +200,7 @@ public class ExternalConfigYamlTest extends AbstractYamlTest {
" - " + LIBRARY_URL,
"",
" item:",
- " services:",
- " - type: brooklyn.entity.database.mysql.MySqlNode");
+ " type: brooklyn.entity.database.mysql.MySqlNode");
catalog.addItems(yaml);
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationExternalConfigYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationExternalConfigYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationExternalConfigYamlTest.java
index 6d3f38b..2f4e8cd 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationExternalConfigYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationExternalConfigYamlTest.java
@@ -79,7 +79,7 @@ public class LocationExternalConfigYamlTest extends AbstractYamlRebindTest {
ImmutableList.Builder<String> yamlL = ImmutableList.<String>builder().add(
"brooklyn.catalog:",
" id: l1",
- " item.type: location",
+ " itemType: location",
" item:",
" type: localhost",
" brooklyn.config:",
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/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 0ebbc56..79402f2 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
@@ -105,8 +105,9 @@ public class ReferencedYamlTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: yaml.reference",
" version: " + TEST_VERSION,
- "services:",
- "- type: classpath://yaml-ref-entity.yaml");
+ " itemType: entity",
+ " item:",
+ " type: classpath://yaml-ref-entity.yaml");
String entityName = "YAML -> catalog item -> yaml url";
Entity app = createAndStartApplication(
@@ -125,10 +126,11 @@ public class ReferencedYamlTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: yaml.reference",
" version: " + TEST_VERSION,
+ " itemType: entity",
" libraries:",
" - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
- "services:",
- "- type: classpath://yaml-ref-osgi-entity.yaml");
+ " item:",
+ " type: classpath://yaml-ref-osgi-entity.yaml");
String entityName = "YAML -> catalog item -> yaml url (osgi)";
Entity app = createAndStartApplication(
@@ -145,8 +147,9 @@ public class ReferencedYamlTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: yaml.basic",
" version: " + TEST_VERSION,
- "services:",
- "- type: org.apache.brooklyn.entity.stock.BasicEntity");
+ " itemType: entity",
+ " item:",
+ " type: org.apache.brooklyn.entity.stock.BasicEntity");
String entityName = "YAML -> yaml url -> catalog item";
Entity app = createAndStartApplication(
@@ -161,6 +164,7 @@ public class ReferencedYamlTest extends AbstractYamlTest {
public void testYamlUrlReferencingCallerCatalogItem() throws Exception {
addCatalogItems(
"brooklyn.catalog:",
+ " itemType: entity",
" items:",
" - id: yaml.standalone",
" version: " + TEST_VERSION,
@@ -195,11 +199,11 @@ public class ReferencedYamlTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + parentCatalogId,
" version: " + TEST_VERSION,
+ " itemType: entity",
" libraries:",
" - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
- "",
- "services:",
- "- type: classpath://yaml-ref-bundle-without-libraries.yaml");
+ " item:",
+ " type: classpath://yaml-ref-bundle-without-libraries.yaml");
Entity app = createAndStartApplication(
"services:",
@@ -245,6 +249,7 @@ public class ReferencedYamlTest extends AbstractYamlTest {
" - " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
" items:",
" - id: yaml.nested.catalog.simple",
+ " itemType: entity",
" item:",
" type: " + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY,
" - include: classpath://yaml-ref-back-catalog.bom");
@@ -272,6 +277,7 @@ public class ReferencedYamlTest extends AbstractYamlTest {
" - include: classpath://yaml-ref-parent-catalog.bom",
" items:",
" - id: yaml.nested.catalog.nested",
+ " itemType: entity",
" item:",
" type: " + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY);
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlAppTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlAppTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlAppTest.java
index 10575c5..cc9066c 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlAppTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlAppTest.java
@@ -22,6 +22,7 @@ import org.testng.annotations.Test;
import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
import org.apache.brooklyn.camp.brooklyn.ApplicationsYamlTest;
+import org.apache.brooklyn.entity.stock.BasicEntity;
/**
* Also see related tests in {@link ApplicationsYamlTest}.
@@ -51,14 +52,15 @@ public class CatalogYamlAppTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: org.apache.brooklyn.entity.stock.BasicEntity",
" version: "+TEST_VERSION,
- "services:",
- "- type: org.apache.brooklyn.entity.stock.BasicApplication",
- " brooklyn.config:",
- " memberSpec:",
- " $brooklyn:entitySpec:",
- " - type: org.apache.brooklyn.entity.stock.BasicApplication",
- " brooklyn.children:",
- " - type: org.apache.brooklyn.entity.stock.BasicEntity");
+ " itemType: entity",
+ " item:",
+ " type: org.apache.brooklyn.entity.stock.BasicApplication",
+ " brooklyn.config:",
+ " memberSpec:",
+ " $brooklyn:entitySpec:",
+ " - type: org.apache.brooklyn.entity.stock.BasicApplication",
+ " brooklyn.children:",
+ " - type: org.apache.brooklyn.entity.stock.BasicEntity");
try {
// Use the blueprint from the catalog that has the circular reference.
@@ -67,8 +69,9 @@ public class CatalogYamlAppTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: another.app.in.the.catalog",
" version: "+TEST_VERSION,
- "services:",
- "- type: org.apache.brooklyn.entity.stock.BasicEntity");
+ " itemType: entity",
+ " item:",
+ " type: " + BasicEntity.class.getName());
deleteCatalogEntity("another.app.in.the.catalog");
} finally {
deleteCatalogEntity("org.apache.brooklyn.entity.stock.BasicEntity");
@@ -82,12 +85,13 @@ public class CatalogYamlAppTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: org.apache.brooklyn.entity.stock.BasicApplication",
" version: "+TEST_VERSION,
- "services:",
- "- type: org.apache.brooklyn.entity.stock.BasicApplication",
- " brooklyn.config:",
- " memberSpec:",
- " $brooklyn:entitySpec:",
- " - type: org.apache.brooklyn.entity.stock.BasicApplication");
+ " itemType: entity",
+ " item:",
+ " type: org.apache.brooklyn.entity.stock.BasicApplication",
+ " brooklyn.config:",
+ " memberSpec:",
+ " $brooklyn:entitySpec:",
+ " - type: org.apache.brooklyn.entity.stock.BasicApplication");
try {
// Use the blueprint from the catalog that has the circular reference.
@@ -95,8 +99,9 @@ public class CatalogYamlAppTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: another.app.in.the.catalog",
" version: "+TEST_VERSION,
- "services:",
- "- type: org.apache.brooklyn.entity.stock.BasicApplication");
+ " itemType: entity",
+ " item:",
+ " type: org.apache.brooklyn.entity.stock.BasicApplication");
deleteCatalogEntity("another.app.in.the.catalog");
} finally {
deleteCatalogEntity("org.apache.brooklyn.entity.stock.BasicApplication");
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlCombiTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlCombiTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlCombiTest.java
index 8ce0023..56c51ce 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlCombiTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlCombiTest.java
@@ -46,17 +46,14 @@ public class CatalogYamlCombiTest extends AbstractYamlTest {
"brooklyn.catalog:",
" version: "+TEST_VERSION,
" items:",
-
- " - itemType: entity",
+ " - id: A",
+ " itemType: entity",
" item:",
- // TODO inclusion of the above information gives a better error message when no transformers
-// " - item:",
-
- " id: A",
" type: "+BasicEntity.class.getName(),
" brooklyn.config: { a: 1, b: 0 }",
- " - item:",
- " id: B",
+ " - id: B",
+ " itemType: entity",
+ " item:",
" type: A",
" brooklyn.config: { b: 1 }");
@@ -92,22 +89,24 @@ public class CatalogYamlCombiTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" version: "+TEST_VERSION,
- " id: Z",
+ " itemType: location",
" items:",
- " - item: ",
+ " - id: Z",
+ " item: ",
" type: localhost",
" brooklyn.config: { z: 9 }");
addCatalogItems(
"brooklyn.catalog:",
" version: "+TEST_VERSION,
" items:",
- " - item_type: policy",
+ " - id: A",
+ " itemType: policy",
" item:",
- " id: A",
" type: "+ServiceRestarter.class.getName(),
" brooklyn.config: { a: 99 }",
- " - item:",
- " id: B",
+ " - id: B",
+ " itemType: entity",
+ " item:",
" type: "+BasicStartable.class.getName(),
" location: Z",
" brooklyn.policies:",
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityNameTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityNameTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityNameTest.java
index 23a0c6c..391d937 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityNameTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityNameTest.java
@@ -37,8 +37,9 @@ public class CatalogYamlEntityNameTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName,
- " name: nameInItemMetadata",
" version: " + TEST_VERSION,
+ " itemType: entity",
+ " name: nameInItemMetadata",
" item:",
" type: "+ BasicEntity.class.getName());
@@ -95,8 +96,9 @@ public class CatalogYamlEntityNameTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName,
- " name: nameInItemMetadata",
" version: " + TEST_VERSION,
+ " itemType: entity",
+ " name: nameInItemMetadata",
" item:",
" type: "+ BasicEntity.class.getName(),
" brooklyn.config:",
@@ -176,8 +178,9 @@ public class CatalogYamlEntityNameTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName,
- " name: nameInItemMetadata",
" version: " + TEST_VERSION,
+ " itemType: entity",
+ " name: nameInItemMetadata",
" item:",
" type: "+ BasicEntity.class.getName());
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
index a75c325..484c160 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
@@ -26,6 +26,7 @@ import static org.testng.Assert.fail;
import java.io.InputStream;
import java.util.Collection;
import java.util.List;
+import java.util.Map;
import org.apache.brooklyn.api.catalog.BrooklynCatalog;
import org.apache.brooklyn.api.entity.Entity;
@@ -51,6 +52,8 @@ import org.apache.brooklyn.util.osgi.OsgiTestResources;
import org.testng.Assert;
import org.testng.annotations.Test;
+import com.google.common.base.Joiner;
+import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
@@ -70,6 +73,7 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + symbolicName,
" version: " + TEST_VERSION,
+ " itemType: entity",
" item:",
" type: "+ BasicEntity.class.getName());
@@ -91,18 +95,19 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
deleteCatalogEntity(symbolicName);
}
+ // Legacy / backwards compatibility: should always specify itemType
@Test
- public void testAddCatalogItemTypeAsString() throws Exception {
+ public void testAddCatalogItemAsStringWithoutItemType() throws Exception {
TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
String symbolicName = "my.catalog.app.id.load";
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName,
+ " version: " + TEST_VERSION,
" name: My Catalog App",
" description: My description",
" icon_url: classpath://path/to/myicon.jpg",
- " version: " + TEST_VERSION,
" libraries:",
" - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
" item: " + SIMPLE_ENTITY_TYPE);
@@ -121,11 +126,11 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName,
+ " version: " + TEST_VERSION,
+ " itemType: entity",
" name: My Catalog App",
" description: My description",
" icon_url: classpath://path/to/myicon.jpg",
- " version: " + TEST_VERSION,
- " item_type: entity",
" libraries:",
" - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
" item: " + SIMPLE_ENTITY_TYPE);
@@ -137,7 +142,7 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
}
@Test
- public void testAddCatalogItemTopLevelSyntax() throws Exception {
+ public void testAddCatalogItemLegacySyntax() throws Exception {
TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
String symbolicName = "my.catalog.app.id.load";
@@ -160,14 +165,16 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
deleteCatalogEntity(symbolicName);
}
+ // Legacy / backwards compatibility: should use id
@Test
- public void testAddCatalogItemWithoutVersion() throws Exception {
+ public void testAddCatalogItemUsingNameInsteadOfIdWithoutVersion() throws Exception {
TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
String id = "unversioned.app";
addCatalogItems(
"brooklyn.catalog:",
" name: " + id,
+ " itemType: entity",
" libraries:",
" - " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
" item:",
@@ -177,14 +184,16 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
mgmt().getCatalog().deleteCatalogItem(id, "0.0.0.SNAPSHOT");
}
+ // Legacy / backwards compatibility: should use id
@Test
- public void testAddCatalogItemWithInlinedVersion() throws Exception {
+ public void testAddCatalogItemUsingNameInsteadOfIdWithInlinedVersion() throws Exception {
TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
String id = "inline_version.app";
addCatalogItems(
"brooklyn.catalog:",
" name: " + id+":"+TEST_VERSION,
+ " itemType: entity",
" libraries:",
" - " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
"services:",
@@ -225,7 +234,9 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
String referencedSymbolicName = "my.catalog.app.id.referenced";
String referrerSymbolicName = "my.catalog.app.id.referring";
- addCatalogOSGiEntities(referencedSymbolicName, SIMPLE_ENTITY_TYPE, referrerSymbolicName, ver(referencedSymbolicName));
+ addCatalogOSGiEntities(ImmutableMap.of(
+ referencedSymbolicName, SIMPLE_ENTITY_TYPE,
+ referrerSymbolicName, ver(referencedSymbolicName)));
RegisteredType referrer = mgmt().getTypeRegistry().get(referrerSymbolicName, TEST_VERSION);
String planYaml = RegisteredTypes.getImplementationDataStringForSpec(referrer);
@@ -377,23 +388,23 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + firstItemId,
" version: " + TEST_VERSION,
+ " itemType: entity",
" libraries:",
" - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
- "",
- "services:",
- "- type: " + SIMPLE_ENTITY_TYPE);
+ " item:",
+ " type: " + SIMPLE_ENTITY_TYPE);
deleteCatalogEntity(firstItemId);
addCatalogItems(
"brooklyn.catalog:",
" id: " + secondItemId,
" version: " + TEST_VERSION,
+ " itemType: entity",
" libraries:",
" - name: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_NAME,
" version: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_VERSION,
- "",
- "services:",
- "- type: " + SIMPLE_ENTITY_TYPE);
+ " item:",
+ " type: " + SIMPLE_ENTITY_TYPE);
deleteCatalogEntity(secondItemId);
}
@@ -407,12 +418,12 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: my.catalog.app.id.non_existing.ref",
" version: " + TEST_VERSION,
+ " itemType: entity",
" libraries:",
" - name: " + nonExistentId,
" version: " + nonExistentVersion,
- "",
- "services:",
- "- type: " + SIMPLE_ENTITY_TYPE);
+ " item:",
+ " type: " + SIMPLE_ENTITY_TYPE);
fail();
} catch (IllegalStateException e) {
Assert.assertEquals(e.getMessage(), "Bundle from null failed to install: Bundle CatalogBundleDto{symbolicName=" + nonExistentId + ", version=" + nonExistentVersion + ", url=null} not previously registered, but URL is empty.");
@@ -426,11 +437,11 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: my.catalog.app.id.non_existing.ref",
" version: " + TEST_VERSION,
+ " itemType: entity",
" libraries:",
" - name: io.brooklyn.brooklyn-test-osgi-entities",
- "",
- "services:",
- "- type: " + SIMPLE_ENTITY_TYPE);
+ " item:",
+ " type: " + SIMPLE_ENTITY_TYPE);
fail();
} catch (NullPointerException e) {
Assert.assertEquals(e.getMessage(), "both name and version are required");
@@ -440,11 +451,11 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: my.catalog.app.id.non_existing.ref",
" version: " + TEST_VERSION,
+ " itemType: entity",
" libraries:",
" - version: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_VERSION,
- "",
- "services:",
- "- type: " + SIMPLE_ENTITY_TYPE);
+ " item:",
+ " type: " + SIMPLE_ENTITY_TYPE);
fail();
} catch (NullPointerException e) {
Assert.assertEquals(e.getMessage(), "both name and version are required");
@@ -460,13 +471,13 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + itemId,
" version: " + TEST_VERSION,
+ " itemType: entity",
" libraries:",
" - name: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_NAME,
" version: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_VERSION,
" url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
- "",
- "services:",
- "- type: " + SIMPLE_ENTITY_TYPE);
+ " item:",
+ " type: " + SIMPLE_ENTITY_TYPE);
deleteCatalogEntity(itemId);
}
@@ -486,13 +497,14 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + firstItemId,
" version: " + TEST_VERSION,
+ " itemType: entity",
" libraries:",
" - name: " + nonExistentId,
" version: " + nonExistentVersion,
" url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
"",
- "services:",
- "- type: " + SIMPLE_ENTITY_TYPE);
+ " item:",
+ " type: " + SIMPLE_ENTITY_TYPE);
fail();
} catch (IllegalStateException e) {
assertEquals(e.getMessage(), "Bundle from " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL + " failed to install: " +
@@ -567,18 +579,18 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + symbolicName,
" version: " + TEST_VERSION,
- "",
- "services:",
- "- type: org.apache.brooklyn.entity.stock.BasicEntity");
+ " itemType: entity",
+ " item:",
+ " type: org.apache.brooklyn.entity.stock.BasicEntity");
try {
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName,
" version: " + TEST_VERSION + "-update",
- "",
- "services:",
- "- type: " + symbolicName);
+ " itemType: entity",
+ " item:",
+ " type: " + symbolicName);
fail("Catalog addition expected to fail due to non-existent java type " + symbolicName);
} catch (IllegalStateException e) {
assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
@@ -592,9 +604,9 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + symbolicName,
" version: " + TEST_VERSION,
- "",
- "services:",
- "- type: org.apache.brooklyn.entity.stock.BasicEntity");
+ " itemType: entity",
+ " item:",
+ " type: org.apache.brooklyn.entity.stock.BasicEntity");
String versionedId = CatalogUtils.getVersionedId(symbolicName, TEST_VERSION);
try {
@@ -602,9 +614,9 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + symbolicName,
" version: " + TEST_VERSION + "-update",
- "",
- "services:",
- "- type: " + versionedId);
+ " itemType: entity",
+ " item:",
+ " type: " + versionedId);
fail("Catalog addition expected to fail due to non-existent java type " + versionedId);
} catch (IllegalStateException e) {
assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
@@ -620,26 +632,26 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + symbolicName + ".caller",
" version: " + TEST_VERSION + "pre",
- "",
- "services:",
- "- type: "+BasicEntity.class.getName());
+ " itemType: entity",
+ " item:",
+ " type: "+BasicEntity.class.getName());
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName + ".callee",
" version: " + TEST_VERSION,
- "",
- "services:",
- "- type: " + symbolicName + ".caller");
+ " itemType: entity",
+ " item:",
+ " type: " + symbolicName + ".caller");
try {
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName + ".caller",
" version: " + TEST_VERSION,
- "",
- "services:",
- "- type: " + symbolicName + ".callee");
+ " itemType: entity",
+ " item:",
+ " type: " + symbolicName + ".callee");
fail();
} catch (IllegalStateException e) {
assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
@@ -655,30 +667,31 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + symbolicName + ".caller",
" version: " + TEST_VERSION + "pre",
- "",
- "services:",
- "- type: org.apache.brooklyn.entity.stock.BasicEntity");
+ " itemType: entity",
+ " item:",
+ " type: org.apache.brooklyn.entity.stock.BasicEntity");
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName + ".callee",
" version: " + TEST_VERSION,
- "",
- "services:",
- "- type: " + symbolicName + ".caller");
+ " itemType: entity",
+ " item:",
+ " type: " + symbolicName + ".caller");
try {
+ // TODO Only passes if include "services:" and if itemType=entity, rather than "template"!
+ // Being a child is important, triggers the case where: we allow retrying with other transformers.
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName + ".caller",
" version: " + TEST_VERSION,
- "",
- "services:",
- "- type: org.apache.brooklyn.entity.stock.BasicEntity",
- // Being a child is important, triggers the case where
- // we allow retrying with other transformers.
- " brooklyn.children:",
- " - type: " + symbolicName + ".callee");
+ " itemType: entity",
+ " item:",
+ " services:",
+ " - type: org.apache.brooklyn.entity.stock.BasicEntity",
+ " brooklyn.children:",
+ " - type: " + symbolicName + ".callee");
fail();
} catch (IllegalStateException e) {
assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
@@ -692,9 +705,9 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + symbolicName,
" version: " + TEST_VERSION,
- "",
- "services:",
- "- type: org.apache.brooklyn.entity.stock.BasicEntity");
+ " itemType: entity",
+ " item:",
+ " type: org.apache.brooklyn.entity.stock.BasicEntity");
createAndStartApplication(
"services:",
@@ -714,9 +727,9 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + SIMPLE_ENTITY_TYPE,
" version: " + TEST_VERSION + "-update",
- "",
- "services:",
- "- type: " + SIMPLE_ENTITY_TYPE);
+ " itemType: entity",
+ " item:",
+ " type: " + SIMPLE_ENTITY_TYPE);
fail("Catalog addition expected to fail due to non-existent java type " + SIMPLE_ENTITY_TYPE);
} catch (IllegalStateException e) {
assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
@@ -816,29 +829,30 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + id,
" version: " + TEST_VERSION,
+ " itemType: entity",
" item:",
+ " type: " + BasicApplication.class.getName(),
" brooklyn.parameters:",
" - name: test.myconf",
" type: string",
" default: myval",
- " services:",
- " - type: " + BasicApplication.class.getName(),
+ " brooklyn.config:",
+ " myconf2: $brooklyn:config(\"test.myconf\")",
+ " myconf2.from.root: $brooklyn:root().config(\"test.myconf\")",
+ " brooklyn.children:",
+ " - type: "+BasicEntity.class.getName(),
" brooklyn.config:",
- " myconf2: $brooklyn:config(\"test.myconf\")",
- " myconf2.from.root: $brooklyn:root().config(\"test.myconf\")",
- " brooklyn.children:",
- " - type: "+BasicEntity.class.getName(),
- " brooklyn.config:",
- " myconf3: $brooklyn:config(\"test.myconf\")",
- " myconf3.from.root: $brooklyn:root().config(\"test.myconf\")");
+ " myconf3: $brooklyn:config(\"test.myconf\")",
+ " myconf3.from.root: $brooklyn:root().config(\"test.myconf\")");
RegisteredType catalogItem = mgmt().getTypeRegistry().get(id, version);
assertEquals(catalogItem.getVersion(), version);
- String yaml = "name: simple-app-yaml\n" +
- "location: localhost\n" +
- "services: \n" +
- " - type: "+id+":"+version;
+ String yaml = Joiner.on("\n").join(
+ "name: simple-app-yaml",
+ "location: localhost",
+ "services:",
+ " - type: "+id+":"+version);
Entity app = createAndStartApplication(yaml);
Entity child = Iterables.getOnlyElement(app.getChildren());
ConfigKey<?> configKey = app.getEntityType().getConfigKey("test.myconf");
@@ -880,10 +894,11 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName,
+ " version: " + TEST_VERSION,
+ " itemType: entity",
" name: My Catalog App",
" description: My description",
" icon_url: classpath://path/to/myicon.jpg",
- " version: " + TEST_VERSION,
" libraries:",
" - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL +
(extraLib ? "\n"+" - url: "+OsgiStandaloneTest.BROOKLYN_OSGI_TEST_A_0_1_0_URL : ""),
@@ -891,7 +906,7 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
" type: " + serviceType);
}
- private void addCatalogOSGiEntities(String ...namesAndTypes) {
+ private void addCatalogOSGiEntities(Map<String, String> idAndTypes) {
List<String> lines = MutableList.of(
"brooklyn.catalog:",
" name: My Catalog App",
@@ -902,23 +917,25 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
" - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
" items:");
- for (int i=0; i<namesAndTypes.length; i+=2) {
+ for (Map.Entry<String, String> entry : idAndTypes.entrySet()) {
lines.addAll(MutableList.of(
- " - id: " + namesAndTypes[i],
+ " - id: " + entry.getKey(),
" item:",
- " type: " + namesAndTypes[i+1]));
+ " type: " + entry.getValue()));
}
addCatalogItems(lines);
}
+
private void addCatalogChildOSGiEntityWithServicesBlock(String symbolicName, String serviceType) {
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName,
+ " version: " + TEST_VERSION,
+ " itemType: entity",
" name: My Catalog App",
" description: My description",
" icon_url: classpath://path/to/myicon.jpg",
- " version: " + TEST_VERSION,
" libraries:",
" - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
" item:",
@@ -927,10 +944,12 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
" brooklyn.children:",
" - type: " + serviceType);
}
+
private void addCatalogChildOSGiEntity(String symbolicName, String serviceType) {
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName,
+ " itemType: entity",
" name: My Catalog App",
" description: My description",
" icon_url: classpath://path/to/myicon.jpg",
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java
index 1e35af1..091e972 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java
@@ -94,21 +94,21 @@ public class CatalogYamlLocationTest extends AbstractYamlTest {
}
@Test
- public void testAddCatalogItemTopLevelItemSyntax() throws Exception {
+ public void testAddCatalogItemLegacySyntax() throws Exception {
assertEquals(countCatalogLocations(), 0);
String symbolicName = "my.catalog.location.id.load";
- addCatalogLocationTopLevelItemSyntax(symbolicName, LOCALHOST_LOCATION_TYPE, null);
+ addCatalogLocationLegacySyntax(symbolicName, LOCALHOST_LOCATION_TYPE, null);
assertAdded(symbolicName, LOCALHOST_LOCATION_TYPE);
removeAndAssert(symbolicName);
}
@Test
- public void testAddCatalogItemOsgiTopLevelItemSyntax() throws Exception {
+ public void testAddCatalogItemOsgiLegacySyntax() throws Exception {
assertEquals(countCatalogLocations(), 0);
String symbolicName = "my.catalog.location.id.load";
- addCatalogLocationTopLevelItemSyntax(symbolicName, SIMPLE_LOCATION_TYPE, getOsgiLibraries());
+ addCatalogLocationLegacySyntax(symbolicName, SIMPLE_LOCATION_TYPE, getOsgiLibraries());
assertAdded(symbolicName, SIMPLE_LOCATION_TYPE);
assertOsgi(symbolicName);
removeAndAssert(symbolicName);
@@ -164,18 +164,18 @@ public class CatalogYamlLocationTest extends AbstractYamlTest {
}
@Test
- public void testLaunchApplicationReferencingLocationClassTopLevelItemSyntax() throws Exception {
+ public void testLaunchApplicationReferencingLocationClassLegacySyntax() throws Exception {
String symbolicName = "my.catalog.location.id.launch";
- addCatalogLocationTopLevelItemSyntax(symbolicName, LOCALHOST_LOCATION_TYPE, null);
+ addCatalogLocationLegacySyntax(symbolicName, LOCALHOST_LOCATION_TYPE, null);
runLaunchApplicationReferencingLocation(symbolicName, LOCALHOST_LOCATION_TYPE);
deleteCatalogEntity(symbolicName);
}
@Test
- public void testLaunchApplicationReferencingLocationSpecTopLevelSyntax() throws Exception {
+ public void testLaunchApplicationReferencingLocationSpecLegacySyntax() throws Exception {
String symbolicName = "my.catalog.location.id.launch";
- addCatalogLocationTopLevelItemSyntax(symbolicName, LOCALHOST_LOCATION_SPEC, null);
+ addCatalogLocationLegacySyntax(symbolicName, LOCALHOST_LOCATION_SPEC, null);
runLaunchApplicationReferencingLocation(symbolicName, LOCALHOST_LOCATION_TYPE);
deleteCatalogEntity(symbolicName);
@@ -384,15 +384,15 @@ public class CatalogYamlLocationTest extends AbstractYamlTest {
ImmutableList.Builder<String> yaml = ImmutableList.<String>builder().add(
"brooklyn.catalog:",
" id: " + symbolicName,
+ " version: " + TEST_VERSION,
+ " itemType: location",
" name: My Catalog Location",
- " description: My description",
- " version: " + TEST_VERSION);
+ " description: My description");
if (libraries!=null && libraries.size() > 0) {
yaml.add(" libraries:")
.addAll(Lists.transform(libraries, StringFunctions.prepend(" - url: ")));
}
yaml.add(
- " item.type: location",
" item:",
" type: " + locationType,
" brooklyn.config:",
@@ -403,7 +403,7 @@ public class CatalogYamlLocationTest extends AbstractYamlTest {
addCatalogItems(yaml.build());
}
- private void addCatalogLocationTopLevelItemSyntax(String symbolicName, String locationType, List<String> libraries) {
+ private void addCatalogLocationLegacySyntax(String symbolicName, String locationType, List<String> libraries) {
ImmutableList.Builder<String> yaml = ImmutableList.<String>builder().add(
"brooklyn.catalog:",
" id: " + symbolicName,
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java
index beb2840..573bb7c 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java
@@ -60,7 +60,7 @@ public class CatalogYamlPolicyTest extends AbstractYamlTest {
assertEquals(countCatalogPolicies(), 0);
String symbolicName = "my.catalog.policy.id.load";
- addCatalogOsgiPolicyTopLevelSyntax(symbolicName, SIMPLE_POLICY_TYPE);
+ addCatalogOsgiPolicyLegacySyntax(symbolicName, SIMPLE_POLICY_TYPE);
RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
assertEquals(item.getSymbolicName(), symbolicName);
@@ -97,7 +97,7 @@ public class CatalogYamlPolicyTest extends AbstractYamlTest {
@Test
public void testLaunchApplicationReferencingPolicyTopLevelSyntax() throws Exception {
String symbolicName = "my.catalog.policy.id.launch";
- addCatalogOsgiPolicyTopLevelSyntax(symbolicName, SIMPLE_POLICY_TYPE);
+ addCatalogOsgiPolicyLegacySyntax(symbolicName, SIMPLE_POLICY_TYPE);
Entity app = createAndStartApplication(
"name: simple-app-yaml",
"location: localhost",
@@ -128,17 +128,17 @@ public class CatalogYamlPolicyTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: " + referrerSymbolicName,
+ " version: " + TEST_VERSION,
+ " itemType: entity",
" name: My Catalog App",
" description: My description",
" icon_url: classpath://path/to/myicon.jpg",
- " version: " + TEST_VERSION,
" libraries:",
" - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
- "",
- "services:",
- "- type: " + SIMPLE_ENTITY_TYPE,
- " brooklyn.policies:",
- " - type: " + ver(referencedSymbolicName));
+ " item:",
+ " type: " + SIMPLE_ENTITY_TYPE,
+ " brooklyn.policies:",
+ " - type: " + ver(referencedSymbolicName));
String yaml = "name: simple-app-yaml\n" +
"location: localhost\n" +
@@ -160,10 +160,11 @@ public class CatalogYamlPolicyTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName,
+ " version: " + TEST_VERSION,
+ " itemType: policy",
" name: My Catalog Policy",
" description: My description",
" icon_url: classpath://path/to/myicon.jpg",
- " version: " + TEST_VERSION,
" libraries:",
" - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
" item:",
@@ -173,7 +174,7 @@ public class CatalogYamlPolicyTest extends AbstractYamlTest {
" config2: config2");
}
- private void addCatalogOsgiPolicyTopLevelSyntax(String symbolicName, String policyType) {
+ private void addCatalogOsgiPolicyLegacySyntax(String symbolicName, String policyType) {
TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
addCatalogItems(
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
index 747f630..b91cd11 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
@@ -134,6 +134,7 @@ public class CatalogYamlRebindTest extends AbstractYamlRebindTest {
"brooklyn.catalog:",
" id: " + appSymbolicName,
" version: %s",
+ " itemType: entity",
" item:",
" type: "+ BasicEntity.class.getName(),
" brooklyn.enrichers:",
@@ -147,7 +148,7 @@ public class CatalogYamlRebindTest extends AbstractYamlRebindTest {
"brooklyn.catalog:",
" id: " + locSymbolicName,
" version: %s",
- " item.type: location",
+ " itemType: location",
" item:",
" type: localhost");
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
index 3c9d8a4..954d38d 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
@@ -91,7 +91,7 @@ public class CatalogYamlTemplateTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: t1",
- " item_type: template",
+ " itemType: template",
" name: myT1",
" item:",
" services:",
@@ -99,7 +99,7 @@ public class CatalogYamlTemplateTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: t2",
- " item_type: template",
+ " itemType: template",
" name: myT2",
" item:",
" services:",
@@ -128,7 +128,7 @@ public class CatalogYamlTemplateTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: t1",
- " item_type: template",
+ " itemType: template",
" name: myT1",
" item:",
" services:",
@@ -136,7 +136,7 @@ public class CatalogYamlTemplateTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: t2",
- " item_type: template",
+ " itemType: template",
" name: myT2",
" item:",
" services:",
@@ -164,7 +164,7 @@ public class CatalogYamlTemplateTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: t1",
- " item_type: template",
+ " itemType: template",
" name: myT1",
" item:",
" services:",
@@ -172,7 +172,7 @@ public class CatalogYamlTemplateTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: t2",
- " item_type: template",
+ " itemType: template",
" name: myT2",
" item:",
" services:",
@@ -232,7 +232,7 @@ public class CatalogYamlTemplateTest extends AbstractYamlTest {
" type: org.apache.brooklyn.entity.stock.BasicApplication",
" brooklyn.config: { foo: bar }",
" - id: app1r",
- " item_type: template",
+ " itemType: template",
" item:",
" services:",
" - type: app1",
@@ -261,7 +261,7 @@ public class CatalogYamlTemplateTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: t1",
- " item_type: template",
+ " itemType: template",
" name: My Catalog App",
" description: My description",
" icon_url: classpath://path/to/myicon.jpg",
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java
index e740383..7fb4b68 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java
@@ -205,10 +205,12 @@ public class CatalogYamlVersioningTest extends AbstractYamlTest {
}
private void doTestVersionedReferenceJustAdded(boolean isVersionImplicitSyntax) throws Exception {
- addCatalogItems( "brooklyn.catalog:",
- " version: 0.9",
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " itemType: entity",
" items:",
" - id: referrent",
+ " version: 0.9",
" item:",
" type: "+BasicEntity.class.getName(),
" - id: referrent",
@@ -269,13 +271,13 @@ public class CatalogYamlVersioningTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" id: " + symbolicName,
+ (version != null ? " version: " + version : ""),
+ " itemType: entity",
" name: My Catalog App",
" description: My description",
" icon_url: "+iconUrl,
- (version != null ? " version: " + version : ""),
- "",
- "services:",
- "- type: " + type);
+ " item:",
+ " type: " + type);
}
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java
index 6ecfcd8..e738b9b 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java
@@ -59,6 +59,7 @@ public class SpecParameterParsingTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: test.inputs",
" version: 0.0.1",
+ " itemType: entity",
" item: ",
" type: "+ BasicApplication.class.getName(),
" brooklyn.parameters:",
@@ -96,6 +97,7 @@ public class SpecParameterParsingTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: test.inputs",
" version: 0.0.1",
+ " itemType: entity",
" libraries:",
" - classpath://" + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH,
" item: ",
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
index e129229..d563395 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
@@ -20,6 +20,7 @@ package org.apache.brooklyn.camp.brooklyn.catalog;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.fail;
import java.util.Iterator;
import java.util.List;
@@ -29,8 +30,10 @@ import org.apache.brooklyn.api.entity.Application;
import org.apache.brooklyn.api.entity.Entity;
import org.apache.brooklyn.api.entity.EntitySpec;
import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
+import org.apache.brooklyn.api.location.Location;
import org.apache.brooklyn.api.objs.BrooklynObject;
import org.apache.brooklyn.api.objs.SpecParameter;
+import org.apache.brooklyn.api.policy.Policy;
import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.core.config.ConfigKeys;
@@ -84,13 +87,15 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
@Test(dataProvider = "brooklynTypes")
public void testParameters(Class<? extends BrooklynObject> testClass) {
- addCatalogItems("brooklyn.catalog:",
- " id: " + SYMBOLIC_NAME,
- " version: " + TEST_VERSION,
- " item:",
- " type: " + testClass.getName(),
- " brooklyn.parameters:",
- " - simple");
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " id: " + SYMBOLIC_NAME,
+ " version: " + TEST_VERSION,
+ " itemType: " + inferItemType(testClass),
+ " item:",
+ " type: " + testClass.getName(),
+ " brooklyn.parameters:",
+ " - simple");
ConfigKey<String> SIMPLE_CONFIG = ConfigKeys.newStringConfigKey("simple");
SpecParameter<String> SIMPLE_PARAM = new BasicSpecParameter<>("simple", true, SIMPLE_CONFIG);
@@ -105,6 +110,7 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + SYMBOLIC_NAME,
" version: " + TEST_VERSION,
+ " itemType: " + inferItemType(testClass),
" item:",
" type: "+ testClass.getName());
@@ -119,6 +125,7 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + SYMBOLIC_NAME,
" version: " + TEST_VERSION,
+ " itemType: entity",
" item:",
" services:",
" - type: " + ConfigEntityForTest.class.getName(),
@@ -142,6 +149,7 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" version: " + TEST_VERSION,
+ " itemType: " + inferItemType(type),
" items:",
" - id: paramItem",
" item:",
@@ -165,6 +173,7 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" version: " + TEST_VERSION,
+ " itemType: " + inferItemType(type),
" items:",
" - id: paramItem",
" item:",
@@ -192,13 +201,13 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + SYMBOLIC_NAME,
" version: " + TEST_VERSION,
- " items:",
- " - item:",
- " type: " + ConfigEntityForTest.class.getName(),
- " brooklyn.children:",
- " - type: " + ConfigEntityForTest.class.getName(),
- " brooklyn.parameters:",
- " - simple");
+ " itemType: entity",
+ " item:",
+ " type: " + ConfigEntityForTest.class.getName(),
+ " brooklyn.children:",
+ " - type: " + ConfigEntityForTest.class.getName(),
+ " brooklyn.parameters:",
+ " - simple");
CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION);
@SuppressWarnings({ "rawtypes", "unchecked"})
@@ -213,12 +222,12 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
addCatalogItems(
"brooklyn.catalog:",
" version: " + TEST_VERSION,
- " items:",
- " - id: " + SYMBOLIC_NAME,
- " item:",
- " type: " + BasicApplication.class.getName(),
- " brooklyn.parameters:",
- " - simple");
+ " id: " + SYMBOLIC_NAME,
+ " itemType: entity",
+ " item:",
+ " type: " + BasicApplication.class.getName(),
+ " brooklyn.parameters:",
+ " - simple");
EntitySpec<? extends Application> spec = createAppSpec(
"services:",
@@ -234,13 +243,13 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
public void testAppSpecInheritsCatalogRootParameters() {
addCatalogItems(
"brooklyn.catalog:",
+ " id: " + SYMBOLIC_NAME,
" version: " + TEST_VERSION,
- " items:",
- " - id: " + SYMBOLIC_NAME,
- " item:",
- " type: " + BasicApplication.class.getName(),
- " brooklyn.parameters:",
- " - simple");
+ " itemType: entity",
+ " item:",
+ " type: " + BasicApplication.class.getName(),
+ " brooklyn.parameters:",
+ " - simple");
EntitySpec<? extends Application> spec = createAppSpec(
"services:",
@@ -255,14 +264,14 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
public void testAppSpecInheritsCatalogRootParametersWithServices() {
addCatalogItems(
"brooklyn.catalog:",
+ " id: " + SYMBOLIC_NAME,
" version: " + TEST_VERSION,
- " items:",
- " - id: " + SYMBOLIC_NAME,
- " item:",
- " brooklyn.parameters:",
- " - simple",
- " services:",
- " - type: " + BasicApplication.class.getName());
+ " itemType: entity",
+ " item:",
+ " brooklyn.parameters:",
+ " - simple",
+ " services:",
+ " - type: " + BasicApplication.class.getName());
EntitySpec<? extends Application> spec = createAppSpec(
"services:",
@@ -288,6 +297,7 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
" services:",
" - type: basic-app",
" - id: basic-app",
+ " itemType: entity",
" item:",
" type: " + ConfigAppForTest.class.getName());
EntitySpec<? extends Application> spec = createAppSpec(
@@ -305,6 +315,7 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
"brooklyn.catalog:",
" id: " + SYMBOLIC_NAME,
" version: " + TEST_VERSION,
+ " itemType: entity",
" item:",
" type: " + BasicApplication.class.getName(),
" brooklyn.parameters:",
@@ -376,4 +387,15 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
return EntityManagementUtils.createEntitySpecForApplication(mgmt(), joinLines(lines));
}
+ private String inferItemType(Class<? extends BrooklynObject> testClass) {
+ if (Entity.class.isAssignableFrom(testClass)) {
+ return "entity";
+ } else if (Policy.class.isAssignableFrom(testClass)) {
+ return "policy";
+ } else if (Location.class.isAssignableFrom(testClass)) {
+ return "location";
+ } else {
+ throw new IllegalArgumentException("Class" + testClass + " not an entity, policy or location");
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampYamlLiteTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampYamlLiteTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampYamlLiteTest.java
index 4749fa8..89cbe88 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampYamlLiteTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/lite/CampYamlLiteTest.java
@@ -216,17 +216,18 @@ public class CampYamlLiteTest {
}
private String getSampleMyCatalogAppYaml(String symbolicName, String bundleUrl) {
- return "brooklyn.catalog:\n" +
- " id: " + symbolicName + "\n" +
- " name: My Catalog App\n" +
- " description: My description\n" +
- " icon_url: classpath:/org/apache/brooklyn/test/osgi/entities/icon.gif\n" +
- " version: " + TEST_VERSION + "\n" +
- " libraries:\n" +
- " - url: " + bundleUrl + "\n" +
- "\n" +
- "services:\n" +
- "- type: io.camp.mock:AppServer\n";
+ return Joiner.on("\n").join(
+ "brooklyn.catalog:",
+ " id: " + symbolicName,
+ " version: " + TEST_VERSION,
+ " itemType: entity",
+ " name: My Catalog App",
+ " description: My description",
+ " icon_url: classpath:/org/apache/brooklyn/test/osgi/entities/icon.gif",
+ " libraries:",
+ " - url: " + bundleUrl,
+ " item:",
+ " type: io.camp.mock:AppServer");
}
private void assertMgmtHasSampleMyCatalogApp(String symbolicName, String bundleUrl) {
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/core/src/main/resources/catalog.bom
----------------------------------------------------------------------
diff --git a/core/src/main/resources/catalog.bom b/core/src/main/resources/catalog.bom
index de388c3..75404d5 100644
--- a/core/src/main/resources/catalog.bom
+++ b/core/src/main/resources/catalog.bom
@@ -16,7 +16,8 @@
# under the License.
brooklyn.catalog:
- version: 0.10.0-SNAPSHOT # BROOKLYN_VERSION
+ version: "0.10.0-SNAPSHOT" # BROOKLYN_VERSION
+ itemType: entity
items:
- id: org.apache.brooklyn.entity.group.QuarantineGroup
item:
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/057760ee/core/src/test/java/org/apache/brooklyn/core/catalog/internal/StaticTypePlanTransformer.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/catalog/internal/StaticTypePlanTransformer.java b/core/src/test/java/org/apache/brooklyn/core/catalog/internal/StaticTypePlanTransformer.java
index b7255e2..a1bfa98 100644
--- a/core/src/test/java/org/apache/brooklyn/core/catalog/internal/StaticTypePlanTransformer.java
+++ b/core/src/test/java/org/apache/brooklyn/core/catalog/internal/StaticTypePlanTransformer.java
@@ -39,7 +39,8 @@ import org.apache.brooklyn.util.text.Identifiers;
* <pre> {@code
* brooklyn.catalog:
* id: test.inputs
- * version: 0.0.1
+ * version: "0.0.1"
+ * itemType: entity
* item: <specId>
* } </pre>
* <p>