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