mx4j/src/test/test/javax/management/remote/rmi RMIJRMPRemoteSecurityManagerTest.java,NONE,1.1

[email protected]
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/test/test/javax/management/remote/rmi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3968/test/test/javax/management/remote/rmi

Added Files:
	RMIJRMPRemoteSecurityManagerTest.java 
Log Message:
Rewriting security tests based on a modifiable policy, for both remote and local tests

--- NEW FILE: RMIJRMPRemoteSecurityManagerTest.java ---
/*
 * Copyright (C) MX4J.
 * All rights reserved.
 *
 * This software is distributed under the terms of the MX4J License version 1.0.
 * See the terms of the MX4J License in the documentation provided with this software.
 */

package test.javax.management.remote.rmi;

import java.net.MalformedURLException;
import java.security.Policy;

import javax.management.remote.JMXServiceURL;

import test.javax.management.remote.RemoteSecurityManagerTestCase;

/**
 * @author <a href="mailto:[email protected]">Simone Bordet</a>
 * @version $Revision: 1.1 $
 */
public class RMIJRMPRemoteSecurityManagerTest extends RemoteSecurityManagerTestCase
{
   static
   {
      // For the way JUnit works, we have one JVM per test class
      Policy.setPolicy(new RMIJRMPRemoteModifiablePolicy());
      System.setSecurityManager(new SecurityManager());
   }

   public RMIJRMPRemoteSecurityManagerTest(String s)
   {
      super(s);
   }

   protected JMXServiceURL createJMXConnectorServerAddress() throws MalformedURLException
   {
      return new JMXServiceURL("rmi", "localhost", 7777);
   }

   public static class RMIJRMPRemoteModifiablePolicy extends RemoteModifiablePolicy
   {
      public boolean isServerSide()
      {
         if (!isSeparateClientServerPermissions()) return true;
         String name = Thread.currentThread().getName();
         if (name.indexOf("RMI") >= 0) return true;
         return false;
      }
   }
}



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.