Author: asoldano
Date: 2013-11-05 18:20:38 -0500 (Tue, 05 Nov 2013)
New Revision: 18062
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3713/ClientBusStrategyTests.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3713/TestClient.java
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666/JBWS1666TestCase.java
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666/TestClient.java
Log:
Trying to make the tests relying on System.out from jboss modules based client a bit more
robust
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3713/ClientBusStrategyTests.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3713/ClientBusStrategyTests.java 2013-11-05
16:30:12 UTC (rev 18061)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3713/ClientBusStrategyTests.java 2013-11-05
23:20:38 UTC (rev 18062)
@@ -24,6 +24,7 @@
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
@@ -68,17 +69,22 @@
final String command = javaCmd + props + " -jar " + f.getAbsolutePath() +
" " + wsdlAddress + " " + threadPoolSize + " " +
invocations;
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();
- }
- StringTokenizer st = new StringTokenizer(res, " ");
+ StringTokenizer st = new StringTokenizer(readFirstLine(bout), " ");
List<Integer> list = new LinkedList<Integer>();
while (st.hasMoreTokens()) {
list.add(Integer.parseInt(st.nextToken()));
}
return list;
}
+
+ private static String readFirstLine(ByteArrayOutputStream bout) throws IOException {
+ bout.flush();
+ final byte[] bytes = bout.toByteArray();
+ if (bytes != null) {
+ BufferedReader reader = new BufferedReader(new java.io.StringReader(new
String(bytes)));
+ return reader.readLine();
+ } else {
+ return null;
+ }
+ }
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3713/TestClient.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3713/TestClient.java 2013-11-05
16:30:12 UTC (rev 18061)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3713/TestClient.java 2013-11-05
23:20:38 UTC (rev 18062)
@@ -33,5 +33,10 @@
int ret1 = new HelperUsignThreadLocal().run(new URL(wsdlAddress),
Integer.parseInt(threadPoolSize), Integer.parseInt(invocations));
int ret2 = new Helper().run(new URL(wsdlAddress), Integer.parseInt(threadPoolSize),
Integer.parseInt(invocations));
System.out.println(String.valueOf(ret1) + " " + String.valueOf(ret2));
+
+ //wait a bit before returning as the log processing can be aysnch, the test client
+ //relies on the log contents and the log streams are closed by the system when the
+ //process terminates
+ Thread.sleep(1000);
}
}
Modified:
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666/JBWS1666TestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666/JBWS1666TestCase.java 2013-11-05
16:30:12 UTC (rev 18061)
+++
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666/JBWS1666TestCase.java 2013-11-05
23:20:38 UTC (rev 18062)
@@ -24,6 +24,7 @@
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.IOException;
import javax.xml.ws.spi.Provider;
@@ -84,13 +85,18 @@
final String command = javaCmd + props + " -jar " + f.getAbsolutePath() +
" " + getServerHost();
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();
- }
//check result (includes check on Provider impl, which might be affected by missing
javax.xml.ws.api module dependency
- assertEquals(Provider.provider().getClass().getName() + ", " +
TestClient.REQ_STR, res);
+ assertEquals(Provider.provider().getClass().getName() + ", " +
TestClient.REQ_STR, readFirstLine(bout));
}
+
+ private static String readFirstLine(ByteArrayOutputStream bout) throws IOException {
+ bout.flush();
+ final byte[] bytes = bout.toByteArray();
+ if (bytes != null) {
+ BufferedReader reader = new BufferedReader(new java.io.StringReader(new
String(bytes)));
+ return reader.readLine();
+ } else {
+ return null;
+ }
+ }
}
Modified:
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666/TestClient.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666/TestClient.java 2013-11-05
16:30:12 UTC (rev 18061)
+++
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666/TestClient.java 2013-11-05
23:20:38 UTC (rev 18062)
@@ -48,5 +48,10 @@
String serverHost = args[0];
String resStr = testPortAccess(serverHost);
System.out.println(Provider.provider().getClass().getName() + ", " +
resStr);
+
+ //wait a bit before returning as the log processing can be aysnch, the test client
+ //relies on the log contents and the log streams are closed by the system when the
+ //process terminates
+ Thread.sleep(1000);
}
}
Show replies by date