mx4j/src/test/test/javax/management/remote/rmi RMIIIOPConnectorServerTest.java,1.8,1.9

Simone Bordet <[email protected]> Fri, 18 Mar 2005 10:32:07 +0000
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/test/test/javax/management/remote/rmi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14127/src/test/test/javax/management/remote/rmi

Modified Files:
	RMIIIOPConnectorServerTest.java 
Log Message:
Tests for bug #1164309: use property java.naming.corba.orb to lookup an ORB in the environment map

Index: RMIIIOPConnectorServerTest.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/test/test/javax/management/remote/rmi/RMIIIOPConnectorServerTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** RMIIIOPConnectorServerTest.java	13 Nov 2004 16:38:58 -0000	1.8
--- RMIIIOPConnectorServerTest.java	18 Mar 2005 10:32:04 -0000	1.9
***************
*** 12,19 ****
--- 12,23 ----
  import java.util.HashMap;
  import java.util.Map;
+ 
+ import javax.management.remote.JMXConnectorServer;
+ import javax.management.remote.JMXConnectorServerFactory;
  import javax.management.remote.JMXServiceURL;
  import javax.naming.Context;
  
  import mx4j.tools.naming.CosNamingService;
+ import org.omg.CORBA.ORB;
  
  /**
***************
*** 60,62 ****
--- 64,104 ----
        return env;
     }
+ 
+    public void testInvalidProvidedORB() throws Exception
+    {
+       Map environment = new HashMap();
+       environment.put("java.naming.corba.orb", new Object());
+ 
+       JMXServiceURL url = new JMXServiceURL("iiop", null, 0, "/jndi/iiop://localhost:" + getNamingPort() + "/jmx");
+       try
+       {
+          JMXConnectorServer connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, environment, newMBeanServer());
+          connectorServer.start();
+          fail();
+       }
+       catch (IllegalArgumentException ignored)
+       {
+       }
+    }
+ 
+    public void testProvidedORB() throws Exception
+    {
+       ORB orb = ORB.init((String[])null, null);
+       Map environment = new HashMap();
+       environment.put("java.naming.corba.orb", orb);
+ 
+       JMXServiceURL url = new JMXServiceURL("iiop", null, 0, "/jndi/iiop://localhost:" + getNamingPort() + "/jmx");
+       JMXConnectorServer connectorServer = null;
+       try
+       {
+          startNaming();
+          connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, environment, newMBeanServer());
+          connectorServer.start();
+       }
+       finally
+       {
+          if (connectorServer != null) connectorServer.stop();
+          stopNaming();
+       }
+    }
  }



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click