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 2017/05/29 11:50:48 UTC

[1/2] brooklyn-server git commit: jclouds stub test: better allow config to be overridden

Repository: brooklyn-server
Updated Branches:
  refs/heads/master 6c7751d74 -> fe6e370e0


jclouds stub test: better allow config to be overridden

This allows sub-classes to better override the config values
(the `jcloudsLocationConfig` can contain keys of type ConfigKey or
String).

Also fixes the log.debug, to say what the default value is overridden 
with.

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

Branch: refs/heads/master
Commit: b845e41c695175bcf8c8fd5660df0e2a64978146
Parents: 6c7751d
Author: Aled Sage <al...@gmail.com>
Authored: Mon May 29 11:41:32 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Mon May 29 11:41:32 2017 +0100

----------------------------------------------------------------------
 .../jclouds/AbstractJcloudsStubbedUnitTest.java       | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b845e41c/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java
index 83c6b7e..7c658b5 100644
--- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java
+++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java
@@ -49,7 +49,6 @@ import com.google.common.collect.ImmutableMap;
  */
 public abstract class AbstractJcloudsStubbedUnitTest extends AbstractJcloudsLiveTest {
 
-    @SuppressWarnings("unused")
     private static final Logger LOG = LoggerFactory.getLogger(AbstractJcloudsStubbedUnitTest.class);
 
     // TODO These values are hard-coded into the JcloudsStubTemplateBuilder, so best not to mess!
@@ -96,7 +95,7 @@ public abstract class AbstractJcloudsStubbedUnitTest extends AbstractJcloudsLive
     protected void initNodeCreatorAndJcloudsLocation(NodeCreator nodeCreator, Map<?, ?> jcloudsLocationConfig) throws Exception {
         this.nodeCreator = nodeCreator;
         this.computeServiceRegistry = new StubbedComputeServiceRegistry(nodeCreator, false);
-        final Map<Object, Object> defaults = ImmutableMap.builder()
+        final Map<ConfigKey<?>, Object> defaults = ImmutableMap.<ConfigKey<?>, Object>builder()
                 .put(JcloudsLocationConfig.COMPUTE_SERVICE_REGISTRY, computeServiceRegistry)
                 .put(JcloudsLocationConfig.TEMPLATE_BUILDER, JcloudsStubTemplateBuilder.create(getProvider(), getRegion()))
                 .put(JcloudsLocationConfig.ACCESS_IDENTITY, "stub-identity")
@@ -108,11 +107,14 @@ public abstract class AbstractJcloudsStubbedUnitTest extends AbstractJcloudsLive
                 .build();
         final ImmutableMap.Builder<Object, Object> flags = ImmutableMap.builder()
                 .putAll(jcloudsLocationConfig);
-        for (Map.Entry<Object, Object> entry : defaults.entrySet()) {
-            if (!jcloudsLocationConfig.containsKey(entry.getKey())) {
-                flags.put(entry.getKey(), entry.getValue());
+        for (Map.Entry<ConfigKey<?>, Object> entry : defaults.entrySet()) {
+            ConfigKey<?> key = entry.getKey();
+            if (!jcloudsLocationConfig.containsKey(key) && !jcloudsLocationConfig.containsKey(key.getName())) {
+                flags.put(key, entry.getValue());
             } else {
-                LOG.debug("Overridden default value for {} with: {}", new Object[]{entry.getKey(), entry.getValue()});
+                Object overrideVal = jcloudsLocationConfig.get(key);
+                if (overrideVal == null) overrideVal = jcloudsLocationConfig.get(key.getName());
+                LOG.debug("Overridden default value for {} with: {}", new Object[]{key, overrideVal});
             }
         }
         this.jcloudsLocation = (JcloudsLocation)managementContext.getLocationRegistry().getLocationManaged(


[2/2] brooklyn-server git commit: This closes #705

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


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

Branch: refs/heads/master
Commit: fe6e370e05469ad29380ca63db9ca64cf8e15697
Parents: 6c7751d b845e41
Author: Aled Sage <al...@gmail.com>
Authored: Mon May 29 12:50:33 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Mon May 29 12:50:33 2017 +0100

----------------------------------------------------------------------
 .../jclouds/AbstractJcloudsStubbedUnitTest.java       | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------