commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1098095 - /commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestExec.java
Date Sat, 30 Apr 2011 10:33:54 GMT
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



Mime
View raw message