JBossWS SVN: r17428 - shared-testsuite/trunk/src/main/java/org/jboss/wsf/test.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2013-03-29 07:18:24 -0400 (Fri, 29 Mar 2013)
New Revision: 17428
Modified:
shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/AppclientHelper.java
Log:
Few improvements on AppclientHelper to help diagnose deployment issues
Modified: shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/AppclientHelper.java
===================================================================
--- shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/AppclientHelper.java 2013-03-28 14:08:00 UTC (rev 17427)
+++ shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/AppclientHelper.java 2013-03-29 11:18:24 UTC (rev 17428)
@@ -27,6 +27,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.io.PrintWriter;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -95,18 +96,20 @@
{
s.release();
//NPE checks to avoid hiding other exceptional conditions that led to premature undeploy..
- if (ap.output != null) {
- ap.outTask.kill();
+ if (ap != null) {
+ if (ap.output != null) {
+ ap.outTask.kill();
+ }
+ if (ap.errTask != null) {
+ ap.errTask.kill();
+ }
+ if (ap.process != null) {
+ ap.process.destroy();
+ }
+ if (ap.log != null) {
+ ap.log.close();
+ }
}
- if (ap.errTask != null) {
- ap.errTask.kill();
- }
- if (ap.process != null) {
- ap.process.destroy();
- }
- if (ap.log != null) {
- ap.log.close();
- }
}
}
@@ -135,6 +138,11 @@
args.add(appclientArg);
}
}
+
+ ap.log = new FileOutputStream(new File(getAppclientOutputDir(), appclientShortName + ".log-" + System.currentTimeMillis()));
+ final OutputStream logOutputStreams = (appclientOS == null) ? ap.log : new TeeOutputStream(ap.log, appclientOS);
+ printLogTrailer(logOutputStreams, appclientFullName);
+
final ProcessBuilder pb = new ProcessBuilder().command(args);
// always propagate IPv6 related properties
final StringBuilder javaOptsValue = new StringBuilder();
@@ -143,10 +151,8 @@
javaOptsValue.append("-Djava.net.preferIPv6Addresses=").append(System.getProperty("java.net.preferIPv6Addresses", "false")).append(" ");
pb.environment().put("JAVA_OPTS", javaOptsValue.toString());
ap.process = pb.start();
- ap.log = new FileOutputStream(new File(getAppclientOutputDir(), appclientShortName + ".log-" + System.currentTimeMillis()));
// appclient out
- ap.outTask = new CopyJob(ap.process.getInputStream(),
- appclientOS == null ? new TeeOutputStream(ap.output, ap.log) : new TeeOutputStream(ap.output, ap.log, appclientOS));
+ ap.outTask = new CopyJob(ap.process.getInputStream(), new TeeOutputStream(ap.output, logOutputStreams));
// appclient err
ap.errTask = new CopyJob(ap.process.getErrorStream(), ap.log);
// unfortunately the following threads are needed because of Windows behavior
@@ -158,6 +164,12 @@
throw e;
}
}
+
+ private static void printLogTrailer(OutputStream logOutputStreams, String appclientFullName) {
+ final PrintWriter pw = new PrintWriter(logOutputStreams);
+ pw.write("Starting appclient process: " + appclientFullName + "...\n");
+ pw.flush();
+ }
private static String undoIPv6Brackets(final String s)
{