1 8 9 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 22 public class RMIJRMPConnectorServerTest extends RMIConnectorServerTestCase 23 { 24 private NamingService naming; 25 26 public RMIJRMPConnectorServerTest(String s) 27 { 28 super(s); 29 } 30 31 public void startNaming() throws Exception 32 { 33 naming = new NamingService(getNamingPort()); 34 naming.start(); 35 } 36 37 public void stopNaming() throws Exception 38 { 39 naming.stop(); 40 naming = null; 41 Thread.sleep(5000); 42 } 43 44 public int getNamingPort() 45 { 46 return 1099; 47 } 48 49 public JMXServiceURL createJMXConnectorServerAddress() throws MalformedURLException 50 { 51 return new JMXServiceURL ("rmi", "localhost", 0); 52 } 53 54 public Map getEnvironment() 55 { 56 HashMap env = new HashMap (); 57 env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry.RegistryContextFactory"); 58 env.put(Context.PROVIDER_URL, "rmi://localhost:" + getNamingPort()); 59 return env; 60 } 61 } 62 | Popular Tags |