File: ComplexEchoServiceTestCase.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 (105 lines) | stat: -rw-r--r-- 4,486 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
 * ComplexEchoServiceTestCase.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis WSDL2Java emitter.
 */

package test.wsdl.echo;

public class ComplexEchoServiceTestCase extends junit.framework.TestCase {
    public ComplexEchoServiceTestCase(String name) {
        super(name);
    }

    public void testComplexEchoServiceWSDL() throws Exception {
        javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
        java.net.URL url = new java.net.URL(new test.wsdl.echo.ComplexEchoServiceLocator().getComplexEchoServiceAddress() + "?WSDL");
        javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.echo.ComplexEchoServiceLocator().getServiceName());
        assertTrue(service != null);
    }

    public void test1ComplexEchoServiceEcho() {
        test.wsdl.echo.Echo binding;
        try {
            binding = new test.wsdl.echo.ComplexEchoServiceLocator().getComplexEchoService();
        }
        catch (javax.xml.rpc.ServiceException jre) {
            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
        }
        assertTrue("binding is null", binding != null);

        try {
            test.wsdl.echo.MyComplexType complexType = new test.wsdl.echo.MyComplexType();
            test.wsdl.echo.holders.MyComplexTypeHolder complexTypeHolder = 
                    new test.wsdl.echo.holders.MyComplexTypeHolder(complexType);  
            binding.echo(complexTypeHolder);
            assertTrue(complexTypeHolder.value.getSimpleItem().equals("MY_SIMPLE_ITEM"));
        }
        catch (java.rmi.RemoteException re) {
            throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
        }
    }

    public void test2ComplexEchoServiceEcho2() throws Exception {
        test.wsdl.echo.ComplexEchoServiceSoapBindingStub binding;
        try {
            binding = (test.wsdl.echo.ComplexEchoServiceSoapBindingStub)
                    new test.wsdl.echo.ComplexEchoServiceLocator().getComplexEchoService();
        }
        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);
        test.wsdl.echo.MyComplexType2 request = new test.wsdl.echo.MyComplexType2();
        request.setUsername("xxx");
        request.setPassword("yyy");
        request.setOptions(new NamedValue[]{
            new NamedValue("dummy1", "dummy_val1"),
            new NamedValue("dummy2",
                    new NamedValueSet (new NamedValue[]{
                        new NamedValue("dummy2-1", "val2-1"),
                        new NamedValue("dummy2-2", new Integer(314))
                    }))
        });
        // Test operation
        test.wsdl.echo.NamedValue[] value = null;
        value = binding.echo2(request);
        // TBD - validate results
    }

    public void test2ComplexEchoServiceEcho21() throws Exception {
        test.wsdl.echo.ComplexEchoServiceSoapBindingStub binding;
        try {
            binding = (test.wsdl.echo.ComplexEchoServiceSoapBindingStub)
                    new test.wsdl.echo.ComplexEchoServiceLocator().getComplexEchoService();
        }
        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);
        test.wsdl.echo.MyComplexType2 request = new test.wsdl.echo.MyComplexType2();
        request.setUsername("xxx");
        request.setPassword("yyy");
        request.setOptions(new NamedValue[]{
            new NamedValue("dummy1", "dummy_val1"),
            new NamedValue("dummy2", new NamedValue[]{
                new NamedValue("dummy2-1", "val2-1"),
                new NamedValue("dummy2-2", new Integer(314))
            })
        });
        // Test operation
        test.wsdl.echo.NamedValue[] value = null;

        value = binding.echo2(request);
        // TBD - validate results
    }
}