brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [2/4] brooklyn-server git commit: Read yaml directly into string in tests
Date Thu, 16 Jun 2016 10:15:34 GMT
Read yaml directly into string in tests

A Reader needs to be closed and the data ends up in a string anyway.


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

Branch: refs/heads/master
Commit: a0e0f2ccfc49fd5dbd9acf384d19abe480d5a0f2
Parents: 2f52917
Author: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Authored: Wed Jun 15 15:42:20 2016 +0300
Committer: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Committed: Thu Jun 16 11:49:20 2016 +0300

----------------------------------------------------------------------
 .../camp/brooklyn/AbstractYamlTest.java         | 14 ++++--
 .../brooklyn/camp/brooklyn/AppYamlTest.java     | 14 +++---
 .../camp/brooklyn/ByonLocationsYamlTest.java    | 24 +++++------
 .../brooklyn/ConfigInheritanceYamlTest.java     | 45 ++++++++++----------
 .../ConfigLocationInheritanceYamlTest.java      | 13 +++---
 .../camp/brooklyn/ConfigParametersYamlTest.java |  2 +-
 .../brooklyn/camp/brooklyn/ConfigYamlTest.java  | 15 +++----
 .../camp/brooklyn/EntitiesYamlTest.java         | 28 ++++++------
 .../camp/brooklyn/ExternalConfigYamlTest.java   |  9 ++--
 .../camp/brooklyn/LocationsYamlTest.java        | 27 ++++++------
 .../camp/brooklyn/WindowsYamlLiveTest.java      |  7 ++-
 .../brooklyn/camp/brooklyn/WrapAppTest.java     |  5 +--
 12 files changed, 97 insertions(+), 106 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0e0f2cc/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
index ca446f9..0b5df2c 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
@@ -19,7 +19,6 @@
 package org.apache.brooklyn.camp.brooklyn;
 
 import java.io.Reader;
-import java.io.StringReader;
 import java.util.Map;
 import java.util.Set;
 
@@ -112,20 +111,21 @@ public abstract class AbstractYamlTest {
         }
     }
 
-    protected Reader loadYaml(String yamlFileName, String ...extraLines) throws Exception {
+    protected String loadYaml(String yamlFileName, String ...extraLines) throws Exception {
         String input = new ResourceUtils(this).getResourceAsString(yamlFileName).trim();
         StringBuilder builder = new StringBuilder(input);
         for (String l: extraLines)
             builder.append("\n").append(l);
-        return new StringReader(builder.toString());
+        return builder.toString();
     }
     
     protected Entity createAndStartApplication(String... multiLineYaml) throws Exception {
         return createAndStartApplication(joinLines(multiLineYaml));
     }
     
+    /** @deprecated since 0.10.0, use {@link #createAndStartApplication(String)} instead */
     protected Entity createAndStartApplication(Reader input) throws Exception {
-        return createAndStartApplication(Streams.readFullyAndClose(input));
+        return createAndStartApplication(Streams.readFully(input));
     }
 
     protected Entity createAndStartApplication(String input) throws Exception {
@@ -140,7 +140,13 @@ public abstract class AbstractYamlTest {
         return app;
     }
 
+    /** @deprecated since 0.10.0, use {@link #createStartWaitAndLogApplication(String)} instead */
+    @Deprecated
     protected Entity createStartWaitAndLogApplication(Reader input) throws Exception {
+        return createStartWaitAndLogApplication(Streams.readFully(input));
+    }
+
+    protected Entity createStartWaitAndLogApplication(String input) throws Exception {
         Entity app = createAndStartApplication(input);
         waitForApplicationTasks(app);
         getLogger().info("App started: "+app);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0e0f2cc/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java
index c462889..098f911 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java
@@ -22,8 +22,6 @@ import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
 
-import java.io.StringReader;
-
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
 import org.apache.brooklyn.core.test.entity.TestApplication;
@@ -46,7 +44,7 @@ public class AppYamlTest extends AbstractYamlTest {
                 "services:",
                 "- serviceType: org.apache.brooklyn.core.test.entity.TestEntity");
         
-        BasicApplication app = (BasicApplication) createStartWaitAndLogApplication(new StringReader(yaml));
+        BasicApplication app = (BasicApplication) createStartWaitAndLogApplication(yaml);
         @SuppressWarnings("unused")
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
     }
@@ -57,7 +55,7 @@ public class AppYamlTest extends AbstractYamlTest {
                 "services:",
                 "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication");
         
-        TestApplication app = (TestApplication) createStartWaitAndLogApplication(new StringReader(yaml));
+        TestApplication app = (TestApplication) createStartWaitAndLogApplication(yaml);
         assertTrue(app.getChildren().isEmpty());
     }
     
@@ -69,7 +67,7 @@ public class AppYamlTest extends AbstractYamlTest {
                 "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication",
                 "  name: myEntityName");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         assertNull(app.getConfig(EntityManagementUtils.WRAPPER_APP_MARKER));
         assertEquals(app.getDisplayName(), "myTopLevelName");
         assertEquals(app.getChildren().size(), 0);
@@ -82,7 +80,7 @@ public class AppYamlTest extends AbstractYamlTest {
                 "services:",
                 "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication");
         
-        TestApplication app = (TestApplication) createStartWaitAndLogApplication(new StringReader(yaml));
+        TestApplication app = (TestApplication) createStartWaitAndLogApplication(yaml);
         assertTrue(app.getChildren().isEmpty());
         assertEquals(app.getDisplayName(), "myTopLevelName");
     }
@@ -96,7 +94,7 @@ public class AppYamlTest extends AbstractYamlTest {
                 "  brooklyn.config:",
                 "    defaultDisplayName: myDefaultEntityName");
         
-        TestApplication app = (TestApplication) createStartWaitAndLogApplication(new StringReader(yaml));
+        TestApplication app = (TestApplication) createStartWaitAndLogApplication(yaml);
         assertTrue(app.getChildren().isEmpty());
         assertEquals(app.getDisplayName(), "myTopLevelName");
     }
@@ -109,7 +107,7 @@ public class AppYamlTest extends AbstractYamlTest {
                 "  brooklyn.config:",
                 "    defaultDisplayName: myDefaultEntityName");
         
-        TestApplication app = (TestApplication) createStartWaitAndLogApplication(new StringReader(yaml));
+        TestApplication app = (TestApplication) createStartWaitAndLogApplication(yaml);
         assertTrue(app.getChildren().isEmpty());
         assertEquals(app.getDisplayName(), "myDefaultEntityName");
     }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0e0f2cc/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java
index 0f5f75d..66e619f 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ByonLocationsYamlTest.java
@@ -21,7 +21,6 @@ package org.apache.brooklyn.camp.brooklyn;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
 
-import java.io.StringReader;
 import java.util.Map;
 import java.util.Set;
 
@@ -35,6 +34,11 @@ import org.apache.brooklyn.core.location.access.PortForwardManager;
 import org.apache.brooklyn.core.location.access.PortForwardManagerLocationResolver;
 import org.apache.brooklyn.core.location.cloud.CloudLocationConfig;
 import org.apache.brooklyn.entity.software.base.DoNothingSoftwareProcess;
+import org.apache.brooklyn.location.byon.FixedListMachineProvisioningLocation;
+import org.apache.brooklyn.location.ssh.SshMachineLocation;
+import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
+import org.apache.brooklyn.test.Asserts;
+import org.apache.brooklyn.util.net.UserAndHostAndPort;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.Test;
@@ -47,12 +51,6 @@ import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import com.google.common.net.HostAndPort;
 
-import org.apache.brooklyn.location.byon.FixedListMachineProvisioningLocation;
-import org.apache.brooklyn.location.ssh.SshMachineLocation;
-import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
-import org.apache.brooklyn.test.Asserts;
-import org.apache.brooklyn.util.net.UserAndHostAndPort;
-
 public class ByonLocationsYamlTest extends AbstractYamlTest {
     private static final Logger log = LoggerFactory.getLogger(ByonLocationsYamlTest.class);
 
@@ -64,7 +62,7 @@ public class ByonLocationsYamlTest extends AbstractYamlTest {
                 "services:",
                 "- serviceType: org.apache.brooklyn.entity.stock.BasicApplication");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         FixedListMachineProvisioningLocation<SshMachineLocation> loc = (FixedListMachineProvisioningLocation<SshMachineLocation>) Iterables.get(app.getLocations(), 0);
         
         Set<SshMachineLocation> machines = loc.getAvailable();
@@ -87,7 +85,7 @@ public class ByonLocationsYamlTest extends AbstractYamlTest {
                 "services:",
                 "- serviceType: org.apache.brooklyn.entity.stock.BasicApplication");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         FixedListMachineProvisioningLocation<SshMachineLocation> loc = (FixedListMachineProvisioningLocation<SshMachineLocation>) Iterables.get(app.getLocations(), 0);
         
         Set<SshMachineLocation> machines = loc.getAvailable();
@@ -114,7 +112,7 @@ public class ByonLocationsYamlTest extends AbstractYamlTest {
                 "services:",
                 "- serviceType: org.apache.brooklyn.entity.stock.BasicApplication");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         FixedListMachineProvisioningLocation<WinRmMachineLocation> loc = (FixedListMachineProvisioningLocation<WinRmMachineLocation>) Iterables.get(app.getLocations(), 0);
         
         Set<WinRmMachineLocation> machines = loc.getAvailable();
@@ -151,7 +149,7 @@ public class ByonLocationsYamlTest extends AbstractYamlTest {
                 "services:",
                 "- serviceType: org.apache.brooklyn.entity.stock.BasicApplication");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         FixedListMachineProvisioningLocation<MachineLocation> loc = (FixedListMachineProvisioningLocation<MachineLocation>) Iterables.get(app.getLocations(), 0);
         
         Set<MachineLocation> machines = loc.getAvailable();
@@ -199,7 +197,7 @@ public class ByonLocationsYamlTest extends AbstractYamlTest {
                 "services:",
                 "- serviceType: org.apache.brooklyn.entity.stock.BasicApplication");
 
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         FixedListMachineProvisioningLocation<MachineLocation> loc = (FixedListMachineProvisioningLocation<MachineLocation>) Iterables.get(app.getLocations(), 0);
         PortForwardManager pfm = (PortForwardManager) mgmt().getLocationRegistry().getLocationManaged(PortForwardManagerLocationResolver.PFM_GLOBAL_SPEC);
         
@@ -240,7 +238,7 @@ public class ByonLocationsYamlTest extends AbstractYamlTest {
                 "  brooklyn.config:",
                 "    requiredOpenLoginPorts: [22, 1024]");
 
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         DoNothingSoftwareProcess entity = (DoNothingSoftwareProcess) Iterables.find(Entities.descendants(app), Predicates.instanceOf(DoNothingSoftwareProcess.class));
         FixedListMachineProvisioningLocation<MachineLocation> loc = (FixedListMachineProvisioningLocation<MachineLocation>) Iterables.get(app.getLocations(), 0);
         

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0e0f2cc/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java
index 36cd02b..4a4721b 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigInheritanceYamlTest.java
@@ -20,7 +20,6 @@ package org.apache.brooklyn.camp.brooklyn;
 
 import static org.testng.Assert.assertEquals;
 
-import java.io.StringReader;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.List;
@@ -147,7 +146,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "services:",
                 "- type: EmptySoftwareProcess-with-conf");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
         
         assertEmptySoftwareProcessConfig(
@@ -183,7 +182,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "      templateOptions:",
                 "        myOptionsKey2: myOptionsVal2");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
         
         assertEmptySoftwareProcessConfig(
@@ -222,7 +221,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "  brooklyn.children:",
                 "  - type: org.apache.brooklyn.entity.software.base.EmptySoftwareProcess");
 
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
         
         assertEmptySoftwareProcessConfig(
@@ -253,7 +252,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "  brooklyn.children:",
                 "  - type: org.apache.brooklyn.core.test.entity.TestEntity");
 
-        final Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        final Entity app = createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
      
         // Task that resolves quickly
@@ -280,7 +279,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "  brooklyn.children:",
                 "  - type: org.apache.brooklyn.core.test.entity.TestEntity");
 
-        final Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        final Entity app = createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
      
         // Task that resolves quickly
@@ -306,7 +305,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "  brooklyn.children:",
                 "  - type: org.apache.brooklyn.core.test.entity.TestEntity");
 
-        final Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        final Entity app = createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
      
         assertEquals(entity.config().get(TestEntity.CONF_MAP_THING), ImmutableMap.of("mykey", "myval", "mykey2", "myOther"));
@@ -325,7 +324,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "  brooklyn.children:",
                 "  - type: org.apache.brooklyn.core.test.entity.TestEntity");
 
-        final Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        final Entity app = createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
      
         assertEquals(entity.config().get(TestEntity.CONF_MAP_THING), ImmutableMap.of("mykey", "myval", "mykey2", "myOther"));
@@ -378,7 +377,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "        templateOptions:",
                 "          myOptionsKey2: myOptionsVal2");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
         
         assertEmptySoftwareProcessConfig(
@@ -427,7 +426,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                     "services:",
                     "- type: entity-with-keys");
             
-            Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+            Entity app = createStartWaitAndLogApplication(yaml);
             TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
     
             assertEquals(entity.config().get(entity.getEntityType().getConfigKey("map.type-merged")), ImmutableMap.of("myDefaultKey", "myDefaultVal"));
@@ -448,7 +447,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                     "    map.type-never:",
                     "      mykey2: myval2");
             
-            Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+            Entity app = createStartWaitAndLogApplication(yaml);
             TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
     
             assertEquals(entity.config().get(entity.getEntityType().getConfigKey("map.type-merged")), ImmutableMap.of("mykey2", "myval2"));
@@ -463,7 +462,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                     "services:",
                     "- type: entity-with-conf");
             
-            Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+            Entity app = createStartWaitAndLogApplication(yaml);
             TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
     
             assertEquals(entity.config().get(entity.getEntityType().getConfigKey("map.type-merged")), ImmutableMap.of("mykey", "myval"));
@@ -484,7 +483,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                     "    map.type-never:",
                     "      mykey2: myval2");
             
-            Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+            Entity app = createStartWaitAndLogApplication(yaml);
             TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
     
             assertEquals(entity.config().get(entity.getEntityType().getConfigKey("map.type-merged")), ImmutableMap.of("mykey", "myval", "mykey2", "myval2"));
@@ -524,7 +523,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                     "  brooklyn.children:",
                     "  - type: entity-with-keys");
             
-            Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+            Entity app = createStartWaitAndLogApplication(yaml);
             TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
     
             assertEquals(entity.config().get(entity.getEntityType().getConfigKey("map.type-merged")), ImmutableMap.of("myDefaultKey", "myDefaultVal"));
@@ -547,7 +546,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                     "  brooklyn.children:",
                     "  - type: entity-with-keys");
             
-            Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+            Entity app = createStartWaitAndLogApplication(yaml);
             TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
     
             assertEquals(entity.config().get(entity.getEntityType().getConfigKey("map.type-merged")), ImmutableMap.of("mykey", "myval"));
@@ -577,7 +576,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                     "      map.type-never:",
                     "        mykey2: myval2");
             
-            Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+            Entity app = createStartWaitAndLogApplication(yaml);
             TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
     
             assertEquals(entity.config().get(entity.getEntityType().getConfigKey("map.type-merged")), ImmutableMap.of("mykey", "myval", "mykey2", "myval2"));
@@ -599,7 +598,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "    shell.env:",
                 "      ENV2: myEnv2");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
         EntityAsserts.assertConfigEquals(entity, EmptySoftwareProcess.SHELL_ENVIRONMENT, expectedEnv);
     }
@@ -617,7 +616,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "    shell.env:",
                 "      ENV2: myEnv2");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
         EntityAsserts.assertConfigEquals(entity, EmptySoftwareProcess.SHELL_ENVIRONMENT, expectedEnv);
     }
@@ -635,7 +634,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "    env:",
                 "      ENV2: myEnv2");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
         EntityAsserts.assertConfigEquals(entity, EmptySoftwareProcess.SHELL_ENVIRONMENT, expectedEnv);
     }
@@ -655,7 +654,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "    env:",
                 "      ENV2: myEnv2");
 
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
         EntityAsserts.assertConfigEquals(entity, EmptySoftwareProcess.SHELL_ENVIRONMENT, expectedEnv);
     }
@@ -697,7 +696,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "services:",
                 "- type: EmptySoftwareProcess-level3");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
         EntityAsserts.assertConfigEquals(entity, EmptySoftwareProcess.SHELL_ENVIRONMENT, 
                 ImmutableMap.<String, Object>of("ENV1", "myEnv1", "ENV2", "myEnv2", "ENV3", "myEnv3"));
@@ -744,7 +743,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "services:",
                 "- type: TestEntity-level3");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
 
         assertEquals(entity.config().get(entity.getEntityType().getConfigKey("map.type-merged")), 
@@ -788,7 +787,7 @@ public class ConfigInheritanceYamlTest extends AbstractYamlTest {
                 "        map.type-merged:",
                 "          mykey3: myval3");
 
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.find(Entities.descendants(app), Predicates.instanceOf(TestEntity.class));
 
         assertEquals(entity.config().get(entity.getEntityType().getConfigKey("map.type-merged")), 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0e0f2cc/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigLocationInheritanceYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigLocationInheritanceYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigLocationInheritanceYamlTest.java
index eaf0d22..6fba27f 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigLocationInheritanceYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigLocationInheritanceYamlTest.java
@@ -20,7 +20,6 @@ package org.apache.brooklyn.camp.brooklyn;
 
 import static org.testng.Assert.assertEquals;
 
-import java.io.StringReader;
 import java.net.URI;
 import java.util.List;
 import java.util.Map;
@@ -200,7 +199,7 @@ public class ConfigLocationInheritanceYamlTest extends AbstractYamlTest {
                 "services:",
                 "- type: org.apache.brooklyn.entity.software.base.EmptySoftwareProcess");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
         
         assertMachineConfig(
@@ -221,7 +220,7 @@ public class ConfigLocationInheritanceYamlTest extends AbstractYamlTest {
                 "      templateOptions:",
                 "        subnetId: mysubnet");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
 
         assertMachineConfig(
@@ -244,7 +243,7 @@ public class ConfigLocationInheritanceYamlTest extends AbstractYamlTest {
                 "        networks: ",
                 "        subnetId: mysubnet");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
 
         assertMachineConfig(
@@ -277,7 +276,7 @@ public class ConfigLocationInheritanceYamlTest extends AbstractYamlTest {
                 "        mymap:",
                 "          key2: val2");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
 
         assertMachineConfig(
@@ -310,7 +309,7 @@ public class ConfigLocationInheritanceYamlTest extends AbstractYamlTest {
                 "      templateOptions:",
                 "        subnetId: mysubnet");
 
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
 
         assertMachineConfig(
@@ -341,7 +340,7 @@ public class ConfigLocationInheritanceYamlTest extends AbstractYamlTest {
                 "services:",
                 "- type: org.apache.brooklyn.entity.software.base.EmptySoftwareProcess");
 
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity entity = Iterables.getOnlyElement(app.getChildren());
 
         assertMachineConfig(

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0e0f2cc/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
index 869558b..3350686 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
@@ -59,7 +59,7 @@ public class ConfigParametersYamlTest extends AbstractYamlTest {
                 "services:",
                 "- type: entity-with-keys");
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
 
         // Check config key is listed

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0e0f2cc/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
index 569f90a..867122f 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
@@ -21,7 +21,6 @@ package org.apache.brooklyn.camp.brooklyn;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
-import java.io.StringReader;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -76,7 +75,7 @@ public class ConfigYamlTest extends AbstractYamlTest {
                 "    test.confSetPlain:",
                 "    - myval");
 
-        final Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        final Entity app = createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
      
         // Task that resolves quickly
@@ -108,7 +107,7 @@ public class ConfigYamlTest extends AbstractYamlTest {
                 "    test.confSetObjThing:",
                 "    - myval");
 
-        final Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        final Entity app = createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
      
         // Task that resolves quickly
@@ -137,7 +136,7 @@ public class ConfigYamlTest extends AbstractYamlTest {
                 "    test.confSetThing.mysubkey: myval",
                 "    test.confSetObjThing.mysubkey: myval");
 
-        final Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        final Entity app = createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
      
         // Task that resolves quickly
@@ -171,7 +170,7 @@ public class ConfigYamlTest extends AbstractYamlTest {
                 "    - $brooklyn:config(\"myOtherConf\")",
                 "    myOtherConf: myOther");
 
-        final Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        final Entity app = createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
      
         assertEquals(entity.config().get(TestEntity.CONF_NAME), "myOther");
@@ -191,7 +190,7 @@ public class ConfigYamlTest extends AbstractYamlTest {
                 "  brooklyn.config:",
                 "    test.confName: $brooklyn:attributeWhenReady(\"myOtherSensor\")");
 
-        final Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        final Entity app = createStartWaitAndLogApplication(yaml);
         final TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
 
         // Attribute not yet set; non-blocking will return promptly without the value
@@ -226,7 +225,7 @@ public class ConfigYamlTest extends AbstractYamlTest {
                 "    test.confSetThing:",
                 "    - $brooklyn:attributeWhenReady(\"myOtherSensor\")");
 
-        final Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        final Entity app = createStartWaitAndLogApplication(yaml);
         final TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
 
         // Attribute not yet set; non-blocking will return promptly without the value
@@ -277,7 +276,7 @@ public class ConfigYamlTest extends AbstractYamlTest {
                 "    test.confSetPlain:",
                 "    - $brooklyn:attributeWhenReady(\"myOtherSensor\")");
 
-        final Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        final Entity app = createStartWaitAndLogApplication(yaml);
         final TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
 
         // Attribute not yet set; non-blocking will return promptly without the value

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0e0f2cc/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 b63f587..d17fa2a 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
@@ -22,7 +22,6 @@ import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
-import java.io.StringReader;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -61,7 +60,6 @@ import org.apache.brooklyn.util.core.task.Tasks;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.guava.Functionals;
 import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.stream.Streams;
 import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes;
 import org.apache.brooklyn.util.time.Duration;
 import org.slf4j.Logger;
@@ -690,8 +688,8 @@ public class EntitiesYamlTest extends AbstractYamlTest {
 
     @Test
     public void testWithEntityLocationsAndStartInLocation() throws Exception {
-        Entity app = createAndStartApplication(Streams.readFullyAndClose(loadYaml("test-entity-basic-template.yaml",  
-            "  location: localhost:(name=localhost name)")),
+        Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml",  
+            "  location: localhost:(name=localhost name)"),
             // must pass as JSON list because otherwise the comma confuses the list parser
             MutableMap.of("locations", "[ "+JavaStringEscapes.wrapJavaString(
                 "byon:(hosts=\"1.1.1.1\", name=\"byon name\")")+" ]") );
@@ -781,7 +779,7 @@ public class EntitiesYamlTest extends AbstractYamlTest {
                 "       brooklyn.config:\n"+
                 "         test.confName: inchildspec\n";
         
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
+        Application app = (Application) createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
         
         TestEntity child = (TestEntity) entity.createAndManageChildFromConfig();
@@ -800,7 +798,7 @@ public class EntitiesYamlTest extends AbstractYamlTest {
                 "       type: org.apache.brooklyn.core.test.entity.TestEntity\n"+
                 "       confName: inchildspec\n";
         
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
+        Application app = (Application) createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
         
         TestEntity child = (TestEntity) entity.createAndManageChildFromConfig();
@@ -821,7 +819,7 @@ public class EntitiesYamlTest extends AbstractYamlTest {
                 "       brooklyn.flags:\n"+
                 "         confName: inchildspec\n";
         
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
+        Application app = (Application) createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
         
         TestEntity child = (TestEntity) entity.createAndManageChildFromConfig();
@@ -848,7 +846,7 @@ public class EntitiesYamlTest extends AbstractYamlTest {
                 "           brooklyn.config:\n" +
                 "             test.confName: greatgrandchild\n";
         
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
+        Application app = (Application) createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
         
         TestEntity child = (TestEntity) entity.createAndManageChildFromConfig();
@@ -880,7 +878,7 @@ public class EntitiesYamlTest extends AbstractYamlTest {
                 "             brooklyn.config:\n"+
                 "               test.confName: ingrandchildspec\n";
         
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
+        Application app = (Application) createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
         
         TestEntity child = (TestEntity) entity.createAndManageChildFromConfig();
@@ -902,7 +900,7 @@ public class EntitiesYamlTest extends AbstractYamlTest {
                 "       brooklyn.config:\n"+
                 "         test.confName: inchildspec\n";
         
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
+        Application app = (Application) createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
         EntitySpec<?> entitySpec = (EntitySpec<?>) entity.config().getBag().getStringKey("key.does.not.match");
         assertEquals(entitySpec.getType(), TestEntity.class);
@@ -934,7 +932,7 @@ public class EntitiesYamlTest extends AbstractYamlTest {
                 "services:\n"+
                 "- serviceType: org.apache.brooklyn.core.test.entity.TestEntityImpl\n";
         
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
+        Application app = (Application) createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
         assertTrue(entity.getCallHistory().contains("start"), "history="+entity.getCallHistory());
     }
@@ -946,7 +944,7 @@ public class EntitiesYamlTest extends AbstractYamlTest {
                 "- type: "+TestEntity.class.getName()+"\n"+
                 "  brooklyn.initializers: [ { type: "+TestSensorAndEffectorInitializer.class.getName()+" } ]";
         
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
+        Application app = (Application) createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
         
         Effector<?> hi = entity.getEffector(TestSensorAndEffectorInitializer.EFFECTOR_SAY_HELLO);
@@ -975,7 +973,7 @@ public class EntitiesYamlTest extends AbstractYamlTest {
                 "- type: "+TestEntity.class.getName()+"\n"+
                 "  brooklyn.initializers: [ { type: "+TestSensorAndEffectorInitializer.TestConfigurableInitializer.class.getName()+" } ]";
         
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
+        Application app = (Application) createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
         
         Task<String> saying = entity.invoke(Effectors.effector(String.class, TestSensorAndEffectorInitializer.EFFECTOR_SAY_HELLO).buildAbstract(), 
@@ -993,7 +991,7 @@ public class EntitiesYamlTest extends AbstractYamlTest {
                   + "brooklyn.config: { "+TestSensorAndEffectorInitializer.TestConfigurableInitializer.HELLO_WORD+": Hey }"
                   + " } ]";
         
-        Application app = (Application) createStartWaitAndLogApplication(new StringReader(yaml));
+        Application app = (Application) createStartWaitAndLogApplication(yaml);
         TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
         
         Task<String> saying = entity.invoke(Effectors.effector(String.class, TestSensorAndEffectorInitializer.EFFECTOR_SAY_HELLO).buildAbstract(), 
@@ -1007,7 +1005,7 @@ public class EntitiesYamlTest extends AbstractYamlTest {
                 "services:"+"\n"+
                 "- type: "+CustomTestEntityImpl.class.getName()+"\n";
 
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
 
         Entity testEntity = Iterables.getOnlyElement(app.getChildren());
         assertEquals(testEntity.getEntityType().getName(), "CustomTestEntityImpl");

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0e0f2cc/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
index 66d3cfe..a5f98b3 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ExternalConfigYamlTest.java
@@ -21,7 +21,6 @@ package org.apache.brooklyn.camp.brooklyn;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.fail;
 
-import java.io.StringReader;
 import java.util.Map;
 
 import org.apache.brooklyn.api.catalog.CatalogItem;
@@ -105,7 +104,7 @@ public class ExternalConfigYamlTest extends AbstractYamlTest {
             "  brooklyn.config:",
             "    my.config.key: $brooklyn:external(\"myprovider\", \"mykey\")");
 
-        TestApplication app = (TestApplication) createAndStartApplication(new StringReader(yaml));
+        TestApplication app = (TestApplication) createAndStartApplication(yaml);
         waitForApplicationTasks(app);
 
         assertEquals(app.getConfig(MY_CONFIG_KEY), "myval");
@@ -122,7 +121,7 @@ public class ExternalConfigYamlTest extends AbstractYamlTest {
             "  localhost:",
             "    my.config.key: $brooklyn:external(\"myprovider\", \"mykey\")");
 
-        TestApplication app = (TestApplication) createAndStartApplication(new StringReader(yaml));
+        TestApplication app = (TestApplication) createAndStartApplication(yaml);
         waitForApplicationTasks(app);
         assertEquals(Iterables.getOnlyElement( app.getLocations() ).config().get(MY_CONFIG_KEY), "myval");
     }
@@ -227,7 +226,7 @@ public class ExternalConfigYamlTest extends AbstractYamlTest {
             "    credential: $brooklyn:external(\"myprovider\", \"mykey\")",
             "location: localhost");
 
-        Entity app = createAndStartApplication(new StringReader(yaml));
+        Entity app = createAndStartApplication(yaml);
         waitForApplicationTasks(app);
         Entity entity = Iterables.getOnlyElement( app.getChildren() );
         assertEquals(Iterables.getOnlyElement( entity.getLocations() ).config().get(CloudLocationConfig.ACCESS_CREDENTIAL), "myval");
@@ -243,7 +242,7 @@ public class ExternalConfigYamlTest extends AbstractYamlTest {
             "  brooklyn.config:",
             "    my.config.key: $brooklyn:external(\"myproviderWithoutMapArg\", \"mykey\")");
 
-        TestApplication app = (TestApplication) createAndStartApplication(new StringReader(yaml));
+        TestApplication app = (TestApplication) createAndStartApplication(yaml);
         waitForApplicationTasks(app);
 
         assertEquals(app.getConfig(MY_CONFIG_KEY), "myHardcodedVal");

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0e0f2cc/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationsYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationsYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationsYamlTest.java
index f1efd33..934163b 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationsYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/LocationsYamlTest.java
@@ -22,7 +22,6 @@ import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
-import java.io.StringReader;
 import java.util.List;
 
 import org.apache.brooklyn.api.entity.Entity;
@@ -52,7 +51,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "services:\n"+
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         LocalhostMachineProvisioningLocation loc = (LocalhostMachineProvisioningLocation) Iterables.getOnlyElement(app.getLocations());
         assertNotNull(loc);
     }
@@ -64,7 +63,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "services:\n"+
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         LocalhostMachineProvisioningLocation loc = (LocalhostMachineProvisioningLocation) Iterables.getOnlyElement(app.getLocations());
         assertEquals(loc.getDisplayName(), "myname");
     }
@@ -77,7 +76,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "services:\n"+
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         LocalhostMachineProvisioningLocation loc = (LocalhostMachineProvisioningLocation) Iterables.getOnlyElement(app.getLocations());
         assertNotNull(loc);
     }
@@ -91,7 +90,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "services:\n"+
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         List<Location> locs = ImmutableList.copyOf(app.getLocations());
         assertEquals(locs.size(), 2, "locs="+locs);
         LocalhostMachineProvisioningLocation loc1 = (LocalhostMachineProvisioningLocation) locs.get(0);
@@ -110,7 +109,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "services:\n"+
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         LocalhostMachineProvisioningLocation loc = (LocalhostMachineProvisioningLocation) Iterables.getOnlyElement(app.getLocations());
         assertEquals(loc.getDisplayName(), "myname");
         assertEquals(loc.config().getLocalBag().getStringKey("myconfkey"), "myconfval");
@@ -129,7 +128,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "services:\n"+
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         List<Location> locs = ImmutableList.copyOf(app.getLocations());
         assertEquals(locs.size(), 2, "locs="+locs);
         LocalhostMachineProvisioningLocation loc1 = (LocalhostMachineProvisioningLocation) locs.get(0);
@@ -148,7 +147,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "services:\n"+
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         assertTrue(app.getLocations().isEmpty(), "locs="+app.getLocations());
     }
 
@@ -162,7 +161,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
         try {
-            createStartWaitAndLogApplication(new StringReader(yaml));
+            createStartWaitAndLogApplication(yaml);
         } catch (Exception e) {
             if (!e.toString().contains("Conflicting 'location' and 'locations'")) throw e;
         }
@@ -178,7 +177,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
         try {
-            createStartWaitAndLogApplication(new StringReader(yaml));
+            createStartWaitAndLogApplication(yaml);
         } catch (Exception e) {
             if (!e.toString().contains("must be a string or map")) throw e;
         }
@@ -192,7 +191,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "services:\n"+
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity child = Iterables.getOnlyElement(app.getChildren());
         LocalhostMachineProvisioningLocation loc = (LocalhostMachineProvisioningLocation) Iterables.getOnlyElement(Entities.getAllInheritedLocations(child));
         assertEquals(loc.getDisplayName(), "loc1");
@@ -211,7 +210,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "services:\n"+
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity child = Iterables.getOnlyElement(app.getChildren());
         FixedListMachineProvisioningLocation<?> loc = (FixedListMachineProvisioningLocation<?>) Iterables.getOnlyElement(Entities.getAllInheritedLocations(child));
         Assert.assertEquals(loc.getChildren().size(), 2);
@@ -232,7 +231,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "services:\n"+
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity child = Iterables.getOnlyElement(app.getChildren());
         FixedListMachineProvisioningLocation<?> loc = (FixedListMachineProvisioningLocation<?>) Iterables.getOnlyElement(Entities.getAllInheritedLocations(child));
         Assert.assertEquals(loc.getChildren().size(), 5);
@@ -260,7 +259,7 @@ public class LocationsYamlTest extends AbstractYamlTest {
                 "services:\n"+
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity\n";
         
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
+        Entity app = createStartWaitAndLogApplication(yaml);
         Entity child = Iterables.getOnlyElement(app.getChildren());
         MultiLocation<?> loc = (MultiLocation<?>) Iterables.getOnlyElement(Entities.getAllInheritedLocations(child));
         Assert.assertEquals(loc.getSubLocations().size(), 2);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0e0f2cc/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WindowsYamlLiveTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WindowsYamlLiveTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WindowsYamlLiveTest.java
index 7dcc9cb..d7e21fb 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WindowsYamlLiveTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WindowsYamlLiveTest.java
@@ -23,7 +23,6 @@ import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
-import java.io.StringReader;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -294,7 +293,7 @@ public class WindowsYamlLiveTest extends AbstractYamlTest {
         }
 
         if (Strings.isBlank(cmdFailed)) {
-            app = createAndStartApplication(new StringReader(Joiner.on("\n").join(yaml)));
+            app = createAndStartApplication(Joiner.on("\n").join(yaml));
             waitForApplicationTasks(app);
             log.info("App started:");
             Entities.dumpInfo(app);
@@ -305,7 +304,7 @@ public class WindowsYamlLiveTest extends AbstractYamlTest {
             assertStreams(entity, stdouts);
             
         } else if (cmdFailed.equals("stop-command")) {
-            app = createAndStartApplication(new StringReader(Joiner.on("\n").join(yaml)));
+            app = createAndStartApplication(Joiner.on("\n").join(yaml));
             waitForApplicationTasks(app);
             log.info("App started:");
             Entities.dumpInfo(app);
@@ -317,7 +316,7 @@ public class WindowsYamlLiveTest extends AbstractYamlTest {
             
         } else {
             try {
-                app = createAndStartApplication(new StringReader(Joiner.on("\n").join(yaml)));
+                app = createAndStartApplication(Joiner.on("\n").join(yaml));
                 fail("start should have failed for app="+app);
             } catch (Exception e) {
                 if (e.toString().contains("invalid result") && e.toString().contains("for "+cmdFailed)) throw e;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0e0f2cc/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WrapAppTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WrapAppTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WrapAppTest.java
index 6df5093..b7c378d 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WrapAppTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WrapAppTest.java
@@ -84,9 +84,6 @@ public class WrapAppTest extends AbstractYamlTest {
     }
     
     private StartableApplication createApp(String yaml) throws Exception {
-        StringReader in = new StringReader(yaml);
-        StartableApplication app = (StartableApplication)createAndStartApplication(in);
-        in.close();
-        return app;
+        return (StartableApplication)createAndStartApplication(yaml);
     }
 }


Mime
View raw message