File: PerfService_ServiceTestCase.java

package info (click to toggle)
axis 1.4-29
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 52,100 kB
  • sloc: java: 129,124; xml: 10,602; jsp: 983; sh: 84; cs: 36; makefile: 18
file content (68 lines) | stat: -rw-r--r-- 2,393 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
 * PerfService_ServiceTestCase.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.2beta Apr 25, 2004 (11:19:16 EDT) WSDL2Java emitter.
 */

package samples.perf;

import java.util.Date;
import org.apache.axis.components.logger.LogFactory;
import org.apache.commons.logging.Log;

public class PerfService_ServiceTestCase extends junit.framework.TestCase {
    /** Field log */
    static Log log = LogFactory.getLog(PerfService_ServiceTestCase.class.getName());

    public PerfService_ServiceTestCase(java.lang.String name) {
        super(name);
    }

    public void test1PerfPortHandleStringArray() throws Exception {
        samples.perf.PerfPortSoapBindingStub binding;
        try {
            binding = (samples.perf.PerfPortSoapBindingStub)
                          new samples.perf.PerfService_ServiceLocator().getPerfPort();
        }
        catch (javax.xml.rpc.ServiceException jre) {
            if(jre.getLinkedCause()!=null)
                jre.getLinkedCause().printStackTrace();
            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
        }
        assertNotNull("binding is null", binding);

        // Time out after a minute
        binding.setTimeout(60000);
        binding._setProperty(org.apache.axis.client.Call.STREAMING_PROPERTY, Boolean.TRUE);
        // Time out after a minute
        binding.setTimeout(60000);

        log.info(">>>> Warming up...");
        pump(binding, 1);
        log.info(">>>> Running volume tests...");
        pump(binding, 100);
        pump(binding, 1000);
        pump(binding, 10000);
        pump(binding, 100000);
    }

    private static void pump(PerfPortSoapBindingStub binding, int count)
            throws java.rmi.RemoteException {
        String[] s = new String[count];
        for (int i = 0; i < s.length; i++) {
            s[i] = "qwertyuiopasdfghjklzxcvbnm";
        }
        Date start = new Date();
        String value = binding.handleStringArray(s);
        Date end = new Date();

        log.info("Count:" + count + " \tTime consumed: " +
                (end.getTime() - start.getTime()) + "\tReturn:" + value);
    }

    public static void main(String[] args) throws Exception {
        PerfService_ServiceTestCase tests = new PerfService_ServiceTestCase("Perf");
        tests.test1PerfPortHandleStringArray();
    }
}