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/09/30 13:01:38 UTC
[4/5] brooklyn-server git commit: Rename
JcloudsLocationExternalConfigYamlTest.java
Rename JcloudsLocationExternalConfigYamlTest.java
(to ...LiveTest)
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/5533af13
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/5533af13
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/5533af13
Branch: refs/heads/master
Commit: 5533af13ed612186f83a2a2338dba4efb12a5f0f
Parents: eab2dfa
Author: Aled Sage <al...@gmail.com>
Authored: Fri Sep 30 12:44:30 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Fri Sep 30 12:44:55 2016 +0100
----------------------------------------------------------------------
...loudsLocationExternalConfigYamlLiveTest.java | 121 ++++++++++++++++++
.../JcloudsLocationExternalConfigYamlTest.java | 124 -------------------
2 files changed, 121 insertions(+), 124 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5533af13/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsLocationExternalConfigYamlLiveTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsLocationExternalConfigYamlLiveTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsLocationExternalConfigYamlLiveTest.java
new file mode 100644
index 0000000..6a946d3
--- /dev/null
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsLocationExternalConfigYamlLiveTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.StringReader;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.camp.brooklyn.ExternalConfigYamlTest.MyExternalConfigSupplier;
+import org.apache.brooklyn.camp.brooklyn.ExternalConfigYamlTest.MyExternalConfigSupplierWithoutMapArg;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.entity.StartableApplication;
+import org.apache.brooklyn.core.internal.BrooklynProperties;
+import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
+import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess;
+import org.apache.brooklyn.location.jclouds.JcloudsLocation;
+import org.apache.brooklyn.util.core.internal.ssh.SshTool;
+import org.apache.brooklyn.util.core.task.DeferredSupplier;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Iterables;
+
+// also see ExternalConfigYamlTest
+public class JcloudsLocationExternalConfigYamlLiveTest extends AbstractYamlRebindTest {
+
+ private static final Logger log = LoggerFactory.getLogger(ExternalConfigYamlTest.class);
+
+ private static final ConfigKey<String> MY_CONFIG_KEY = ConfigKeys.newStringConfigKey("my.config.key");
+
+ @Override
+ protected BrooklynProperties createBrooklynProperties() {
+ BrooklynProperties props = BrooklynProperties.Factory.newDefault();
+ props.put("brooklyn.external.myprovider", MyExternalConfigSupplier.class.getName());
+ props.put("brooklyn.external.myprovider.mykey", "myval");
+ props.put("brooklyn.external.myproviderWithoutMapArg", MyExternalConfigSupplierWithoutMapArg.class.getName());
+ return props;
+ }
+
+ @Test(groups="Live")
+ public void testJcloudsInheritanceAndPasswordSecret() throws Exception {
+ String yaml = Joiner.on("\n").join(
+ "services:",
+ "- type: "+EmptySoftwareProcess.class.getName(),
+ "location:",
+ " jclouds:aws-ec2:",
+ " password: $brooklyn:external(\"myprovider\", \"mykey\")",
+ " my.config.key: $brooklyn:external(\"myprovider\", \"mykey\")");
+
+ origApp = (StartableApplication) createAndStartApplication(new StringReader(yaml));
+
+ Entity entity = Iterables.getOnlyElement( origApp.getChildren() );
+ Location l = Iterables.getOnlyElement( entity.getLocations() );
+ log.info("Location: "+l);
+ assertEquals(l.config().get(MY_CONFIG_KEY), "myval");
+
+ Maybe<Object> rawConfig = ((BrooklynObjectInternal.ConfigurationSupportInternal)l.config()).getRaw(MY_CONFIG_KEY);
+ log.info("Raw config: "+rawConfig);
+ Assert.assertTrue(rawConfig.isPresentAndNonNull());
+ Assert.assertTrue(rawConfig.get() instanceof DeferredSupplier, "Expected deferred raw value; got "+rawConfig.get());
+
+ rawConfig = ((BrooklynObjectInternal.ConfigurationSupportInternal)l.config()).getRaw(SshTool.PROP_PASSWORD);
+ log.info("Raw config password: "+rawConfig);
+ Assert.assertTrue(rawConfig.isPresentAndNonNull());
+ Assert.assertTrue(rawConfig.get() instanceof DeferredSupplier, "Expected deferred raw value; got "+rawConfig.get());
+ }
+
+ @Test(groups="Live")
+ public void testProvisioningPropertyInheritance() throws Exception {
+ String yaml = Joiner.on("\n").join(
+ "services:",
+ "- type: "+EmptySoftwareProcess.class.getName(),
+ " provisioning.properties:",
+ " password: $brooklyn:external(\"myprovider\", \"mykey\")",
+ // note that these 2 do not get transferred -- see below
+ " simple: 42",
+ " my.config.key: $brooklyn:external(\"myprovider\", \"mykey\")",
+ "location: aws-ec2");
+
+ origApp = (StartableApplication) createAndStartApplication(new StringReader(yaml));
+
+ Entity entity = Iterables.getOnlyElement( origApp.getChildren() );
+ Location l = Iterables.getOnlyElement( entity.getLocations() );
+ log.info("Location: "+l);
+ assertEquals(l.config().get(JcloudsLocation.PASSWORD), "myval");
+
+ Maybe<Object> rawConfig = ((BrooklynObjectInternal.ConfigurationSupportInternal)l.config()).getRaw(ConfigKeys.newStringConfigKey("password"));
+ log.info("Raw config password: "+rawConfig);
+ Assert.assertTrue(rawConfig.isPresentAndNonNull());
+ Assert.assertTrue(rawConfig.get() instanceof DeferredSupplier, "Expected deferred raw value; got "+rawConfig.get());
+
+ // these are null as only recognised provisioning properties are transmitted by jclouds
+ log.info("my config key: "+l.getConfig(MY_CONFIG_KEY));
+ log.info("my config key raw: "+((BrooklynObjectInternal.ConfigurationSupportInternal)l.config()).getRaw(MY_CONFIG_KEY));
+ log.info("simple: "+l.getConfig(ConfigKeys.builder(Integer.class, "simple").build()));
+ log.info("simple raw: "+((BrooklynObjectInternal.ConfigurationSupportInternal)l.config()).getRaw(ConfigKeys.builder(Integer.class, "simple").build()));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5533af13/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsLocationExternalConfigYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsLocationExternalConfigYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsLocationExternalConfigYamlTest.java
deleted file mode 100644
index 7e99328..0000000
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsLocationExternalConfigYamlTest.java
+++ /dev/null
@@ -1,124 +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 org.apache.brooklyn.camp.brooklyn;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.File;
-import java.io.StringReader;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.camp.brooklyn.ExternalConfigYamlTest.MyExternalConfigSupplier;
-import org.apache.brooklyn.camp.brooklyn.ExternalConfigYamlTest.MyExternalConfigSupplierWithoutMapArg;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils;
-import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
-import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess;
-import org.apache.brooklyn.location.jclouds.JcloudsLocation;
-import org.apache.brooklyn.util.core.internal.ssh.SshTool;
-import org.apache.brooklyn.util.core.task.DeferredSupplier;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.Iterables;
-
-// also see ExternalConfigYamlTest
-public class JcloudsLocationExternalConfigYamlTest extends AbstractYamlRebindTest {
-
- private static final Logger log = LoggerFactory.getLogger(ExternalConfigYamlTest.class);
-
- private static final ConfigKey<String> MY_CONFIG_KEY = ConfigKeys.newStringConfigKey("my.config.key");
-
- @Override
- protected BrooklynProperties createBrooklynProperties() {
- BrooklynProperties props = BrooklynProperties.Factory.newDefault();
- props.put("brooklyn.external.myprovider", MyExternalConfigSupplier.class.getName());
- props.put("brooklyn.external.myprovider.mykey", "myval");
- props.put("brooklyn.external.myproviderWithoutMapArg", MyExternalConfigSupplierWithoutMapArg.class.getName());
- return props;
- }
-
- @Test(groups="Live")
- public void testJcloudsInheritanceAndPasswordSecret() throws Exception {
- String yaml = Joiner.on("\n").join(
- "services:",
- "- type: "+EmptySoftwareProcess.class.getName(),
- "location:",
- " jclouds:aws-ec2:",
- " password: $brooklyn:external(\"myprovider\", \"mykey\")",
- " my.config.key: $brooklyn:external(\"myprovider\", \"mykey\")");
-
- origApp = (StartableApplication) createAndStartApplication(new StringReader(yaml));
-
- Entity entity = Iterables.getOnlyElement( origApp.getChildren() );
- Location l = Iterables.getOnlyElement( entity.getLocations() );
- log.info("Location: "+l);
- assertEquals(l.config().get(MY_CONFIG_KEY), "myval");
-
- Maybe<Object> rawConfig = ((BrooklynObjectInternal.ConfigurationSupportInternal)l.config()).getRaw(MY_CONFIG_KEY);
- log.info("Raw config: "+rawConfig);
- Assert.assertTrue(rawConfig.isPresentAndNonNull());
- Assert.assertTrue(rawConfig.get() instanceof DeferredSupplier, "Expected deferred raw value; got "+rawConfig.get());
-
- rawConfig = ((BrooklynObjectInternal.ConfigurationSupportInternal)l.config()).getRaw(SshTool.PROP_PASSWORD);
- log.info("Raw config password: "+rawConfig);
- Assert.assertTrue(rawConfig.isPresentAndNonNull());
- Assert.assertTrue(rawConfig.get() instanceof DeferredSupplier, "Expected deferred raw value; got "+rawConfig.get());
- }
-
- @Test(groups="Live")
- public void testProvisioningPropertyInheritance() throws Exception {
- String yaml = Joiner.on("\n").join(
- "services:",
- "- type: "+EmptySoftwareProcess.class.getName(),
- " provisioning.properties:",
- " password: $brooklyn:external(\"myprovider\", \"mykey\")",
- // note that these 2 do not get transferred -- see below
- " simple: 42",
- " my.config.key: $brooklyn:external(\"myprovider\", \"mykey\")",
- "location: aws-ec2");
-
- origApp = (StartableApplication) createAndStartApplication(new StringReader(yaml));
-
- Entity entity = Iterables.getOnlyElement( origApp.getChildren() );
- Location l = Iterables.getOnlyElement( entity.getLocations() );
- log.info("Location: "+l);
- assertEquals(l.config().get(JcloudsLocation.PASSWORD), "myval");
-
- Maybe<Object> rawConfig = ((BrooklynObjectInternal.ConfigurationSupportInternal)l.config()).getRaw(ConfigKeys.newStringConfigKey("password"));
- log.info("Raw config password: "+rawConfig);
- Assert.assertTrue(rawConfig.isPresentAndNonNull());
- Assert.assertTrue(rawConfig.get() instanceof DeferredSupplier, "Expected deferred raw value; got "+rawConfig.get());
-
- // these are null as only recognised provisioning properties are transmitted by jclouds
- log.info("my config key: "+l.getConfig(MY_CONFIG_KEY));
- log.info("my config key raw: "+((BrooklynObjectInternal.ConfigurationSupportInternal)l.config()).getRaw(MY_CONFIG_KEY));
- log.info("simple: "+l.getConfig(ConfigKeys.builder(Integer.class, "simple").build()));
- log.info("simple raw: "+((BrooklynObjectInternal.ConfigurationSupportInternal)l.config()).getRaw(ConfigKeys.builder(Integer.class, "simple").build()));
- }
-}
\ No newline at end of file