Wait all apps running in BrooklynNote test

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

Branch: refs/heads/master
Commit: af9cf334d7bcd5fb28ef245ac94bd30e28c77548
Parents: 00ec054
Author: Svetoslav Neykov <[email protected]>
Authored: Wed Jun 24 22:03:56 2015 +0300
Committer: Svetoslav Neykov <[email protected]>
Committed: Thu Jun 25 17:20:13 2015 +0300

----------------------------------------------------------------------
 .../entity/brooklynnode/BrooklynNodeIntegrationTest.java | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/af9cf334/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java
 
b/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java
index ba6cd92..182c24a 100644
--- 
a/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java
+++ 
b/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java
@@ -48,6 +48,7 @@ import brooklyn.entity.basic.BasicApplication;
 import brooklyn.entity.basic.BasicApplicationImpl;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.basic.EntityLocal;
+import brooklyn.entity.basic.Lifecycle;
 import brooklyn.entity.basic.SoftwareProcess.StopSoftwareParameters.StopMode;
 import brooklyn.entity.brooklynnode.BrooklynNode.DeployBlueprintEffector;
 import brooklyn.entity.brooklynnode.BrooklynNode.ExistingFileBehaviour;
@@ -362,15 +363,24 @@ services:
         
HttpTestUtils.assertHttpStatusCodeEventuallyEquals(webConsoleUri+"/v1/applications",
 200);
     }
 
+    // TODO Should introduce startup stages and let the client select which 
stage it expects to be complete
     protected void waitForApps(final URI webConsoleUri, final int num) {
         waitForApps(webConsoleUri.toString());
         
         // e.g. [{"id":"UnBqPcqg","spec":{"name":"Application 
(UnBqPcqg)","type":"brooklyn.entity.basic.BasicApplication","locations":["pOL4NtiW"]},"status":"RUNNING","links":{"self":"/v1/applications/UnBqPcqg","entities":"/v1/applications/UnBqPcqg/entities"}}]
         Asserts.succeedsEventually(new Runnable() {
+            @Override
             public void run() {
+                //Wait all apps to become managed
                 String appsContent = 
HttpTestUtils.getContent(webConsoleUri.toString()+"/v1/applications");
                 List<String> appIds = parseJsonList(appsContent, 
ImmutableList.of("id"), String.class);
                 assertEquals(appIds.size(), num);
+                
+                // and then to start
+                List<String> statuses = parseJsonList(appsContent, 
ImmutableList.of("status"), String.class);
+                for (String status : statuses) {
+                    assertEquals(status, 
Lifecycle.RUNNING.toString().toUpperCase());
+                }
             }});
     }
 
@@ -541,7 +551,6 @@ services:
         File pidFile = new File(getDriver(brooklynNode).getPidFile());
         assertTrue(isPidRunning(pidFile));
         
-        Maybe<MachineLocation> l = 
Locations.findUniqueMachineLocation(brooklynNode.getLocations());
         brooklynNode.invoke(eff, Collections.<String, 
Object>emptyMap()).getUnchecked();
 
         // Note can't use driver.isRunning to check shutdown; can't invoke 
scripts on an unmanaged entity

Reply via email to