KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > arrays4 > StructureTypeTestCase


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 JavaDoc name) {
12         super(name);
13     }
14
15     public void testEchoStruct() throws Exception JavaDoc {
16         ArrayTest4SOAPBindingStub binding;
17         try {
18             binding = (ArrayTest4SOAPBindingStub)
19                     new ArrayTest4ServiceLocator().getArrayTest4();
20         } catch (javax.xml.rpc.ServiceException JavaDoc 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 JavaDoc a1[] = new Integer JavaDoc[]{new Integer JavaDoc(1), new Integer JavaDoc(2), new Integer JavaDoc(3)};
33         Integer JavaDoc a2[] = new Integer JavaDoc[] {new Integer JavaDoc(9), new Integer JavaDoc(8), new Integer JavaDoc(7)};
34         Integer JavaDoc a3[][] = new Integer JavaDoc[][] {
35             {new Integer JavaDoc(1), new Integer JavaDoc(2), new Integer JavaDoc(3)},
36             {new Integer JavaDoc(9), new Integer JavaDoc(8), new Integer JavaDoc(7)} };
37         final StructureType inStruct = new StructureType(a1, a2, a3);
38         StructureType value = null;
39         value = binding.echoStruct(inStruct);
40         Integer JavaDoc 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 JavaDoc 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 JavaDoc 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
60
Popular Tags