geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/jmx ContextTest.java
Date Wed, 19 Nov 2003 02:08:42 GMT
djencks     2003/11/18 18:08:42

  Modified:    modules/core/src/test/org/apache/geronimo/naming/jmx
                        ContextTest.java
  Log:
  Fix lookup tests by using Hirams addOperationsDeclaredIn method to deploy test object as
GeronimoMBean
  
  Revision  Changes    Path
  1.5       +22 -10    incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/jmx/ContextTest.java
  
  Index: ContextTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/jmx/ContextTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ContextTest.java	17 Nov 2003 07:33:51 -0000	1.4
  +++ ContextTest.java	19 Nov 2003 02:08:42 -0000	1.5
  @@ -68,8 +68,11 @@
   
   import junit.framework.TestCase;
   import org.apache.geronimo.kernel.jmx.JMXKernel;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
  +import org.apache.geronimo.kernel.service.GeronimoMBean;
   import org.apache.geronimo.naming.java.ReadOnlyContext;
   import org.apache.geronimo.naming.java.RootContext;
  +import org.apache.geronimo.test.util.ServerUtil;
   
   /**
    *
  @@ -85,29 +88,38 @@
       private MBeanServer server;
       private String agentId;
       private ObjectName objectName;
  -    private JMXKernel kernel;
       private TestObject mbean;
   
       protected void setUp() throws Exception {
  -        kernel = new JMXKernel("geronimo.test");
  -        server = kernel.getMBeanServer();
  -        agentId = kernel.getMBeanServerId();
  +        server = ServerUtil.newLocalServer();
  +
  +        agentId = JMXKernel.getMBeanServerId(server);
           objectName = new ObjectName(on1);
  -        mbean = new TestObject();
  -        server.registerMBean(mbean, objectName);
  +        mbean = registerTestObject(server, objectName);
  +    }
  +
  +    public static TestObject registerTestObject(MBeanServer server, ObjectName objectName)
throws Exception {
  +        GeronimoMBeanInfo info = new GeronimoMBeanInfo();
  +        TestObject to = new TestObject();
  +        info.setTargetClass(TestObject.class.getName());
  +        info.setTarget(to);
  +        info.addOperationsDeclaredIn(TestObject.class);
  +        GeronimoMBean gmb = new GeronimoMBean();
  +        gmb.setMBeanInfo(info);
  +        server.registerMBean(gmb, objectName);
  +        return to;
       }
   
       protected void tearDown() throws Exception {
  -        kernel.release();
       }
   
  -    public void XtestLookupString() throws Exception {
  +    public void testLookupString() throws Exception {
           JMXContext context = new JMXContext(new Hashtable());
           Object result = context.lookup(JMXContext.encode(agentId, on1, mn1));
           assertTrue("Expected the ", result == mbean.getEJBHome());
       }
   
  -    public void XtestLookupName() throws Exception {
  +    public void testLookupName() throws Exception {
           JMXContext context = new JMXContext(new Hashtable());
           Object result = context.lookup(new CompositeName(JMXContext.encode(agentId, on1,
mn1)));
           assertTrue("Expected the supplied object back", result == mbean.getEJBHome());
  
  
  

Mime
View raw message