[jboss-remoting-commits] JBoss Remoting SVN: r5891 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ssl.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Sat Jul 3 13:25:15 EDT 2010


Author: ron.sigal at jboss.com
Date: 2010-07-03 13:25:15 -0400 (Sat, 03 Jul 2010)
New Revision: 5891

Modified:
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ssl/SSLSupportedTransportTestCase.java
Log:
JBREM-1231: Wrapped all state changing calls to InvokerRegistry in PrivilegedAction.

Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ssl/SSLSupportedTransportTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ssl/SSLSupportedTransportTestCase.java	2010-07-03 17:24:44 UTC (rev 5890)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/ssl/SSLSupportedTransportTestCase.java	2010-07-03 17:25:15 UTC (rev 5891)
@@ -21,6 +21,10 @@
 */
 package org.jboss.test.remoting.ssl;
 
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
 import junit.framework.TestCase;
 import org.jboss.remoting.InvokerRegistry;
 
@@ -31,13 +35,29 @@
 {
    public void testTransportSupportsSSL() throws Exception
    {
-      String[] transports = new String[] {"socket", "sslsocket", "multiplex", "sslmultiplex", "rmi", "sslrmi", "http", "https"};
+      final String[] transports = new String[] {"socket", "sslsocket", "multiplex", "sslmultiplex", "rmi", "sslrmi", "http", "https"};
       boolean[] expextedResult = new boolean[] {false, true, false, true, false, true, false, true};
 
       for(int x = 0; x < transports.length; x++)
       {
-         boolean isSupported = InvokerRegistry.isSSLSupported(transports[x]);
-         assertEquals("transport " + transports[x] + " was supposed to be " + expextedResult[x] + " for supporting ssl.", expextedResult[x], isSupported);
+         Boolean isSupported = null;
+         final int finalX = x;
+         try
+         {
+            isSupported = (Boolean) AccessController.doPrivileged( new PrivilegedExceptionAction()
+            {
+               public Object run() throws Exception
+               {
+                  return new Boolean(InvokerRegistry.isSSLSupported(transports[finalX]));
+               }
+            });
+         }
+         catch (PrivilegedActionException pae)
+         {
+            throw pae.getException();
+         }
+         
+         assertEquals("transport " + transports[x] + " was supposed to be " + expextedResult[x] + " for supporting ssl.", expextedResult[x], isSupported.booleanValue());
       }
    }
 }
\ No newline at end of file



More information about the jboss-remoting-commits mailing list