KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > any > AnyTestCase


1
2 package test.wsdl.any;
3
4 /**
5  * @author Ashutosh Shahi
6  *
7  * Test to check if MessageElement [] for <any>
8  * includes all elements
9  */

10 public class AnyTestCase extends junit.framework.TestCase{
11     
12     public AnyTestCase(java.lang.String JavaDoc name) {
13         super(name);
14     }
15     
16     public void testAny1() throws Exception JavaDoc{
17         AnyServiceLocator loc = new AnyServiceLocator();
18         Soap svc = loc.getSoap();
19         
20         QueryResult qr = svc.query("blah");
21         
22         assertTrue("Records size mismatch", qr.getRecords().length == 1);
23          for (int i =0; i < qr.getRecords().length; i++ ) {
24             SObject s = qr.getRecords(i);
25             System.out.println("id::" + s.getId());
26             org.apache.axis.message.MessageElement [] e= s.get_any();
27             System.out.println("MessageElement array size is " + e.length);
28              for (int j = 0; j < e.length; j++ ){
29                  System.out.print(" " + e[j].getValue());
30              }
31              System.out.println("");
32             assertTrue("Any should have three elements", e.length == 3);
33          }
34     }
35     
36     public static void main(String JavaDoc[] args) throws Exception JavaDoc{
37         AnyTestCase at = new AnyTestCase("test");
38         at.testAny1();
39     }
40 }
41
Popular Tags