1 package hudson.remoting; 2 3 import junit.framework.Test; 4 import org.objectweb.asm.ClassReader; 5 import org.objectweb.asm.commons.EmptyVisitor; 6 7 12 public class ClassRemotingTest extends RmiTestBase { 13 public void test1() throws Throwable { 14 DummyClassLoader cl = new DummyClassLoader(this.getClass().getClassLoader()); 17 Callable c = (Callable) cl.loadClass("hudson.remoting.test.TestCallable").newInstance(); 18 19 Object [] r = (Object []) channel.call(c); 20 21 System.out.println(r[0]); 22 23 assertTrue(r[0].toString().startsWith("hudson.remoting.RemoteClassLoader@")); 24 25 System.out.println("Resource is "+((byte[])r[1]).length+" bytes"); 27 ClassReader cr = new ClassReader((byte[])r[1]); 28 cr.accept(new EmptyVisitor(),false); 29 30 System.out.println(r[2]); 32 System.out.println(r[3]); 33 assertEquals(r[2],r[3]); 34 } 35 36 public static Test suite() throws Exception { 37 return buildSuite(ClassRemotingTest.class); 38 } 39 } 40 | Popular Tags |