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 TestObject.java TestObjectMBean.java
Date Wed, 21 Jan 2004 19:56:40 GMT
djencks     2004/01/21 11:56:40

  Modified:    modules/core/src/test/org/apache/geronimo/connector
                        BootstrapContextTest.java
               modules/core/src/test/org/apache/geronimo/naming/java
                        AbstractContextTest.java
               modules/core/src/test/org/apache/geronimo/naming/jmx
                        ContextTest.java TestObject.java
  Removed:     modules/core/src/test/org/apache/geronimo/naming/jmx
                        TestObjectMBean.java
  Log:
  clean up context tests slightly
  
  Revision  Changes    Path
  1.2       +3 -34     incubator-geronimo/modules/core/src/test/org/apache/geronimo/connector/BootstrapContextTest.java
  
  Index: BootstrapContextTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/connector/BootstrapContextTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BootstrapContextTest.java	25 Nov 2003 07:01:06 -0000	1.1
  +++ BootstrapContextTest.java	21 Jan 2004 19:56:40 -0000	1.2
  @@ -56,12 +56,11 @@
   package org.apache.geronimo.connector;
   
   import java.util.Timer;
  +
   import javax.resource.spi.XATerminator;
   import javax.resource.spi.work.WorkManager;
  +
   import junit.framework.TestCase;
  -import org.apache.geronimo.connector.BootstrapContext;
  -import org.apache.geronimo.kernel.service.GeronimoMBeanEndpoint;
  -import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
   
   /**
    * Unit tests for {@link BootstrapContext}
  @@ -110,34 +109,4 @@
           assertNotNull("Object is not null", t);
       }
   
  -    /**
  -     * Tests getGeronimoMBeanInfo
  -     */
  -    public void testGetGeronimoMBeanInfo() throws Exception {
  -        BootstrapContext context = new BootstrapContext();
  -        GeronimoMBeanInfo info = context.getGeronimoMBeanInfo();
  -        assertNotNull("Object is not null", info);
  -        assertTrue("Correct target",
  -                info.getTargetClass().equals(BootstrapContext.class.getName()));
  -
  -        GeronimoMBeanEndpoint[] endpoints = info.getEndpoints();
  -        assertNotNull("Endpoinds are not null", endpoints);
  -        assertTrue("Endpoints has 2 elements", endpoints.length == 2);
  -        assertTrue("First endpoint is WorkManager endpoint",
  -                hasEndpoint("WorkManager", endpoints));
  -        assertTrue("Second endpoint is XATerminator endpoint",
  -                hasEndpoint("XATerminator", endpoints));
  -
  -
  -    }
  -
  -    private boolean hasEndpoint(String name, GeronimoMBeanEndpoint[] endpoints) {
  -        for(int i = 0; i < endpoints.length; i++) {
  -            if(name.equals(endpoints[i].getName())) {
  -                return true;
  -            }
  -        }
  -
  -        return false;
  -    }
   }
  
  
  
  1.3       +11 -16    incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/java/AbstractContextTest.java
  
  Index: AbstractContextTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/java/AbstractContextTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractContextTest.java	18 Jan 2004 22:43:52 -0000	1.2
  +++ AbstractContextTest.java	21 Jan 2004 19:56:40 -0000	1.3
  @@ -57,20 +57,20 @@
   package org.apache.geronimo.naming.java;
   
   import java.util.HashMap;
  -import java.util.Properties;
   import java.util.Map;
  +import java.util.Properties;
   
  +import javax.management.MBeanServer;
  +import javax.management.ObjectName;
  +import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.LinkRef;
  -import javax.naming.Context;
   import javax.naming.NamingException;
  -import javax.management.MBeanServer;
  -import javax.management.ObjectName;
   
   import junit.framework.TestCase;
  +import org.apache.geronimo.gbean.GBeanInfo;
  +import org.apache.geronimo.gbean.jmx.GBeanMBean;
   import org.apache.geronimo.naming.jmx.TestObject;
  -import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
  -import org.apache.geronimo.kernel.service.GeronimoMBean;
   
   /**
    *
  @@ -115,14 +115,9 @@
       }
   
       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;
  +        GBeanInfo gbeanInfo = TestObject.getGBeanInfo();
  +        GBeanMBean gbean = new GBeanMBean(gbeanInfo);
  +        server.registerMBean(gbean, objectName);
  +        return (TestObject) gbean.getTarget();
       }
   }
  
  
  
  1.8       +1 -3      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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ContextTest.java	18 Jan 2004 22:43:53 -0000	1.7
  +++ ContextTest.java	21 Jan 2004 19:56:40 -0000	1.8
  @@ -67,8 +67,6 @@
   import javax.naming.NamingException;
   
   import org.apache.geronimo.kernel.jmx.JMXKernel;
  -import org.apache.geronimo.kernel.service.GeronimoMBean;
  -import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
   import org.apache.geronimo.naming.java.AbstractContextTest;
   import org.apache.geronimo.naming.java.RootContext;
   import org.apache.geronimo.test.util.ServerUtil;
  
  
  
  1.4       +18 -3     incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/jmx/TestObject.java
  
  Index: TestObject.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/jmx/TestObject.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestObject.java	16 Nov 2003 05:24:38 -0000	1.3
  +++ TestObject.java	21 Jan 2004 19:56:40 -0000	1.4
  @@ -56,7 +56,9 @@
   
   package org.apache.geronimo.naming.jmx;
   
  -import javax.ejb.EJBHome;
  +import org.apache.geronimo.gbean.GBeanInfo;
  +import org.apache.geronimo.gbean.GBeanInfoFactory;
  +import org.apache.geronimo.gbean.GOperationInfo;
   
   /**
    *
  @@ -64,7 +66,9 @@
    * @version $Revision$ $Date$
    *
    * */
  -public class TestObject implements TestObjectMBean {
  +public class TestObject {
  +
  +    private static final GBeanInfo GBEAN_INFO;
   
       private Object home = new Object();
       private Object local = new Object();
  @@ -85,5 +89,16 @@
           return cf;
       }
   
  +    static {
  +        GBeanInfoFactory infoFactory = new GBeanInfoFactory(TestObject.class.getName());
  +        infoFactory.addOperation(new GOperationInfo("getEJBHome"));
  +        infoFactory.addOperation(new GOperationInfo("getEJBLocalHome"));
  +        infoFactory.addOperation(new GOperationInfo("getConnectionFactory"));
  +        GBEAN_INFO = infoFactory.getBeanInfo();
  +    }
  +
  +    public static GBeanInfo getGBeanInfo() {
  +        return GBEAN_INFO;
  +    }
   
   }
  
  
  

Mime
View raw message