KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > attrGroup > AttrGroupServiceTestCase


1 /**
2  * AttrGroupServiceTestCase.java
3  */

4
5 package test.wsdl.attrGroup;
6
7 public class AttrGroupServiceTestCase extends junit.framework.TestCase {
8     public AttrGroupServiceTestCase(java.lang.String JavaDoc name) {
9         super(name);
10     }
11     public void test1AttrGroupService() throws Exception JavaDoc {
12         // make sure WSDL2Java generated the right stuff
13

14         // we don't really need to test sending a request
15
// and getting a response, since many other tests comprehend that
16
// all we need to do is make sure WSDL2Java generated
17
// the attributes needed from the attributeGroup definitions
18
// so, basically, if this compiles, we are good to go
19
// but running it won't hurt anything
20

21         test.wsdl.attrGroup.Record1 rec1 = new test.wsdl.attrGroup.Record1();
22
23         // an element defined within Record1
24
rec1.setElem1(1);
25         assertTrue("elem1 should be 1, but is "+rec1.getElem1(), rec1.getElem1()==1);
26
27         // an attribute defined in an attributeGroup
28
rec1.setAttr1(2);
29         assertTrue("attr1 should be 2, but is "+rec1.getAttr1(), rec1.getAttr1()==2);
30
31         // an attribute defined in Record1 itself
32
rec1.setAttr3("x");
33         assertTrue("attr3 should be x, but is "+rec1.getAttr3(), rec1.getAttr3().equals("x"));
34         
35         // two attributes from a known 1.1 soap encoding schema
36
rec1.setId(new org.apache.axis.types.Id("theId"));
37         rec1.setHref(new org.apache.axis.types.URI("a", "b"));
38
39         test.wsdl.attrGroup.Record2 rec2 = new test.wsdl.attrGroup.Record2();
40         
41         // an element defined within Record2
42
rec2.setElem2("2");
43
44         // an attribute defined in a referenced attributeGroup within an attributeGroup
45
rec2.setAttr1(2);
46         
47         // an attribute defined in an attributeGroup that has another nested reference
48
rec2.setAttr2(1.2);
49         
50         // an attribute from a known 1.2 soap encoding schema
51
rec2.setId(new org.apache.axis.types.Id("theId"));
52     }
53
54     /*
55     public static void main(String[] args)
56     {
57         AttrGroupServiceTestCase test = new AttrGroupServiceTestCase("x");
58         try {
59             test.test1AttrGroupService();
60         }
61         catch (Exception e)
62         {
63             e.printStackTrace();
64         }
65     }
66     */

67 }
68
Popular Tags