geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject svn commit: r379128 - /geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanNameTest.java
Date Mon, 20 Feb 2006 13:47:06 GMT
Author: gdamour
Date: Mon Feb 20 05:47:05 2006
New Revision: 379128

URL: http://svn.apache.org/viewcvs?rev=379128&view=rev
Log:
The CL used by M2 is a URLClassLoader, so it is pointless to set the RMI codebase property.
Rewrite the test to perform a standard serialization without the RMI annotation mechanism,
which causes problem.

Modified:
    geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanNameTest.java

Modified: geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanNameTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanNameTest.java?rev=379128&r1=379127&r2=379128&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanNameTest.java (original)
+++ geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/gbean/GBeanNameTest.java Mon
Feb 20 05:47:05 2006
@@ -22,6 +22,10 @@
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Comparator;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.rmi.MarshalledObject;
 
 import junit.framework.TestCase;
@@ -164,18 +168,15 @@
 
     public void testSerialization() throws Exception {
         GBeanName name = new GBeanName("testDomain:prop1=value1,prop2=value2");
-        String codeBaseProperty = "java.rmi.server.codebase";
-        String codeBase = System.getProperty(codeBaseProperty);
-        MarshalledObject o;
-        try {
-            System.setProperty(codeBaseProperty, "");
-            o = new MarshalledObject(name);
-        } finally {
-            if (null != codeBase) {
-                System.setProperty(codeBaseProperty, codeBase);
-            }
-        }
-        GBeanName name2 = (GBeanName) o.get();
+        ByteArrayOutputStream memOut = new ByteArrayOutputStream();
+        ObjectOutputStream os = new ObjectOutputStream(memOut);
+        os.writeObject(name);
+        os.close();
+        ByteArrayInputStream memIn = new ByteArrayInputStream(memOut.toByteArray());
+        ObjectInputStream in = new ObjectInputStream(memIn);
+        Object opaque = in.readObject();
+        assertTrue(opaque instanceof GBeanName);
+        GBeanName name2 = (GBeanName) opaque;
         assertEquals(name, name2);
     }
 



Mime
View raw message