01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package test.javax.management.remote.rmi;
10:
11: import java.net.MalformedURLException;
12: import java.security.Policy;
13: import javax.management.remote.JMXServiceURL;
14:
15: import test.javax.management.remote.RemoteSecurityManagerTestCase;
16:
17: /**
18: * @version $Revision: 1.3 $
19: */
20: public class RMIJRMPRemoteSecurityManagerTest extends
21: RemoteSecurityManagerTestCase {
22: static {
23: // For the way JUnit works, we have one JVM per test class
24: Policy.setPolicy(new RMIJRMPRemoteModifiablePolicy());
25: System.setSecurityManager(new SecurityManager());
26: }
27:
28: public RMIJRMPRemoteSecurityManagerTest(String s) {
29: super (s);
30: }
31:
32: protected JMXServiceURL createJMXConnectorServerAddress()
33: throws MalformedURLException {
34: return new JMXServiceURL("rmi", "localhost", 7777);
35: }
36:
37: public static class RMIJRMPRemoteModifiablePolicy extends
38: RemoteModifiablePolicy {
39: public boolean isServerSide() {
40: if (!isSeparateClientServerPermissions())
41: return true;
42: String name = Thread.currentThread().getName();
43: if (name.indexOf("RMI") >= 0)
44: return true;
45: return false;
46: }
47: }
48: }
|