1 22 package org.jboss.test.proxyfactory.test; 23 24 import java.io.Serializable ; 25 import java.lang.reflect.Method ; 26 27 import junit.framework.Test; 28 29 import org.jboss.test.proxyfactory.AbstractProxyTest; 30 import org.jboss.test.proxyfactory.support.SimpleInterceptor; 31 import org.jboss.test.proxyfactory.support.TestConnectionManager; 32 import org.jboss.test.proxyfactory.support.TestManagedConnectionFactory; 33 34 40 public class SerializableTestCase extends AbstractProxyTest 41 { 42 public void testSerializable() throws Exception 43 { 44 Serializable object = (Serializable ) assertCreateProxy(new TestManagedConnectionFactory(), Serializable .class); 45 byte[] bytes = serialize(object); 46 Object result = deserialize(bytes); 47 assertNotNull(result); 48 assertTrue(result instanceof TestManagedConnectionFactory); 49 TestManagedConnectionFactory mcf = (TestManagedConnectionFactory) result; 50 TestConnectionManager cm = new TestConnectionManager(); 51 Object cf = mcf.createConnectionFactory(cm); 52 assertTrue(cm == cf); 53 Method method = SimpleInterceptor.invoked; 54 assertNotNull(method); 55 assertEquals("createConnectionFactory", method.getName()); 56 } 57 58 public static Test suite() 59 { 60 return suite(SerializableTestCase.class); 61 } 62 63 public SerializableTestCase(String name) 64 { 65 super(name); 66 } 67 } 68 | Popular Tags |