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.util.HashMap;
13: import java.util.Map;
14: import javax.management.remote.JMXServiceURL;
15: import javax.naming.Context;
16:
17: import mx4j.tools.naming.NamingService;
18:
19: /**
20: * @version $Revision: 1.7 $
21: */
22: public class RMIJRMPConnectorServerTest extends
23: RMIConnectorServerTestCase {
24: private NamingService naming;
25:
26: public RMIJRMPConnectorServerTest(String s) {
27: super (s);
28: }
29:
30: public void startNaming() throws Exception {
31: naming = new NamingService(getNamingPort());
32: naming.start();
33: }
34:
35: public void stopNaming() throws Exception {
36: naming.stop();
37: naming = null;
38: Thread.sleep(5000);
39: }
40:
41: public int getNamingPort() {
42: return 1099;
43: }
44:
45: public JMXServiceURL createJMXConnectorServerAddress()
46: throws MalformedURLException {
47: return new JMXServiceURL("rmi", "localhost", 0);
48: }
49:
50: public Map getEnvironment() {
51: HashMap env = new HashMap();
52: env.put(Context.INITIAL_CONTEXT_FACTORY,
53: "com.sun.jndi.rmi.registry.RegistryContextFactory");
54: env.put(Context.PROVIDER_URL, "rmi://localhost:"
55: + getNamingPort());
56: return env;
57: }
58: }
|