[jboss-cvs] JBossAS SVN: r70908 - in branches/Branch_4_2/test: src and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 17 09:24:00 EDT 2008


Author: mmalina at redhat.com
Date: 2008-03-17 09:23:59 -0400 (Mon, 17 Mar 2008)
New Revision: 70908

Added:
   branches/Branch_4_2/test/src/resources/
   branches/Branch_4_2/test/src/resources/security-provider.properties
Modified:
   branches/Branch_4_2/test/build.xml
   branches/Branch_4_2/test/src/main/org/jboss/test/util/SecurityProviderUtil.java
Log:
JBAS-5317 Updated the test module so that HttpsUnitTestCase works with IBM JVM.

Modified: branches/Branch_4_2/test/build.xml
===================================================================
--- branches/Branch_4_2/test/build.xml	2008-03-17 12:21:47 UTC (rev 70907)
+++ branches/Branch_4_2/test/build.xml	2008-03-17 13:23:59 UTC (rev 70908)
@@ -106,7 +106,7 @@
     -->
    <target name="compile"
            description="Compile all source files."
-           depends="_default:compile-classes, _default:compile-etc"
+           depends="_default:compile-classes, _default:compile-resources, _default:compile-etc"
    />
 
    <!-- ================================================================== -->
@@ -120,6 +120,7 @@
       <jar jarfile="${build.lib}/${jar.server.name}"
            manifest="${build.etc}/default.mf">
          <fileset dir="${build.classes}"/>
+         <fileset dir="${build.resources}"/>
       </jar>
    </target>
 

Modified: branches/Branch_4_2/test/src/main/org/jboss/test/util/SecurityProviderUtil.java
===================================================================
--- branches/Branch_4_2/test/src/main/org/jboss/test/util/SecurityProviderUtil.java	2008-03-17 12:21:47 UTC (rev 70907)
+++ branches/Branch_4_2/test/src/main/org/jboss/test/util/SecurityProviderUtil.java	2008-03-17 13:23:59 UTC (rev 70908)
@@ -25,6 +25,8 @@
 
 import org.jboss.logging.Logger;
 
+import java.util.Properties;
+
 //$Id$
 
 /**
@@ -39,24 +41,67 @@
    private static Logger log = Logger.getLogger(SecurityProviderUtil.class);
    
    //Pass the system properties as part of the test suite setup - based on your VM
-   private static String jsseProviderClassName = System.getProperty("jsse.provider.class",
-                                              "com.sun.net.ssl.internal.ssl.Provider");
    
    private static String sslProtocolClass = System.getProperty("www.protocol.class",
                                               "com.sun.net.ssl.internal.www.protocol");
    
+   private static final String PROP_FILE_NAME = "security-provider.properties";
+   private static final String JSSE_PROV_NAME_PREFIX = "jsse.provider.class.";
+
    /**
     * Get a JSSE Security Provider
     * @return
     */
    public static Provider getJSSEProvider() 
    {
+      String jsseProviderName = null;
+
+      Properties prop = new Properties();
+      try
+      {
+         prop.load(ClassLoader.getSystemResourceAsStream(PROP_FILE_NAME));
+      } catch (java.io.IOException ioe)
+      {
+         log.error("Error loading the property file: ", ioe);
+         return null;
+      }
+
+      boolean searched = false;
+      boolean found = false;
+      int i=1;
+      while (!searched)
+      {
+         if (prop.containsKey(JSSE_PROV_NAME_PREFIX + i))
+         {
+            String jsseProvider = prop.getProperty(JSSE_PROV_NAME_PREFIX + i);
+            try
+            {
+               Class.forName(jsseProvider);
+               jsseProviderName = jsseProvider;
+               log.debug ("Using JSEE Provider :" + jsseProvider);
+               searched = true;
+            } catch (ClassNotFoundException cnfe)
+            {
+               log.debug ("Could not find JSEE Provider :" + jsseProvider );
+            }
+         } else
+         {
+            log.debug("Unable to read " + JSSE_PROV_NAME_PREFIX + i + " - no other properties");
+            searched = true;
+         }
+         i++;
+      }
+      if (jsseProviderName == null)
+      {
+         log.error ("No JSSE Providers found. Please add the appropriate provider in providers.properties");
+      }
+
       Provider obj = null;
       ClassLoader tcl = Thread.currentThread().getContextClassLoader();
       Class clazz;
       try
       {
-         clazz = tcl.loadClass(jsseProviderClassName);
+         clazz = tcl.loadClass(jsseProviderName);
          obj = (Provider)clazz.newInstance();
       }
       catch (Throwable t)

Added: branches/Branch_4_2/test/src/resources/security-provider.properties
===================================================================
--- branches/Branch_4_2/test/src/resources/security-provider.properties	                        (rev 0)
+++ branches/Branch_4_2/test/src/resources/security-provider.properties	2008-03-17 13:23:59 UTC (rev 70908)
@@ -0,0 +1,9 @@
+# Specifies a list of possible jsse provider classes.
+# Numbers must start from 1 upwards and denotes priority.
+jsse.provider.class.1 com.sun.net.ssl.internal.ssl.Provider
+jsse.provider.class.2 com.ibm.jsse.IBMJSSEProvider
+
+# Specifies a list of possible www protocol classes.
+# Numbers must start from 1 upwards and denotes priority.
+#www.protocol.class.1 com.sun.net.ssl.internal.www.protocol
+#www.protocol.class.2 com.ibm.net.ssl.internal.www.protocol




More information about the jboss-cvs-commits mailing list