1 7 package org.jboss.test.remoting.performance.synchronous; 8 9 import java.io.IOException ; 10 import org.apache.log4j.Level; 11 import org.jboss.jrunit.harness.TestDriver; 12 13 16 public class PerformanceTestCase extends TestDriver 17 { 18 protected int numberOfClients = 1; 19 20 public static final String REMOTING_TRANSPORT = "remoting.transport"; 21 public static final String PAYLOAD_SIZE = "remoting.payload.size"; 22 public static final String NUMBER_OF_CLIENTS = "remoting.number_of_clients"; 23 public static final String NUMBER_OF_CALLS = "remoting.number_of_calls"; 24 25 public void declareTestClasses() 26 { 27 org.apache.log4j.BasicConfigurator.configure(); 29 org.apache.log4j.Category.getRoot().setLevel(Level.DEBUG); 30 32 org.apache.log4j.SimpleLayout layout = new org.apache.log4j.SimpleLayout(); 33 34 try 35 { 36 org.apache.log4j.FileAppender fileAppender = new org.apache.log4j.FileAppender(layout, "debug_output.log"); 37 fileAppender.setThreshold(Level.DEBUG); 38 fileAppender.setAppend(false); 39 org.apache.log4j.Category.getRoot().addAppender(fileAppender); 40 } 41 catch(IOException e) 42 { 43 e.printStackTrace(); 44 } 45 47 48 49 String numOfClients = System.getProperty(NUMBER_OF_CLIENTS); 50 if(numOfClients != null && numOfClients.length() > 0) 51 { 52 try 53 { 54 numberOfClients = Integer.parseInt(numOfClients); 55 } 56 catch(NumberFormatException e) 57 { 58 e.printStackTrace(); 59 } 60 } 61 62 addTestClasses(PerformanceClientTest.class.getName(), 63 numberOfClients, 64 PerformanceServerTest.class.getName()); 65 } 66 67 protected Level getTestHarnessLogLevel() 68 { 69 return Level.INFO; 70 } 72 73 78 protected Level getTestLogLevel() 79 { 80 return Level.INFO; 81 } 83 84 90 protected String getClientJVMArguments() 91 { 92 return getJVMArguments(); 93 } 97 98 104 protected String getServerJVMArguments() 105 { 106 return getJVMArguments(); 107 } 108 109 115 private String getJVMArguments() 116 { 117 String vmArgs = ""; 118 119 String transport = System.getProperty(REMOTING_TRANSPORT); 120 if(transport != null && transport.length() > 0) 121 { 122 vmArgs = "-D" + REMOTING_TRANSPORT + "=" + transport; 123 } 124 String payloadSize = System.getProperty(PAYLOAD_SIZE); 125 if(payloadSize != null && payloadSize.length() > 0) 126 { 127 vmArgs = vmArgs + " -D" + PAYLOAD_SIZE + "=" + payloadSize; 128 } 129 String numOfCalls = System.getProperty(NUMBER_OF_CALLS); 130 if(numOfCalls != null && numOfCalls.length() > 0) 131 { 132 vmArgs = vmArgs + " -D" + NUMBER_OF_CALLS + "=" + numOfCalls; 133 } 134 135 return vmArgs; 136 } 137 138 145 protected long getResultsTimeout() 146 { 147 return 300000; 148 } 149 150 156 protected long getTearDownTimeout() 157 { 158 return 300000; 159 } 160 161 167 protected long getRunTestTimeout() 168 { 169 return 300000; 170 } 171 172 } 173 | Popular Tags |