Debian Codegraph @

test/wsdl/arrays4/StructureTypeTestCase.java

raw
1 package test.wsdl.arrays4;
2
3 /**
4 * StructureTypeTestCase
5 * <p/>
6 * This test only needs to compile, as we are testing to make sure that the
7 * Schema in the WSDL generates the correctly wrapped Integer arrays.
8 */
9 public class StructureTypeTestCase extends junit.framework.TestCase {
10
11 public StructureTypeTestCase(String name) {
12 super(name);
13 }
14
15 public void testEchoStruct() throws Exception {
16 ArrayTest4SOAPBindingStub binding;
17 try {
18 binding = (ArrayTest4SOAPBindingStub)
19 new ArrayTest4ServiceLocator().getArrayTest4();
20 } catch (javax.xml.rpc.ServiceException jre) {
21 if (jre.getLinkedCause() != null)
22 jre.getLinkedCause().printStackTrace();
23 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
24 }
25 assertNotNull("binding is null", binding);
26
27 // Time out after a minute
28 binding.setTimeout(60000);
29 binding._setProperty("sendMultiRefs",Boolean.FALSE);
30
31 // Test operation
32 Integer a1[] = new Integer[]{new Integer(1), new Integer(2), new Integer(3)};
33 Integer a2[] = new Integer[] {new Integer(9), new Integer(8), new Integer(7)};
34 Integer a3[][] = new Integer[][] {
35 {new Integer(1), new Integer(2), new Integer(3)},
36 {new Integer(9), new Integer(8), new Integer(7)} };
37 final StructureType inStruct = new StructureType(a1, a2, a3);
38 StructureType value = null;
39 value = binding.echoStruct(inStruct);
40 Integer r1[] = value.getFld1();
41 assertEquals("return struct #1 didn't match", 1, r1[0].intValue() );
42 assertEquals("return struct #1 didn't match", 2, r1[1].intValue() );
43 assertEquals("return struct #1 didn't match", 3, r1[2].intValue() );
44
45 Integer r2[] = value.getFld2();
46 assertEquals("return struct #2 didn't match", 9, r2[0].intValue() );
47 assertEquals("return struct #2 didn't match", 8, r2[1].intValue() );
48 assertEquals("return struct #2 didn't match", 7, r2[2].intValue() );
49
50 Integer r3[][] = value.getFld3();
51 assertEquals("return struct #3 didn't match", 1, r3[0][0].intValue() );
52 assertEquals("return struct #3 didn't match", 2, r3[0][1].intValue() );
53 assertEquals("return struct #3 didn't match", 3, r3[0][2].intValue() );
54 assertEquals("return struct #3 didn't match", 9, r3[1][0].intValue() );
55 assertEquals("return struct #3 didn't match", 8, r3[1][1].intValue() );
56 assertEquals("return struct #3 didn't match", 7, r3[1][2].intValue() );
57 }
58 }
59