No echo executable on Windows.

There is no echo executable on Windows, it is a command
provided by the shell. To test the process builder we need
OS-specific commands. The alternative is to include shell
scripts for both UNIX and Windows and call them with an
uniform command.


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

Branch: refs/heads/master
Commit: 9b70511429b68d9d9b9cf93c9cac7068c1d729db
Parents: e324c24
Author: Svetoslav Neykov <svetoslav.ney...@cloudsoftcorp.com>
Authored: Fri Jun 6 18:02:47 2014 +0300
Committer: Svetoslav Neykov <svetoslav.ney...@cloudsoftcorp.com>
Committed: Wed Jun 25 18:28:53 2014 +0300

----------------------------------------------------------------------
 .../internal/ssh/process/ProcessToolStaticsTest.java    | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/9b705114/core/src/test/java/brooklyn/util/internal/ssh/process/ProcessToolStaticsTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/brooklyn/util/internal/ssh/process/ProcessToolStaticsTest.java
 
b/core/src/test/java/brooklyn/util/internal/ssh/process/ProcessToolStaticsTest.java
index 5557108..563f7ec 100644
--- 
a/core/src/test/java/brooklyn/util/internal/ssh/process/ProcessToolStaticsTest.java
+++ 
b/core/src/test/java/brooklyn/util/internal/ssh/process/ProcessToolStaticsTest.java
@@ -3,12 +3,14 @@ package brooklyn.util.internal.ssh.process;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.util.Arrays;
+import java.util.List;
 
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import brooklyn.util.collections.MutableMap;
+import brooklyn.util.os.Os;
 
 public class ProcessToolStaticsTest {
 
@@ -21,9 +23,17 @@ public class ProcessToolStaticsTest {
         err = new ByteArrayOutputStream();
     }
     
+    private List<String> getTestCommand() {
+        if(Os.isMicrosoftWindows()) {
+            return Arrays.asList("cmd", "/c", "echo", "hello", "world");
+        } else {
+            return Arrays.asList("echo", "hello", "world");
+        }
+    }
+
     @Test
     public void testRunsWithStdout() throws Exception {
-        int code = ProcessTool.execSingleProcess(Arrays.asList("echo", 
"hello", "world"), null, (File)null, out, err, this);
+        int code = ProcessTool.execSingleProcess(getTestCommand(), null, 
(File)null, out, err, this);
         Assert.assertEquals(err.toString().trim(), "");
         Assert.assertEquals(out.toString().trim(), "hello world");
         Assert.assertEquals(code, 0);

Reply via email to