Author: richard.opalka(a)jboss.com
Date: 2008-09-25 11:28:11 -0400 (Thu, 25 Sep 2008)
New Revision: 8233
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java
Log:
[JBWS-2322] fix test case to be cross platform
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java 2008-09-25
15:23:24 UTC (rev 8232)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java 2008-09-25
15:28:11 UTC (rev 8233)
@@ -23,6 +23,7 @@
import java.io.*;
+import org.jboss.wsf.common.concurrent.CopyJob;
import org.jboss.wsf.test.JBossWSTest;
/**
@@ -39,6 +40,8 @@
public class ScriptTestCase extends JBossWSTest
{
private static final String FS = System.getProperty("file.separator"); //
'/' on unix, '\' on windows
+ private static final String PS = System.getProperty("path.separator"); //
':' on unix, ';' on windows
+ private static final String EXT = ":".equals( PS ) ? ".sh" :
".bat";
private String WSDL_LOCATION = "jaxws" + FS + "smoke" + FS +
"tools" + FS + "wsdl" + FS + "TestServiceCatalog.wsdl";
private String ENDPOINT_CLASS =
"org.jboss.test.ws.jaxws.smoke.tools.CalculatorBean";
@@ -80,16 +83,11 @@
public void testWSConsumeFromCommandLine() throws Exception
{
- if (isWindowsOS())
- {
- fail("This test has not been verified on windows");
- }
-
// use absolute path for the output to be re-usable
String absWsdlLoc = getResourceFile(WSDL_LOCATION).getAbsolutePath();
String absOutput = new File(TEST_DIR, "wsconsume" + FS +
"java").getAbsolutePath();
- String command = JBOSS_HOME + FS + "bin" + FS + "wsconsume.sh -v -k
-o " + absOutput + " " + absWsdlLoc;
+ String command = JBOSS_HOME + FS + "bin" + FS + "wsconsume" +
EXT + " -v -k -o " + absOutput + " " + absWsdlLoc;
Process p = executeCommand(command);
// check status code
@@ -102,14 +100,9 @@
public void testWSProvideFromCommandLine() throws Exception
{
- if (isWindowsOS())
- {
- fail("This test has not been verified on windows");
- }
-
String absOutput = new File(TEST_DIR, "wsprovide" + FS +
"java").getAbsolutePath();
- String command = JBOSS_HOME + FS + "bin" + FS + "wsprovide.sh -k -w
-o " + absOutput + " --classpath " + CLASSES_DIR + " " +
ENDPOINT_CLASS;
+ String command = JBOSS_HOME + FS + "bin" + FS + "wsprovide" +
EXT + " -k -w -o " + absOutput + " --classpath " + CLASSES_DIR +
" " + ENDPOINT_CLASS;
Process p = executeCommand(command);
// check status code
@@ -131,11 +124,25 @@
private void assertStatusCode(Process p, String s) throws InterruptedException
{
+ CopyJob job = new CopyJob(p.getInputStream(), System.out);
+ new Thread( job ).start();
+ int status = -1;
+ try
+ {
+ status = p.waitFor();
+ }
+ finally
+ {
+ job.kill();
+ p.destroy();
+ }
+
// check status code
- int status = p.waitFor();
- dumpStream(p.getInputStream());
- dumpStream(p.getErrorStream());
-
+ if (status != 0)
+ {
+ System.out.println("Error stream");
+ dumpStream(p.getErrorStream());
+ }
assertTrue(s + " did exit with status " + status, status == 0);
}
Show replies by date