You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by dr...@apache.org on 2017/11/17 16:25:37 UTC

[2/3] brooklyn-server git commit: Updates tests to use effector

Updates tests to use effector

Rather than use entity.stop use the stop effector to make test more
realistic.

Duplicate stop start test for test when ssh monitoring is enable to
ensure this works in both cases.


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

Branch: refs/heads/master
Commit: 67f60d958ded6016417d3fddd356d109a7961b63
Parents: 9dea09c
Author: Duncan Grant <du...@cloudsoftcorp.com>
Authored: Fri Nov 17 14:27:01 2017 +0000
Committer: Duncan Grant <du...@cloudsoftcorp.com>
Committed: Fri Nov 17 14:27:01 2017 +0000

----------------------------------------------------------------------
 .../base/VanillaSoftwareProcessTest.java        | 29 +++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/67f60d95/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java
index bcf79b4..b7c15ba 100644
--- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java
+++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java
@@ -18,14 +18,7 @@
  */
 package org.apache.brooklyn.entity.software.base;
 
-import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecContains;
-import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecHasAtLeastOnce;
-import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecHasNever;
-import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecHasOnlyOnce;
-import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecSatisfies;
-import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecsContain;
-import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecsNotContains;
-import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecsSatisfy;
+import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.*;
 
 import java.util.Map;
 import java.util.concurrent.Callable;
@@ -150,6 +143,18 @@ public class VanillaSoftwareProcessTest extends BrooklynAppUnitTestSupport {
                 "checkRunningCommand", "stopCommand",  
                 "preLaunchCommand", "launchCommand", "postLaunchCommand", 
                 "checkRunningCommand"));
+
+        EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true);
+
+        Entities.invokeEffector(app, entity, SoftwareProcess.STOP, ImmutableMap.of(
+                SoftwareProcess.StopSoftwareParameters.STOP_MACHINE_MODE.getName(), SoftwareProcess.StopSoftwareParameters.StopMode.NEVER))
+                .get();
+
+        EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, false);
+
+        entity.start(ImmutableList.of());
+
+        EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true);
     }
 
     
@@ -309,7 +314,7 @@ public class VanillaSoftwareProcessTest extends BrooklynAppUnitTestSupport {
         assertExecHasOnlyOnce(RecordingSshTool.getExecCmds(), "preInstallCommand");
         assertExecHasOnlyOnce(RecordingSshTool.getExecCmds(), "launchCommand");
     }
-    
+
     @Test
     public void testUseSshMonitoringDisabled() throws Exception {
         // Setup a custom health-check that returns true after launch is called, 
@@ -367,8 +372,12 @@ public class VanillaSoftwareProcessTest extends BrooklynAppUnitTestSupport {
         // Restart (see https://issues.apache.org/jira/browse/BROOKLYN-547)
         entity.restart();
         EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true);
-        entity.stop();
+
+        Entities.invokeEffector(app, entity, SoftwareProcess.STOP, ImmutableMap.of(
+                SoftwareProcess.StopSoftwareParameters.STOP_MACHINE_MODE.getName(), SoftwareProcess.StopSoftwareParameters.StopMode.NEVER))
+                .get();
         EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, false);
+
         entity.start(ImmutableList.of());
         EntityAsserts.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true);
     }