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 2015/10/08 01:37:52 UTC

[1/2] incubator-brooklyn git commit: more tests for $brooklyn:external, clarifying DSL usage in location block

Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master b2986e724 -> 7b89b6644


more tests for $brooklyn:external, clarifying DSL usage in location block


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

Branch: refs/heads/master
Commit: b41451290c052f8f6b271416c0435d253597a371
Parents: 2995471
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Sep 28 10:46:03 2015 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Sep 28 10:52:10 2015 +0100

----------------------------------------------------------------------
 .../camp/brooklyn/ExternalConfigYamlTest.java   | 40 ++++++++++++++++++++
 1 file changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b4145129/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
index 7f46861..5d1ab39 100644
--- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
+++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
@@ -24,16 +24,20 @@ import static org.testng.Assert.fail;
 import java.io.StringReader;
 import java.util.Map;
 
+import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.mgmt.ManagementContext;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.config.ConfigKeys;
 import org.apache.brooklyn.core.config.external.AbstractExternalConfigSupplier;
 import org.apache.brooklyn.core.config.external.ExternalConfigSupplier;
 import org.apache.brooklyn.core.internal.BrooklynProperties;
+import org.apache.brooklyn.core.location.cloud.CloudLocationConfig;
 import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
 import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
 import org.apache.brooklyn.core.test.entity.TestApplication;
+import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess;
 import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.python.google.common.collect.Iterables;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.Test;
@@ -71,6 +75,42 @@ public class ExternalConfigYamlTest extends AbstractYamlTest {
 
         assertEquals(app.getConfig(MY_CONFIG_KEY), "myval");
     }
+
+    // FIXME fails currently - see comment at ConfigBag.get; fix at AbstractLocation.BasicConfigurationSupport to enable this?
+//    at org.apache.brooklyn.util.core.config.ConfigBag.coerceFirstNonNullKeyValue(ConfigBag.java:464)
+//    at org.apache.brooklyn.util.core.config.ConfigBag.get(ConfigBag.java:458)
+//    at org.apache.brooklyn.util.core.config.ConfigBag.get(ConfigBag.java:345)
+//    at org.apache.brooklyn.core.location.AbstractLocation$BasicConfigurationSupport.get(AbstractLocation.java:364)    @Test
+    @Test(groups="WIP")
+    public void testExternalisedLocationConfigReferencedFromYaml() throws Exception {
+        ConfigKey<String> MY_CONFIG_KEY = ConfigKeys.newStringConfigKey("my.config.key");
+        
+        String yaml = Joiner.on("\n").join(
+            "services:",
+            "- type: org.apache.brooklyn.core.test.entity.TestApplication",
+            "location:",
+            "  localhost:",
+            "    my.config.key: $brooklyn:external(\"myprovider\", \"mykey\")");
+        
+        TestApplication app = (TestApplication) createAndStartApplication(new StringReader(yaml));
+        waitForApplicationTasks(app);
+        assertEquals(Iterables.getOnlyElement( app.getLocations() ).config().get(MY_CONFIG_KEY), "myval");
+    }
+    
+    @Test(groups="Integration")
+    public void testExternalisedLocationConfigSetViaProvisioningPropertiesReferencedFromYaml() throws Exception {
+        String yaml = Joiner.on("\n").join(
+            "services:",
+            "- type: "+EmptySoftwareProcess.class.getName(),
+            "  provisioning.properties:",
+            "    credential: $brooklyn:external(\"myprovider\", \"mykey\")",
+            "location: localhost");
+        
+        Entity app = createAndStartApplication(new StringReader(yaml));
+        waitForApplicationTasks(app);
+        Entity entity = Iterables.getOnlyElement( app.getChildren() );
+        assertEquals(Iterables.getOnlyElement( entity.getLocations() ).config().get(CloudLocationConfig.ACCESS_CREDENTIAL), "myval");
+    }
     
     @Test
     public void testExternalisedConfigFromSupplierWithoutMapArg() throws Exception {


[2/2] incubator-brooklyn git commit: This closes #922

Posted by al...@apache.org.
This closes #922


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

Branch: refs/heads/master
Commit: 7b89b66442d3030ce6c08156b54b3595b6996e5e
Parents: b2986e7 b414512
Author: Aled Sage <al...@gmail.com>
Authored: Thu Oct 8 00:37:39 2015 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Oct 8 00:37:39 2015 +0100

----------------------------------------------------------------------
 .../camp/brooklyn/ExternalConfigYamlTest.java   | 40 ++++++++++++++++++++
 1 file changed, 40 insertions(+)
----------------------------------------------------------------------