geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: rev 47567 - in geronimo/trunk/modules: connector/src/test/org/apache/geronimo/connector connector/src/test/org/apache/geronimo/connector/outbound naming/src/java/org/apache/geronimo/naming/jmx naming/src/test/org/apache/geronimo/naming/java
Date Thu, 30 Sep 2004 08:19:54 GMT
Author: djencks
Date: Thu Sep 30 01:19:53 2004
New Revision: 47567

Modified:
   geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
   geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
   geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java
   geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/ContextBuilderTest.java
Log:
Slightly more sensible way of constructing object names, and use it in tests

Modified: geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
==============================================================================
--- geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
(original)
+++ geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
Thu Sep 30 01:19:53 2004
@@ -105,8 +105,8 @@
     protected void setUp() throws Exception {
         kernel = new Kernel(KERNEL_NAME, "test.domain");
         kernel.boot();
-
-        selfName = ObjectName.getInstance("geronimo.server:J2EEServer=geronimo" + JMXReferenceFactory.BASE_ADMIN_OBJECT_NAME
+ TARGET_NAME);
+        JMXReferenceFactory refFactory = new JMXReferenceFactory("geronimo.server", "geronimo");
+        selfName = refFactory.createAdminObjectObjectName(TARGET_NAME);
 
         GBeanMBean aow = new GBeanMBean(AdminObjectWrapper.getGBeanInfo());
         aow.setAttribute("adminObjectInterface", MockAdminObject.class);

Modified: geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
==============================================================================
--- geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
(original)
+++ geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
Thu Sep 30 01:19:53 2004
@@ -41,12 +41,11 @@
 import org.apache.geronimo.gbean.GBeanInfoFactory;
 import org.apache.geronimo.gbean.jmx.GBeanMBean;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.naming.ReferenceFactory;
 import org.apache.geronimo.naming.java.ComponentContextBuilder;
 import org.apache.geronimo.naming.java.ReadOnlyContext;
 import org.apache.geronimo.naming.jmx.JMXReferenceFactory;
-import org.apache.geronimo.naming.ReferenceFactory;
 import org.apache.geronimo.xbeans.geronimo.naming.GerLocalRefType;
-import org.apache.xmlbeans.XmlObject;
 
 /**
  * @version $Rev$ $Date$
@@ -152,7 +151,8 @@
         cmfName = ObjectName.getInstance("test:role=ConnectionManagerFactory");
         kernel.loadGBean(cmfName, cmf);
 
-        managedConnectionFactoryName = ObjectName.getInstance("geronimo.server:J2EEServer=geronimo"
+ JMXReferenceFactory.BASE_MANAGED_CONNECTION_FACTORY_NAME + TARGET_NAME);
+        JMXReferenceFactory refFactory = new JMXReferenceFactory("geronimo.server", "geronimo");
+        managedConnectionFactoryName = refFactory.createManagedConnectionFactoryObjectName(TARGET_NAME);
 
         GBeanMBean mcfw = new GBeanMBean(ManagedConnectionFactoryWrapper.getGBeanInfo());
         mcfw.setAttribute("managedConnectionFactoryClass", MockManagedConnectionFactory.class);

Modified: geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java
==============================================================================
--- geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java
(original)
+++ geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java
Thu Sep 30 01:19:53 2004
@@ -45,20 +45,31 @@
 
     public Reference buildConnectionFactoryReference(GerLocalRefType localRef, Class iface)
throws MalformedObjectNameException {
         Reference ref = new Reference(null, JMXObjectFactory.class.getName(), null);
-        ref.add(new JMXRefAddr(localRef.getServer(), localRef.getKernelName(), ObjectName.getInstance(baseName
+ BASE_MANAGED_CONNECTION_FACTORY_NAME + localRef.getTargetName()), iface));
+
+        String targetName = localRef.getTargetName();
+        ref.add(new JMXRefAddr(localRef.getServer(), localRef.getKernelName(), createManagedConnectionFactoryObjectName(targetName),
iface));
         return ref;
     }
 
+    public ObjectName createManagedConnectionFactoryObjectName(String targetName) throws
MalformedObjectNameException {
+        return ObjectName.getInstance(baseName + BASE_MANAGED_CONNECTION_FACTORY_NAME + targetName);
+    }
+
     public Reference buildAdminObjectReference(GerLocalRefType localRef, Class iface) throws
MalformedObjectNameException {
         Reference ref = new Reference(null, JMXObjectFactory.class.getName(), null);
-        ref.add(new JMXRefAddr(localRef.getServer(), localRef.getKernelName(), ObjectName.getInstance(baseName
+ BASE_ADMIN_OBJECT_NAME + localRef.getTargetName()), iface));
+        String targetName = localRef.getTargetName();
+        ref.add(new JMXRefAddr(localRef.getServer(), localRef.getKernelName(), createAdminObjectObjectName(targetName),
iface));
         return ref;
     }
 
+    public ObjectName createAdminObjectObjectName(String targetName) throws MalformedObjectNameException
{
+        return ObjectName.getInstance(baseName + BASE_ADMIN_OBJECT_NAME + targetName);
+    }
+
     //TODO warning: this only works if there is only one kernel!
     public Reference buildMessageDestinationReference(String linkName, Class iface) throws
MalformedObjectNameException {
         Reference ref = new Reference(null, JMXObjectFactory.class.getName(), null);
-        ref.add(new JMXRefAddr(null, null, ObjectName.getInstance(baseName + BASE_ADMIN_OBJECT_NAME
+ linkName), iface));
+        ref.add(new JMXRefAddr(null, null, createAdminObjectObjectName(linkName), iface));
         return ref;
     }
 

Modified: geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/ContextBuilderTest.java
==============================================================================
--- geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/ContextBuilderTest.java
(original)
+++ geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/ContextBuilderTest.java
Thu Sep 30 01:19:53 2004
@@ -32,7 +32,6 @@
 import org.apache.geronimo.gbean.GBeanInfoFactory;
 import org.apache.geronimo.gbean.jmx.GBeanMBean;
 import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.naming.ReferenceFactory;
 import org.apache.geronimo.naming.jmx.JMXReferenceFactory;
 import org.apache.geronimo.xbeans.geronimo.naming.GerLocalRefType;
 
@@ -43,6 +42,7 @@
     private ComponentContextBuilder builder;
 
     private List proxy;
+    private JMXReferenceFactory referenceFactory;
 
     public void testFreeze() {
         ReadOnlyContext context = builder.getContext();
@@ -117,7 +117,7 @@
         kernel.boot();
         try {
             assertEquals(kernel, Kernel.getKernel("test.kernel"));
-            ObjectName proxyFactoryName = ObjectName.getInstance("geronimo.server:J2EEServer=geronimo"
+ JMXReferenceFactory.BASE_ADMIN_OBJECT_NAME + "testAdminObject");
+            ObjectName proxyFactoryName = referenceFactory.createAdminObjectObjectName("testAdminObject");
             GBeanMBean gbean = new GBeanMBean(getGbeanInfo());
             gbean.setAttribute("Content", proxy);
             kernel.loadGBean(proxyFactoryName, gbean);
@@ -141,7 +141,7 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        ReferenceFactory referenceFactory = new JMXReferenceFactory("geronimo.server", "geronimo");
+        referenceFactory = new JMXReferenceFactory("geronimo.server", "geronimo");
         builder = new ComponentContextBuilder(referenceFactory);
     }
 

Mime
View raw message