1 7 package org.jboss.test.remoting.interceptor; 8 9 import java.net.MalformedURLException ; 10 import org.jboss.remoting.InvokerLocator; 11 import org.jboss.remoting.marshal.serializable.SerializableUnMarshaller; 12 13 import junit.framework.TestCase; 14 15 18 public class InterceptorTestCase extends TestCase 19 { 20 private boolean continueRun = true; 21 22 public InterceptorTestCase(String name) 23 { 24 super(name); 25 } 26 27 protected void setUp() throws Exception 28 { 29 super.setUp(); 30 continueRun = true; 31 new Thread () 32 { 33 public void run() 34 { 35 startServer(); 36 } 37 }.start(); 38 } 39 40 public void testClient() throws Exception 41 { 42 try 43 { 44 org.jboss.test.remoting.interceptor.ClientInterceptorTest test = new org.jboss.test.remoting.interceptor.ClientInterceptorTest(); 45 test.runTest(); 46 boolean passed = test.isTestPassing(); 47 assertTrue("ClientInterceptorTest failed.", passed); 48 } 49 catch(MalformedURLException e) 50 { 51 e.printStackTrace(); 52 } 53 54 } 55 56 protected void tearDown() throws Exception 57 { 58 super.tearDown(); 59 continueRun = false; 60 61 } 62 63 64 public void startServer() 65 { 66 try 67 { 68 int port = 8081; 69 String transport = "socket"; 70 InvokerLocator locator = new InvokerLocator(transport + "://localhost:" + port + "/?" + 73 InvokerLocator.DATATYPE + "=" + SerializableUnMarshaller.DATATYPE); 74 75 ServerInterceptorTest server = new ServerInterceptorTest(); 76 server.setLocator(locator); 77 server.setup(); 78 79 while(continueRun) 80 { 81 Thread.sleep(1000); 82 } 83 } 84 catch(Exception e) 85 { 86 e.printStackTrace(); 87 } 88 } 89 90 } | Popular Tags |