gdamour 2004/09/06 04:32:53
Modified: modules/remoting/src/test/org/apache/geronimo/remoting RemotingInterceptorsTest.java Log: Do not need to fork remoting JUnit tests. Revision Changes Path 1.7 +21 -1 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.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- RemotingInterceptorsTest.java 6 Sep 2004 11:14:13 -0000 1.6 +++ RemotingInterceptorsTest.java 6 Sep 2004 11:32:53 -0000 1.7 @@ -145,10 +145,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, true); call(proxy1, "setSpouse", new Object[] { object1 }); + + Thread.currentThread().setContextClassLoader(oldCL); } /** @@ -166,6 +170,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, true); @@ -175,6 +181,8 @@ Thread.currentThread().setContextClassLoader(cl1); Object proxy1 = mo.get(); call(proxy1, "setSpouse", new Object[] { object1 }); + + Thread.currentThread().setContextClassLoader(oldCL); } /** @@ -187,6 +195,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(); @@ -203,6 +213,8 @@ }); assertSame(rc, "foo"); + + Thread.currentThread().setContextClassLoader(oldCL); } /** @@ -212,6 +224,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(); @@ -239,6 +253,8 @@ rc = call(rc, "getValue", new Object[] { }); assertSame(rc, "foo"); // No serialization occured. + + Thread.currentThread().setContextClassLoader(oldCL); } /** @@ -249,6 +265,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(); @@ -268,6 +286,8 @@ }); assertSame(rc, null); + + Thread.currentThread().setContextClassLoader(oldCL); } /**