[jbossws-commits] JBossWS SVN: r10833 - common/branches/ropalka/src/main/java/org/jboss/wsf/test.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Mon Oct 5 06:58:26 EDT 2009


Author: richard.opalka at jboss.com
Date: 2009-10-05 06:58:26 -0400 (Mon, 05 Oct 2009)
New Revision: 10833

Modified:
   common/branches/ropalka/src/main/java/org/jboss/wsf/test/JBossWSTest.java
   common/branches/ropalka/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
Log:
it's better to have defined helper methods static

Modified: common/branches/ropalka/src/main/java/org/jboss/wsf/test/JBossWSTest.java
===================================================================
--- common/branches/ropalka/src/main/java/org/jboss/wsf/test/JBossWSTest.java	2009-10-02 17:05:40 UTC (rev 10832)
+++ common/branches/ropalka/src/main/java/org/jboss/wsf/test/JBossWSTest.java	2009-10-05 10:58:26 UTC (rev 10833)
@@ -50,15 +50,15 @@
 import org.w3c.dom.NodeList;
 
 /**
- * Base class for JBossWS test cases
+ * Base class for JBossWS test cases.
  *
- * @author Thomas.Diesler at jboss.org
- * @author ropalka at redhat.com
+ * @author <a href="mailto:tdiesler at redhat.com">Thomas Diesler</a>
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
  */
 public abstract class JBossWSTest extends TestCase
 {
    protected static Logger log = Logger.getLogger(JBossWSTest.class.getName());
-   private JBossWSTestHelper delegate = new JBossWSTestHelper();
+   //private static JBossWSTestHelper delegate = new JBossWSTestHelper();
 
    public JBossWSTest()
    {
@@ -74,9 +74,9 @@
     * @param command command to execute
     * @throws IOException if I/O error occurs
     */
-   public void executeCommand(String command) throws IOException
+   public static void executeCommand(String command) throws IOException
    {
-      this.executeCommand(command, null, null, null);
+      executeCommand(command, null, null, null);
    }
 
    /**
@@ -85,9 +85,9 @@
     * @param message message to display if assertion fails
     * @throws IOException if I/O error occurs
     */
-   public void executeCommand(String command, String message) throws IOException
+   public static void executeCommand(String command, String message) throws IOException
    {
-      this.executeCommand(command, null, message, null);
+      executeCommand(command, null, message, null);
    }
 
    /**
@@ -96,9 +96,9 @@
     * @param os output stream to copy process input to. If null, <b>System.out</b> will be used
     * @throws IOException if I/O error occurs
     */
-   public void executeCommand(String command, OutputStream os) throws IOException
+   public static void executeCommand(String command, OutputStream os) throws IOException
    {
-      this.executeCommand(command, os, null, null);
+      executeCommand(command, os, null, null);
    }
 
    /**
@@ -108,9 +108,9 @@
     * @param message message to display if assertion fails
     * @throws IOException if I/O error occurs
     */
-   public void executeCommand(String command, OutputStream os, String message) throws IOException
+   public static void executeCommand(String command, OutputStream os, String message) throws IOException
    {
-      this.executeCommand(command, os, message, null);
+      executeCommand(command, os, message, null);
    }
 
    /**
@@ -121,7 +121,7 @@
     * @param env environment
     * @throws IOException if I/O error occurs
     */
-   public void executeCommand(String command, OutputStream os, String message, Map<String, String> env) throws IOException
+   public static void executeCommand(String command, OutputStream os, String message, Map<String, String> env) throws IOException
    {
       if (command == null)
          throw new NullPointerException( "Command cannot be null" );
@@ -139,7 +139,7 @@
 
       try
       {
-         this.executeCommand(tokenizedCommand, os, message, env);
+         executeCommand(tokenizedCommand, os, message, env);
       }
       catch (IOException e)
       {
@@ -156,7 +156,7 @@
     * @param env environment
     * @throws IOException if I/O error occurs
     */
-   private void executeCommand(List<String> command, OutputStream os, String message, Map<String, String> env) throws IOException
+   private static void executeCommand(List<String> command, OutputStream os, String message, Map<String, String> env) throws IOException
    {
       ProcessBuilder pb = new ProcessBuilder(command);
       if (env != null)
@@ -192,118 +192,115 @@
       }
    }
 
-   public MBeanServerConnection getServer() throws NamingException
+   public static MBeanServerConnection getServer() throws NamingException
    {
       return JBossWSTestHelper.getServer();
    }
 
-   public boolean isTargetJBoss5()
+   public static boolean isTargetJBoss5()
    {
-      return delegate.isTargetJBoss5();
+      return JBossWSTestHelper.isTargetJBoss5();
    }
 
-   public boolean isTargetJBoss51()
+   public static boolean isTargetJBoss51()
    {
-      return delegate.isTargetJBoss51();
+      return JBossWSTestHelper.isTargetJBoss51();
    }
 
-   public boolean isTargetJBoss52()
+   public static boolean isTargetJBoss52()
    {
-      return delegate.isTargetJBoss52();
+      return JBossWSTestHelper.isTargetJBoss52();
    }
 
-   public boolean isTargetJBoss50()
+   public static boolean isTargetJBoss50()
    {
-      return delegate.isTargetJBoss50();
+      return JBossWSTestHelper.isTargetJBoss50();
    }
 
-   public boolean isTargetJBoss6()
+   public static boolean isTargetJBoss6()
    {
-      return delegate.isTargetJBoss6();
+      return JBossWSTestHelper.isTargetJBoss6();
    }
 
-   public boolean isTargetJBoss61()
+   public static boolean isTargetJBoss61()
    {
-      return delegate.isTargetJBoss61();
+      return JBossWSTestHelper.isTargetJBoss61();
    }
 
-   public boolean isTargetJBoss60()
+   public static boolean isTargetJBoss60()
    {
-      return delegate.isTargetJBoss60();
+      return JBossWSTestHelper.isTargetJBoss60();
    }
 
-   public boolean isIntegrationNative()
+   public static boolean isIntegrationNative()
    {
-      return delegate.isIntegrationNative();
-
+      return JBossWSTestHelper.isIntegrationNative();
    }
 
-   public boolean isIntegrationMetro()
+   public static boolean isIntegrationMetro()
    {
-      return delegate.isIntegrationMetro();
+      return JBossWSTestHelper.isIntegrationMetro();
    }
 
-   public boolean isIntegrationCXF()
+   public static boolean isIntegrationCXF()
    {
-      return delegate.isIntegrationCXF();
+      return JBossWSTestHelper.isIntegrationCXF();
    }
 
    /** Deploy the given archive
     */
-   public void deploy(String archive) throws Exception
+   public static void deploy(String archive) throws Exception
    {
-      delegate.deploy(archive);
+      JBossWSTestHelper.deploy(archive);
    }
 
    /** Undeploy the given archive
     */
-   public void undeploy(String archive) throws Exception
+   public static void undeploy(String archive) throws Exception
    {
-      delegate.undeploy(archive);
+      JBossWSTestHelper.undeploy(archive);
    }
 
-   public String getServerHost()
+   public static String getServerHost()
    {
       return JBossWSTestHelper.getServerHost();
    }
 
-   public File getArchiveFile(String archive)
+   public static File getArchiveFile(String archive)
    {
-      return delegate.getArchiveFile(archive);
+      return JBossWSTestHelper.getArchiveFile(archive);
    }
 
-   public URL getArchiveURL(String archive) throws MalformedURLException
+   public static URL getArchiveURL(String archive) throws MalformedURLException
    {
-      return delegate.getArchiveURL(archive);
+      return JBossWSTestHelper.getArchiveURL(archive);
    }
 
-   public File getResourceFile(String resource)
+   public static File getResourceFile(String resource)
    {
-      return delegate.getResourceFile(resource);
+      return JBossWSTestHelper.getResourceFile(resource);
    }
 
-   public URL getResourceURL(String resource) throws MalformedURLException
+   public static URL getResourceURL(String resource) throws MalformedURLException
    {
-      return delegate.getResourceURL(resource);
+      return JBossWSTestHelper.getResourceURL(resource);
    }
 
-   public File createResourceFile(String filename)
+   public static File createResourceFile(String filename)
    {
       File resDir = new File(JBossWSTestHelper.getTestResourcesDir());
-      File file = new File(resDir.getAbsolutePath() + File.separator + filename);
-      return file;
+      return new File(resDir.getAbsolutePath() + File.separator + filename);
    }
 
-   public File createResourceFile(File parent, String filename)
+   public static File createResourceFile(File parent, String filename)
    {
-      File file = new File(parent, filename);
-      return file;
+      return new File(parent, filename);
    }
 
    /** Get the client's env context for a given name.
     */
    @SuppressWarnings("unchecked")
-   protected InitialContext getInitialContext(String clientName) throws NamingException
+   protected static InitialContext getInitialContext(String clientName) throws NamingException
    {
       InitialContext iniCtx = new InitialContext();
       Hashtable env = iniCtx.getEnvironment();
@@ -314,7 +311,7 @@
 
    /** Get the client's env context
     */
-   protected InitialContext getInitialContext() throws NamingException
+   protected static InitialContext getInitialContext() throws NamingException
    {
       return getInitialContext("jbossws-client");
    }
@@ -461,4 +458,5 @@
          }
       }
    }
+
 }

Modified: common/branches/ropalka/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
===================================================================
--- common/branches/ropalka/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java	2009-10-02 17:05:40 UTC (rev 10832)
+++ common/branches/ropalka/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java	2009-10-05 10:58:26 UTC (rev 10833)
@@ -46,11 +46,11 @@
  */
 public class JBossWSTestHelper
 {
-   private static final String SYSPROP_JBOSSWS_INTEGRATION_TARGET = "jbossws.integration.target";
-   private static final String SYSPROP_JBOSS_BIND_ADDRESS = "jboss.bind.address";
-   private static final String SYSPROP_TEST_ARCHIVE_DIRECTORY = "test.archive.directory";
-   private static final String SYSPROP_TEST_RESOURCES_DIRECTORY = "test.resources.directory";
-   private static final boolean DEPLOY_PROCESS_ENABLED = !Boolean.getBoolean("test.disable.deployment");
+   private static String SYSPROP_JBOSSWS_INTEGRATION_TARGET = "jbossws.integration.target";
+   private static String SYSPROP_JBOSS_BIND_ADDRESS = "jboss.bind.address";
+   private static String SYSPROP_TEST_ARCHIVE_DIRECTORY = "test.archive.directory";
+   private static String SYSPROP_TEST_RESOURCES_DIRECTORY = "test.resources.directory";
+   private static boolean DEPLOY_PROCESS_ENABLED = !Boolean.getBoolean("test.disable.deployment");
 
    private static MBeanServerConnection server;
    private static String integrationTarget;
@@ -62,7 +62,7 @@
 
    /** Deploy the given archive
     */
-   public void deploy(String archive) throws Exception
+   public static void deploy(String archive) throws Exception
    {
       if ( DEPLOY_PROCESS_ENABLED )
       {
@@ -73,7 +73,7 @@
 
    /** Undeploy the given archive
     */
-   public void undeploy(String archive) throws Exception
+   public static void undeploy(String archive) throws Exception
    {
       if ( DEPLOY_PROCESS_ENABLED )
       {
@@ -83,71 +83,71 @@
    }
 
    /** True, if -Djbossws.integration.target=jboss5x */
-   public boolean isTargetJBoss5()
+   public static boolean isTargetJBoss5()
    {
       return  isTargetJBoss52() || isTargetJBoss51() || isTargetJBoss50();
    }
 
    /** True, if -Djbossws.integration.target=jboss50x */
-   public boolean isTargetJBoss50()
+   public static boolean isTargetJBoss50()
    {
       String target = getIntegrationTarget();
       return target.startsWith("jboss50");
    }
 
    /** True, if -Djbossws.integration.target=jboss51x */
-   public boolean isTargetJBoss51()
+   public static boolean isTargetJBoss51()
    {
       String target = getIntegrationTarget();
       return target.startsWith("jboss51");
    }
 
    /** True, if -Djbossws.integration.target=jboss52x */
-   public boolean isTargetJBoss52()
+   public static boolean isTargetJBoss52()
    {
       String target = getIntegrationTarget();
       return target.startsWith("jboss52");
    }
 
    /** True, if -Djbossws.integration.target=jboss6x */
-   public boolean isTargetJBoss6()
+   public static boolean isTargetJBoss6()
    {
       return isTargetJBoss61() || isTargetJBoss60();
    }
    
    /** True, if -Djbossws.integration.target=jboss60x */
-   public boolean isTargetJBoss60()
+   public static boolean isTargetJBoss60()
    {
       String target = getIntegrationTarget();
       return target.startsWith("jboss60");
    }
 
    /** True, if -Djbossws.integration.target=jboss61x */
-   public boolean isTargetJBoss61()
+   public static boolean isTargetJBoss61()
    {
       String target = getIntegrationTarget();
       return target.startsWith("jboss61");
    }
 
-   public boolean isIntegrationNative()
+   public static boolean isIntegrationNative()
    {
       String vendor = getImplementationVendor();
       return vendor.toLowerCase().indexOf("jboss") != -1;
    }
 
-   public boolean isIntegrationMetro()
+   public static boolean isIntegrationMetro()
    {
       String vendor = getImplementationVendor();
       return vendor.toLowerCase().indexOf("sun") != -1;
    }
 
-   public boolean isIntegrationCXF()
+   public static boolean isIntegrationCXF()
    {
       String vendor = getImplementationVendor();
       return vendor.toLowerCase().indexOf("apache") != -1;
    }
 
-   private String getImplementationVendor()
+   private static String getImplementationVendor()
    {
       if (implVendor == null)
       {
@@ -164,7 +164,7 @@
       return implVendor;
    }
 
-   private Object getImplementationObject()
+   private static Object getImplementationObject()
    {
       Service service = Service.create(new QName("dummyService"));
       Object obj = service.getHandlerResolver();
@@ -176,7 +176,7 @@
       return obj;
    }
 
-   private String getImplementationPackage()
+   private static String getImplementationPackage()
    {
       return getImplementationObject().getClass().getPackage().getName();
    }
@@ -210,12 +210,12 @@
       return server;
    }
 
-   private TestDeployer getDeployer()
+   private static TestDeployer getDeployer()
    {
       return new TestDeployerJBoss(getServer());
    }
 
-   public String getIntegrationTarget()
+   public static String getIntegrationTarget()
    {
       if (integrationTarget == null)
       {
@@ -258,13 +258,13 @@
    }
 
    /** Try to discover the URL for the deployment archive */
-   public URL getArchiveURL(String archive) throws MalformedURLException
+   public static URL getArchiveURL(String archive) throws MalformedURLException
    {
       return getArchiveFile(archive).toURL();
    }
 
    /** Try to discover the File for the deployment archive */
-   public File getArchiveFile(String archive)
+   public static File getArchiveFile(String archive)
    {
       File file = new File(archive);
       if (file.exists())
@@ -279,13 +279,13 @@
    }
 
    /** Try to discover the URL for the test resource */
-   public URL getResourceURL(String resource) throws MalformedURLException
+   public static URL getResourceURL(String resource) throws MalformedURLException
    {
       return getResourceFile(resource).toURL();
    }
 
    /** Try to discover the File for the test resource */
-   public File getResourceFile(String resource)
+   public static File getResourceFile(String resource)
    {
       File file = new File(resource);
       if (file.exists())



More information about the jbossws-commits mailing list