Package org.springmodules.javaspaces

Source Code of org.springmodules.javaspaces.SecurityTests

/**
* Created on Mar 11, 2006
*
* $Id$
* $Revision$
*/
package org.springmodules.javaspaces;

import java.rmi.RMISecurityManager;

import junit.framework.TestCase;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

/**
* @author Costin Leau
*
*/
public class SecurityTests extends TestCase {

  public void testRMISecurityManager() throws Exception {
    SecurityManager securityManager = System.getSecurityManager();

    try {
      Resource policy = new ClassPathResource("policy");
      System.out.println("policy is " + policy);
      System.setProperty("java.security.policy", policy.getFile().getAbsolutePath());
      System.setSecurityManager(new RMISecurityManager());
      System.setSecurityManager(null);
    }
    finally {
      System.setSecurityManager(securityManager);
    }
  }
}
TOP

Related Classes of org.springmodules.javaspaces.SecurityTests

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.