You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ha...@apache.org on 2015/08/18 17:04:11 UTC
[62/64] [abbrv] incubator-brooklyn git commit: BROOKLYN-162 - apply
org.apache package prefix to core camp
BROOKLYN-162 - apply org.apache package prefix to core camp
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/a5676edd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/a5676edd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/a5676edd
Branch: refs/heads/master
Commit: a5676edde60ed1d7f371febdeab8d31e790c2419
Parents: 6824019
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Tue Aug 18 14:39:38 2015 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Aug 18 15:05:22 2015 +0100
----------------------------------------------------------------------
.../api/AssemblyTemplateSpecInstantiator.java | 35 ---
.../api/HasBrooklynManagementContext.java | 27 --
.../brooklyn/basic/BasicConfigurableObject.java | 3 +-
.../api/AssemblyTemplateSpecInstantiator.java | 35 +++
.../api/HasBrooklynManagementContext.java | 27 ++
.../catalog/internal/BasicBrooklynCatalog.java | 4 +-
.../internal/EntityManagementUtils.java | 2 +-
.../lite/CampPlatformWithJustBrooklynMgmt.java | 42 ---
.../brooklyn/camp/lite/CampYamlLiteTest.java | 256 -------------------
.../brooklyn/camp/lite/TestAppAssembly.java | 36 ---
.../camp/lite/TestAppAssemblyInstantiator.java | 91 -------
.../entity/rebind/RebindCatalogItemTest.java | 6 +-
...talogWhenCatalogPersistenceDisabledTest.java | 4 +-
.../lite/CampPlatformWithJustBrooklynMgmt.java | 41 +++
.../camp/brooklyn/lite/CampYamlLiteTest.java | 256 +++++++++++++++++++
.../camp/brooklyn/lite/TestAppAssembly.java | 36 +++
.../lite/TestAppAssemblyInstantiator.java | 90 +++++++
.../camp/lite/test-app-service-blueprint.yaml | 38 ---
.../lite/test-app-service-blueprint.yaml | 38 +++
.../camp/brooklyn/BrooklynCampPlatform.java | 3 +-
.../BrooklynAssemblyTemplateInstantiator.java | 6 +-
.../platform/BrooklynImmutableCampPlatform.java | 3 +-
22 files changed, 533 insertions(+), 546 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java b/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
deleted file mode 100644
index a314f9d..0000000
--- a/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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 brooklyn.camp.brooklyn.api;
-
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.proxying.EntitySpec;
-import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.camp.CampPlatform;
-import org.apache.brooklyn.camp.spi.AssemblyTemplate;
-import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-
-public interface AssemblyTemplateSpecInstantiator extends AssemblyTemplateInstantiator {
-
- EntitySpec<?> createSpec(AssemblyTemplate template, CampPlatform platform, BrooklynClassLoadingContext loader, boolean autoUnwrapIfAppropriate);
- EntitySpec<?> createNestedSpec(AssemblyTemplate template, CampPlatform platform, BrooklynClassLoadingContext itemLoader, Set<String> encounteredCatalogTypes);
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/main/java/brooklyn/camp/brooklyn/api/HasBrooklynManagementContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/camp/brooklyn/api/HasBrooklynManagementContext.java b/core/src/main/java/brooklyn/camp/brooklyn/api/HasBrooklynManagementContext.java
deleted file mode 100644
index 7925db8..0000000
--- a/core/src/main/java/brooklyn/camp/brooklyn/api/HasBrooklynManagementContext.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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 brooklyn.camp.brooklyn.api;
-
-import org.apache.brooklyn.api.management.ManagementContext;
-
-public interface HasBrooklynManagementContext {
-
- public ManagementContext getBrooklynManagementContext();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/main/java/org/apache/brooklyn/basic/BasicConfigurableObject.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/basic/BasicConfigurableObject.java b/core/src/main/java/org/apache/brooklyn/basic/BasicConfigurableObject.java
index 3994ad2..60abb50 100644
--- a/core/src/main/java/org/apache/brooklyn/basic/BasicConfigurableObject.java
+++ b/core/src/main/java/org/apache/brooklyn/basic/BasicConfigurableObject.java
@@ -22,6 +22,7 @@ import org.apache.brooklyn.api.entity.trait.Configurable;
import org.apache.brooklyn.api.entity.trait.Identifiable;
import org.apache.brooklyn.api.management.ManagementContext;
import org.apache.brooklyn.api.management.Task;
+import org.apache.brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.config.ConfigMap;
import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
@@ -30,8 +31,6 @@ import org.apache.brooklyn.core.util.config.ConfigBag;
import org.apache.brooklyn.core.util.flags.SetFromFlag;
import org.apache.brooklyn.util.text.Identifiers;
-import brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
-
/**
* A parent class for ancilliary objects that do not require the full heavy lifting of {@link AbstractBrooklynObject}
* or similar, but wish to use {@link ConfigKey} and {@link Configurable} in their construction, via the
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/main/java/org/apache/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java b/core/src/main/java/org/apache/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
new file mode 100644
index 0000000..df1e108
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
@@ -0,0 +1,35 @@
+/*
+ * 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 org.apache.brooklyn.camp.brooklyn.api;
+
+import java.util.Set;
+
+import org.apache.brooklyn.api.entity.proxying.EntitySpec;
+import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
+
+public interface AssemblyTemplateSpecInstantiator extends AssemblyTemplateInstantiator {
+
+ EntitySpec<?> createSpec(AssemblyTemplate template, CampPlatform platform, BrooklynClassLoadingContext loader, boolean autoUnwrapIfAppropriate);
+ EntitySpec<?> createNestedSpec(AssemblyTemplate template, CampPlatform platform, BrooklynClassLoadingContext itemLoader, Set<String> encounteredCatalogTypes);
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/main/java/org/apache/brooklyn/camp/brooklyn/api/HasBrooklynManagementContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/camp/brooklyn/api/HasBrooklynManagementContext.java b/core/src/main/java/org/apache/brooklyn/camp/brooklyn/api/HasBrooklynManagementContext.java
new file mode 100644
index 0000000..d41407f
--- /dev/null
+++ b/core/src/main/java/org/apache/brooklyn/camp/brooklyn/api/HasBrooklynManagementContext.java
@@ -0,0 +1,27 @@
+/*
+ * 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 org.apache.brooklyn.camp.brooklyn.api;
+
+import org.apache.brooklyn.api.management.ManagementContext;
+
+public interface HasBrooklynManagementContext {
+
+ public ManagementContext getBrooklynManagementContext();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
index 7db7c9a..96baa2f 100644
--- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
@@ -34,9 +34,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;
import org.apache.brooklyn.basic.BrooklynObjectInternal.ConfigurationSupportInternal;
-
-import brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
-
import org.apache.brooklyn.api.basic.AbstractBrooklynObjectSpec;
import org.apache.brooklyn.api.catalog.BrooklynCatalog;
import org.apache.brooklyn.api.catalog.CatalogItem;
@@ -49,6 +46,7 @@ import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingConte
import org.apache.brooklyn.api.policy.Policy;
import org.apache.brooklyn.api.policy.PolicySpec;
import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
import org.apache.brooklyn.camp.spi.AssemblyTemplate;
import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
import org.apache.brooklyn.camp.spi.pdp.DeploymentPlan;
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java b/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java
index b07bbac..0209090 100644
--- a/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java
+++ b/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java
@@ -33,6 +33,7 @@ import org.apache.brooklyn.api.management.ManagementContext;
import org.apache.brooklyn.api.management.Task;
import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
import org.apache.brooklyn.camp.spi.Assembly;
import org.apache.brooklyn.camp.spi.AssemblyTemplate;
import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
@@ -50,7 +51,6 @@ import org.apache.brooklyn.util.time.Duration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
import brooklyn.entity.basic.BrooklynTaskTags;
import brooklyn.entity.basic.ConfigKeys;
import brooklyn.entity.basic.Entities;
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java b/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java
deleted file mode 100644
index 9bea0e1..0000000
--- a/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 brooklyn.camp.lite;
-
-import org.apache.brooklyn.api.management.ManagementContext;
-import org.apache.brooklyn.camp.BasicCampPlatform;
-import org.apache.brooklyn.core.config.BrooklynProperties;
-import org.apache.brooklyn.core.config.BrooklynServerConfig;
-
-import brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
-
-public class CampPlatformWithJustBrooklynMgmt extends BasicCampPlatform implements HasBrooklynManagementContext {
-
- private ManagementContext mgmt;
-
- public CampPlatformWithJustBrooklynMgmt(ManagementContext mgmt) {
- this.mgmt = mgmt;
- ((BrooklynProperties)mgmt.getConfig()).put(BrooklynServerConfig.CAMP_PLATFORM, this);
- }
-
- @Override
- public ManagementContext getBrooklynManagementContext() {
- return mgmt;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java b/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java
deleted file mode 100644
index 4ba6d59..0000000
--- a/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * 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 brooklyn.camp.lite;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.apache.brooklyn.test.TestResourceUnavailableException;
-import org.apache.brooklyn.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.test.entity.TestApplication;
-import org.apache.brooklyn.test.entity.TestEntity;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.stream.Streams;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.proxying.EntitySpec;
-import org.apache.brooklyn.api.management.Task;
-import org.apache.brooklyn.camp.spi.Assembly;
-import org.apache.brooklyn.camp.spi.AssemblyTemplate;
-import org.apache.brooklyn.camp.spi.pdp.PdpYamlTest;
-import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
-import org.apache.brooklyn.core.catalog.CatalogPredicates;
-import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
-import org.apache.brooklyn.core.catalog.internal.CatalogDto;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.management.internal.LocalManagementContext;
-import org.apache.brooklyn.core.management.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.core.util.ResourceUtils;
-import org.apache.brooklyn.core.util.config.ConfigBag;
-
-import brooklyn.entity.basic.ApplicationBuilder;
-import brooklyn.entity.basic.ConfigKeys;
-import brooklyn.entity.basic.Entities;
-import brooklyn.entity.effector.AddChildrenEffector;
-import brooklyn.entity.effector.Effectors;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-
-/** Tests of lightweight CAMP integration. Since the "real" integration is in brooklyn-camp project,
- * but some aspects of CAMP we want to be able to test here. */
-public class CampYamlLiteTest {
- private static final String TEST_VERSION = "0.1.2";
-
- private static final Logger log = LoggerFactory.getLogger(CampYamlLiteTest.class);
-
- protected LocalManagementContext mgmt;
- protected CampPlatformWithJustBrooklynMgmt platform;
-
- @BeforeMethod(alwaysRun=true)
- public void setUp() {
- mgmt = LocalManagementContextForTests.newInstanceWithOsgi();
- platform = new CampPlatformWithJustBrooklynMgmt(mgmt);
- MockWebPlatform.populate(platform, TestAppAssemblyInstantiator.class);
- }
-
- @AfterMethod(alwaysRun=true)
- public void tearDown() {
- if (mgmt!=null) mgmt.terminate();
- }
-
- /** based on {@link PdpYamlTest} for parsing,
- * then creating a {@link TestAppAssembly} */
- @Test
- public void testYamlServiceMatchAndBrooklynInstantiate() throws Exception {
- Reader input = new InputStreamReader(getClass().getResourceAsStream("test-app-service-blueprint.yaml"));
- AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
- log.info("AT is:\n"+at.toString());
- Assert.assertEquals(at.getName(), "sample");
- Assert.assertEquals(at.getPlatformComponentTemplates().links().size(), 1);
-
- // now use brooklyn to instantiate - note it won't be faithful, but it will set some config keys
- Assembly assembly = at.getInstantiator().newInstance().instantiate(at, platform);
-
- TestApplication app = ((TestAppAssembly)assembly).getBrooklynApp();
- Assert.assertEquals( app.getConfig(TestEntity.CONF_NAME), "sample" );
- Map<String, String> map = app.getConfig(TestEntity.CONF_MAP_THING);
- Assert.assertEquals( map.get("desc"), "Tomcat sample JSP and servlet application." );
-
- Assert.assertEquals( app.getChildren().size(), 1 );
- Entity svc = Iterables.getOnlyElement(app.getChildren());
- Assert.assertEquals( svc.getConfig(TestEntity.CONF_NAME), "Hello WAR" );
- map = svc.getConfig(TestEntity.CONF_MAP_THING);
- Assert.assertEquals( map.get("type"), MockWebPlatform.APPSERVER.getType() );
- // desc ensures we got the information from the matcher, as this value is NOT in the yaml
- Assert.assertEquals( map.get("desc"), MockWebPlatform.APPSERVER.getDescription() );
- }
-
- /** based on {@link PdpYamlTest} for parsing,
- * then creating a {@link TestAppAssembly} */
- @SuppressWarnings({ "rawtypes", "unchecked" })
- @Test
- public void testAddChildrenEffector() throws Exception {
- String childYaml = Streams.readFullyString(getClass().getResourceAsStream("test-app-service-blueprint.yaml"));
- AddChildrenEffector newEff = new AddChildrenEffector(ConfigBag.newInstance()
- .configure(AddChildrenEffector.EFFECTOR_NAME, "add_tomcat")
- .configure(AddChildrenEffector.BLUEPRINT_YAML, childYaml)
- .configure(AddChildrenEffector.EFFECTOR_PARAMETER_DEFS, MutableMap.of("war", (Object)MutableMap.of(
- "defaultValue", "foo.war"))) ) ;
- TestApplication app = ApplicationBuilder.newManagedApp(EntitySpec.create(TestApplication.class).addInitializer(newEff), mgmt);
-
- // test adding, with a parameter
- Task<List> task = app.invoke(Effectors.effector(List.class, "add_tomcat").buildAbstract(), MutableMap.of("war", "foo.bar"));
- List result = task.get();
-
- Entity newChild = Iterables.getOnlyElement(app.getChildren());
- Assert.assertEquals(newChild.getConfig(ConfigKeys.newStringConfigKey("war")), "foo.bar");
-
- Assert.assertEquals(Iterables.getOnlyElement(result), newChild.getId());
- Entities.unmanage(newChild);
-
- // and test default value
- task = app.invoke(Effectors.effector(List.class, "add_tomcat").buildAbstract(), MutableMap.<String,Object>of());
- result = task.get();
-
- newChild = Iterables.getOnlyElement(app.getChildren());
- Assert.assertEquals(newChild.getConfig(ConfigKeys.newStringConfigKey("war")), "foo.war");
-
- Assert.assertEquals(Iterables.getOnlyElement(result), newChild.getId());
- Entities.unmanage(newChild);
- }
-
- @Test
- public void testYamlServiceForCatalog() {
- TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
- CatalogItem<?, ?> realItem = Iterables.getOnlyElement(mgmt.getCatalog().addItems(Streams.readFullyString(getClass().getResourceAsStream("test-app-service-blueprint.yaml"))));
- Iterable<CatalogItem<Object, Object>> retrievedItems = mgmt.getCatalog()
- .getCatalogItems(CatalogPredicates.symbolicName(Predicates.equalTo("catalog-name")));
-
- Assert.assertEquals(Iterables.size(retrievedItems), 1, "Wrong retrieved items: "+retrievedItems);
- CatalogItem<Object, Object> retrievedItem = Iterables.getOnlyElement(retrievedItems);
- Assert.assertEquals(retrievedItem, realItem);
-
- Collection<CatalogBundle> bundles = retrievedItem.getLibraries();
- Assert.assertEquals(bundles.size(), 1);
- CatalogBundle bundle = Iterables.getOnlyElement(bundles);
- Assert.assertEquals(bundle.getUrl(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL);
- Assert.assertEquals(bundle.getVersion(), "0.1.0");
-
- EntitySpec<?> spec1 = (EntitySpec<?>) mgmt.getCatalog().createSpec(retrievedItem);
- assertNotNull(spec1);
- Assert.assertEquals(spec1.getConfig().get(TestEntity.CONF_NAME), "sample");
-
- // TODO other assertions, about children
- }
-
- @Test
- public void testRegisterCustomEntityWithBundleWhereEntityIsFromCoreAndIconFromBundle() throws IOException {
- TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
- String symbolicName = "my.catalog.app.id";
- String bundleUrl = OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL;
- String yaml = getSampleMyCatalogAppYaml(symbolicName, bundleUrl);
-
- mgmt.getCatalog().addItems(yaml);
-
- assertMgmtHasSampleMyCatalogApp(symbolicName, bundleUrl);
- }
-
- @Test
- public void testResetXmlWithCustomEntity() throws IOException {
- TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
- String symbolicName = "my.catalog.app.id";
- String bundleUrl = OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL;
- String yaml = getSampleMyCatalogAppYaml(symbolicName, bundleUrl);
-
- LocalManagementContext mgmt2 = LocalManagementContextForTests.newInstanceWithOsgi();
- try {
- CampPlatformWithJustBrooklynMgmt platform2 = new CampPlatformWithJustBrooklynMgmt(mgmt2);
- MockWebPlatform.populate(platform2, TestAppAssemblyInstantiator.class);
-
- mgmt2.getCatalog().addItems(yaml);
- String xml = ((BasicBrooklynCatalog) mgmt2.getCatalog()).toXmlString();
- ((BasicBrooklynCatalog) mgmt.getCatalog()).reset(CatalogDto.newDtoFromXmlContents(xml, "copy of temporary catalog"));
- } finally {
- mgmt2.terminate();
- }
-
- assertMgmtHasSampleMyCatalogApp(symbolicName, bundleUrl);
- }
-
- 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:/brooklyn/osgi/tests/icon.gif\n" +
- " version: " + TEST_VERSION + "\n" +
- " libraries:\n" +
- " - url: " + bundleUrl + "\n" +
- "\n" +
- "services:\n" +
- "- type: io.camp.mock:AppServer\n";
- }
-
- private void assertMgmtHasSampleMyCatalogApp(String symbolicName, String bundleUrl) {
- CatalogItem<?, ?> item = mgmt.getCatalog().getCatalogItem(symbolicName, TEST_VERSION);
- assertNotNull(item, "failed to load item with id=" + symbolicName + " from catalog. Entries were: " +
- Joiner.on(",").join(mgmt.getCatalog().getCatalogItems()));
- assertEquals(item.getSymbolicName(), symbolicName);
-
- // stored as yaml, not java
- assertNotNull(item.getPlanYaml());
- Assert.assertTrue(item.getPlanYaml().contains("io.camp.mock:AppServer"));
-
- // and let's check we have libraries
- Collection<CatalogBundle> libs = item.getLibraries();
- assertEquals(libs.size(), 1);
- CatalogBundle bundle = Iterables.getOnlyElement(libs);
- assertEquals(bundle.getUrl(), bundleUrl);
-
- // now let's check other things on the item
- assertEquals(item.getDisplayName(), "My Catalog App");
- assertEquals(item.getDescription(), "My description");
- assertEquals(item.getIconUrl(), "classpath:/brooklyn/osgi/tests/icon.gif");
-
- // and confirm we can resolve ICON
- byte[] iconData = Streams.readFully(ResourceUtils.create(CatalogUtils.newClassLoadingContext(mgmt, item)).getResourceFromUrl(item.getIconUrl()));
- assertEquals(iconData.length, 43);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java b/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java
deleted file mode 100644
index a48827f..0000000
--- a/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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 brooklyn.camp.lite;
-
-import org.apache.brooklyn.camp.spi.Assembly;
-import org.apache.brooklyn.test.entity.TestApplication;
-
-public class TestAppAssembly extends Assembly {
-
- private TestApplication brooklynApp;
-
- public TestAppAssembly(TestApplication brooklynApp) {
- this.brooklynApp = brooklynApp;
- }
-
- public TestApplication getBrooklynApp() {
- return brooklynApp;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java b/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java
deleted file mode 100644
index 47b3c3f..0000000
--- a/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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 brooklyn.camp.lite;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.proxying.EntitySpec;
-import org.apache.brooklyn.api.management.ManagementContext;
-import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
-import org.apache.brooklyn.camp.CampPlatform;
-import org.apache.brooklyn.camp.spi.AbstractResource;
-import org.apache.brooklyn.camp.spi.Assembly;
-import org.apache.brooklyn.camp.spi.AssemblyTemplate;
-import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
-import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
-import org.apache.brooklyn.camp.spi.instantiate.BasicAssemblyTemplateInstantiator;
-import org.apache.brooklyn.core.util.config.ConfigBag;
-import org.apache.brooklyn.test.entity.TestApplication;
-import org.apache.brooklyn.test.entity.TestEntity;
-import org.apache.brooklyn.util.collections.MutableMap;
-
-import brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
-import brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
-
-/** simple illustrative instantiator which always makes a {@link TestApplication}, populated with {@link TestEntity} children,
- * all setting {@link TestEntity#CONF_NAME} for the name in the plan and in the service specs
- * <p>
- * the "real" instantiator for brooklyn is in brooklyn-camp project, not visible here, so let's have something we can test */
-public class TestAppAssemblyInstantiator extends BasicAssemblyTemplateInstantiator implements AssemblyTemplateSpecInstantiator {
-
- @Override
- public Assembly instantiate(AssemblyTemplate template, CampPlatform platform) {
- if (!(platform instanceof HasBrooklynManagementContext)) {
- throw new IllegalStateException("Instantiator can only be used with CAMP platforms with a Brooklyn management context");
- }
- ManagementContext mgmt = ((HasBrooklynManagementContext)platform).getBrooklynManagementContext();
-
- TestApplication app = (TestApplication) mgmt.getEntityManager().createEntity( createSpec(template, platform, null, false) );
- mgmt.getEntityManager().manage(app);
-
- return new TestAppAssembly(app);
- }
-
- @Override
- public EntitySpec<?> createSpec(AssemblyTemplate template, CampPlatform platform, BrooklynClassLoadingContext loader, boolean autoUnwrap) {
- EntitySpec<TestApplication> app = EntitySpec.create(TestApplication.class)
- .configure(TestEntity.CONF_NAME, template.getName())
- .configure(TestEntity.CONF_MAP_THING, MutableMap.of("type", template.getType(), "desc", template.getDescription()));
- applyBrooklynConfig(template, app);
-
- for (ResolvableLink<PlatformComponentTemplate> t: template.getPlatformComponentTemplates().links()) {
- EntitySpec<TestEntity> spec = EntitySpec.create(TestEntity.class)
- .configure(TestEntity.CONF_NAME, t.getName())
- .configure(TestEntity.CONF_MAP_THING, MutableMap.of("type", t.resolve().getType(), "desc", t.resolve().getDescription()));
- applyBrooklynConfig(t.resolve(), app);
- app.child(spec);
- }
-
- return app;
- }
-
- @SuppressWarnings("rawtypes")
- private void applyBrooklynConfig(AbstractResource template, EntitySpec<TestApplication> app) {
- Object bc = template.getCustomAttributes().get("brooklyn.config");
- if (bc instanceof Map)
- app.configure(ConfigBag.newInstance().putAll((Map)bc).getAllConfigAsConfigKeyMap());
- }
-
- @Override
- public EntitySpec<?> createNestedSpec(AssemblyTemplate template, CampPlatform platform, BrooklynClassLoadingContext itemLoader, Set<String> encounteredCatalogTypes) {
- return createSpec(template, platform, itemLoader, true);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java b/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java
index 64e8305..af25dc6 100644
--- a/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java
+++ b/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java
@@ -30,10 +30,6 @@ import org.slf4j.LoggerFactory;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-
-import brooklyn.camp.lite.CampPlatformWithJustBrooklynMgmt;
-import brooklyn.camp.lite.TestAppAssemblyInstantiator;
-
import org.apache.brooklyn.api.catalog.CatalogItem;
import org.apache.brooklyn.api.catalog.CatalogItem.CatalogItemType;
import org.apache.brooklyn.api.entity.proxying.EntitySpec;
@@ -47,6 +43,8 @@ import org.apache.brooklyn.core.config.BrooklynServerConfig;
import org.apache.brooklyn.core.internal.BrooklynFeatureEnablement;
import org.apache.brooklyn.core.management.internal.LocalManagementContext;
import org.apache.brooklyn.core.policy.basic.AbstractPolicy;
+import org.apache.brooklyn.core.test.camp.brooklyn.lite.CampPlatformWithJustBrooklynMgmt;
+import org.apache.brooklyn.core.test.camp.brooklyn.lite.TestAppAssemblyInstantiator;
import org.apache.brooklyn.test.entity.TestEntity;
import org.apache.brooklyn.location.basic.LocalhostMachineProvisioningLocation;
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/test/java/brooklyn/entity/rebind/RebindCatalogWhenCatalogPersistenceDisabledTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/entity/rebind/RebindCatalogWhenCatalogPersistenceDisabledTest.java b/core/src/test/java/brooklyn/entity/rebind/RebindCatalogWhenCatalogPersistenceDisabledTest.java
index fb1fc08..c4ada5f 100644
--- a/core/src/test/java/brooklyn/entity/rebind/RebindCatalogWhenCatalogPersistenceDisabledTest.java
+++ b/core/src/test/java/brooklyn/entity/rebind/RebindCatalogWhenCatalogPersistenceDisabledTest.java
@@ -25,15 +25,13 @@ import java.io.File;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-
-import brooklyn.camp.lite.CampPlatformWithJustBrooklynMgmt;
-
import org.apache.brooklyn.api.catalog.CatalogItem;
import org.apache.brooklyn.api.entity.proxying.EntitySpec;
import org.apache.brooklyn.core.config.BrooklynProperties;
import org.apache.brooklyn.core.config.BrooklynServerConfig;
import org.apache.brooklyn.core.internal.BrooklynFeatureEnablement;
import org.apache.brooklyn.core.management.internal.LocalManagementContext;
+import org.apache.brooklyn.core.test.camp.brooklyn.lite.CampPlatformWithJustBrooklynMgmt;
import org.apache.brooklyn.test.entity.TestEntity;
import com.google.common.collect.Iterables;
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/CampPlatformWithJustBrooklynMgmt.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/CampPlatformWithJustBrooklynMgmt.java b/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/CampPlatformWithJustBrooklynMgmt.java
new file mode 100644
index 0000000..218384b
--- /dev/null
+++ b/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/CampPlatformWithJustBrooklynMgmt.java
@@ -0,0 +1,41 @@
+/*
+ * 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 org.apache.brooklyn.core.test.camp.brooklyn.lite;
+
+import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
+import org.apache.brooklyn.core.config.BrooklynProperties;
+import org.apache.brooklyn.core.config.BrooklynServerConfig;
+
+public class CampPlatformWithJustBrooklynMgmt extends BasicCampPlatform implements HasBrooklynManagementContext {
+
+ private ManagementContext mgmt;
+
+ public CampPlatformWithJustBrooklynMgmt(ManagementContext mgmt) {
+ this.mgmt = mgmt;
+ ((BrooklynProperties)mgmt.getConfig()).put(BrooklynServerConfig.CAMP_PLATFORM, this);
+ }
+
+ @Override
+ public ManagementContext getBrooklynManagementContext() {
+ return mgmt;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/CampYamlLiteTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/CampYamlLiteTest.java b/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/CampYamlLiteTest.java
new file mode 100644
index 0000000..6c25e79
--- /dev/null
+++ b/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/CampYamlLiteTest.java
@@ -0,0 +1,256 @@
+/*
+ * 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 org.apache.brooklyn.core.test.camp.brooklyn.lite;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import org.apache.brooklyn.test.TestResourceUnavailableException;
+import org.apache.brooklyn.test.entity.LocalManagementContextForTests;
+import org.apache.brooklyn.test.entity.TestApplication;
+import org.apache.brooklyn.test.entity.TestEntity;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.apache.brooklyn.util.stream.Streams;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.apache.brooklyn.api.catalog.CatalogItem;
+import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.proxying.EntitySpec;
+import org.apache.brooklyn.api.management.Task;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.pdp.PdpYamlTest;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
+import org.apache.brooklyn.core.catalog.CatalogPredicates;
+import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
+import org.apache.brooklyn.core.catalog.internal.CatalogDto;
+import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
+import org.apache.brooklyn.core.management.internal.LocalManagementContext;
+import org.apache.brooklyn.core.management.osgi.OsgiStandaloneTest;
+import org.apache.brooklyn.core.util.ResourceUtils;
+import org.apache.brooklyn.core.util.config.ConfigBag;
+
+import brooklyn.entity.basic.ApplicationBuilder;
+import brooklyn.entity.basic.ConfigKeys;
+import brooklyn.entity.basic.Entities;
+import brooklyn.entity.effector.AddChildrenEffector;
+import brooklyn.entity.effector.Effectors;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicates;
+import com.google.common.collect.Iterables;
+
+/** Tests of lightweight CAMP integration. Since the "real" integration is in brooklyn-camp project,
+ * but some aspects of CAMP we want to be able to test here. */
+public class CampYamlLiteTest {
+ private static final String TEST_VERSION = "0.1.2";
+
+ private static final Logger log = LoggerFactory.getLogger(CampYamlLiteTest.class);
+
+ protected LocalManagementContext mgmt;
+ protected CampPlatformWithJustBrooklynMgmt platform;
+
+ @BeforeMethod(alwaysRun=true)
+ public void setUp() {
+ mgmt = LocalManagementContextForTests.newInstanceWithOsgi();
+ platform = new CampPlatformWithJustBrooklynMgmt(mgmt);
+ MockWebPlatform.populate(platform, TestAppAssemblyInstantiator.class);
+ }
+
+ @AfterMethod(alwaysRun=true)
+ public void tearDown() {
+ if (mgmt!=null) mgmt.terminate();
+ }
+
+ /** based on {@link PdpYamlTest} for parsing,
+ * then creating a {@link TestAppAssembly} */
+ @Test
+ public void testYamlServiceMatchAndBrooklynInstantiate() throws Exception {
+ Reader input = new InputStreamReader(getClass().getResourceAsStream("test-app-service-blueprint.yaml"));
+ AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
+ log.info("AT is:\n"+at.toString());
+ Assert.assertEquals(at.getName(), "sample");
+ Assert.assertEquals(at.getPlatformComponentTemplates().links().size(), 1);
+
+ // now use brooklyn to instantiate - note it won't be faithful, but it will set some config keys
+ Assembly assembly = at.getInstantiator().newInstance().instantiate(at, platform);
+
+ TestApplication app = ((TestAppAssembly)assembly).getBrooklynApp();
+ Assert.assertEquals( app.getConfig(TestEntity.CONF_NAME), "sample" );
+ Map<String, String> map = app.getConfig(TestEntity.CONF_MAP_THING);
+ Assert.assertEquals( map.get("desc"), "Tomcat sample JSP and servlet application." );
+
+ Assert.assertEquals( app.getChildren().size(), 1 );
+ Entity svc = Iterables.getOnlyElement(app.getChildren());
+ Assert.assertEquals( svc.getConfig(TestEntity.CONF_NAME), "Hello WAR" );
+ map = svc.getConfig(TestEntity.CONF_MAP_THING);
+ Assert.assertEquals( map.get("type"), MockWebPlatform.APPSERVER.getType() );
+ // desc ensures we got the information from the matcher, as this value is NOT in the yaml
+ Assert.assertEquals( map.get("desc"), MockWebPlatform.APPSERVER.getDescription() );
+ }
+
+ /** based on {@link PdpYamlTest} for parsing,
+ * then creating a {@link TestAppAssembly} */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Test
+ public void testAddChildrenEffector() throws Exception {
+ String childYaml = Streams.readFullyString(getClass().getResourceAsStream("test-app-service-blueprint.yaml"));
+ AddChildrenEffector newEff = new AddChildrenEffector(ConfigBag.newInstance()
+ .configure(AddChildrenEffector.EFFECTOR_NAME, "add_tomcat")
+ .configure(AddChildrenEffector.BLUEPRINT_YAML, childYaml)
+ .configure(AddChildrenEffector.EFFECTOR_PARAMETER_DEFS, MutableMap.of("war", (Object)MutableMap.of(
+ "defaultValue", "foo.war"))) ) ;
+ TestApplication app = ApplicationBuilder.newManagedApp(EntitySpec.create(TestApplication.class).addInitializer(newEff), mgmt);
+
+ // test adding, with a parameter
+ Task<List> task = app.invoke(Effectors.effector(List.class, "add_tomcat").buildAbstract(), MutableMap.of("war", "foo.bar"));
+ List result = task.get();
+
+ Entity newChild = Iterables.getOnlyElement(app.getChildren());
+ Assert.assertEquals(newChild.getConfig(ConfigKeys.newStringConfigKey("war")), "foo.bar");
+
+ Assert.assertEquals(Iterables.getOnlyElement(result), newChild.getId());
+ Entities.unmanage(newChild);
+
+ // and test default value
+ task = app.invoke(Effectors.effector(List.class, "add_tomcat").buildAbstract(), MutableMap.<String,Object>of());
+ result = task.get();
+
+ newChild = Iterables.getOnlyElement(app.getChildren());
+ Assert.assertEquals(newChild.getConfig(ConfigKeys.newStringConfigKey("war")), "foo.war");
+
+ Assert.assertEquals(Iterables.getOnlyElement(result), newChild.getId());
+ Entities.unmanage(newChild);
+ }
+
+ @Test
+ public void testYamlServiceForCatalog() {
+ TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
+
+ CatalogItem<?, ?> realItem = Iterables.getOnlyElement(mgmt.getCatalog().addItems(Streams.readFullyString(getClass().getResourceAsStream("test-app-service-blueprint.yaml"))));
+ Iterable<CatalogItem<Object, Object>> retrievedItems = mgmt.getCatalog()
+ .getCatalogItems(CatalogPredicates.symbolicName(Predicates.equalTo("catalog-name")));
+
+ Assert.assertEquals(Iterables.size(retrievedItems), 1, "Wrong retrieved items: "+retrievedItems);
+ CatalogItem<Object, Object> retrievedItem = Iterables.getOnlyElement(retrievedItems);
+ Assert.assertEquals(retrievedItem, realItem);
+
+ Collection<CatalogBundle> bundles = retrievedItem.getLibraries();
+ Assert.assertEquals(bundles.size(), 1);
+ CatalogBundle bundle = Iterables.getOnlyElement(bundles);
+ Assert.assertEquals(bundle.getUrl(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL);
+ Assert.assertEquals(bundle.getVersion(), "0.1.0");
+
+ EntitySpec<?> spec1 = (EntitySpec<?>) mgmt.getCatalog().createSpec(retrievedItem);
+ assertNotNull(spec1);
+ Assert.assertEquals(spec1.getConfig().get(TestEntity.CONF_NAME), "sample");
+
+ // TODO other assertions, about children
+ }
+
+ @Test
+ public void testRegisterCustomEntityWithBundleWhereEntityIsFromCoreAndIconFromBundle() throws IOException {
+ TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
+
+ String symbolicName = "my.catalog.app.id";
+ String bundleUrl = OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL;
+ String yaml = getSampleMyCatalogAppYaml(symbolicName, bundleUrl);
+
+ mgmt.getCatalog().addItems(yaml);
+
+ assertMgmtHasSampleMyCatalogApp(symbolicName, bundleUrl);
+ }
+
+ @Test
+ public void testResetXmlWithCustomEntity() throws IOException {
+ TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
+
+ String symbolicName = "my.catalog.app.id";
+ String bundleUrl = OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL;
+ String yaml = getSampleMyCatalogAppYaml(symbolicName, bundleUrl);
+
+ LocalManagementContext mgmt2 = LocalManagementContextForTests.newInstanceWithOsgi();
+ try {
+ CampPlatformWithJustBrooklynMgmt platform2 = new CampPlatformWithJustBrooklynMgmt(mgmt2);
+ MockWebPlatform.populate(platform2, TestAppAssemblyInstantiator.class);
+
+ mgmt2.getCatalog().addItems(yaml);
+ String xml = ((BasicBrooklynCatalog) mgmt2.getCatalog()).toXmlString();
+ ((BasicBrooklynCatalog) mgmt.getCatalog()).reset(CatalogDto.newDtoFromXmlContents(xml, "copy of temporary catalog"));
+ } finally {
+ mgmt2.terminate();
+ }
+
+ assertMgmtHasSampleMyCatalogApp(symbolicName, bundleUrl);
+ }
+
+ 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:/brooklyn/osgi/tests/icon.gif\n" +
+ " version: " + TEST_VERSION + "\n" +
+ " libraries:\n" +
+ " - url: " + bundleUrl + "\n" +
+ "\n" +
+ "services:\n" +
+ "- type: io.camp.mock:AppServer\n";
+ }
+
+ private void assertMgmtHasSampleMyCatalogApp(String symbolicName, String bundleUrl) {
+ CatalogItem<?, ?> item = mgmt.getCatalog().getCatalogItem(symbolicName, TEST_VERSION);
+ assertNotNull(item, "failed to load item with id=" + symbolicName + " from catalog. Entries were: " +
+ Joiner.on(",").join(mgmt.getCatalog().getCatalogItems()));
+ assertEquals(item.getSymbolicName(), symbolicName);
+
+ // stored as yaml, not java
+ assertNotNull(item.getPlanYaml());
+ Assert.assertTrue(item.getPlanYaml().contains("io.camp.mock:AppServer"));
+
+ // and let's check we have libraries
+ Collection<CatalogBundle> libs = item.getLibraries();
+ assertEquals(libs.size(), 1);
+ CatalogBundle bundle = Iterables.getOnlyElement(libs);
+ assertEquals(bundle.getUrl(), bundleUrl);
+
+ // now let's check other things on the item
+ assertEquals(item.getDisplayName(), "My Catalog App");
+ assertEquals(item.getDescription(), "My description");
+ assertEquals(item.getIconUrl(), "classpath:/brooklyn/osgi/tests/icon.gif");
+
+ // and confirm we can resolve ICON
+ byte[] iconData = Streams.readFully(ResourceUtils.create(CatalogUtils.newClassLoadingContext(mgmt, item)).getResourceFromUrl(item.getIconUrl()));
+ assertEquals(iconData.length, 43);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/TestAppAssembly.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/TestAppAssembly.java b/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/TestAppAssembly.java
new file mode 100644
index 0000000..ed038c5
--- /dev/null
+++ b/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/TestAppAssembly.java
@@ -0,0 +1,36 @@
+/*
+ * 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 org.apache.brooklyn.core.test.camp.brooklyn.lite;
+
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.test.entity.TestApplication;
+
+public class TestAppAssembly extends Assembly {
+
+ private TestApplication brooklynApp;
+
+ public TestAppAssembly(TestApplication brooklynApp) {
+ this.brooklynApp = brooklynApp;
+ }
+
+ public TestApplication getBrooklynApp() {
+ return brooklynApp;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/TestAppAssemblyInstantiator.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/TestAppAssemblyInstantiator.java b/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/TestAppAssemblyInstantiator.java
new file mode 100644
index 0000000..1f4fb19
--- /dev/null
+++ b/core/src/test/java/org/apache/brooklyn/core/test/camp/brooklyn/lite/TestAppAssemblyInstantiator.java
@@ -0,0 +1,90 @@
+/*
+ * 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 org.apache.brooklyn.core.test.camp.brooklyn.lite;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.brooklyn.api.entity.proxying.EntitySpec;
+import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
+import org.apache.brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
+import org.apache.brooklyn.camp.spi.instantiate.BasicAssemblyTemplateInstantiator;
+import org.apache.brooklyn.core.util.config.ConfigBag;
+import org.apache.brooklyn.test.entity.TestApplication;
+import org.apache.brooklyn.test.entity.TestEntity;
+import org.apache.brooklyn.util.collections.MutableMap;
+
+/** simple illustrative instantiator which always makes a {@link TestApplication}, populated with {@link TestEntity} children,
+ * all setting {@link TestEntity#CONF_NAME} for the name in the plan and in the service specs
+ * <p>
+ * the "real" instantiator for brooklyn is in brooklyn-camp project, not visible here, so let's have something we can test */
+public class TestAppAssemblyInstantiator extends BasicAssemblyTemplateInstantiator implements AssemblyTemplateSpecInstantiator {
+
+ @Override
+ public Assembly instantiate(AssemblyTemplate template, CampPlatform platform) {
+ if (!(platform instanceof HasBrooklynManagementContext)) {
+ throw new IllegalStateException("Instantiator can only be used with CAMP platforms with a Brooklyn management context");
+ }
+ ManagementContext mgmt = ((HasBrooklynManagementContext)platform).getBrooklynManagementContext();
+
+ TestApplication app = (TestApplication) mgmt.getEntityManager().createEntity( createSpec(template, platform, null, false) );
+ mgmt.getEntityManager().manage(app);
+
+ return new TestAppAssembly(app);
+ }
+
+ @Override
+ public EntitySpec<?> createSpec(AssemblyTemplate template, CampPlatform platform, BrooklynClassLoadingContext loader, boolean autoUnwrap) {
+ EntitySpec<TestApplication> app = EntitySpec.create(TestApplication.class)
+ .configure(TestEntity.CONF_NAME, template.getName())
+ .configure(TestEntity.CONF_MAP_THING, MutableMap.of("type", template.getType(), "desc", template.getDescription()));
+ applyBrooklynConfig(template, app);
+
+ for (ResolvableLink<PlatformComponentTemplate> t: template.getPlatformComponentTemplates().links()) {
+ EntitySpec<TestEntity> spec = EntitySpec.create(TestEntity.class)
+ .configure(TestEntity.CONF_NAME, t.getName())
+ .configure(TestEntity.CONF_MAP_THING, MutableMap.of("type", t.resolve().getType(), "desc", t.resolve().getDescription()));
+ applyBrooklynConfig(t.resolve(), app);
+ app.child(spec);
+ }
+
+ return app;
+ }
+
+ @SuppressWarnings("rawtypes")
+ private void applyBrooklynConfig(AbstractResource template, EntitySpec<TestApplication> app) {
+ Object bc = template.getCustomAttributes().get("brooklyn.config");
+ if (bc instanceof Map)
+ app.configure(ConfigBag.newInstance().putAll((Map)bc).getAllConfigAsConfigKeyMap());
+ }
+
+ @Override
+ public EntitySpec<?> createNestedSpec(AssemblyTemplate template, CampPlatform platform, BrooklynClassLoadingContext itemLoader, Set<String> encounteredCatalogTypes) {
+ return createSpec(template, platform, itemLoader, true);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/test/resources/brooklyn/camp/lite/test-app-service-blueprint.yaml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/brooklyn/camp/lite/test-app-service-blueprint.yaml b/core/src/test/resources/brooklyn/camp/lite/test-app-service-blueprint.yaml
deleted file mode 100644
index c0bb607..0000000
--- a/core/src/test/resources/brooklyn/camp/lite/test-app-service-blueprint.yaml
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# 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: sample
-description: Tomcat sample JSP and servlet application.
-origin: http://www.oracle.com/nCAMP/Hand
-services:
- -
- type: io.camp.mock:AppServer
- name: Hello WAR
- wars:
- /: hello.war
- controller.spec:
- port: 80
-
-brooklyn.catalog:
- name: catalog-name
- type: io.camp.mock.MyApplication
- version: 0.9
- libraries:
- - name: org.apache.brooklyn.test.resources.osgi.brooklyn-test-osgi-entities
- version: 0.1.0
- url: classpath:/brooklyn/osgi/brooklyn-test-osgi-entities.jar
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/core/src/test/resources/org/apache/brooklyn/core/test/camp/brooklyn/lite/test-app-service-blueprint.yaml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/brooklyn/core/test/camp/brooklyn/lite/test-app-service-blueprint.yaml b/core/src/test/resources/org/apache/brooklyn/core/test/camp/brooklyn/lite/test-app-service-blueprint.yaml
new file mode 100644
index 0000000..c0bb607
--- /dev/null
+++ b/core/src/test/resources/org/apache/brooklyn/core/test/camp/brooklyn/lite/test-app-service-blueprint.yaml
@@ -0,0 +1,38 @@
+#
+# 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: sample
+description: Tomcat sample JSP and servlet application.
+origin: http://www.oracle.com/nCAMP/Hand
+services:
+ -
+ type: io.camp.mock:AppServer
+ name: Hello WAR
+ wars:
+ /: hello.war
+ controller.spec:
+ port: 80
+
+brooklyn.catalog:
+ name: catalog-name
+ type: io.camp.mock.MyApplication
+ version: 0.9
+ libraries:
+ - name: org.apache.brooklyn.test.resources.osgi.brooklyn-test-osgi-entities
+ version: 0.1.0
+ url: classpath:/brooklyn/osgi/brooklyn-test-osgi-entities.jar
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
index 6ffe01f..dfeccb7 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
@@ -22,14 +22,13 @@ import org.apache.brooklyn.api.management.ManagementContext;
import org.apache.brooklyn.api.management.ManagementContext.PropertiesReloadListener;
import org.apache.brooklyn.camp.AggregatingCampPlatform;
import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynEntityMatcher;
import org.apache.brooklyn.camp.brooklyn.spi.dsl.BrooklynDslInterpreter;
import org.apache.brooklyn.camp.brooklyn.spi.platform.BrooklynImmutableCampPlatform;
import org.apache.brooklyn.camp.spi.PlatformRootSummary;
import org.apache.brooklyn.core.config.BrooklynProperties;
-import brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
-
/** {@link CampPlatform} implementation which includes Brooklyn entities
* (via {@link BrooklynImmutableCampPlatform})
* and allows customisation / additions */
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
index d8710bf..e65e159 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
@@ -28,10 +28,6 @@ import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-import brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
-import brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
-
import org.apache.brooklyn.api.catalog.CatalogItem;
import org.apache.brooklyn.api.entity.Application;
import org.apache.brooklyn.api.entity.Entity;
@@ -40,6 +36,8 @@ import org.apache.brooklyn.api.management.ManagementContext;
import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
import org.apache.brooklyn.camp.CampPlatform;
import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
+import org.apache.brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
+import org.apache.brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
import org.apache.brooklyn.camp.spi.Assembly;
import org.apache.brooklyn.camp.spi.AssemblyTemplate;
import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5676edd/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
index d69a3e4..96fc625 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
@@ -20,6 +20,7 @@ package org.apache.brooklyn.camp.brooklyn.spi.platform;
import org.apache.brooklyn.api.management.ManagementContext;
import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
import org.apache.brooklyn.camp.brooklyn.spi.lookup.AssemblyBrooklynLookup;
import org.apache.brooklyn.camp.brooklyn.spi.lookup.AssemblyTemplateBrooklynLookup;
import org.apache.brooklyn.camp.brooklyn.spi.lookup.PlatformComponentBrooklynLookup;
@@ -36,8 +37,6 @@ import org.apache.brooklyn.camp.spi.collection.BasicResourceLookup;
import org.apache.brooklyn.camp.spi.collection.ResourceLookup;
import org.apache.brooklyn.camp.spi.collection.ResourceLookup.EmptyResourceLookup;
-import brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
-
/** Immutable CAMP platform which reflects things in the underlying Brooklyn system */
public class BrooklynImmutableCampPlatform extends CampPlatform implements HasBrooklynManagementContext {