djencks 2004/01/18 14:43:53
Modified: modules/core/src/test/org/apache/geronimo/naming/java
AbstractContextTest.java ContextBuilderTest.java
modules/core/src/test/org/apache/geronimo/naming/jmx
ContextTest.java
Log:
fixed ejb lookup naming tests
Revision Changes Path
1.2 +18 -1
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractContextTest.java 12 Jan 2004 06:19:52 -0000 1.1
+++ AbstractContextTest.java 18 Jan 2004 22:43:52 -0000 1.2
@@ -64,8 +64,13 @@
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.naming.jmx.TestObject;
+import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
+import org.apache.geronimo.kernel.service.GeronimoMBean;
/**
*
@@ -107,5 +112,17 @@
protected void bind(String name, Object value) throws NamingException {
readOnlyContext.internalBind(name, value);
+ }
+
+ 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;
}
}
1.13 +21 -15
incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/java/ContextBuilderTest.java
Index: ContextBuilderTest.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/java/ContextBuilderTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ContextBuilderTest.java 12 Jan 2004 06:19:52 -0000 1.12
+++ ContextBuilderTest.java 18 Jan 2004 22:43:53 -0000 1.13
@@ -57,6 +57,7 @@
import java.net.URL;
import javax.management.ObjectName;
+import javax.management.MBeanServer;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameNotFoundException;
@@ -73,6 +74,7 @@
import org.apache.geronimo.naming.jmx.JMXReferenceFactory;
import org.apache.geronimo.naming.jmx.TestObject;
import org.apache.geronimo.transaction.manager.UserTransactionImpl;
+import org.apache.geronimo.test.util.ServerUtil;
/**
*
@@ -82,24 +84,28 @@
public class ContextBuilderTest extends TestCase {
protected static final String objectName1 = "geronimo.test:name=test1";
protected static final String objectName2 = "geronimo.test:name=test2";
- protected static final String objectName3 = "geronimo.test:name=test3";
+ protected static final String objectName3 =
"geronimo.j2ee:J2eeType=SessionBean,name=test3";
protected ApplicationClient client;
protected Session session;
protected Context compCtx;
- protected JMXKernel kernel;
protected ReferenceFactory referenceFactory;
- protected TestObject testObject1 = new TestObject();
- protected TestObject testObject2 = new TestObject();
- protected TestObject testObject3 = new TestObject();
+ protected TestObject testObject1;
+ protected TestObject testObject2;
+ protected TestObject testObject3;
protected void setUp() throws Exception {
- kernel = new JMXKernel("geronimo.test");
- kernel.getMBeanServer().registerMBean(testObject1,
ObjectName.getInstance(objectName1));
- kernel.getMBeanServer().registerMBean(testObject2,
ObjectName.getInstance(objectName2));
- kernel.getMBeanServer().registerMBean(testObject3,
ObjectName.getInstance(objectName3));
+ MBeanServer server = ServerUtil.newLocalServer();
- referenceFactory = new
JMXReferenceFactory(kernel.getMBeanServerId());
+ String agentId = JMXKernel.getMBeanServerId(server);
+ testObject1 = AbstractContextTest.registerTestObject(server,
ObjectName.getInstance(objectName1));
+ testObject2 = AbstractContextTest.registerTestObject(server,
ObjectName.getInstance(objectName2));
+ testObject3 = AbstractContextTest.registerTestObject(server,
ObjectName.getInstance(objectName3));
+ //kernel.getMBeanServer().registerMBean(testObject1,
ObjectName.getInstance(objectName1));
+ //kernel.getMBeanServer().registerMBean(testObject2,
ObjectName.getInstance(objectName2));
+ //kernel.getMBeanServer().registerMBean(testObject3,
ObjectName.getInstance(objectName3));
+
+ referenceFactory = new JMXReferenceFactory(agentId);
client = new ApplicationClient();
session = new Session();
EnvEntry stringEntry = new EnvEntry();
@@ -123,7 +129,7 @@
EjbRef ejbLinkRef = new EjbRef();
ejbLinkRef.setEJBRefName("here/LinkEjb");
ejbLinkRef.setEJBRefType("Session");
- ejbLinkRef.setEJBLink(objectName3);
+ ejbLinkRef.setEJBLink("test3");
EjbLocalRef ejbLocalRef = new EjbLocalRef();
ejbLocalRef.setEJBRefName("local/here/LocalEJB2");
@@ -133,7 +139,7 @@
EjbLocalRef ejbLocalLinkRef = new EjbLocalRef();
ejbLocalLinkRef.setEJBRefName("local/here/LinkLocalEjb");
ejbLocalLinkRef.setEJBRefType("Entity");
- ejbLocalLinkRef.setEJBLink(objectName3);
+ ejbLocalLinkRef.setEJBLink("test3");
ResourceRef urlRef = new ResourceRef();
urlRef.setResRefName("url/testURL");
@@ -179,7 +185,7 @@
assertEquals(userTransaction, compCtx.lookup("UserTransaction"));
}
- public void XtestClientEJBRefs() throws Exception {
+ public void testClientEJBRefs() throws Exception {
ReadOnlyContext compContext = new
ComponentContextBuilder(referenceFactory, null).buildContext(client);
RootContext.setComponentContext(compContext);
InitialContext initialContext = new InitialContext();
@@ -191,7 +197,7 @@
initialContext.lookup("java:comp/env/DefaultCF"));
}
- public void XtestLocalEJBRefs() throws Exception {
+ public void testLocalEJBRefs() throws Exception {
ReadOnlyContext compContext = new
ComponentContextBuilder(referenceFactory, null).buildContext(session);
RootContext.setComponentContext(compContext);
InitialContext initialContext = new InitialContext();
1.7 +1 -13
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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ContextTest.java 12 Jan 2004 06:19:52 -0000 1.6
+++ ContextTest.java 18 Jan 2004 22:43:53 -0000 1.7
@@ -98,18 +98,6 @@
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 {
}