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.CosNamingService;
18:
19: /**
20: * @version $Revision: 1.8 $
21: */
22: public class RMIIIOPConnectorServerTest extends
23: RMIConnectorServerTestCase {
24: private CosNamingService naming;
25:
26: public RMIIIOPConnectorServerTest(String s) {
27: super (s);
28: }
29:
30: public void startNaming() throws Exception {
31: naming = new CosNamingService(getNamingPort());
32: naming.start();
33: Thread.sleep(5000);
34: }
35:
36: public void stopNaming() throws Exception {
37: naming.stop();
38: naming = null;
39: Thread.sleep(5000);
40: }
41:
42: public int getNamingPort() {
43: return 1100;
44: }
45:
46: public JMXServiceURL createJMXConnectorServerAddress()
47: throws MalformedURLException {
48: return new JMXServiceURL("iiop", "localhost", 0);
49: }
50:
51: public Map getEnvironment() {
52: HashMap env = new HashMap();
53: env.put(Context.INITIAL_CONTEXT_FACTORY,
54: "com.sun.jndi.cosnaming.CNCtxFactory");
55: env.put(Context.PROVIDER_URL, "iiop://localhost:"
56: + getNamingPort());
57: return env;
58: }
59: }
|