[jbossws-commits] JBossWS SVN: r15917 - in shared-testsuite/trunk: testsuite/src/test/ant-import and 1 other directory.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Mon Mar 12 10:02:57 EDT 2012


Author: ropalka
Date: 2012-03-12 10:02:57 -0400 (Mon, 12 Mar 2012)
New Revision: 15917

Modified:
   shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
   shared-testsuite/trunk/testsuite/src/test/ant-import/build-testsuite.xml
Log:
[JBWS-3452] do not log appclient boot messages to console

Modified: shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
===================================================================
--- shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java	2012-03-12 14:02:21 UTC (rev 15916)
+++ shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java	2012-03-12 14:02:57 UTC (rev 15917)
@@ -23,6 +23,7 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.Inet6Address;
@@ -84,6 +85,7 @@
    private static String implVersion;
    private static String testArchiveDir;
    private static String testResourcesDir;
+   private static String appclientOutputDir;
    private static Map<String, AppclientProcess> appclients = new HashMap<String, JBossWSTestHelper.AppclientProcess>();
    private static ExecutorService es = Executors.newCachedThreadPool();
    
@@ -92,6 +94,7 @@
       public CopyJob outTask;
       public CopyJob errTask;
       public OutputStream output;
+      public OutputStream log;
    }
    
    private static synchronized Deployer getDeployer()
@@ -140,6 +143,16 @@
          final String appclientName = archive.substring(sharpIndex + 1);
          final String appclientFullName = getArchiveFile(earName).getParent() + FS + archive;
          final String touchFile = JBOSS_HOME + FS + "bin" + FS + appclientName + ".kill";
+         final String appclientOutputDirName = System.getProperty("appclient.output.dir");
+         if (appclientOutputDirName == null)
+         {
+            throw new IllegalStateException("System property appclient.output.dir not configured");
+         }
+         final File appclientOutputDir = new File(appclientOutputDirName);
+         if (!appclientOutputDir.exists())
+         {
+            appclientOutputDir.mkdirs();
+         }
          AppclientProcess ap = new AppclientProcess();
          ap.output = new ByteArrayOutputStream();
          if (appclientOS == null)
@@ -158,20 +171,18 @@
             }
             ap.process = new ProcessBuilder().command(args).start();
          }
+         ap.log = new FileOutputStream(new File(getAppclientOutputDir(), appclientName + ".log-" + System.currentTimeMillis()));
          // appclient out
          ap.outTask = new CopyJob(ap.process.getInputStream(),
-               appclientOS == null ? new TeeOutputStream(ap.output, System.out) : new TeeOutputStream(ap.output, System.out, appclientOS));
+               appclientOS == null ? new TeeOutputStream(ap.output, ap.log) : new TeeOutputStream(ap.output, ap.log, appclientOS));
          // appclient err
-         ap.errTask = new CopyJob(ap.process.getErrorStream(), System.err);
+         ap.errTask = new CopyJob(ap.process.getErrorStream(), ap.log);
          // unfortunately the following threads are needed because of Windows behavior
          es.submit(ap.outTask);
          es.submit(ap.errTask);
          final String patternToMatch = "Deployed \"" + earName + "\"";
          final String errorMessage = "Cannot deploy " + appclientFullName + " to appclient";
          awaitOutput(ap.output, patternToMatch, errorMessage);
-         System.out.println("-----------------");
-         System.out.println("appclient started");
-         System.out.println("-----------------");
          appclients.put(archive, ap);
          return ap.process;
       }
@@ -202,14 +213,33 @@
             touchFile.delete();
             ap.outTask.kill();
             ap.errTask.kill();
+            ap.log.close();
             ap.process.destroy();
             appclients.remove(archive);
          }
-         System.out.println("-----------------");
-         System.out.println("appclient stopped");
-         System.out.println("-----------------");
       }
    }
+
+   private static String getAppclientOutputDir()
+   {
+      if (appclientOutputDir == null)
+      {
+         appclientOutputDir = System.getProperty("appclient.output.dir");
+         if (appclientOutputDir == null)
+         {
+            throw new IllegalStateException("System property appclient.output.dir not configured");
+         }
+         final File appclientOutputDirectory = new File(appclientOutputDir);
+         if (!appclientOutputDirectory.exists())
+         {
+            if (!appclientOutputDirectory.mkdirs())
+            {
+               throw new IllegalStateException("Unable to create directory " + appclientOutputDir);
+            }
+         }
+      }
+      return appclientOutputDir;
+   }
    
    private static void awaitOutput(final OutputStream os, final String patternToMatch, final String errorMessage) throws InterruptedException {
       int countOfAttempts = 0;

Modified: shared-testsuite/trunk/testsuite/src/test/ant-import/build-testsuite.xml
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/ant-import/build-testsuite.xml	2012-03-12 14:02:21 UTC (rev 15916)
+++ shared-testsuite/trunk/testsuite/src/test/ant-import/build-testsuite.xml	2012-03-12 14:02:57 UTC (rev 15917)
@@ -571,6 +571,7 @@
       
       <sysproperty key="jdk.home" value="${env.JAVA_HOME}"/>
       <sysproperty key="log4j.output.dir" value="${tests.output.dir}"/>
+      <sysproperty key="appclient.output.dir" value="${tests.output.dir}/appclient-logs"/>
       <sysproperty key="client.scenario" value="${client.scenario}"/>
       <sysproperty key="interop" value="${interop}"/>
       <sysproperty key="java.endorsed.dirs" value="${endorsed.dirs}"/>
@@ -626,6 +627,7 @@
       
       <sysproperty key="jdk.home" value="${env.JAVA_HOME}"/>
       <sysproperty key="log4j.output.dir" value="${tests.output.dir}"/>
+      <sysproperty key="appclient.output.dir" value="${tests.output.dir}/appclient-logs"/>
       <sysproperty key="client.scenario" value="${client.scenario}"/>
       <sysproperty key="interop" value="${interop}"/>
       <sysproperty key="java.endorsed.dirs" value="${endorsed.dirs}"/>



More information about the jbossws-commits mailing list