brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [5/6] incubator-brooklyn git commit: Power Shell Commands, refactoring
Date Fri, 28 Aug 2015 08:16:55 GMT
Power Shell Commands, refactoring

- refactored runPreInstallCommand

- add config for powershell commands for:
  post-install; pre-launch; post-launch


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

Branch: refs/heads/master
Commit: 7aee31aea31aba6658357135f278948f4acbd595
Parents: 9a54156
Author: Valentin Aitken <valentin.aitken@cloudsoftcorp.com>
Authored: Tue Aug 25 15:10:05 2015 +0300
Committer: Valentin Aitken <valentin.aitken@cloudsoftcorp.com>
Committed: Fri Aug 28 10:52:48 2015 +0300

----------------------------------------------------------------------
 .../base/AbstractSoftwareProcessDriver.java     | 40 ++++++++------------
 .../base/AbstractSoftwareProcessSshDriver.java  | 25 ++++++++----
 .../AbstractSoftwareProcessWinRmDriver.java     | 28 ++++++++++----
 .../software/base/VanillaWindowsProcess.java    |  6 +++
 .../base/VanillaWindowsProcessWinRmDriver.java  | 17 ++++-----
 .../AbstractSoftwareProcessStreamsTest.java     |  9 ++---
 .../base/SoftwareProcessEntityTest.java         |  8 ++--
 ...nillaWindowsProcessWinrmStreamsLiveTest.java | 23 ++++++++++-
 8 files changed, 96 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7aee31ae/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessDriver.java
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessDriver.java
index 426cb8a..32de606 100644
--- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessDriver.java
+++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessDriver.java
@@ -116,11 +116,9 @@ public abstract class AbstractSoftwareProcessDriver implements SoftwareProcessDr
                 preInstall();
             }});
 
-            if (Strings.isNonBlank(entity.getConfig(BrooklynConfigKeys.PRE_INSTALL_COMMAND)))
{
-                DynamicTasks.queue("pre-install-command", new Runnable() { public void run()
{
-                    runPreInstallCommand(entity.getConfig(BrooklynConfigKeys.PRE_INSTALL_COMMAND));
-                }});
-            };
+            DynamicTasks.queue("pre-install-command", new Runnable() { public void run()
{
+                runPreInstallCommand();
+            }});
 
             Optional<Boolean> locationInstalled = Optional.fromNullable(getLocation().getConfig(BrooklynConfigKeys.SKIP_ENTITY_INSTALLATION));
             Optional<Boolean> entityInstalled = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_ENTITY_INSTALLATION));
@@ -142,11 +140,9 @@ public abstract class AbstractSoftwareProcessDriver implements SoftwareProcessDr
                 }});
             }
 
-            if (Strings.isNonBlank(entity.getConfig(BrooklynConfigKeys.POST_INSTALL_COMMAND)))
{
-                DynamicTasks.queue("post-install-command", new Runnable() { public void run()
{
-                    runPostInstallCommand(entity.getConfig(BrooklynConfigKeys.POST_INSTALL_COMMAND));
-                }});
-            }
+            DynamicTasks.queue("post-install-command", new Runnable() { public void run()
{
+                runPostInstallCommand();
+            }});
 
             DynamicTasks.queue("customize", new Runnable() { public void run() {
                 waitForConfigKey(BrooklynConfigKeys.CUSTOMIZE_LATCH);
@@ -158,22 +154,18 @@ public abstract class AbstractSoftwareProcessDriver implements SoftwareProcessDr
                 copyRuntimeResources();
             }});
 
-            if (Strings.isNonBlank(entity.getConfig(BrooklynConfigKeys.PRE_LAUNCH_COMMAND)))
{
-                DynamicTasks.queue("pre-launch-command", new Runnable() { public void run()
{
-                    runPreLaunchCommand(entity.getConfig(BrooklynConfigKeys.PRE_LAUNCH_COMMAND));
-                }});
-            };
+            DynamicTasks.queue("pre-launch-command", new Runnable() { public void run() {
+                runPreLaunchCommand();
+            }});
 
             DynamicTasks.queue("launch", new Runnable() { public void run() {
                 waitForConfigKey(BrooklynConfigKeys.LAUNCH_LATCH);
                 launch();
             }});
 
-            if (Strings.isNonBlank(entity.getConfig(BrooklynConfigKeys.POST_LAUNCH_COMMAND)))
{
-                DynamicTasks.queue("post-launch-command", new Runnable() { public void run()
{
-                    runPostLaunchCommand(entity.getConfig(BrooklynConfigKeys.POST_LAUNCH_COMMAND));
-                }});
-            };
+            DynamicTasks.queue("post-launch-command", new Runnable() { public void run()
{
+                runPostLaunchCommand();
+            }});
         }
 
         DynamicTasks.queue("post-launch", new Runnable() { public void run() {
@@ -189,14 +181,14 @@ public abstract class AbstractSoftwareProcessDriver implements SoftwareProcessDr
      */
     public void preInstall() {}
 
-    public abstract void runPreInstallCommand(String command);
+    public abstract void runPreInstallCommand();
     public abstract void setup();
     public abstract void install();
-    public abstract void runPostInstallCommand(String command);
+    public abstract void runPostInstallCommand();
     public abstract void customize();
-    public abstract void runPreLaunchCommand(String command);
+    public abstract void runPreLaunchCommand();
     public abstract void launch();
-    public abstract void runPostLaunchCommand(String command);
+    public abstract void runPostLaunchCommand();
 
     @Override
     public void kill() {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7aee31ae/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java
index e381c79..6b0e4a8 100644
--- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java
+++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java
@@ -33,6 +33,7 @@ import org.apache.brooklyn.core.BrooklynLogging;
 import org.apache.brooklyn.core.effector.EffectorTasks;
 import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks;
 import org.apache.brooklyn.core.entity.Attributes;
+import org.apache.brooklyn.core.entity.BrooklynConfigKeys;
 import org.apache.brooklyn.core.entity.Entities;
 import org.apache.brooklyn.core.entity.EntityInternal;
 import org.apache.brooklyn.core.feed.ConfigToAttributes;
@@ -295,23 +296,31 @@ public abstract class AbstractSoftwareProcessSshDriver extends AbstractSoftwareP
     }
 
     @Override
-    public void runPreInstallCommand(String command) {
-        execute(ImmutableList.of(command), "running pre-install commands");
+    public void runPreInstallCommand() {
+        if(Strings.isNonBlank(getEntity().getConfig(VanillaSoftwareProcess.PRE_INSTALL_COMMAND)))
{
+            execute(getEntity().getConfig(VanillaSoftwareProcess.PRE_INSTALL_COMMAND), "running
pre-install commands");
+        }
     }
 
     @Override
-    public void runPostInstallCommand(String command) {
-        execute(ImmutableList.of(command), "running post-install commands");
+    public void runPostInstallCommand() {
+        if (Strings.isNonBlank(entity.getConfig(BrooklynConfigKeys.POST_INSTALL_COMMAND)))
{
+            execute(ImmutableList.of(entity.getConfig(BrooklynConfigKeys.POST_INSTALL_COMMAND)),
"running post-install commands");
+        }
     }
 
     @Override
-    public void runPreLaunchCommand(String command) {
-        execute(ImmutableList.of(command), "running pre-launch commands");
+    public void runPreLaunchCommand() {
+        if (Strings.isNonBlank(entity.getConfig(BrooklynConfigKeys.PRE_LAUNCH_COMMAND)))
{
+            execute(ImmutableList.of(entity.getConfig(BrooklynConfigKeys.PRE_LAUNCH_COMMAND)),
"running pre-launch commands");
+        }
     }
 
     @Override
-    public void runPostLaunchCommand(String command) {
-        execute(ImmutableList.of(command), "running post-launch commands");
+    public void runPostLaunchCommand() {
+        if (Strings.isNonBlank(entity.getConfig(BrooklynConfigKeys.POST_LAUNCH_COMMAND)))
{
+            execute(ImmutableList.of(entity.getConfig(BrooklynConfigKeys.POST_LAUNCH_COMMAND)),
"running post-launch commands");
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7aee31ae/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessWinRmDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessWinRmDriver.java
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessWinRmDriver.java
index 2587833..750f3eb 100644
--- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessWinRmDriver.java
+++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessWinRmDriver.java
@@ -24,6 +24,7 @@ import org.apache.brooklyn.api.entity.EntityLocal;
 import org.apache.brooklyn.api.mgmt.Task;
 import org.apache.brooklyn.api.sensor.AttributeSensor;
 import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.entity.BrooklynConfigKeys;
 import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
 import org.apache.brooklyn.core.sensor.Sensors;
 import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
@@ -60,8 +61,13 @@ public abstract class AbstractSoftwareProcessWinRmDriver extends AbstractSoftwar
     }
 
     @Override
-    public void runPreInstallCommand(String command) {
-        execute(ImmutableList.of(command));
+    public void runPreInstallCommand() {
+        if (Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.PRE_INSTALL_COMMAND))
|| Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.PRE_INSTALL_POWERSHELL_COMMAND)))
{
+            executeCommand(VanillaWindowsProcess.PRE_INSTALL_COMMAND, VanillaWindowsProcess.PRE_INSTALL_POWERSHELL_COMMAND,
true);
+        }
+        if (entity.getConfig(VanillaWindowsProcess.PRE_INSTALL_REBOOT_REQUIRED)) {
+            rebootAndWait();
+        }
     }
 
     @Override
@@ -70,18 +76,24 @@ public abstract class AbstractSoftwareProcessWinRmDriver extends AbstractSoftwar
     }
 
     @Override
-    public void runPostInstallCommand(String command) {
-        execute(ImmutableList.of(command));
+    public void runPostInstallCommand() {
+        if (Strings.isNonBlank(entity.getConfig(BrooklynConfigKeys.POST_INSTALL_COMMAND))
|| Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.POST_INSTALL_POWERSHELL_COMMAND)))
{
+            executeCommand(BrooklynConfigKeys.POST_INSTALL_COMMAND, VanillaWindowsProcess.POST_INSTALL_POWERSHELL_COMMAND,
true);
+        }
     }
 
     @Override
-    public void runPreLaunchCommand(String command) {
-        execute(ImmutableList.of(command));
+    public void runPreLaunchCommand() {
+        if (Strings.isNonBlank(entity.getConfig(BrooklynConfigKeys.PRE_LAUNCH_COMMAND)) ||
Strings.isNonBlank(entity.getConfig(VanillaWindowsProcess.PRE_LAUNCH_POWERSHELL_COMMAND)))
{
+            executeCommand(BrooklynConfigKeys.PRE_LAUNCH_COMMAND, VanillaWindowsProcess.PRE_LAUNCH_POWERSHELL_COMMAND,
true);
+        }
     }
 
     @Override
-    public void runPostLaunchCommand(String command) {
-        execute(ImmutableList.of(command));
+    public void runPostLaunchCommand() {
+        if (Strings.isNonBlank(entity.getConfig(BrooklynConfigKeys.POST_LAUNCH_COMMAND))
|| Strings.isNonBlank(entity.getConfig(VanillaWindowsProcess.POST_LAUNCH_POWERSHELL_COMMAND)))
{
+            executeCommand(BrooklynConfigKeys.POST_LAUNCH_COMMAND, VanillaWindowsProcess.POST_LAUNCH_POWERSHELL_COMMAND,
true);
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7aee31ae/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcess.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcess.java
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcess.java
index 6390eba..f243e38 100644
--- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcess.java
+++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcess.java
@@ -37,6 +37,12 @@ public interface VanillaWindowsProcess extends AbstractVanillaProcess {
             ImmutableSet.of(5985, 3389));
     ConfigKey<String> PRE_INSTALL_POWERSHELL_COMMAND = ConfigKeys.newStringConfigKey("pre.install.powershell.command",
             "powershell command to run during the pre-install phase");
+    ConfigKey<String> POST_INSTALL_POWERSHELL_COMMAND = ConfigKeys.newStringConfigKey("post.install.powershell.command",
+            "powershell command to run during the post-install phase");
+    ConfigKey<String> PRE_LAUNCH_POWERSHELL_COMMAND = ConfigKeys.newStringConfigKey("pre.launch.powershell.command",
+            "powershell command to run during the pre-launch phase");
+    ConfigKey<String> POST_LAUNCH_POWERSHELL_COMMAND = ConfigKeys.newStringConfigKey("post.launch.powershell.command",
+            "powershell command to run during the post-launch phase");
     ConfigKey<Boolean> PRE_INSTALL_REBOOT_REQUIRED = ConfigKeys.newBooleanConfigKey("pre.install.reboot.required",
             "indicates that a reboot should be performed after the pre-install command is
run", false);
     ConfigKey<Boolean> INSTALL_REBOOT_REQUIRED = ConfigKeys.newBooleanConfigKey("install.reboot.required",

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7aee31ae/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
index 640c0d0..c70a35e 100644
--- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
+++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
@@ -23,6 +23,7 @@ import org.apache.brooklyn.api.entity.EntityLocal;
 import org.apache.brooklyn.core.entity.Attributes;
 import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
 import org.apache.brooklyn.util.net.UserAndHostAndPort;
+import org.apache.brooklyn.util.text.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,19 +42,13 @@ public class VanillaWindowsProcessWinRmDriver extends AbstractSoftwareProcessWin
 
         super.start();
     }
-    
-    @Override
-    public void runPreInstallCommand(String preInstallCommand) {
-        executeCommand(VanillaWindowsProcess.PRE_INSTALL_COMMAND, VanillaWindowsProcess.PRE_INSTALL_POWERSHELL_COMMAND,
true);
-        if (entity.getConfig(VanillaWindowsProcess.PRE_INSTALL_REBOOT_REQUIRED)) {
-            rebootAndWait();
-        }
-    }
 
     @Override
     public void install() {
         // TODO: Follow install path of VanillaSoftwareProcessSshDriver
-        executeCommand(VanillaWindowsProcess.INSTALL_COMMAND, VanillaWindowsProcess.INSTALL_POWERSHELL_COMMAND,
true);
+        if(Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.INSTALL_COMMAND))
|| Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.INSTALL_POWERSHELL_COMMAND)))
{
+            executeCommand(VanillaWindowsProcess.INSTALL_COMMAND, VanillaWindowsProcess.INSTALL_POWERSHELL_COMMAND,
true);
+        }
         if (entity.getConfig(VanillaWindowsProcess.INSTALL_REBOOT_REQUIRED)) {
             rebootAndWait();
         }
@@ -62,7 +57,9 @@ public class VanillaWindowsProcessWinRmDriver extends AbstractSoftwareProcessWin
     @Override
     public void customize() {
         // TODO: Follow customize path of VanillaSoftwareProcessSshDriver
-        executeCommand(VanillaWindowsProcess.CUSTOMIZE_COMMAND, VanillaWindowsProcess.CUSTOMIZE_POWERSHELL_COMMAND,
true);
+        if(Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.CUSTOMIZE_COMMAND))
|| Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.CUSTOMIZE_POWERSHELL_COMMAND)))
{
+            executeCommand(VanillaWindowsProcess.CUSTOMIZE_COMMAND, VanillaWindowsProcess.CUSTOMIZE_POWERSHELL_COMMAND,
true);
+        }
         if (entity.getConfig(VanillaWindowsProcess.CUSTOMIZE_REBOOT_REQUIRED)) {
             rebootAndWait();
         }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7aee31ae/software/base/src/test/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessStreamsTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessStreamsTest.java
b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessStreamsTest.java
index 8f6fbba..a1f006a 100644
--- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessStreamsTest.java
+++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessStreamsTest.java
@@ -32,16 +32,15 @@ import org.apache.brooklyn.core.test.BrooklynAppLiveTestSupport;
 import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
 import org.apache.brooklyn.core.test.entity.TestApplication;
 import org.apache.brooklyn.util.core.task.TaskPredicates;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import org.apache.brooklyn.util.text.StringPredicates;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.BeforeMethod;
 
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import static com.google.common.base.Preconditions.checkNotNull;
 import static org.testng.Assert.assertTrue;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7aee31ae/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java
b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java
index 2b5ec4a..eb77899 100644
--- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java
+++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java
@@ -705,16 +705,16 @@ public class SoftwareProcessEntityTest extends BrooklynAppUnitTestSupport
{
         }
 
         @Override
-        public void runPreInstallCommand(String command) { }
+        public void runPreInstallCommand() { }
 
         @Override
-        public void runPostInstallCommand(String command) { }
+        public void runPostInstallCommand() { }
 
         @Override
-        public void runPreLaunchCommand(String command) { }
+        public void runPreLaunchCommand() { }
 
         @Override
-        public void runPostLaunchCommand(String command) { }
+        public void runPostLaunchCommand() { }
 
         @Override
         protected String getInstallLabelExtraSalt() {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7aee31ae/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinrmStreamsLiveTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinrmStreamsLiveTest.java
b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinrmStreamsLiveTest.java
index 48c7f1c..788df8a 100644
--- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinrmStreamsLiveTest.java
+++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinrmStreamsLiveTest.java
@@ -46,7 +46,7 @@ public class VanillaWindowsProcessWinrmStreamsLiveTest extends AbstractSoftwareP
                 .put("checkRunning.command", "echo true")
                 .put("useJcloudsSshInit", false)
                 .build();
-        location = ((JcloudsLocation)mgmt.getLocationRegistry().resolve("jclouds:aws-ec2:eu-west-1",
config)).obtain();
+        location = ((JcloudsLocation)mgmt.getLocationRegistry().resolve("jclouds:aws-ec2:us-west-1",
config)).obtain();
     }
 
     @Test(groups = "Live")
@@ -55,20 +55,41 @@ public class VanillaWindowsProcessWinrmStreamsLiveTest extends AbstractSoftwareP
         VanillaWindowsProcess entity = app.createAndManageChild(EntitySpec.create(VanillaWindowsProcess.class)
                 .configure(VanillaSoftwareProcess.PRE_INSTALL_COMMAND, "echo " + getCommands().get("pre-install-command"))
                 .configure(VanillaSoftwareProcess.INSTALL_COMMAND, "echo " + getCommands().get("^install$"))
+                .configure(VanillaSoftwareProcess.POST_INSTALL_COMMAND, "echo " + getCommands().get("post-install-command"))
                 .configure(VanillaSoftwareProcess.CUSTOMIZE_COMMAND, "echo " + getCommands().get("^customize$"))
+                .configure(VanillaSoftwareProcess.PRE_LAUNCH_COMMAND, "echo " + getCommands().get("pre-launch-command"))
                 .configure(VanillaSoftwareProcess.LAUNCH_COMMAND, "echo " + getCommands().get("^launch$"))
+                .configure(VanillaSoftwareProcess.POST_LAUNCH_COMMAND, "echo " + getCommands().get("post-launch-command"))
                 .configure(VanillaSoftwareProcess.CHECK_RUNNING_COMMAND, "echo true"));
         app.start(ImmutableList.of(location));
         assertStreams(entity);
     }
 
+    @Test(groups = "Live")
+    public void testGetsStreamsPowerShell() {
+        VanillaWindowsProcess entity = app.createAndManageChild(EntitySpec.create(VanillaWindowsProcess.class)
+                .configure(VanillaWindowsProcess.PRE_INSTALL_POWERSHELL_COMMAND, "echo "
+ getCommands().get("pre-install-command"))
+                .configure(VanillaWindowsProcess.INSTALL_POWERSHELL_COMMAND, "echo " + getCommands().get("^install$"))
+                .configure(VanillaWindowsProcess.POST_INSTALL_POWERSHELL_COMMAND, "echo "
+ getCommands().get("post-install-command"))
+                .configure(VanillaWindowsProcess.CUSTOMIZE_POWERSHELL_COMMAND, "echo " +
getCommands().get("^customize$"))
+                .configure(VanillaWindowsProcess.PRE_LAUNCH_POWERSHELL_COMMAND, "echo " +
getCommands().get("pre-launch-command"))
+                .configure(VanillaWindowsProcess.LAUNCH_POWERSHELL_COMMAND, "echo " + getCommands().get("^launch$"))
+                .configure(VanillaWindowsProcess.POST_LAUNCH_POWERSHELL_COMMAND, "echo "
+ getCommands().get("post-launch-command"))
+                .configure(VanillaWindowsProcess.CHECK_RUNNING_POWERSHELL_COMMAND, "echo
true"));
+        app.start(ImmutableList.of(location));
+        assertStreams(entity);
+    }
+
     @Override
     protected Map<String, String> getCommands() {
         return ImmutableMap.<String, String>builder()
                 .put("pre-install-command", "myPreInstall")
                 .put("^install$", "myInstall")
+                .put("post-install-command", "pre install command output")
                 .put("^customize$", "myCustomizing")
+                .put("pre-launch-command", "pre launch command output")
                 .put("^launch$", "myLaunch")
+                .put("post-launch-command", "post launch command output")
                 .build();
     }
 }


Mime
View raw message