[Jboss-cvs] JBossAS SVN: r55415 - in branches/Branch_4_0/testsuite/src/main/org/jboss/test/security: service test
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Aug 8 13:59:26 EDT 2006
Author: anil.saldhana at jboss.com
Date: 2006-08-08 13:59:25 -0400 (Tue, 08 Aug 2006)
New Revision: 55415
Modified:
branches/Branch_4_0/testsuite/src/main/org/jboss/test/security/service/HttpsClient.java
branches/Branch_4_0/testsuite/src/main/org/jboss/test/security/test/HttpsUnitTestCase.java
Log:
JBAS-3449: remove the sun jvm specific references
Modified: branches/Branch_4_0/testsuite/src/main/org/jboss/test/security/service/HttpsClient.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/security/service/HttpsClient.java 2006-08-08 17:52:57 UTC (rev 55414)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/security/service/HttpsClient.java 2006-08-08 17:59:25 UTC (rev 55415)
@@ -30,16 +30,18 @@
import java.net.URL;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
+import java.security.Provider;
import java.security.Security;
import java.util.StringTokenizer;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import javax.net.ssl.SSLSocketFactory;
-import com.sun.net.ssl.internal.ssl.Provider;
+//import com.sun.net.ssl.internal.ssl.Provider;
import org.jboss.logging.Logger;
import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.test.util.SecurityProviderUtil;
import org.jboss.invocation.http.interfaces.Util;
/** A test mbean service that reads input from an https url passed in
@@ -56,7 +58,7 @@
// Attributes ----------------------------------------------------
private boolean addedHttpsHandler;
- private boolean addedSunJSSEProvider;
+ private boolean addedJSSEProvider;
// Static --------------------------------------------------------
@@ -113,7 +115,7 @@
// Public --------------------------------------------------------
protected void startService() throws Exception
{
- addedSunJSSEProvider = false;
+ addedJSSEProvider = false;
try
{
new URL("https://www.https.test");
@@ -121,19 +123,25 @@
catch(MalformedURLException e)
{
// Install the default JSSE security provider
- log.debug("Adding com.sun.net.ssl.internal.ssl.Provider");
- addedSunJSSEProvider = Security.addProvider(new Provider()) != -1;
- if (addedSunJSSEProvider)
+ Provider provider = SecurityProviderUtil.getJSSEProvider();
+ log.debug("Adding " + provider.getName());
+
+ //addedJSSEProvider = Security.addProvider(new Provider()) != -1;
+ addedJSSEProvider = Security.addProvider(provider) != -1;
+ if (addedJSSEProvider)
{
- log.debug("Added com.sun.net.ssl.internal.ssl.Provider");
+ log.debug("Added " + provider.getName());
}
addedHttpsHandler = false;
+
+
// Install the JSSE https handler if it has not already been added
+ String protocolHandler = SecurityProviderUtil.getProtocolHandlerName();
String handlers = System.getProperty("java.protocol.handler.pkgs");
- if( handlers == null || handlers.indexOf("com.sun.net.ssl.internal.www.protocol") < 0 )
+ if( handlers == null || handlers.indexOf(protocolHandler) < 0 )
{
- handlers += "|com.sun.net.ssl.internal.www.protocol";
+ handlers += "|protocolHandler";
log.debug("Adding https handler to java.protocol.handler.pkgs");
System.setProperty("java.protocol.handler.pkgs", handlers);
addedHttpsHandler = true;
@@ -167,22 +175,25 @@
}
protected void stopService() throws Exception
{
- if (addedSunJSSEProvider)
+ if (addedJSSEProvider)
{
- String name = (new Provider()).getName();
- log.debug("Removing com.sun.net.ssl.internal.ssl.Provider");
+ //String name = (new Provider()).getName();
+ Provider provider = SecurityProviderUtil.getJSSEProvider();
+ String name = provider.getName();
+ log.debug("Removing " + name);
Security.removeProvider(name);
}
if( addedHttpsHandler == true )
{
log.debug("Removing https handler from java.protocol.handler.pkgs");
+ String protocolHandler = SecurityProviderUtil.getProtocolHandlerName();
String handlers = System.getProperty("java.protocol.handler.pkgs");
StringTokenizer tokenizer = new StringTokenizer(handlers, "|");
StringBuffer buffer = new StringBuffer();
while( tokenizer.hasMoreTokens() )
{
String handler = tokenizer.nextToken();
- if( handler.equals("com.sun.net.ssl.internal.www.protocol") == false )
+ if( handler.equals(protocolHandler) == false )
{
buffer.append('|');
buffer.append(handler);
@@ -257,6 +268,5 @@
{
return factoryDelegate.getSupportedCipherSuites();
}
- }
-
+ }
}
Modified: branches/Branch_4_0/testsuite/src/main/org/jboss/test/security/test/HttpsUnitTestCase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/security/test/HttpsUnitTestCase.java 2006-08-08 17:52:57 UTC (rev 55414)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/security/test/HttpsUnitTestCase.java 2006-08-08 17:59:25 UTC (rev 55415)
@@ -50,6 +50,7 @@
import org.apache.log4j.Category;
import org.jboss.test.JBossTestCase;
import org.jboss.test.JBossTestSetup;
+import org.jboss.test.util.SecurityProviderUtil;
/** Test of using https urls inside of the JBoss server. This testcase
creates a simple https server and deploys a service that tries to
@@ -167,7 +168,8 @@
{
super.setUp();
deploy(JAR);
- Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
+ //Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
+ Security.addProvider(SecurityProviderUtil.getJSSEProvider());
}
protected void tearDown() throws Exception
{
More information about the jboss-cvs-commits
mailing list