geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: rev 47502 - 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/deployment naming/src/java/org/apache/geronimo/naming/jmx naming/src/test-data naming/src/test/org/apache/geronimo/naming/geronimo naming/src/test/org/apache/geronimo/naming/java
Date Wed, 29 Sep 2004 21:04:43 GMT
Author: djencks
Date: Wed Sep 29 14:04:42 2004
New Revision: 47502

Removed:
   geronimo/trunk/modules/naming/src/test-data/jndi.properties
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/deployment/ENCConfigBuilder.java
   geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java
   geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/geronimo/GeronimoRootContextTest.java
   geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/AbstractContextTest.java
   geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/ContextBuilderTest.java
   geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/ThreadContextTest.java
Log:
Parameterize the JMXReferenceFactory to make references that can be used on the client. Replace
jndi.properties with explicit setting 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
Wed Sep 29 14:04:42 2004
@@ -89,7 +89,7 @@
 
 
     public void testLocalLookup() throws Exception {
-        ReferenceFactory referenceFactory = new JMXReferenceFactory();
+        ReferenceFactory referenceFactory = new JMXReferenceFactory("geronimo.server", "geronimo");
         ComponentContextBuilder builder = new ComponentContextBuilder(referenceFactory);
         GerLocalRefType localRef = GerLocalRefType.Factory.newInstance();
         localRef.setRefName("resourceenvref");

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
Wed Sep 29 14:04:42 2004
@@ -125,7 +125,7 @@
     }
 
     public void testLocalLookup() throws Exception {
-        ReferenceFactory referenceFactory = new JMXReferenceFactory();
+        ReferenceFactory referenceFactory = new JMXReferenceFactory("geronimo.server", "geronimo");
         ComponentContextBuilder builder = new ComponentContextBuilder(referenceFactory);
         GerLocalRefType localRef = GerLocalRefType.Factory.newInstance();
         localRef.setRefName("resourceref");

Modified: geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
==============================================================================
--- geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
(original)
+++ geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
Wed Sep 29 14:04:42 2004
@@ -248,7 +248,7 @@
     }
 
     public static ReadOnlyContext buildComponentContext(EARContext earContext, URI uri, UserTransaction
userTransaction, EnvEntryType[] envEntries, EjbRefType[] ejbRefs, Map ejbRefMap, EjbLocalRefType[]
ejbLocalRefs, Map ejbLocalRefMap, ResourceRefType[] resourceRefs, Map resourceRefMap, ResourceEnvRefType[]
resourceEnvRefs, Map resourceEnvRefMap, MessageDestinationRefType[] messageDestinationRefs,
ClassLoader cl) throws DeploymentException {
-        ComponentContextBuilder builder = new ComponentContextBuilder(new JMXReferenceFactory());
+        ComponentContextBuilder builder = new ComponentContextBuilder(new JMXReferenceFactory(earContext.getJ2EEDomainName(),
earContext.getJ2EEServerName()));
 
         if (userTransaction != null) {
             try {

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
Wed Sep 29 14:04:42 2004
@@ -34,28 +34,31 @@
 public class JMXReferenceFactory implements ReferenceFactory {
 
     //TODO these names are constructed in a more generic fashion in ConnectorModuleBuilder.
-    public static final String BASE_MANAGED_CONNECTION_FACTORY_NAME = "geronimo.server:J2EEServer=geronimo,j2eeType=JCAManagedConnectionFactory,name=";
-    public static final String BASE_ADMIN_OBJECT_NAME = "geronimo.server:J2EEServer=geronimo,j2eeType=JCAAdminObject,name=";
+    public static final String BASE_MANAGED_CONNECTION_FACTORY_NAME = ",j2eeType=JCAManagedConnectionFactory,name=";
+    public static final String BASE_ADMIN_OBJECT_NAME = ",j2eeType=JCAAdminObject,name=";
 
-    public JMXReferenceFactory() {
+    private final String baseName;
+
+    public JMXReferenceFactory(String domainName, String serverName) {
+        baseName = domainName + ":J2EEServer=" + serverName;
     }
 
     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(BASE_MANAGED_CONNECTION_FACTORY_NAME
+ localRef.getTargetName()), iface));
+        ref.add(new JMXRefAddr(localRef.getServer(), localRef.getKernelName(), ObjectName.getInstance(baseName
+ BASE_MANAGED_CONNECTION_FACTORY_NAME + localRef.getTargetName()), iface));
         return ref;
     }
 
     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(BASE_ADMIN_OBJECT_NAME
+ localRef.getTargetName()), iface));
+        ref.add(new JMXRefAddr(localRef.getServer(), localRef.getKernelName(), ObjectName.getInstance(baseName
+ BASE_ADMIN_OBJECT_NAME + localRef.getTargetName()), iface));
         return ref;
     }
 
     //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(BASE_ADMIN_OBJECT_NAME
+ linkName), iface));
+        ref.add(new JMXRefAddr(null, null, ObjectName.getInstance(baseName + BASE_ADMIN_OBJECT_NAME
+ linkName), iface));
         return ref;
     }
 

Modified: geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/geronimo/GeronimoRootContextTest.java
==============================================================================
--- geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/geronimo/GeronimoRootContextTest.java
(original)
+++ geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/geronimo/GeronimoRootContextTest.java
Wed Sep 29 14:04:42 2004
@@ -30,6 +30,10 @@
 public class GeronimoRootContextTest extends TestCase {
 
     protected void setUp() throws Exception {
+        System.setProperty("java.naming.factory.initial", "com.sun.jndi.rmi.registry.RegistryContextFactory");
+        System.setProperty("java.naming.factory.url.pkgs", "org.apache.geronimo.naming");
+        System.setProperty("java.naming.provider.url", "rmi://localhost:1099");
+
         GeronimoContextManager.bind("one", "one");
         GeronimoContextManager.bind("this/is/a/compound/name", "two");
         GeronimoContextManager.bind("this/is/another/compound/name", "three");

Modified: geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/AbstractContextTest.java
==============================================================================
--- geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/AbstractContextTest.java
(original)
+++ geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/AbstractContextTest.java
Wed Sep 29 14:04:42 2004
@@ -45,6 +45,10 @@
     public void testNothing() { }
 
     protected void setUp() throws Exception {
+        System.setProperty("java.naming.factory.initial", "com.sun.jndi.rmi.registry.RegistryContextFactory");
+        System.setProperty("java.naming.factory.url.pkgs", "org.apache.geronimo.naming");
+        System.setProperty("java.naming.provider.url", "rmi://localhost:1099");
+
         initialContext = new InitialContext();
 
         readOnlyContext = new ReadOnlyContext();

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
Wed Sep 29 14:04:42 2004
@@ -131,7 +131,7 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        ReferenceFactory referenceFactory = new JMXReferenceFactory();
+        ReferenceFactory referenceFactory = new JMXReferenceFactory("geronimo.server", "geronimo");
         builder = new ComponentContextBuilder(referenceFactory);
     }
 

Modified: geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/ThreadContextTest.java
==============================================================================
--- geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/ThreadContextTest.java
(original)
+++ geronimo/trunk/modules/naming/src/test/org/apache/geronimo/naming/java/ThreadContextTest.java
Wed Sep 29 14:04:42 2004
@@ -50,6 +50,10 @@
     }
 
     protected void setUp() throws Exception {
+        System.setProperty("java.naming.factory.initial", "com.sun.jndi.rmi.registry.RegistryContextFactory");
+        System.setProperty("java.naming.factory.url.pkgs", "org.apache.geronimo.naming");
+        System.setProperty("java.naming.provider.url", "rmi://localhost:1099");
+
         ReadOnlyContext readOnlyContext = new ReadOnlyContext();
         readOnlyContext.internalBind("env/hello", "Hello");
         readOnlyContext.internalBind("env/world", "Hello World");

Mime
View raw message