You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gd...@apache.org on 2004/09/06 13:14:13 UTC
cvs commit: incubator-geronimo/modules/remoting project.properties
gdamour 2004/09/06 04:14:13
Modified: modules/remoting/src/test/org/apache/geronimo/remoting
MarshalingInterceptorsTest.java
RemotingInterceptorsTest.java JMXRemotingTest.java
StartupTest.java
modules/remoting project.properties
Log:
Do not need to fork the JUnit tests of remoting.
Revision Changes Path
1.5 +26 -4 incubator-geronimo/modules/remoting/src/test/org/apache/geronimo/remoting/MarshalingInterceptorsTest.java
Index: MarshalingInterceptorsTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/remoting/src/test/org/apache/geronimo/remoting/MarshalingInterceptorsTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MarshalingInterceptorsTest.java 10 Mar 2004 09:59:20 -0000 1.4
+++ MarshalingInterceptorsTest.java 6 Sep 2004 11:14:13 -0000 1.5
@@ -42,6 +42,7 @@
*/
public class MarshalingInterceptorsTest extends TestCase {
+ private static final File basedir = new File(System.getProperty("basedir", System.getProperty("user.dir")));
private static final String PERSON_CLASS = "org.apache.geronimo.remoting.Person";
private static final String TRANSIENT_CLASS = "org.apache.geronimo.remoting.TransientValue";
@@ -52,11 +53,12 @@
* creates the two classloaders that will be used during the tests.
*/
public void setUp() throws MalformedURLException, IOException {
- URL url = new File("./target/mock-app").toURL();
+ URL url = new File(basedir, "target/mock-app").toURL();
System.out.println("Setting up the CP to: " + url);
- cl1 = new URLClassLoader(new URL[] { url });
- cl2 = new URLClassLoader(new URL[] { url });
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ cl1 = new URLClassLoader(new URL[] { url }, cl);
+ cl2 = new URLClassLoader(new URL[] { url }, cl);
}
/**
@@ -120,10 +122,14 @@
Class class1 = cl1.loadClass(PERSON_CLASS);
Object object1 = class1.newInstance();
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+
// Simulate App1 creating a proxy.
Thread.currentThread().setContextClassLoader(cl1);
Object proxy1 = createProxy(object1);
call(proxy1, "setSpouse", new Object[] { object1 });
+
+ Thread.currentThread().setContextClassLoader(oldCL);
}
/**
@@ -141,6 +147,8 @@
Object object1 = class1.newInstance();
Object object2 = class2.newInstance();
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+
// Simulate App2 creating a proxy.
Thread.currentThread().setContextClassLoader(cl2);
Object proxy2 = createProxy(object2);
@@ -150,6 +158,8 @@
Thread.currentThread().setContextClassLoader(cl1);
Object proxy1 = mo.get();
call(proxy1, "setSpouse", new Object[] { object1 });
+
+ Thread.currentThread().setContextClassLoader(oldCL);
}
/**
@@ -162,6 +172,8 @@
* @throws Throwable
*/
public void testSetTransientWithOptimizedProxy() throws Throwable {
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+
Thread.currentThread().setContextClassLoader(cl1);
Class class1 = cl1.loadClass(PERSON_CLASS);
Object object1 = class1.newInstance();
@@ -178,6 +190,8 @@
});
assertSame(rc, "foo");
+
+ Thread.currentThread().setContextClassLoader(oldCL);
}
/**
@@ -187,6 +201,8 @@
* @throws Throwable
*/
public void testSetTransientWithSerializedOptimizedProxy() throws Throwable {
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+
Thread.currentThread().setContextClassLoader(cl1);
Class class1 = cl1.loadClass(PERSON_CLASS);
Object object1 = class1.newInstance();
@@ -204,6 +220,8 @@
});
assertSame(rc, "foo");
+
+ Thread.currentThread().setContextClassLoader(oldCL);
}
/**
@@ -214,6 +232,8 @@
* @throws Throwable
*/
public void testSetTransientWithSerializedNonOptimizedProxy() throws Throwable {
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+
Thread.currentThread().setContextClassLoader(cl1);
Class class1 = cl1.loadClass(PERSON_CLASS);
Object object1 = class1.newInstance();
@@ -233,6 +253,8 @@
});
assertSame(rc, null);
+
+ Thread.currentThread().setContextClassLoader(oldCL);
}
/**
1.6 +6 -5 incubator-geronimo/modules/remoting/src/test/org/apache/geronimo/remoting/RemotingInterceptorsTest.java
Index: RemotingInterceptorsTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/remoting/src/test/org/apache/geronimo/remoting/RemotingInterceptorsTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- RemotingInterceptorsTest.java 10 Mar 2004 09:59:20 -0000 1.5
+++ RemotingInterceptorsTest.java 6 Sep 2004 11:14:13 -0000 1.6
@@ -34,7 +34,6 @@
import org.apache.geronimo.remoting.transport.TransportFactory;
import org.apache.geronimo.remoting.transport.TransportServer;
import org.apache.geronimo.remoting.transport.URISupport;
-import org.apache.geronimo.core.service.Interceptor;
/**
* Unit test for the Marshaling/DeMarshaling Interceptors
@@ -46,6 +45,7 @@
*/
public class RemotingInterceptorsTest extends TestCase {
+ private static final File basedir = new File(System.getProperty("basedir", System.getProperty("user.dir")));
private static final String PERSON_CLASS = "org.apache.geronimo.remoting.Person";
private static final String TRANSIENT_CLASS = "org.apache.geronimo.remoting.TransientValue";
@@ -58,11 +58,12 @@
* creates the two classloaders that will be used during the tests.
*/
public void setUp() throws Exception {
- URL url = new File("./target/mock-app").toURL();
+ URL url = new File(basedir, "/target/mock-app").toURL();
System.out.println("Setting up the CP to: " + url);
- cl1 = new URLClassLoader(new URL[] { url });
- cl2 = new URLClassLoader(new URL[] { url });
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ cl1 = new URLClassLoader(new URL[] { url }, cl);
+ cl2 = new URLClassLoader(new URL[] { url }, cl);
System.out.println("================================================");
URI bindURI = new URI("async://0.0.0.0:0");
1.7 +6 -5 incubator-geronimo/modules/remoting/src/test/org/apache/geronimo/remoting/JMXRemotingTest.java
Index: JMXRemotingTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/remoting/src/test/org/apache/geronimo/remoting/JMXRemotingTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JMXRemotingTest.java 12 Jul 2004 06:07:51 -0000 1.6
+++ JMXRemotingTest.java 6 Sep 2004 11:14:13 -0000 1.7
@@ -51,23 +51,24 @@
GBeanMBean gbean;
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
// Create all the parts
- gbean = new GBeanMBean("org.apache.geronimo.remoting.router.SubsystemRouter");
+ gbean = new GBeanMBean("org.apache.geronimo.remoting.router.SubsystemRouter", cl);
subsystemRouter = new ObjectName("geronimo.remoting:router=SubsystemRouter");
kernel.loadGBean(subsystemRouter, gbean);
- gbean = new GBeanMBean("org.apache.geronimo.remoting.transport.TransportLoader");
+ gbean = new GBeanMBean("org.apache.geronimo.remoting.transport.TransportLoader", cl);
gbean.setAttribute("bindURI", new URI("async://0.0.0.0:0"));
gbean.setReferencePatterns("Router", Collections.singleton(subsystemRouter));
asyncTransport = new ObjectName("geronimo.remoting:transport=async");
kernel.loadGBean(asyncTransport, gbean);
- gbean = new GBeanMBean("org.apache.geronimo.remoting.router.JMXRouter");
+ gbean = new GBeanMBean("org.apache.geronimo.remoting.router.JMXRouter", cl);
gbean.setReferencePatterns("SubsystemRouter", Collections.singleton(subsystemRouter));
jmxRouter = new ObjectName("geronimo.remoting:router=JMXRouter");
kernel.loadGBean(jmxRouter, gbean);
- gbean = new GBeanMBean("org.apache.geronimo.remoting.jmx.MBeanServerStub");
+ gbean = new GBeanMBean("org.apache.geronimo.remoting.jmx.MBeanServerStub", cl);
gbean.setReferencePatterns("Router", Collections.singleton(jmxRouter));
serverStub = new ObjectName("geronimo.remoting:target=MBeanServerStub");
kernel.loadGBean(serverStub, gbean);
1.8 +7 -6 incubator-geronimo/modules/remoting/src/test/org/apache/geronimo/remoting/StartupTest.java
Index: StartupTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/remoting/src/test/org/apache/geronimo/remoting/StartupTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- StartupTest.java 12 Jul 2004 06:07:51 -0000 1.7
+++ StartupTest.java 6 Sep 2004 11:14:13 -0000 1.8
@@ -38,28 +38,29 @@
public void testLoad() throws Exception {
GBeanMBean gbean;
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
// Create all the parts
- gbean = new GBeanMBean("org.apache.geronimo.remoting.router.SubsystemRouter");
+ gbean = new GBeanMBean("org.apache.geronimo.remoting.router.SubsystemRouter", cl);
ObjectName subsystemRouter = new ObjectName("geronimo.remoting:router=SubsystemRouter");
kernel.loadGBean(subsystemRouter, gbean);
- gbean = new GBeanMBean("org.apache.geronimo.remoting.transport.TransportLoader");
+ gbean = new GBeanMBean("org.apache.geronimo.remoting.transport.TransportLoader", cl);
gbean.setAttribute("bindURI", new URI("async://0.0.0.0:3434"));
gbean.setReferencePatterns("Router", Collections.singleton(subsystemRouter));
ObjectName asyncTransport = new ObjectName("geronimo.remoting:transport=async");
kernel.loadGBean(asyncTransport, gbean);
- gbean = new GBeanMBean("org.apache.geronimo.remoting.router.JMXRouter");
+ gbean = new GBeanMBean("org.apache.geronimo.remoting.router.JMXRouter", cl);
gbean.setReferencePatterns("SubsystemRouter", Collections.singleton(subsystemRouter));
ObjectName jmxRouter = new ObjectName("geronimo.remoting:router=JMXRouter");
kernel.loadGBean(jmxRouter, gbean);
- gbean = new GBeanMBean("org.apache.geronimo.remoting.router.InterceptorRegistryRouter");
+ gbean = new GBeanMBean("org.apache.geronimo.remoting.router.InterceptorRegistryRouter", cl);
gbean.setReferencePatterns("SubsystemRouter", Collections.singleton(subsystemRouter));
ObjectName registeryRouter = new ObjectName("geronimo.remoting:router=InterceptorRegistryRouter");
kernel.loadGBean(registeryRouter, gbean);
- gbean = new GBeanMBean("org.apache.geronimo.remoting.jmx.MBeanServerStub");
+ gbean = new GBeanMBean("org.apache.geronimo.remoting.jmx.MBeanServerStub", cl);
gbean.setReferencePatterns("Router", Collections.singleton(jmxRouter));
ObjectName serverStub = new ObjectName("geronimo.remoting:target=MBeanServerStub");
kernel.loadGBean(serverStub, gbean);
1.2 +1 -2 incubator-geronimo/modules/remoting/project.properties
Index: project.properties
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/remoting/project.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- project.properties 5 Sep 2004 06:09:11 -0000 1.1
+++ project.properties 6 Sep 2004 11:14:13 -0000 1.2
@@ -2,4 +2,3 @@
## $Revision$ $Date$
##
-maven.junit.fork=true