1 7 8 package samples.perf; 9 10 import java.util.Date ; 11 import org.apache.axis.components.logger.LogFactory; 12 import org.apache.commons.logging.Log; 13 14 public class PerfService_ServiceTestCase extends junit.framework.TestCase { 15 16 static Log log = LogFactory.getLog(PerfService_ServiceTestCase.class.getName()); 17 18 public PerfService_ServiceTestCase(java.lang.String name) { 19 super(name); 20 } 21 22 public void test1PerfPortHandleStringArray() throws Exception { 23 samples.perf.PerfPortSoapBindingStub binding; 24 try { 25 binding = (samples.perf.PerfPortSoapBindingStub) 26 new samples.perf.PerfService_ServiceLocator().getPerfPort(); 27 } 28 catch (javax.xml.rpc.ServiceException jre) { 29 if(jre.getLinkedCause()!=null) 30 jre.getLinkedCause().printStackTrace(); 31 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 32 } 33 assertNotNull("binding is null", binding); 34 35 binding.setTimeout(60000); 37 binding._setProperty(org.apache.axis.client.Call.STREAMING_PROPERTY, Boolean.TRUE); 38 binding.setTimeout(60000); 40 41 log.info(">>>> Warming up..."); 42 pump(binding, 1); 43 log.info(">>>> Running volume tests..."); 44 pump(binding, 100); 45 pump(binding, 1000); 46 pump(binding, 10000); 47 pump(binding, 100000); 48 } 49 50 private static void pump(PerfPortSoapBindingStub binding, int count) 51 throws java.rmi.RemoteException { 52 String [] s = new String [count]; 53 for (int i = 0; i < s.length; i++) { 54 s[i] = "qwertyuiopåasdfghjklöäzxcvbnm"; 55 } 56 Date start = new Date (); 57 String value = binding.handleStringArray(s); 58 Date end = new Date (); 59 60 log.info("Count:" + count + " \tTime consumed: " + 61 (end.getTime() - start.getTime()) + "\tReturn:" + value); 62 } 63 64 public static void main(String [] args) throws Exception { 65 PerfService_ServiceTestCase tests = new PerfService_ServiceTestCase("Perf"); 66 tests.test1PerfPortHandleStringArray(); 67 } 68 } 69 | Popular Tags |