[jbossws-commits] JBossWS SVN: r15717 - shared-testsuite/trunk/src/main/java/org/jboss/wsf/test.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Thu Feb 23 10:05:39 EST 2012


Author: ropalka
Date: 2012-02-23 10:05:38 -0500 (Thu, 23 Feb 2012)
New Revision: 15717

Modified:
   shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
   shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java
Log:
[JBWS-3435] update appclient launcher to return associated process + allow tests to specify output stream & params for appclient

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-02-23 13:55:50 UTC (rev 15716)
+++ shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java	2012-02-23 15:05:38 UTC (rev 15717)
@@ -24,6 +24,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.MalformedURLException;
@@ -42,7 +43,6 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.ws.common.concurrent.CopyJob;
-import org.jboss.ws.common.io.NullOutputStream;
 import org.jboss.ws.common.io.TeeOutputStream;
 import org.jboss.wsf.spi.SPIProvider;
 import org.jboss.wsf.spi.SPIProviderResolver;
@@ -115,7 +115,7 @@
    /** Deploy the given archive to the appclient.
     * Archive name is always in form archive.ear#appclient.jar
     */
-   public static void deployAppclient(final String archive) throws Exception
+   public static Process deployAppclient(final String archive, final OutputStream appclientOS, final String appclientArg) throws Exception
    {
       if (DEPLOY_PROCESS_ENABLED)
       {
@@ -126,10 +126,17 @@
          final String appclientFullName = getArchiveFile(earName).getParent() + FS + archive;
          final String touchFile = JBOSS_HOME + FS + "bin" + FS + appclientName + ".kill";
          final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-         appclientProcess = new ProcessBuilder().command(appclientScript, appclientFullName, touchFile)
-               .start();
-         CopyJob inputStreamJob = new CopyJob(appclientProcess.getInputStream(), new TeeOutputStream(baos, System.out));
-         CopyJob errorStreamJob = new CopyJob(appclientProcess.getErrorStream(), System.err);
+         if (appclientOS == null)
+         {
+            appclientProcess = new ProcessBuilder().command(appclientScript, appclientFullName, touchFile).start();
+         }
+         else
+         {
+            appclientProcess = new ProcessBuilder().command(appclientScript, appclientFullName, appclientArg).start();
+         }
+         final CopyJob inputStreamJob = new CopyJob(appclientProcess.getInputStream(),
+               appclientOS == null ? new TeeOutputStream(baos, System.out) : new TeeOutputStream(baos, System.out, appclientOS));
+         final CopyJob errorStreamJob = new CopyJob(appclientProcess.getErrorStream(), System.err);
          // unfortunately the following threads are needed because of Windows behavior
          System.out.println("Appclient output stream:");
          new Thread(inputStreamJob).start();
@@ -146,6 +153,7 @@
          }
          System.out.println("appclient started");
       }
+      return appclientProcess;
    }
 
    /** Undeploy the given archive from the appclient

Modified: shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java
===================================================================
--- shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java	2012-02-23 13:55:50 UTC (rev 15716)
+++ shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java	2012-02-23 15:05:38 UTC (rev 15717)
@@ -22,6 +22,7 @@
 package org.jboss.wsf.test;
 
 import java.io.File;
+import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -56,6 +57,8 @@
    private static final String JBOSSWS_SEC_DOMAIN = "JBossWS";
 
    private String[] archives = new String[0];
+   private OutputStream appclientOutputStream;
+   private String appclientArg;
    private ClassLoader originalClassLoader;
    private Map<String, Map<String, String>> securityDomains = new HashMap<String, Map<String,String>>();
    private boolean defaultSecurityDomainRequirement = false;
@@ -66,6 +69,13 @@
       getArchiveArray(archiveList);
    }
    
+   public JBossWSTestSetup(Class<?> testClass, String archiveList, OutputStream appclientOutputStream)
+   {
+      super(new TestSuite(testClass));
+      getArchiveArray(archiveList);
+      this.appclientOutputStream = appclientOutputStream;
+   }
+   
    public JBossWSTestSetup(Class<?> testClass, String archiveList, boolean requiresDefaultSecurityDomain)
    {
       this(testClass, archiveList);
@@ -165,7 +175,7 @@
          {
             URL archiveURL = getArchiveURL(archive.substring(archive.indexOf('#') + 1));
             clientJars.add(archiveURL);
-            JBossWSTestHelper.deployAppclient(archive);
+            JBossWSTestHelper.deployAppclient(archive, appclientOutputStream, appclientArg);
          }
          else if (archive.endsWith("-client.jar"))
          {



More information about the jbossws-commits mailing list