1 7 package org.jboss.remoting.performance.oneway; 8 9 import org.apache.log4j.Level; 10 import org.jboss.dtf.MultipleTestRunner; 11 import org.jboss.remoting.oneway.OnewayInvokerClientTest; 12 import org.jboss.remoting.performance.PerformanceTest; 13 14 19 public class ClientOnewayInvocationTest extends OnewayTest 20 { 21 public ClientOnewayInvocationTest(String name) 22 { 23 super(name); 24 } 25 26 public ClientOnewayInvocationTest(int numberOfInstances) 27 { 28 super(numberOfInstances); 29 } 30 31 public ClientOnewayInvocationTest(String transport, int port) 32 { 33 super(transport, port); 34 } 35 36 public ClientOnewayInvocationTest(String transport, int port, int numberOfInstances) 37 { 38 super(transport, port, numberOfInstances); 39 } 40 41 protected void printStartMessage() 42 { 43 System.out.println("\n*****************************************************\n" + 44 "Starting oneway preformance test with client oneway.\n" + 45 "*****************************************************\n"); 46 } 47 48 protected Runnable getRunner(String method) 49 { 50 return new ClientRunner(method); 51 } 52 53 public void testOnewayServerInvocation() throws Throwable 54 { 55 } 57 58 public void testInvocation() throws Throwable 59 { 60 } 62 63 64 public class ClientRunner implements Runnable 65 { 66 private String method; 67 68 public ClientRunner(String method) 69 { 70 this.method = method; 71 } 72 73 public void run() 74 { 75 for(int i = 0; i < PerformanceTest.NUM_OF_CALLS; i++) 76 { 77 try 78 { 79 superMakeClientOnewayInvocation(this.method, String.valueOf(incrementCallCount())); 80 } 81 catch(Throwable throwable) 82 { 83 throwable.printStackTrace(); 84 } 85 } 86 } 87 88 } 89 90 public static void main(String [] args) 91 { 92 93 org.apache.log4j.BasicConfigurator.configure(); 94 org.apache.log4j.Category.getRoot().setLevel(Level.INFO); 95 org.apache.log4j.Category.getInstance("org.jgroups").setLevel(Level.INFO); 96 99 ClientOnewayInvocationTest client = null; 100 if(args.length == 1) 101 { 102 int instances = Integer.parseInt(args[0]); 103 client = new ClientOnewayInvocationTest(instances); 104 } 105 else if(args.length == 2) 106 { 107 String transport = args[0]; 108 int port = Integer.parseInt(args[1]); 109 client = new ClientOnewayInvocationTest(transport, port); 110 } 111 else if(args.length == 3) 112 { 113 String transport = args[0]; 114 int port = Integer.parseInt(args[1]); 115 int instances = Integer.parseInt(args[2]); 116 client = new ClientOnewayInvocationTest(transport, port, instances); 117 } 118 else 119 { 120 client = new ClientOnewayInvocationTest(OnewayInvokerClientTest.class.getName()); 121 System.out.println("Using default transport (" + client.getTransport() + 122 ") and default port (" + client.getPort() + ") and " + 123 "default number of instances (" + client.getNumberOfInstances() + ")" + 124 "\nCan enter transport, port, and instances via command line."); 125 } 126 127 try 128 { 129 MultipleTestRunner runner = new MultipleTestRunner(); 132 runner.doRun(client, true); 133 } 134 catch(Throwable e) 135 { 136 e.printStackTrace(); 137 System.exit(1); 138 } 139 System.exit(0); 140 } 141 142 } | Popular Tags |