You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/01/15 00:54:18 UTC
[04/24] incubator-brooklyn git commit: Merge branch 'master' into
blueprint-for-app-spec
Merge branch 'master' into blueprint-for-app-spec
Conflicts:
brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java -- tests added
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/9fac9c45
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/9fac9c45
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/9fac9c45
Branch: refs/heads/master
Commit: 9fac9c454f59821b37ade208bfcb581eba38009f
Parents: 09351a6 c97ccaf
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Jan 13 16:40:06 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Wed Jan 13 16:40:06 2016 +0000
----------------------------------------------------------------------
.../BrooklynAssemblyTemplateInstantiator.java | 11 ++
.../BrooklynComponentTemplateResolver.java | 25 +++-
.../spi/dsl/BrooklynDslDeferredSupplier.java | 40 +++++-
.../DependentConfigPollingYamlTest.java | 117 ++++++++++++++++++
.../catalog/CatalogYamlTemplateTest.java | 123 ++++++++++++++++++-
.../location/geo/LocalhostExternalIpLoader.java | 73 +++++++----
.../geo/external-ip-address-resolvers.txt | 1 -
brooklyn-server/karaf/feature.xml | 51 --------
brooklyn-server/karaf/features/pom.xml | 4 -
.../features/src/main/history/dependencies.xml | 103 ----------------
10 files changed, 363 insertions(+), 185 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9fac9c45/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
----------------------------------------------------------------------
diff --cc brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
index c5ea96f,304ba8b..7954369
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
+++ b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlTemplateTest.java
@@@ -18,23 -18,21 +18,30 @@@
*/
package org.apache.brooklyn.camp.brooklyn.catalog;
+ import static org.testng.Assert.assertEquals;
+ import static org.testng.Assert.assertTrue;
+
+import java.util.List;
+
+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.typereg.RegisteredType;
import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
+ import org.apache.brooklyn.core.entity.Entities;
+import org.apache.brooklyn.core.mgmt.BrooklynTags;
+import org.apache.brooklyn.core.mgmt.BrooklynTags.NamedStringTag;
+import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
+ import org.apache.brooklyn.core.test.entity.TestEntity;
import org.apache.brooklyn.core.typereg.RegisteredTypePredicates;
import org.apache.brooklyn.core.typereg.RegisteredTypes;
+ import org.apache.brooklyn.entity.group.DynamicCluster;
+ import org.apache.brooklyn.entity.stock.BasicApplication;
+import org.apache.brooklyn.test.Asserts;
- import org.apache.brooklyn.test.TestUtils;
import org.apache.brooklyn.test.support.TestResourceUnavailableException;
import org.apache.brooklyn.util.osgi.OsgiTestResources;
+import org.python.google.common.collect.Iterables;
import org.testng.Assert;
import org.testng.TestListenerAdapter;
import org.testng.TestNG;
@@@ -73,18 -73,119 +80,130 @@@ public class CatalogYamlTemplateTest ex
deleteCatalogEntity("t1");
}
- @Test
+ public void testServiceTypeEntityOfTypeCatalogTemplateNotWrapped() throws Exception {
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " id: t1",
+ " item_type: template",
+ " name: myT1",
+ " item:",
+ " services:",
+ " - type: " + TestEntity.class.getName());
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " id: t2",
+ " item_type: template",
+ " name: myT2",
+ " item:",
+ " services:",
+ " - type: t1",
+ " - type: t1");
+
+ Entity app = createAndStartApplication(
+ "services:",
+ "- type: t2");
+ waitForApplicationTasks(app);
+
+ Entities.dumpInfo(app);
+ Entity t1a = Iterables.get(app.getChildren(), 0);
+ Entity t1b = Iterables.get(app.getChildren(), 1);
+ assertEquals(app.getChildren().size(), 2);
+ assertEquals(t1a.getChildren().size(), 0);
+ assertEquals(t1b.getChildren().size(), 0);
+
+ assertTrue(app instanceof BasicApplication);
+ assertTrue(t1a instanceof TestEntity);
+ assertTrue(t1b instanceof TestEntity);
+ }
+
+ @Test
+ public void testChildEntityOfTypeCatalogTemplateNotWrapped() throws Exception {
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " id: t1",
+ " item_type: template",
+ " name: myT1",
+ " item:",
+ " services:",
+ " - type: " + TestEntity.class.getName());
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " id: t2",
+ " item_type: template",
+ " name: myT2",
+ " item:",
+ " services:",
+ " - type: " + TestEntity.class.getName(),
+ " brooklyn.children:",
+ " - type: t1");
+
+ Entity app = createAndStartApplication(
+ "services:",
+ "- type: t2");
+ waitForApplicationTasks(app);
+
+ Entities.dumpInfo(app);
+ Entity t2 = Iterables.getOnlyElement(app.getChildren());
+ Entity t1 = Iterables.getOnlyElement(t2.getChildren());
+ assertEquals(t1.getChildren().size(), 0);
+
+ assertTrue(app instanceof BasicApplication);
+ assertTrue(t1 instanceof TestEntity);
+ assertTrue(t2 instanceof TestEntity);
+ }
+
+ @Test
+ public void testMemberSpecEntityOfTypeCatalogTemplateNotWrapped() throws Exception {
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " id: t1",
+ " item_type: template",
+ " name: myT1",
+ " item:",
+ " services:",
+ " - type: " + TestEntity.class.getName());
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " id: t2",
+ " item_type: template",
+ " name: myT2",
+ " item:",
+ " services:",
+ " - type: " + DynamicCluster.class.getName(),
+ " brooklyn.config:",
+ " memberSpec:",
+ " $brooklyn:entitySpec:",
+ " type: t1",
+ " cluster.initial.size: 1");
+
+ Entity app = createAndStartApplication(
+ "location: localhost",
+ "services:",
+ "- type: t2");
+ waitForApplicationTasks(app);
+
+ Entities.dumpInfo(app);
+ DynamicCluster t2 = (DynamicCluster) Iterables.getOnlyElement(app.getChildren());
+ Entity t1 = Iterables.getOnlyElement(t2.getMembers());
+ assertEquals(t1.getChildren().size(), 0);
+
+ assertTrue(app instanceof BasicApplication);
+ assertTrue(t2 instanceof DynamicCluster);
+ assertTrue(t1 instanceof TestEntity);
+ }
+
+ @Test
- public void testSpecFromItem() throws Exception {
++ public void testPlanYamlTagOnSpecFromItem() throws Exception {
+ makeItem();
+ EntitySpec<? extends Application> spec = EntityManagementUtils.createEntitySpecForApplication(mgmt(),
+ "services: [ { type: t1 } ]\n" +
+ "location: localhost");
+ List<NamedStringTag> yamls = BrooklynTags.findAll(BrooklynTags.YAML_SPEC_KIND, spec.getTags());
+ Assert.assertEquals(yamls.size(), 1, "Expected 1 yaml tag; instead had: "+yamls);
+ String yaml = Iterables.getOnlyElement(yamls).getContents();
+ Asserts.assertStringContains(yaml, "services:", "t1", "localhost");
+ }
+
private RegisteredType makeItem() {
TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);