1 7 package org.jboss.remoting.handler.mbean; 8 9 import org.jboss.dtf.MultipleTestRunner; 10 import org.jboss.remoting.AbstractInvokerTest; 11 import org.jboss.remoting.Client; 12 import org.jboss.remoting.InvokerLocator; 13 14 17 public class ClientTest extends AbstractInvokerTest 18 { 19 private static String transport = "socket"; 21 private static String host = "localhost"; 22 private static int port = 5400; 23 24 private String locatorURI = null; 25 26 public ClientTest(String name) 27 { 28 super(name); 29 } 30 31 public ClientTest(String name, String locatorURI) 32 { 33 super(name); 34 this.locatorURI = locatorURI; 35 } 36 public ClientTest(String name, int numberOfInstances) 37 { 38 super(name, numberOfInstances); 39 } 40 41 public ClientTest(String name, String transport, int port) 42 { 43 super(name, transport, port); 44 } 45 46 public ClientTest(String name, String transport, int port, int numberOfInstances) 47 { 48 super(name, transport, port, numberOfInstances); 49 } 50 51 public void testMakeInvocation() throws Throwable 52 { 53 if(locatorURI == null) 54 { 55 locatorURI = transport + "://" + host + ":" + port; 56 } 57 InvokerLocator locator = new InvokerLocator(locatorURI); 58 System.out.println("Calling remoting server with locator uri of: " + locatorURI); 59 60 Client remotingClient = new Client(locator); 61 Object response = remotingClient.invoke("Do something"); 62 63 assertEquals(response,ServerTest.RESPONSE_VALUE); 64 } 65 66 72 public static void main(String [] args) 73 { 74 if(args != null && args.length == 2) 75 { 76 transport = args[0]; 77 port = Integer.parseInt(args[1]); 78 } 79 String locatorURI = transport + "://" + host + ":" + port; 80 ClientTest clientTest = new ClientTest(ClientTest.class.getName(), locatorURI); 81 try 82 { 83 MultipleTestRunner runner = new MultipleTestRunner(); 84 runner.doRun(clientTest, true); 85 } 86 catch(Throwable e) 87 { 88 e.printStackTrace(); 89 System.exit(1); 90 } 91 System.exit(0); 92 } 93 } | Popular Tags |