brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/2] brooklyn-server git commit: Address commit e4dfd87a74e58d373d45fa67f66656c9e6ac863c review comments
Date Thu, 23 Jun 2016 12:01:00 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master d9cbe117d -> 4b11f509d


Address commit e4dfd87a74e58d373d45fa67f66656c9e6ac863c  review comments


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

Branch: refs/heads/master
Commit: 1d929bc6c3d37bfc226cd11c20bd39e13d7bdddc
Parents: e4dfd87
Author: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Authored: Thu Jun 23 14:18:11 2016 +0300
Committer: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Committed: Thu Jun 23 14:18:11 2016 +0300

----------------------------------------------------------------------
 .../apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java | 12 ++++++------
 .../software/base/ShellEnvironmentSerializer.java       |  4 ++--
 .../software/base/ShellEnvironmentSerializerTest.java   |  2 ++
 3 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/1d929bc6/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
index 924db45..e87a3f3 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java
@@ -1029,9 +1029,9 @@ public class EntitiesYamlTest extends AbstractYamlTest {
                 "    - true",
                 "    - $brooklyn:entity(\"self\")",
                 "    shell.env:",
-                "      mapRef: $brooklyn:config(\"map-config\")",
-                "      listRef: $brooklyn:config(\"list-config\")",
-                "      bean:",
+                "      MAP_REF: $brooklyn:config(\"map-config\")",
+                "      LIST_REF: $brooklyn:config(\"list-config\")",
+                "      BEAN:",
                 "        $brooklyn:object:",
                 "          type: org.apache.brooklyn.entity.software.base.SoftwareProcessShellEnvironmentTest$SimpleBean",
                 "          object.fields:",
@@ -1046,9 +1046,9 @@ public class EntitiesYamlTest extends AbstractYamlTest {
 
         Map<String, ?> env = recordingMachine.getRecordedEnv().get(1);
         String entityRef = "{\"type\":\"org.apache.brooklyn.api.entity.Entity\",\"id\":\""
+ entity.getId() + "\"}";
-        assertEquals(env.get("mapRef"), "{\"key1\":\"val1\",\"key2\":" + entityRef + "}");
-        assertEquals(env.get("listRef"), "[4.12,true," + entityRef + "]");
-        assertEquals(env.get("bean"), "{\"propString\":\"bean-string\",\"propInt\":-1}");
+        assertEquals(env.get("MAP_REF"), "{\"key1\":\"val1\",\"key2\":" + entityRef + "}");
+        assertEquals(env.get("LIST_REF"), "[4.12,true," + entityRef + "]");
+        assertEquals(env.get("BEAN"), "{\"propString\":\"bean-string\",\"propInt\":-1}");
     }
     
     public static class CustomTestEntityImpl extends TestEntityImpl {

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/1d929bc6/software/base/src/main/java/org/apache/brooklyn/entity/software/base/ShellEnvironmentSerializer.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/ShellEnvironmentSerializer.java
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/ShellEnvironmentSerializer.java
index 6368496..9b71b8b 100644
--- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/ShellEnvironmentSerializer.java
+++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/ShellEnvironmentSerializer.java
@@ -35,7 +35,7 @@ public class ShellEnvironmentSerializer {
         try {
             String str = mapper.writeValueAsString(value);
             // Avoid dealing with unquoting and unescaping the serialized result is a string
-            if (isString(str)) {
+            if (isJsonString(str)) {
                 return value.toString();
             } else {
                 return str;
@@ -45,7 +45,7 @@ public class ShellEnvironmentSerializer {
         }
     }
 
-    protected boolean isString(String str) {
+    protected boolean isJsonString(String str) {
         return str.length() > 0 && str.charAt(0) == '"';
     }
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/1d929bc6/software/base/src/test/java/org/apache/brooklyn/entity/software/base/ShellEnvironmentSerializerTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/ShellEnvironmentSerializerTest.java
b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/ShellEnvironmentSerializerTest.java
index 244439d..5a44da5 100644
--- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/ShellEnvironmentSerializerTest.java
+++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/ShellEnvironmentSerializerTest.java
@@ -54,6 +54,8 @@ public class ShellEnvironmentSerializerTest extends BrooklynAppUnitTestSupport
{
         assertSerialize(null, null);
         assertSerialize(ImmutableList.of(str, 3.14, 0.14));
         assertSerialize(ImmutableMap.of("string", str, "num1", 3.14, "num2", 0.14));
+        assertSerialize(ImmutableMap.of("list", ImmutableList.of(str, 3.14, 0.14), 
+                "map", ImmutableMap.of("string", str, "num1", 3.14, "num2", 0.14)));
         assertSerialize(app, appExpected);
         assertSerialize(ImmutableList.of(app), "[" + appExpected + "]");
         assertSerialize(ImmutableMap.of("app", app), "{\"app\":" + appExpected + "}");


Mime
View raw message