File: DocLitTestCase.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 (95 lines) | stat: -rw-r--r-- 3,349 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
package test.wsdl.interop3.docLit;


import test.wsdl.interop3.docLit.xsd.ArrayOfstring_literal;
import test.wsdl.interop3.docLit.xsd.SOAPStruct;

import java.net.URL;

/*
    <!-- SOAP Builder's round III web services          -->
    <!-- interoperability testing:  import1             -->
    <!-- (see http://www.whitemesa.net/r3/plan.html)    -->
    <!-- Step 1.  Start with predefined WSDL            -->
    <!-- Step 2.  Generate client from predefined WSDL  -->
    <!-- Step 3.  Test generated client against         -->
    <!--          pre-built server                      -->
    <!-- Step 4.  Generate server from predefined WSDL  -->
    <!-- Step 5.  Test generated client against         -->
    <!--          generated server                      -->
    <!-- Step 6.  Generate second client from           -->
    <!--          generated server's WSDL (some clients -->
    <!--          can do this dynamically)              -->
    <!-- Step 7.  Test second generated client against  -->
    <!--          generated server                      -->
    <!-- Step 8.  Test second generated client against  -->
    <!--          pre-built server                      -->
*/

public class DocLitTestCase extends junit.framework.TestCase {
    static URL url;

    public DocLitTestCase(String name) {
        super(name);
    }

    protected void setUp() throws Exception {
    }

    public void testStep3() throws Exception {
        WSDLInteropTestDocLitPortType binding;
        try {
            if (url != null) {
                binding = new WSDLInteropTestDocLitServiceLocator().getWSDLInteropTestDocLitPort(url);
            } else {
                binding = new WSDLInteropTestDocLitServiceLocator().getWSDLInteropTestDocLitPort();
            }
        }
        catch (javax.xml.rpc.ServiceException jre) {
            throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
        }
        assertNotNull("binding is null", binding);

        String str = "Hello there!";
        String [] strArray = new String [] { "1", "two", "trois" };
        ArrayOfstring_literal param = new ArrayOfstring_literal();
        param.setString(strArray);

        assertEquals("echoString results differ", binding.echoString(str), str);

        String [] resArray = binding.echoStringArray(param).getString();
        assertEquals("String array lengths differ",
                     strArray.length,
                     resArray.length);
        for (int i = 0; i < strArray.length; i++) {
            assertEquals("Array members at index " + i + " differ",
                         strArray[i],
                         resArray[i]);
        }

        SOAPStruct struct = new SOAPStruct();
        struct.setVarFloat(3.14159F);
        struct.setVarInt(69);
        struct.setVarString("Struct-o-rama");

        assertTrue("Structs weren't equal",
                   struct.equals(binding.echoStruct(struct)));
        
        // test echoVoid
        binding.echoVoid();
    }



    public static void main(String[] args) {
        if (args.length == 1) {
            try {
                url = new URL(args[0]);
            } catch (Exception e) {
            }
        }

        junit.textui.TestRunner.run(new junit.framework.TestSuite(DocLitTestCase.class));
    } // main
}