brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [3/4] incubator-brooklyn git commit: Adds waitForTasksToComplete parameter to YamlLauncher test methods
Date Wed, 14 Jan 2015 22:32:38 GMT
Adds waitForTasksToComplete parameter to YamlLauncher test methods


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

Branch: refs/heads/master
Commit: 62a54f9b6c0d84b158c89dfd56a49a38f0d4a318
Parents: 359bd1c
Author: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Authored: Wed Jan 14 19:00:15 2015 +0000
Committer: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Committed: Wed Jan 14 19:00:15 2015 +0000

----------------------------------------------------------------------
 .../camp/brooklyn/YamlLauncherAbstract.java     | 22 +++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/62a54f9b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
index 27f0ffb..c4e7894 100644
--- a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
+++ b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
@@ -74,9 +74,13 @@ public abstract class YamlLauncherAbstract {
     protected abstract BrooklynCampPlatformLauncherAbstract newPlatformLauncher();
 
     public Application launchAppYaml(String url) {
+        return launchAppYaml(url, true);
+    }
+
+    public Application launchAppYaml(String url, boolean waitForTasksToComplete) {
         try {
             Reader input = Streams.reader(new ResourceUtils(this).getResourceFromUrl(url));
-            Application app = launchAppYaml(input);
+            Application app = launchAppYaml(input, waitForTasksToComplete);
             log.info("Application started from YAML file "+url+": "+app);
             return app;
         } catch (Exception e) {
@@ -85,6 +89,10 @@ public abstract class YamlLauncherAbstract {
     }
 
     public Application launchAppYaml(Reader input) {
+        return launchAppYaml(input, true);
+    }
+
+    public Application launchAppYaml(Reader input, boolean waitForTasksToComplete) {
         try {
             AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
 
@@ -93,10 +101,14 @@ public abstract class YamlLauncherAbstract {
             log.info("Launching "+app);
 
             if (getShutdownAppsOnExit()) BrooklynShutdownHooks.invokeStopOnShutdown(app);
-            
-            Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(brooklynMgmt.getExecutionManager(),
app);
-            log.info("Waiting on "+tasks.size()+" task(s)");
-            for (Task<?> t: tasks) t.blockUntilEnded();
+
+            if (waitForTasksToComplete) {
+                Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(brooklynMgmt.getExecutionManager(),
app);
+                log.info("Waiting on "+tasks.size()+" task(s)");
+                for (Task<?> t: tasks) {
+                    t.blockUntilEnded();
+                }
+            }
 
             log.info("Application started from YAML: "+app);
             Entities.dumpInfo(app);


Mime
View raw message