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 ServerOnewayInvocationTest extends OnewayTest 20 { 21 public ServerOnewayInvocationTest(String name) 22 { 23 super(name); 24 } 25 26 public ServerOnewayInvocationTest(int numberOfInstances) 27 { 28 super(numberOfInstances); 29 } 30 31 public ServerOnewayInvocationTest(String transport, int port) 32 { 33 super(transport, port); 34 } 35 36 public ServerOnewayInvocationTest(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 server oneway.\n" + 45 "*****************************************************\n"); 46 } 47 48 protected Runnable getRunner(String method) 49 { 50 return new ServerRunner(method); 51 } 52 53 public void testOnewayClientInvocation() throws Throwable 54 { 55 } 57 58 public void testInvocation() throws Throwable 59 { 60 } 62 63 64 public class ServerRunner implements Runnable 65 { 66 private String method; 67 68 public ServerRunner(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 superMakeServerOnewayInvocation(this.method, 80 String.valueOf(incrementCallCount())); 81 } 82 catch(Throwable throwable) 83 { 84 throwable.printStackTrace(); 85 } 86 } 87 } 88 } 89 90 91 public static void main(String [] args) 92 { 93 94 org.apache.log4j.BasicConfigurator.configure(); 95 org.apache.log4j.Category.getRoot().setLevel(Level.INFO); 96 org.apache.log4j.Category.getInstance("org.jgroups").setLevel(Level.INFO); 97 100 ServerOnewayInvocationTest client = null; 101 if(args.length == 1) 102 { 103 int instances = Integer.parseInt(args[0]); 104 client = new ServerOnewayInvocationTest(instances); 105 } 106 else if(args.length == 2) 107 { 108 String transport = args[0]; 109 int port = Integer.parseInt(args[1]); 110 client = new ServerOnewayInvocationTest(transport, port); 111 } 112 else if(args.length == 3) 113 { 114 String transport = args[0]; 115 int port = Integer.parseInt(args[1]); 116 int instances = Integer.parseInt(args[2]); 117 client = new ServerOnewayInvocationTest(transport, port, instances); 118 } 119 else 120 { 121 client = new ServerOnewayInvocationTest(OnewayInvokerClientTest.class.getName()); 122 System.out.println("Using default transport (" + client.getTransport() + 123 ") and default port (" + client.getPort() + ") and " + 124 "default number of instances (" + client.getNumberOfInstances() + ")" + 125 "\nCan enter transport, port, and instances via command line."); 126 } 127 128 try 129 { 130 MultipleTestRunner runner = new MultipleTestRunner(); 133 runner.doRun(client, true); 134 } 135 catch(Throwable e) 136 { 137 e.printStackTrace(); 138 System.exit(1); 139 } 140 System.exit(0); 141 } 142 143 } | Popular Tags |