01: /**
02: * PerfService_ServiceTestCase.java
03: *
04: * This file was auto-generated from WSDL
05: * by the Apache Axis 1.2beta Apr 25, 2004 (11:19:16 EDT) WSDL2Java emitter.
06: */package samples.perf;
07:
08: import java.util.Date;
09: import org.apache.axis.components.logger.LogFactory;
10: import org.apache.commons.logging.Log;
11:
12: public class PerfService_ServiceTestCase extends
13: junit.framework.TestCase {
14: /** Field log */
15: static Log log = LogFactory
16: .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) new samples.perf.PerfService_ServiceLocator()
26: .getPerfPort();
27: } catch (javax.xml.rpc.ServiceException jre) {
28: if (jre.getLinkedCause() != null)
29: jre.getLinkedCause().printStackTrace();
30: throw new junit.framework.AssertionFailedError(
31: "JAX-RPC ServiceException caught: " + jre);
32: }
33: assertNotNull("binding is null", binding);
34:
35: // Time out after a minute
36: binding.setTimeout(60000);
37: binding._setProperty(
38: org.apache.axis.client.Call.STREAMING_PROPERTY,
39: Boolean.TRUE);
40: // Time out after a minute
41: binding.setTimeout(60000);
42:
43: log.info(">>>> Warming up...");
44: pump(binding, 1);
45: log.info(">>>> Running volume tests...");
46: pump(binding, 100);
47: pump(binding, 1000);
48: pump(binding, 10000);
49: pump(binding, 100000);
50: }
51:
52: private static void pump(PerfPortSoapBindingStub binding, int count)
53: throws java.rmi.RemoteException {
54: String[] s = new String[count];
55: for (int i = 0; i < s.length; i++) {
56: s[i] = "qwertyuiopåasdfghjklöäzxcvbnm";
57: }
58: Date start = new Date();
59: String value = binding.handleStringArray(s);
60: Date end = new Date();
61:
62: log.info("Count:" + count + " \tTime consumed: "
63: + (end.getTime() - start.getTime()) + "\tReturn:"
64: + value);
65: }
66:
67: public static void main(String[] args) throws Exception {
68: PerfService_ServiceTestCase tests = new PerfService_ServiceTestCase(
69: "Perf");
70: tests.test1PerfPortHandleStringArray();
71: }
72: }
|