geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/test-data/mock-app/org/apache/geronimo/remoting IPerson.java Person.java TransientValue.java
Date Mon, 25 Aug 2003 03:14:47 GMT
chirino     2003/08/24 20:14:47

  Modified:    modules/core maven.xml
               modules/core/src/java/org/apache/geronimo/proxy
                        ProxyContainer.java
               modules/core/src/test/org/apache/geronimo/remoting
                        MarshalingInterceptorsTest.java
                        RemotingInterceptorsTest.java
  Added:       modules/core/src/test-data/mock-app/org/apache/geronimo/remoting
                        IPerson.java Person.java TransientValue.java
  Removed:     modules/core/src/test/org/apache/geronimo/remoting
                        IPerson.java Person.java TransientValue.java
  Log:
  Figured out how to get maven to compile a few sources files to an isolated directory.  I have now enabled the testcases for the Marshaling and Remoting Interceptors.
  
  Revision  Changes    Path
  1.14      +21 -1     incubator-geronimo/modules/core/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/maven.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- maven.xml	24 Aug 2003 21:44:02 -0000	1.13
  +++ maven.xml	25 Aug 2003 03:14:46 -0000	1.14
  @@ -61,4 +61,24 @@
       -->
     </preGoal>
   
  +
  +  <!-- Set up the test files -->
  +  <postGoal name="test:test-resources">
  +
  +    <!-- Compile the code for the Marshalling/Remoting tests -->
  +    <ant:mkdir dir="${maven.build.dir}/mock-app"/>
  +    <javac
  +      destdir="${maven.build.dir}/mock-app"
  +      debug="${maven.compile.debug}"
  +      deprecation="${maven.compile.deprecation}"
  +      optimize="${maven.compile.optimize}">
  +      <src>
  +        <path>
  +          <pathelement location="${maven.src.dir}/test-data/mock-app"/>
  +        </path>
  +      </src>
  +    </javac>
  +
  +  </postGoal>  
  +
   </project>
  
  
  
  1.2       +2 -8      incubator-geronimo/modules/core/src/java/org/apache/geronimo/proxy/ProxyContainer.java
  
  Index: ProxyContainer.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/proxy/ProxyContainer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProxyContainer.java	22 Aug 2003 02:23:25 -0000	1.1
  +++ ProxyContainer.java	25 Aug 2003 03:14:46 -0000	1.2
  @@ -67,7 +67,7 @@
    */
   public class ProxyContainer extends SimpleRPCContainer implements InvocationHandler {
   
  -    /* (non-Javadoc)
  +    /**
        * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
        */
       public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
  @@ -76,12 +76,6 @@
           ProxyInvocation.putArguments(invocation, args);
           InvocationResult result = this.invoke(invocation);
           return result.getResult();
  -    }
  -
  -    static public Object createProxy(Object target) throws Exception {
  -        ProxyContainer container = new ProxyContainer();
  -        container.addInterceptor(new ReflexiveInterceptor(target));
  -        return container.createProxy(target.getClass());
       }
   
       public Object createProxy(Class likeClass) {
  
  
  
  1.2       +259 -263  incubator-geronimo/modules/core/src/test/org/apache/geronimo/remoting/MarshalingInterceptorsTest.java
  
  Index: MarshalingInterceptorsTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/remoting/MarshalingInterceptorsTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MarshalingInterceptorsTest.java	22 Aug 2003 02:23:36 -0000	1.1
  +++ MarshalingInterceptorsTest.java	25 Aug 2003 03:14:46 -0000	1.2
  @@ -56,6 +56,7 @@
   
   package org.apache.geronimo.remoting;
   
  +import java.io.File;
   import java.io.IOException;
   import java.lang.reflect.InvocationTargetException;
   import java.lang.reflect.Method;
  @@ -87,267 +88,262 @@
       ArrayList severContainers = new ArrayList();
       URLClassLoader cl1, cl2;
   
  -//    /**
  -//     * creates the two classloaders that will be used during the tests.
  -//     */
  -//    public void setUp() throws MalformedURLException, IOException {
  -//        URL url = new URL(System.getProperty("test-app.url"));
  -//        System.out.println("Setting up the CP to: " + url);
  -//
  -//        cl1 = new URLClassLoader(new URL[] { url });
  -//        cl2 = new URLClassLoader(new URL[] { url });
  -//    }
  -    
  -    //
  -    // This is here until we can enable the tests.
  -    public void testNull() {        
  -    }
  -
  -//    /**
  -//     * Verify that the classpath/classloader structure is
  -//     * as expected.  If the application classes are in
  -//     * the current classloader then that will throw all the 
  -//     * tests off.
  -//     * 
  -//     * @throws Exception
  -//     */
  -//    public void testCheckClassLoaders() throws Exception {
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Class class2 = cl2.loadClass(PERSON_CLASS);
  -//        assertFalse("Classpath for this test was incorrect.  The '"+PERSON_CLASS+"' cannot be in the test's classpath.", class1.equals(class2));
  -//    }
  -//
  -//    /**
  -//     * Verify that the helper methods used by this test work
  -//     * as expected.  Everything should be ok when working in the
  -//     * same classloader.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    public void testSetSpouseSameCL() throws Throwable {
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Class class2 = cl1.loadClass(PERSON_CLASS);
  -//
  -//        Object object1 = class1.newInstance();
  -//        Object object2 = class2.newInstance();
  -//
  -//        call(object1, "setSpouse", new Object[] { object2 });
  -//    }
  -//
  -//    /**
  -//     * Verify that the helper methods used by this test work
  -//     * as expected.  We should see problems when you start mixing
  -//     * Objects from different classloaders.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    public void testSetSpouseOtherCL() throws Throwable {
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Class class2 = cl2.loadClass(PERSON_CLASS);
  -//
  -//        Object object1 = class1.newInstance();
  -//        Object object2 = class2.newInstance();
  -//
  -//        try {
  -//            call(object1, "setSpouse", new Object[] { object2 });
  -//            fail("Call should fail due to argument type mismatch.");
  -//        } catch (IllegalArgumentException e) {
  -//        }
  -//    }
  -//
  -//    /**
  -//     * Verify that a proxy using working in a single app context works ok.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    public void testSetSpouseWithProxy() throws Throwable {
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Object object1 = class1.newInstance();
  -//
  -//        // Simulate App1 creating a proxy.
  -//        Thread.currentThread().setContextClassLoader(cl1);
  -//        Object proxy1 = createProxy(object1);
  -//        call(proxy1, "setSpouse", new Object[] { object1 });
  -//    }
  -//
  -//    /**
  -//     * App2 creates a proxy and serializes.  App1 context deserializes
  -//     * the proxy and trys to use it.  Method calls should be getting
  -//     * marshalled/demarshaled by the proxy to avoid getting an 
  -//     * IllegalArgumentException.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    public void testSetSpouseOtherCLWithSerializedProxy() throws Throwable {
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Class class2 = cl2.loadClass(PERSON_CLASS);
  -//
  -//        Object object1 = class1.newInstance();
  -//        Object object2 = class2.newInstance();
  -//
  -//        // Simulate App2 creating a proxy.
  -//        Thread.currentThread().setContextClassLoader(cl2);
  -//        Object proxy2 = createProxy(object2);
  -//        MarshalledObject mo = new BytesMarshalledObject(proxy2);
  -//
  -//        // Simulate App1 using the serialized proxy.    
  -//        Thread.currentThread().setContextClassLoader(cl1);
  -//        Object proxy1 = mo.get();
  -//        call(proxy1, "setSpouse", new Object[] { object1 });
  -//    }
  -//
  -//    /**
  -//     * App1 creates a proxy.  It then creates a Transient calls that holds
  -//     * a "value" property that is transient when serialized.  This allows to 
  -//     * to see if the Transient object was serialized by getting the value back
  -//     * and seeing if the "value" is null.  All this work is done in one classloader
  -//     * so no serialization should occur.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    public void testSetTransientWithOptimizedProxy() throws Throwable {
  -//        Thread.currentThread().setContextClassLoader(cl1);
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Object object1 = class1.newInstance();
  -//
  -//        Class class2 = cl1.loadClass(TRANSIENT_CLASS);
  -//        Object object2 = class2.newInstance();
  -//        call(object2, "setValue", new Object[] { "foo" });
  -//
  -//        Object proxy1 = createProxy(object1);
  -//        call(proxy1, "setValue", new Object[] { object2 });
  -//        Object rc = call(proxy1, "getValue", new Object[] {
  -//        });
  -//        rc = call(rc, "getValue", new Object[] {
  -//        });
  -//
  -//        assertSame(rc, "foo");
  -//    }
  -//
  -//    /**
  -//     * Same as testSetTransientWithOptimizedProxy() but, the proxy is serialized before it is used.
  -//     * It should still result in the method call not being serialized.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    public void testSetTransientWithSerializedOptimizedProxy() throws Throwable {
  -//        Thread.currentThread().setContextClassLoader(cl1);
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Object object1 = class1.newInstance();
  -//
  -//        Class class2 = cl1.loadClass(TRANSIENT_CLASS);
  -//        Object object2 = class2.newInstance();
  -//        call(object2, "setValue", new Object[] { "foo" });
  -//
  -//        Object proxy1 = createProxy(object1);
  -//        proxy1 = new BytesMarshalledObject(proxy1).get();
  -//        call(proxy1, "setValue", new Object[] { object2 });
  -//        Object rc = call(proxy1, "getValue", new Object[] {
  -//        });
  -//        rc = call(rc, "getValue", new Object[] {
  -//        });
  -//
  -//        assertSame(rc, "foo");
  -//    }
  -//
  -//    /**
  -//     * Same as testSetTransientWithOptimizedProxy() but, the proxy is serialized before it is
  -//     * by App2.  Since a different classloader is using the proxy, the metod call should
  -//     * be serialized and we should see that the set "value" is null.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    public void testSetTransientWithSerializedNonOptimizedProxy() throws Throwable {
  -//        Thread.currentThread().setContextClassLoader(cl1);
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Object object1 = class1.newInstance();
  -//
  -//        Object proxy1 = createProxy(object1);
  -//        Thread.currentThread().setContextClassLoader(cl2);
  -//        proxy1 = new BytesMarshalledObject(proxy1).get();
  -//
  -//        Class class2 = cl2.loadClass(TRANSIENT_CLASS);
  -//        Object object2 = class2.newInstance();
  -//        call(object2, "setValue", new Object[] { "foo" });
  -//
  -//        call(proxy1, "setValue", new Object[] { object2 });
  -//        Object rc = call(proxy1, "getValue", new Object[] {
  -//        });
  -//        rc = call(rc, "getValue", new Object[] {
  -//        });
  -//
  -//        assertSame(rc, null);
  -//    }
  -//
  -//    /**
  -//     * Does a reflexive call on object1 my calling method with the provided args.
  -//     * 
  -//     * @param object1
  -//     * @param string
  -//     * @param objects
  -//     */
  -//    private Object call(Object object1, String method, Object[] args) throws Throwable {
  -//        try {
  -//            Class argTypes[] = getArgTypes(object1.getClass().getClassLoader(), args);
  -//            Method m = findMethod(object1.getClass(), method);
  -//            return m.invoke(object1, args);
  -//        } catch (InvocationTargetException e) {
  -//            throw e.getTargetException();
  -//        }
  -//    }
  -//
  -//    /**
  -//     * Gets the Class[] for a given Object[] using the provided loader.
  -//     * 
  -//     * @param object1
  -//     * @param args
  -//     * @return
  -//     */
  -//    private Class[] getArgTypes(ClassLoader loader, Object[] args) throws Exception {
  -//        Class rc[] = new Class[args.length];
  -//        for (int i = 0; i < rc.length; i++) {
  -//            rc[i] = loader.loadClass(args[i].getClass().getName());
  -//        }
  -//        return rc;
  -//    }
  -//
  -//    /**
  -//     * Finds the first method in class c whose name is name.
  -//     * @param c
  -//     * @param name
  -//     * @return
  -//     */
  -//    private Method findMethod(Class c, String name) {
  -//        Method[] methods = c.getMethods();
  -//        for (int i = 0; i < methods.length; i++) {
  -//            if (methods[i].getName().equals(name))
  -//                return methods[i];
  -//        }
  -//        return null;
  -//    }
  -//
  -//    /**
  -//      * @param object1
  -//      * @return
  -//      */
  -//    private Object createProxy(Object object1) throws Exception {
  -//        
  -//        ProxyContainer serverContainer = new ProxyContainer();        
  -//
  -//        DeMarshalingInterceptor dmi = new DeMarshalingInterceptor();
  -//        dmi.setClassloader(object1.getClass().getClassLoader());
  -//        Long dmiid = InterceptorRegistry.instance.register(dmi);
  -//        serverContainer.addInterceptor(dmi);      
  -//        Interceptor reflexive = new ReflexiveInterceptor(object1);
  -//        serverContainer.addInterceptor(reflexive);
  -//        severContainers.add(serverContainer);
  -//        
  -//        ProxyContainer clientContainer = new ProxyContainer();        
  -//        IntraVMRoutingInterceptor ivmri = new IntraVMRoutingInterceptor();
  -//        ivmri.setDeMarshalingInterceptorID(dmiid);
  -//        clientContainer.addInterceptor(ivmri);
  -//
  -//        return clientContainer.createProxy(object1.getClass());
  -//    }
  +    /**
  +     * 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();
  +        System.out.println("Setting up the CP to: " + url);
  +
  +        cl1 = new URLClassLoader(new URL[] { url });
  +        cl2 = new URLClassLoader(new URL[] { url });
  +    }    
  +
  +    /**
  +     * Verify that the classpath/classloader structure is
  +     * as expected.  If the application classes are in
  +     * the current classloader then that will throw all the 
  +     * tests off.
  +     * 
  +     * @throws Exception
  +     */
  +    public void testCheckClassLoaders() throws Exception {
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Class class2 = cl2.loadClass(PERSON_CLASS);
  +        assertFalse("Classpath for this test was incorrect.  The '"+PERSON_CLASS+"' cannot be in the test's classpath.", class1.equals(class2));
  +    }
  +
  +    /**
  +     * Verify that the helper methods used by this test work
  +     * as expected.  Everything should be ok when working in the
  +     * same classloader.
  +     * 
  +     * @throws Throwable
  +     */
  +    public void testSetSpouseSameCL() throws Throwable {
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Class class2 = cl1.loadClass(PERSON_CLASS);
  +
  +        Object object1 = class1.newInstance();
  +        Object object2 = class2.newInstance();
  +
  +        call(object1, "setSpouse", new Object[] { object2 });
  +    }
  +
  +    /**
  +     * Verify that the helper methods used by this test work
  +     * as expected.  We should see problems when you start mixing
  +     * Objects from different classloaders.
  +     * 
  +     * @throws Throwable
  +     */
  +    public void testSetSpouseOtherCL() throws Throwable {
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Class class2 = cl2.loadClass(PERSON_CLASS);
  +
  +        Object object1 = class1.newInstance();
  +        Object object2 = class2.newInstance();
  +
  +        try {
  +            call(object1, "setSpouse", new Object[] { object2 });
  +            fail("Call should fail due to argument type mismatch.");
  +        } catch (IllegalArgumentException e) {
  +        }
  +    }
  +
  +    /**
  +     * Verify that a proxy using working in a single app context works ok.
  +     * 
  +     * @throws Throwable
  +     */
  +    public void testSetSpouseWithProxy() throws Throwable {
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Object object1 = class1.newInstance();
  +
  +        // Simulate App1 creating a proxy.
  +        Thread.currentThread().setContextClassLoader(cl1);
  +        Object proxy1 = createProxy(object1);
  +        call(proxy1, "setSpouse", new Object[] { object1 });
  +    }
  +
  +    /**
  +     * App2 creates a proxy and serializes.  App1 context deserializes
  +     * the proxy and trys to use it.  Method calls should be getting
  +     * marshalled/demarshaled by the proxy to avoid getting an 
  +     * IllegalArgumentException.
  +     * 
  +     * @throws Throwable
  +     */
  +    public void testSetSpouseOtherCLWithSerializedProxy() throws Throwable {
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Class class2 = cl2.loadClass(PERSON_CLASS);
  +
  +        Object object1 = class1.newInstance();
  +        Object object2 = class2.newInstance();
  +
  +        // Simulate App2 creating a proxy.
  +        Thread.currentThread().setContextClassLoader(cl2);
  +        Object proxy2 = createProxy(object2);
  +        MarshalledObject mo = new BytesMarshalledObject(proxy2);
  +
  +        // Simulate App1 using the serialized proxy.    
  +        Thread.currentThread().setContextClassLoader(cl1);
  +        Object proxy1 = mo.get();
  +        call(proxy1, "setSpouse", new Object[] { object1 });
  +    }
  +
  +    /**
  +     * App1 creates a proxy.  It then creates a Transient calls that holds
  +     * a "value" property that is transient when serialized.  This allows to 
  +     * to see if the Transient object was serialized by getting the value back
  +     * and seeing if the "value" is null.  All this work is done in one classloader
  +     * so no serialization should occur.
  +     * 
  +     * @throws Throwable
  +     */
  +    public void testSetTransientWithOptimizedProxy() throws Throwable {
  +        Thread.currentThread().setContextClassLoader(cl1);
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Object object1 = class1.newInstance();
  +
  +        Class class2 = cl1.loadClass(TRANSIENT_CLASS);
  +        Object object2 = class2.newInstance();
  +        call(object2, "setValue", new Object[] { "foo" });
  +
  +        Object proxy1 = createProxy(object1);
  +        call(proxy1, "setValue", new Object[] { object2 });
  +        Object rc = call(proxy1, "getValue", new Object[] {
  +        });
  +        rc = call(rc, "getValue", new Object[] {
  +        });
  +
  +        assertSame(rc, "foo");
  +    }
  +
  +    /**
  +     * Same as testSetTransientWithOptimizedProxy() but, the proxy is serialized before it is used.
  +     * It should still result in the method call not being serialized.
  +     * 
  +     * @throws Throwable
  +     */
  +    public void testSetTransientWithSerializedOptimizedProxy() throws Throwable {
  +        Thread.currentThread().setContextClassLoader(cl1);
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Object object1 = class1.newInstance();
  +
  +        Class class2 = cl1.loadClass(TRANSIENT_CLASS);
  +        Object object2 = class2.newInstance();
  +        call(object2, "setValue", new Object[] { "foo" });
  +
  +        Object proxy1 = createProxy(object1);
  +        proxy1 = new BytesMarshalledObject(proxy1).get();
  +        call(proxy1, "setValue", new Object[] { object2 });
  +        Object rc = call(proxy1, "getValue", new Object[] {
  +        });
  +        rc = call(rc, "getValue", new Object[] {
  +        });
  +
  +        assertSame(rc, "foo");
  +    }
  +
  +    /**
  +     * Same as testSetTransientWithOptimizedProxy() but, the proxy is serialized before it is
  +     * by App2.  Since a different classloader is using the proxy, the metod call should
  +     * be serialized and we should see that the set "value" is null.
  +     * 
  +     * @throws Throwable
  +     */
  +    public void testSetTransientWithSerializedNonOptimizedProxy() throws Throwable {
  +        Thread.currentThread().setContextClassLoader(cl1);
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Object object1 = class1.newInstance();
  +
  +        Object proxy1 = createProxy(object1);
  +        Thread.currentThread().setContextClassLoader(cl2);
  +        proxy1 = new BytesMarshalledObject(proxy1).get();
  +
  +        Class class2 = cl2.loadClass(TRANSIENT_CLASS);
  +        Object object2 = class2.newInstance();
  +        call(object2, "setValue", new Object[] { "foo" });
  +
  +        call(proxy1, "setValue", new Object[] { object2 });
  +        Object rc = call(proxy1, "getValue", new Object[] {
  +        });
  +        rc = call(rc, "getValue", new Object[] {
  +        });
  +
  +        assertSame(rc, null);
  +    }
  +
  +    /**
  +     * Does a reflexive call on object1 my calling method with the provided args.
  +     * 
  +     * @param object1
  +     * @param string
  +     * @param objects
  +     */
  +    private Object call(Object object1, String method, Object[] args) throws Throwable {
  +        try {
  +            Class argTypes[] = getArgTypes(object1.getClass().getClassLoader(), args);
  +            Method m = findMethod(object1.getClass(), method);
  +            return m.invoke(object1, args);
  +        } catch (InvocationTargetException e) {
  +            throw e.getTargetException();
  +        }
  +    }
  +
  +    /**
  +     * Gets the Class[] for a given Object[] using the provided loader.
  +     * 
  +     * @param object1
  +     * @param args
  +     * @return
  +     */
  +    private Class[] getArgTypes(ClassLoader loader, Object[] args) throws Exception {
  +        Class rc[] = new Class[args.length];
  +        for (int i = 0; i < rc.length; i++) {
  +            rc[i] = loader.loadClass(args[i].getClass().getName());
  +        }
  +        return rc;
  +    }
  +
  +    /**
  +     * Finds the first method in class c whose name is name.
  +     * @param c
  +     * @param name
  +     * @return
  +     */
  +    private Method findMethod(Class c, String name) {
  +        Method[] methods = c.getMethods();
  +        for (int i = 0; i < methods.length; i++) {
  +            if (methods[i].getName().equals(name))
  +                return methods[i];
  +        }
  +        return null;
  +    }
  +
  +    /**
  +      * @param object1
  +      * @return
  +      */
  +    private Object createProxy(Object object1) throws Exception {
  +        
  +        ProxyContainer serverContainer = new ProxyContainer();        
  +
  +        DeMarshalingInterceptor dmi = new DeMarshalingInterceptor();
  +        dmi.setClassloader(object1.getClass().getClassLoader());
  +        Long dmiid = InterceptorRegistry.instance.register(dmi);
  +        serverContainer.addInterceptor(dmi);      
  +        Interceptor reflexive = new ReflexiveInterceptor(object1);
  +        serverContainer.addInterceptor(reflexive);
  +        severContainers.add(serverContainer);
  +        
  +        ProxyContainer clientContainer = new ProxyContainer();        
  +        IntraVMRoutingInterceptor ivmri = new IntraVMRoutingInterceptor();
  +        ivmri.setDeMarshalingInterceptorID(dmiid);
  +        clientContainer.addInterceptor(ivmri);
  +
  +        return clientContainer.createProxy(object1.getClass());
  +    }
   
   }
  
  
  
  1.2       +283 -286  incubator-geronimo/modules/core/src/test/org/apache/geronimo/remoting/RemotingInterceptorsTest.java
  
  Index: RemotingInterceptorsTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/remoting/RemotingInterceptorsTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RemotingInterceptorsTest.java	22 Aug 2003 02:23:36 -0000	1.1
  +++ RemotingInterceptorsTest.java	25 Aug 2003 03:14:46 -0000	1.2
  @@ -19,7 +19,7 @@
    * 3. The end-user documentation included with the redistribution,
    *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  + *        Apache Software Foundation (http:www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
    *
  @@ -49,13 +49,14 @@
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation.  For more
    * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  + * <http:www.apache.org/>.
    *
    * ====================================================================
    */
   
   package org.apache.geronimo.remoting;
   
  +import java.io.File;
   import java.lang.reflect.InvocationTargetException;
   import java.lang.reflect.Method;
   import java.net.URI;
  @@ -94,288 +95,284 @@
       TransportServer server;
       URI connectURI;    
   
  -//    /**
  -//     * creates the two classloaders that will be used during the tests.
  -//     */
  -//    public void setUp() throws Exception {
  -//        URL url = new URL(System.getProperty("test-app.url"));
  -//        System.out.println("Setting up the CP to: " + url);
  -//
  -//        cl1 = new URLClassLoader(new URL[] { url });
  -//        cl2 = new URLClassLoader(new URL[] { url });
  -//
  -//        System.out.println("================================================");
  -//        URI bindURI = new URI("async://0.0.0.0:0");
  -//        TransportFactory tf = TransportFactory.getTransportFactory(bindURI);
  -//        server = tf.createSever();
  -//        server.bind(bindURI,new FragmentBasedInterceptorRouter());
  -//        connectURI = server.getClientConnectURI();
  -//        server.start();
  -//
  -//    }
  -//    
  -//    /**
  -//     * @see junit.framework.TestCase#tearDown()
  -//     */
  -//    protected void tearDown() throws Exception {
  -//        server.dispose();
  -//    }    
  -
  -    // This is here until we can enable the tests.
  -    public void testNull() {        
  -    }
  -
  -//    /**
  -//     * Verify that the classpath/classloader structure is
  -//     * as expected.  If the application classes are in
  -//     * the current classloader then that will throw all the 
  -//     * tests off.
  -//     * 
  -//     * @throws Exception
  -//     */
  -//    public void testCheckClassLoaders() throws Exception {
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Class class2 = cl2.loadClass(PERSON_CLASS);
  -//        assertFalse("Classpath for this test was incorrect.  The '"+PERSON_CLASS+"' cannot be in the test's classpath.", class1.equals(class2));
  -//    }
  -//
  -//    /**
  -//     * Verify that the helper methods used by this test work
  -//     * as expected.  Everything should be ok when working in the
  -//     * same classloader.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    public void testSetSpouseSameCL() throws Throwable {
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Class class2 = cl1.loadClass(PERSON_CLASS);
  -//
  -//        Object object1 = class1.newInstance();
  -//        Object object2 = class2.newInstance();
  -//
  -//        call(object1, "setSpouse", new Object[] { object2 });
  -//    }
  -//
  -//    /**
  -//     * Verify that the helper methods used by this test work
  -//     * as expected.  We should see problems when you start mixing
  -//     * Objects from different classloaders.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    public void testSetSpouseOtherCL() throws Throwable {
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Class class2 = cl2.loadClass(PERSON_CLASS);
  -//
  -//        Object object1 = class1.newInstance();
  -//        Object object2 = class2.newInstance();
  -//
  -//        try {
  -//            call(object1, "setSpouse", new Object[] { object2 });
  -//            fail("Call should fail due to argument type mismatch.");
  -//        } catch (IllegalArgumentException e) {
  -//        }
  -//    }
  -//
  -//    /**
  -//     * Verify that a proxy using working in a single app context works ok.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    public void testSetSpouseWithProxy() throws Throwable {
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Object object1 = class1.newInstance();
  -//
  -//        // Simulate App1 creating a proxy.
  -//        Thread.currentThread().setContextClassLoader(cl1);
  -//        Object proxy1 = createProxy(object1);
  -//        call(proxy1, "setSpouse", new Object[] { object1 });
  -//    }
  -//
  -//    /**
  -//     * App2 creates a proxy and serializes.  App1 context deserializes
  -//     * the proxy and trys to use it.  Method calls should be getting
  -//     * marshalled/demarshaled by the proxy to avoid getting an 
  -//     * IllegalArgumentException.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    public void testSetSpouseOtherCLWithSerializedProxy() throws Throwable {
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Class class2 = cl2.loadClass(PERSON_CLASS);
  -//
  -//        Object object1 = class1.newInstance();
  -//        Object object2 = class2.newInstance();
  -//
  -//        // Simulate App2 creating a proxy.
  -//        Thread.currentThread().setContextClassLoader(cl2);
  -//        Object proxy2 = createProxy(object2);
  -//        MarshalledObject mo = new BytesMarshalledObject(proxy2);
  -//
  -//        // Simulate App1 using the serialized proxy.    
  -//        Thread.currentThread().setContextClassLoader(cl1);
  -//        Object proxy1 = mo.get();
  -//        call(proxy1, "setSpouse", new Object[] { object1 });
  -//    }
  -//
  -//    /**
  -//     * App1 creates a proxy.  It then creates a Transient calls that holds
  -//     * a "value" property that is transient when serialized.  This allows to 
  -//     * to see if the Transient object was serialized by getting the value back
  -//     * and seeing if the "value" is null.  All this work is done in one classloader
  -//     * so no serialization should occur.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    /* Disable until proxy knows how to do a local optimize.
  -//    public void testSetTransientWithOptimizedProxy() throws Throwable {
  -//        Thread.currentThread().setContextClassLoader(cl1);
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Object object1 = class1.newInstance();
  -//
  -//        Class class2 = cl1.loadClass(TRANSIENT_CLASS);
  -//        Object object2 = class2.newInstance();
  -//        call(object2, "setValue", new Object[] { "foo" });
  -//
  -//        Object proxy1 = createProxy(object1);
  -//        call(proxy1, "setValue", new Object[] { object2 });
  -//        Object rc = call(proxy1, "getValue", new Object[] {
  -//        });
  -//        rc = call(rc, "getValue", new Object[] {
  -//        });
  -//
  -//        assertSame(rc, "foo");
  -//    }
  -//    */
  -//    
  -//    /**
  -//     * Same as testSetTransientWithOptimizedProxy() but, the proxy is serialized before it is used.
  -//     * It should still result in the method call not being serialized.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    /* Disable until proxy knows how to do a local optimize.
  -//    public void testSetTransientWithSerializedOptimizedProxy() throws Throwable {
  -//        Thread.currentThread().setContextClassLoader(cl1);
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Object object1 = class1.newInstance();
  -//
  -//        Class class2 = cl1.loadClass(TRANSIENT_CLASS);
  -//        Object object2 = class2.newInstance();
  -//        call(object2, "setValue", new Object[] { "foo" });
  -//
  -//        Object proxy1 = createProxy(object1);
  -//        proxy1 = new BytesMarshalledObject(proxy1).get();
  -//        call(proxy1, "setValue", new Object[] { object2 });
  -//        Object rc = call(proxy1, "getValue", new Object[] {
  -//        });
  -//        rc = call(rc, "getValue", new Object[] {
  -//        });
  -//
  -//        assertSame(rc, "foo");
  -//    }
  -//    */
  -//    
  -//    /**
  -//     * Same as testSetTransientWithOptimizedProxy() but, the proxy is serialized before it is
  -//     * by App2.  Since a different classloader is using the proxy, the metod call should
  -//     * be serialized and we should see that the set "value" is null.
  -//     * 
  -//     * @throws Throwable
  -//     */
  -//    public void testSetTransientWithSerializedNonOptimizedProxy() throws Throwable {
  -//        Thread.currentThread().setContextClassLoader(cl1);
  -//        Class class1 = cl1.loadClass(PERSON_CLASS);
  -//        Object object1 = class1.newInstance();
  -//
  -//        Object proxy1 = createProxy(object1);
  -//        Thread.currentThread().setContextClassLoader(cl2);
  -//        proxy1 = new BytesMarshalledObject(proxy1).get();
  -//
  -//        Class class2 = cl2.loadClass(TRANSIENT_CLASS);
  -//        Object object2 = class2.newInstance();
  -//        call(object2, "setValue", new Object[] { "foo" });
  -//
  -//        call(proxy1, "setValue", new Object[] { object2 });
  -//        Object rc = call(proxy1, "getValue", new Object[] {
  -//        });
  -//        rc = call(rc, "getValue", new Object[] {
  -//        });
  -//
  -//        assertSame(rc, null);
  -//    }
  -//
  -//    /**
  -//     * Does a reflexive call on object1 my calling method with the provided args.
  -//     * 
  -//     * @param object1
  -//     * @param string
  -//     * @param objects
  -//     */
  -//    private Object call(Object object1, String method, Object[] args) throws Throwable {
  -//        try {
  -//            Class argTypes[] = getArgTypes(object1.getClass().getClassLoader(), args);
  -//            Method m = findMethod(object1.getClass(), method);
  -//            return m.invoke(object1, args);
  -//        } catch (InvocationTargetException e) {
  -//            throw e.getTargetException();
  -//        }
  -//    }
  -//
  -//    /**
  -//     * Gets the Class[] for a given Object[] using the provided loader.
  -//     * 
  -//     * @param object1
  -//     * @param args
  -//     * @return
  -//     */
  -//    private Class[] getArgTypes(ClassLoader loader, Object[] args) throws Exception {
  -//        Class rc[] = new Class[args.length];
  -//        for (int i = 0; i < rc.length; i++) {
  -//            rc[i] = loader.loadClass(args[i].getClass().getName());
  -//        }
  -//        return rc;
  -//    }
  -//
  -//    /**
  -//     * Finds the first method in class c whose name is name.
  -//     * @param c
  -//     * @param name
  -//     * @return
  -//     */
  -//    private Method findMethod(Class c, String name) {
  -//        Method[] methods = c.getMethods();
  -//        for (int i = 0; i < methods.length; i++) {
  -//            if (methods[i].getName().equals(name))
  -//                return methods[i];
  -//        }
  -//        return null;
  -//    }
  -//
  -//    /**
  -//      * @param object1
  -//      * @return
  -//      */
  -//    private Object createProxy(Object object1) throws Exception {
  -//        
  -//        ProxyContainer serverContainer = new ProxyContainer();        
  -//
  -//        DeMarshalingInterceptor dmi = new DeMarshalingInterceptor();
  -//        dmi.setClassloader(object1.getClass().getClassLoader());
  -//        Long dmiid = InterceptorRegistry.instance.register(dmi);
  -//        serverContainer.addInterceptor(dmi);      
  -//        Interceptor reflexive = new ReflexiveInterceptor(object1);
  -//        serverContainer.addInterceptor(reflexive);
  -//        severContainers.add(serverContainer);
  -//        
  -//        ProxyContainer clientContainer = new ProxyContainer();
  -//        clientContainer.addInterceptor(new MarshalingInterceptor());
  -//        RemoteTransportInterceptor rti = new RemoteTransportInterceptor();
  -//        URI u = URISupport.setFragment(connectURI, ""+dmiid);        
  -//        rti.setRemoteURI(u);
  -//        clientContainer.addInterceptor(rti);
  -//        
  -//        return clientContainer.createProxy(object1.getClass());
  -//    }
  +    /**
  +     * creates the two classloaders that will be used during the tests.
  +     */
  +    public void setUp() throws Exception {
  +        URL url = new File("./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 });
  +
  +        System.out.println("================================================");
  +        URI bindURI = new URI("async://0.0.0.0:0");
  +        TransportFactory tf = TransportFactory.getTransportFactory(bindURI);
  +        server = tf.createSever();
  +        server.bind(bindURI,new FragmentBasedInterceptorRouter());
  +        connectURI = server.getClientConnectURI();
  +        server.start();
  +
  +    }
  +    
  +    /**
  +     * @see junit.framework.TestCase#tearDown()
  +     */
  +    protected void tearDown() throws Exception {
  +        server.dispose();
  +    }    
  +
  +    /**
  +     * Verify that the classpath/classloader structure is
  +     * as expected.  If the application classes are in
  +     * the current classloader then that will throw all the 
  +     * tests off.
  +     * 
  +     * @throws Exception
  +     */
  +    public void testCheckClassLoaders() throws Exception {
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Class class2 = cl2.loadClass(PERSON_CLASS);
  +        assertFalse("Classpath for this test was incorrect.  The '"+PERSON_CLASS+"' cannot be in the test's classpath.", class1.equals(class2));
  +    }
  +
  +    /**
  +     * Verify that the helper methods used by this test work
  +     * as expected.  Everything should be ok when working in the
  +     * same classloader.
  +     * 
  +     * @throws Throwable
  +     */
  +    public void testSetSpouseSameCL() throws Throwable {
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Class class2 = cl1.loadClass(PERSON_CLASS);
  +
  +        Object object1 = class1.newInstance();
  +        Object object2 = class2.newInstance();
  +
  +        call(object1, "setSpouse", new Object[] { object2 });
  +    }
  +
  +    /**
  +     * Verify that the helper methods used by this test work
  +     * as expected.  We should see problems when you start mixing
  +     * Objects from different classloaders.
  +     * 
  +     * @throws Throwable
  +     */
  +    public void testSetSpouseOtherCL() throws Throwable {
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Class class2 = cl2.loadClass(PERSON_CLASS);
  +
  +        Object object1 = class1.newInstance();
  +        Object object2 = class2.newInstance();
  +
  +        try {
  +            call(object1, "setSpouse", new Object[] { object2 });
  +            fail("Call should fail due to argument type mismatch.");
  +        } catch (IllegalArgumentException e) {
  +        }
  +    }
  +
  +    /**
  +     * Verify that a proxy using working in a single app context works ok.
  +     * 
  +     * @throws Throwable
  +     */
  +    public void testSetSpouseWithProxy() throws Throwable {
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Object object1 = class1.newInstance();
  +
  +        // Simulate App1 creating a proxy.
  +        Thread.currentThread().setContextClassLoader(cl1);
  +        Object proxy1 = createProxy(object1);
  +        call(proxy1, "setSpouse", new Object[] { object1 });
  +    }
  +
  +    /**
  +     * App2 creates a proxy and serializes.  App1 context deserializes
  +     * the proxy and trys to use it.  Method calls should be getting
  +     * marshalled/demarshaled by the proxy to avoid getting an 
  +     * IllegalArgumentException.
  +     * 
  +     * @throws Throwable
  +     */
  +    public void testSetSpouseOtherCLWithSerializedProxy() throws Throwable {
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Class class2 = cl2.loadClass(PERSON_CLASS);
  +
  +        Object object1 = class1.newInstance();
  +        Object object2 = class2.newInstance();
  +
  +        // Simulate App2 creating a proxy.
  +        Thread.currentThread().setContextClassLoader(cl2);
  +        Object proxy2 = createProxy(object2);
  +        MarshalledObject mo = new BytesMarshalledObject(proxy2);
  +
  +        // Simulate App1 using the serialized proxy.    
  +        Thread.currentThread().setContextClassLoader(cl1);
  +        Object proxy1 = mo.get();
  +        call(proxy1, "setSpouse", new Object[] { object1 });
  +    }
  +
  +    /**
  +     * App1 creates a proxy.  It then creates a Transient calls that holds
  +     * a "value" property that is transient when serialized.  This allows to 
  +     * to see if the Transient object was serialized by getting the value back
  +     * and seeing if the "value" is null.  All this work is done in one classloader
  +     * so no serialization should occur.
  +     * 
  +     * @throws Throwable
  +     */
  +    /* Disable until proxy knows how to do a local optimize.
  +    public void testSetTransientWithOptimizedProxy() throws Throwable {
  +        Thread.currentThread().setContextClassLoader(cl1);
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Object object1 = class1.newInstance();
  +
  +        Class class2 = cl1.loadClass(TRANSIENT_CLASS);
  +        Object object2 = class2.newInstance();
  +        call(object2, "setValue", new Object[] { "foo" });
  +
  +        Object proxy1 = createProxy(object1);
  +        call(proxy1, "setValue", new Object[] { object2 });
  +        Object rc = call(proxy1, "getValue", new Object[] {
  +        });
  +        rc = call(rc, "getValue", new Object[] {
  +        });
  +
  +        assertSame(rc, "foo");
  +    }
  +    */
  +    
  +    /**
  +     * Same as testSetTransientWithOptimizedProxy() but, the proxy is serialized before it is used.
  +     * It should still result in the method call not being serialized.
  +     * 
  +     * @throws Throwable
  +     */
  +    /* Disable until proxy knows how to do a local optimize.
  +    public void testSetTransientWithSerializedOptimizedProxy() throws Throwable {
  +        Thread.currentThread().setContextClassLoader(cl1);
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Object object1 = class1.newInstance();
  +
  +        Class class2 = cl1.loadClass(TRANSIENT_CLASS);
  +        Object object2 = class2.newInstance();
  +        call(object2, "setValue", new Object[] { "foo" });
  +
  +        Object proxy1 = createProxy(object1);
  +        proxy1 = new BytesMarshalledObject(proxy1).get();
  +        call(proxy1, "setValue", new Object[] { object2 });
  +        Object rc = call(proxy1, "getValue", new Object[] {
  +        });
  +        rc = call(rc, "getValue", new Object[] {
  +        });
  +
  +        assertSame(rc, "foo");
  +    }
  +    */
  +    
  +    /**
  +     * Same as testSetTransientWithOptimizedProxy() but, the proxy is serialized before it is
  +     * by App2.  Since a different classloader is using the proxy, the metod call should
  +     * be serialized and we should see that the set "value" is null.
  +     * 
  +     * @throws Throwable
  +     */
  +    public void testSetTransientWithSerializedNonOptimizedProxy() throws Throwable {
  +        Thread.currentThread().setContextClassLoader(cl1);
  +        Class class1 = cl1.loadClass(PERSON_CLASS);
  +        Object object1 = class1.newInstance();
  +
  +        Object proxy1 = createProxy(object1);
  +        Thread.currentThread().setContextClassLoader(cl2);
  +        proxy1 = new BytesMarshalledObject(proxy1).get();
  +
  +        Class class2 = cl2.loadClass(TRANSIENT_CLASS);
  +        Object object2 = class2.newInstance();
  +        call(object2, "setValue", new Object[] { "foo" });
  +
  +        call(proxy1, "setValue", new Object[] { object2 });
  +        Object rc = call(proxy1, "getValue", new Object[] {
  +        });
  +        rc = call(rc, "getValue", new Object[] {
  +        });
  +
  +        assertSame(rc, null);
  +    }
  +
  +    /**
  +     * Does a reflexive call on object1 my calling method with the provided args.
  +     * 
  +     * @param object1
  +     * @param string
  +     * @param objects
  +     */
  +    private Object call(Object object1, String method, Object[] args) throws Throwable {
  +        try {
  +            Class argTypes[] = getArgTypes(object1.getClass().getClassLoader(), args);
  +            Method m = findMethod(object1.getClass(), method);
  +            return m.invoke(object1, args);
  +        } catch (InvocationTargetException e) {
  +            throw e.getTargetException();
  +        }
  +    }
  +
  +    /**
  +     * Gets the Class[] for a given Object[] using the provided loader.
  +     * 
  +     * @param object1
  +     * @param args
  +     * @return
  +     */
  +    private Class[] getArgTypes(ClassLoader loader, Object[] args) throws Exception {
  +        Class rc[] = new Class[args.length];
  +        for (int i = 0; i < rc.length; i++) {
  +            rc[i] = loader.loadClass(args[i].getClass().getName());
  +        }
  +        return rc;
  +    }
  +
  +    /**
  +     * Finds the first method in class c whose name is name.
  +     * @param c
  +     * @param name
  +     * @return
  +     */
  +    private Method findMethod(Class c, String name) {
  +        Method[] methods = c.getMethods();
  +        for (int i = 0; i < methods.length; i++) {
  +            if (methods[i].getName().equals(name))
  +                return methods[i];
  +        }
  +        return null;
  +    }
  +
  +    /**
  +      * @param object1
  +      * @return
  +      */
  +    private Object createProxy(Object object1) throws Exception {
  +        
  +        ProxyContainer serverContainer = new ProxyContainer();        
  +
  +        DeMarshalingInterceptor dmi = new DeMarshalingInterceptor();
  +        dmi.setClassloader(object1.getClass().getClassLoader());
  +        Long dmiid = InterceptorRegistry.instance.register(dmi);
  +        serverContainer.addInterceptor(dmi);      
  +        Interceptor reflexive = new ReflexiveInterceptor(object1);
  +        serverContainer.addInterceptor(reflexive);
  +        severContainers.add(serverContainer);
  +        
  +        ProxyContainer clientContainer = new ProxyContainer();
  +        clientContainer.addInterceptor(new MarshalingInterceptor());
  +        RemoteTransportInterceptor rti = new RemoteTransportInterceptor();
  +        URI u = URISupport.setFragment(connectURI, ""+dmiid);        
  +        rti.setRemoteURI(u);
  +        clientContainer.addInterceptor(rti);
  +        
  +        return clientContainer.createProxy(object1.getClass());
  +    }
   
   }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/test-data/mock-app/org/apache/geronimo/remoting/IPerson.java
  
  Index: IPerson.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.remoting;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/08/25 03:14:47 $
   */
  public interface IPerson {
      public TransientValue getValue();
      public void setValue(TransientValue value);
     /**
      * @return
      */
     public abstract IPerson getSpouse();
     /**
      * @param spouse
      */
     public abstract void setSpouse(IPerson spouse);
     /**
      * @return
      */
     public abstract String getFirstName();
     /**
      * @param firstName
      */
     public abstract void setFirstName(String firstName);
     /**
      * @return
      */
     public abstract String getLastName();
     /**
      * @param lastName
      */
     public abstract void setLastName(String lastName);
  }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/test-data/mock-app/org/apache/geronimo/remoting/Person.java
  
  Index: Person.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.remoting;
  
  import java.io.Serializable;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/08/25 03:14:47 $
   */
  public class Person implements Serializable, IPerson {
      
      private String firstName;
      private String lastName;
      private IPerson spouse;
      private TransientValue value;
      
     /**
      * @return
      */
     public TransientValue getValue() {
        return value;
     }
  
     /**
      * @param value
      */
     public void setValue(TransientValue value) {
        this.value = value;
     }
  
     /**
      * @return
      */
     public IPerson getSpouse() {
        return spouse;
     }
  
     /**
      * @param spouse
      */
     public void setSpouse(IPerson spouse) {
        this.spouse = spouse;
     }
  
     /**
      * @return
      */
     public String getFirstName() {
        return firstName;
     }
  
     /**
      * @param firstName
      */
     public void setFirstName(String firstName) {
        this.firstName = firstName;
     }
  
     /**
      * @return
      */
     public String getLastName() {
        return lastName;
     }
  
     /**
      * @param lastName
      */
     public void setLastName(String lastName) {
        this.lastName = lastName;
     }
  
      public static void main(String[] args) {
        Person p = new Person();
        p.setSpouse(p);
     }
  }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/test-data/mock-app/org/apache/geronimo/remoting/TransientValue.java
  
  Index: TransientValue.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.remoting;
  
  import java.io.Serializable;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/08/25 03:14:47 $
   */
  public class TransientValue implements Serializable {
      transient public Object value;
      
     /**
      * @return
      */
     public Object getValue() {
        return value;
     }
  
     /**
      * @param value
      */
     public void setValue(Object value) {
        this.value = value;
     }
  
  }
  
  
  

Mime
View raw message