You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2016/05/18 20:44:02 UTC
[1/2] brooklyn-server git commit: BROOKLYN-267: test for
brooklyn.parameters inheritance
Repository: brooklyn-server
Updated Branches:
refs/heads/master f4a6bb868 -> e5dcf40a9
BROOKLYN-267: test for brooklyn.parameters inheritance
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/4c5d099d
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/4c5d099d
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/4c5d099d
Branch: refs/heads/master
Commit: 4c5d099d16d5b5dffa2c44bb26f8ab5c181daf32
Parents: f4a6bb8
Author: Aled Sage <al...@gmail.com>
Authored: Mon May 16 14:59:09 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Mon May 16 14:59:09 2016 +0100
----------------------------------------------------------------------
.../brooklyn/catalog/CatalogYamlEntityTest.java | 50 ++++++++++++++++++++
1 file changed, 50 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/4c5d099d/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 38e2941..a75c325 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
@@ -19,6 +19,7 @@
package org.apache.brooklyn.camp.brooklyn.catalog;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
@@ -33,11 +34,14 @@ import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry;
import org.apache.brooklyn.api.typereg.RegisteredType;
import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
+import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
+import org.apache.brooklyn.core.config.ConfigKeys;
import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
import org.apache.brooklyn.core.test.entity.TestEntity;
import org.apache.brooklyn.core.test.entity.TestEntityImpl;
import org.apache.brooklyn.core.typereg.RegisteredTypes;
+import org.apache.brooklyn.entity.stock.BasicApplication;
import org.apache.brooklyn.entity.stock.BasicEntity;
import org.apache.brooklyn.test.support.TestResourceUnavailableException;
import org.apache.brooklyn.util.collections.MutableList;
@@ -804,6 +808,52 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
"- type: vanilla");
}
+ @Test
+ public void testItemWithBrooklynParameters() throws Exception {
+ String id = "inline_version.app";
+ String version = TEST_VERSION;
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " id: " + id,
+ " version: " + TEST_VERSION,
+ " item:",
+ " 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:",
+ " 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;
+ Entity app = createAndStartApplication(yaml);
+ Entity child = Iterables.getOnlyElement(app.getChildren());
+ ConfigKey<?> configKey = app.getEntityType().getConfigKey("test.myconf");
+ assertNotNull(configKey);
+ assertEquals(app.config().get(configKey), "myval");
+ assertEquals(app.config().get(ConfigKeys.newStringConfigKey("myconf2.from.root")), "myval");
+ assertEquals(child.config().get(ConfigKeys.newStringConfigKey("myconf3.from.root")), "myval");
+ assertEquals(app.config().get(ConfigKeys.newStringConfigKey("myconf2")), "myval");
+
+ // TODO Because of https://issues.apache.org/jira/browse/BROOKLYN-267, the assertion below fails:
+ // assertEquals(child.config().get(ConfigKeys.newStringConfigKey("myconf3")), "myval");
+
+ mgmt().getCatalog().deleteCatalogItem(id, version);
+ }
+
private void registerAndLaunchAndAssertSimpleEntity(String symbolicName, String serviceType) throws Exception {
addCatalogOSGiEntity(symbolicName, serviceType);
String yaml = "name: simple-app-yaml\n" +
[2/2] brooklyn-server git commit: This closes #139
Posted by al...@apache.org.
This closes #139
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/e5dcf40a
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/e5dcf40a
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/e5dcf40a
Branch: refs/heads/master
Commit: e5dcf40a905e6ad9103f4d55189588c011816383
Parents: f4a6bb8 4c5d099
Author: Aled Sage <al...@gmail.com>
Authored: Wed May 18 21:43:49 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Wed May 18 21:43:49 2016 +0100
----------------------------------------------------------------------
.../brooklyn/catalog/CatalogYamlEntityTest.java | 50 ++++++++++++++++++++
1 file changed, 50 insertions(+)
----------------------------------------------------------------------