Author: jim.ma
Date: 2009-11-10 06:54:00 -0500 (Tue, 10 Nov 2009)
New Revision: 11103
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1666/JBWS1666TestCase.java
Log:
[JBWS-2817]:Use executeCommand() to avoid hangs error on windows
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1666/JBWS1666TestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1666/JBWS1666TestCase.java 2009-11-10
09:42:59 UTC (rev 11102)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws1666/JBWS1666TestCase.java 2009-11-10
11:54:00 UTC (rev 11103)
@@ -24,13 +24,11 @@
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.InputStreamReader;
import junit.framework.Test;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
-import org.jboss.wsf.common.IOUtils;
/**
* [JBWS-1666] Simplify JBossWS jar dependencies
@@ -92,24 +90,15 @@
cp.append(PS + jbc + FS + "jboss-common-core.jar");
cp.append(PS + jbc + FS + "jboss-javaee.jar");
- Runtime rt = Runtime.getRuntime();
-
String command = javaCmd + " -Djava.endorsed.dirs=" + jbl + FS +
"endorsed -cp " + cp + " " + TestClient.class.getName() + "
" + getServerHost();
- System.out.println("Executing command: " + command);
- Process proc = rt.exec(command);
- int status = proc.waitFor();
- if (status == 0)
- {
- BufferedReader br = new BufferedReader(new
InputStreamReader(proc.getInputStream()));
- String resStr = br.readLine();
- assertEquals(TestClient.REQ_STR, resStr);
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ executeCommand(command, bout);
+ String res = null;
+ if (bout.toByteArray() != null) {
+ String output = new String(bout.toByteArray());
+ BufferedReader reader = new BufferedReader(new java.io.StringReader(output));
+ res = reader.readLine();
}
- else
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- IOUtils.copyStream(baos, proc.getErrorStream());
- String errStr = new String(baos.toByteArray());
- fail(errStr);
- }
+ assertEquals(TestClient.REQ_STR, res);
}
}