You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/04/30 12:33:54 UTC
svn commit: r1098095 -
/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestExec.java
Author: mturk
Date: Sat Apr 30 10:33:54 2011
New Revision: 1098095
URL: http://svn.apache.org/viewvc?rev=1098095&view=rev
Log:
Add exec I/O test
Modified:
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestExec.java
Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestExec.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestExec.java?rev=1098095&r1=1098094&r2=1098095&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestExec.java (original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestExec.java Sat Apr 30 10:33:54 2011
@@ -46,6 +46,23 @@ public class TestExec extends Assert
System.out.println(new String(os.toByteArray()));
}
+ @Test(groups = { "posix" })
+ public void runCat()
+ throws Exception
+ {
+ Exec e = Exec.newInstance();
+ assertNotNull(e);
+ ArrayList<String> args = new ArrayList<String>();
+ args.add("/bin/cat");
+ e.setInput("hello world".getBytes());
+ e.redirectOutputStream(true);
+ int r = e.run(args);
+ assertEquals(r, Status.CHILD_DONE);
+ ByteArrayOutputStream os = (ByteArrayOutputStream)e.getOutputStream();
+ String rs = new String(os.toByteArray());
+ assertEquals(rs, "hello world");
+ }
+
@Test(groups = { "windows" })
public void runWindows()
throws Exception