Debian Codegraph @

test/wsdl/interop3/compound1/Compound1TestCase.java

raw
1 package test.wsdl.interop3.compound1;
2
3 import test.wsdl.interop3.compound1.xsd.Document;
4 import test.wsdl.interop3.compound1.xsd.Person;
5
6 import java.net.URL;
7
8 /*
9 <!-- SOAP Builder's round III web services -->
10 <!-- interoperability testing: import1 -->
11 <!-- (see http://www.whitemesa.net/r3/plan.html) -->
12 <!-- Step 1. Start with predefined WSDL -->
13 <!-- Step 2. Generate client from predefined WSDL -->
14 <!-- Step 3. Test generated client against -->
15 <!-- pre-built server -->
16 <!-- Step 4. Generate server from predefined WSDL -->
17 <!-- Step 5. Test generated client against -->
18 <!-- generated server -->
19 <!-- Step 6. Generate second client from -->
20 <!-- generated server's WSDL (some clients -->
21 <!-- can do this dynamically) -->
22 <!-- Step 7. Test second generated client against -->
23 <!-- generated server -->
24 <!-- Step 8. Test second generated client against -->
25 <!-- pre-built server -->
26 */
27
28 public class Compound1TestCase extends junit.framework.TestCase {
29 public static URL url;
30
31 public Compound1TestCase(String name) {
32 super(name);
33 }
34
35 protected void setUp() throws Exception {
36 }
37
38 public void testStep3() {
39 SoapInteropCompound1PortType binding;
40 try {
41 if (url != null) {
42 binding = new Compound1Locator().getSoapInteropCompound1Port(url);
43 } else {
44 binding = new Compound1Locator().getSoapInteropCompound1Port();
45 }
46 }
47 catch (javax.xml.rpc.ServiceException jre) {
48 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
49 }
50 assertTrue("binding is null", binding != null);
51
52 try {
53 Document doc = new Document();
54 doc.setValue("some value");
55 doc.setID("myID");
56 Document newDoc = binding.echoDocument(doc);
57
58 assertEquals("Documents didn't match!", newDoc, doc);
59
60 Person person = new Person();
61 person.setAge(33);
62 person.setMale(true);
63 person.setName("Frodo");
64 person.setID(2.345F);
65 Person newPerson = binding.echoPerson(person);
66
67 assertEquals("Returned Person didn't match!", newPerson, person);
68 }
69 catch (java.rmi.RemoteException re) {
70 throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
71 }
72 }
73
74 /*
75 public void testStep5() {
76 SoapInteropCompound1PortType binding;
77 try {
78 binding = new Compound1Locator().getSoapInteropCompound1Port(new java.net.URL("http://localhost:8080/axis/services/SoapInteropImport1Port"));
79 }
80 catch (Throwable t) {
81 throw new junit.framework.AssertionFailedError("Throwable caught: " + t);
82 }
83 assertTrue("binding is null", binding != null);
84
85 try {
86 Document doc = new Document();
87 doc.setValue("some value");
88 doc.setID("myID");
89 Document newDoc = binding.echoDocument(doc);
90
91 assertEquals("Step 5 IDs didn't match!", doc.getID(), newDoc.getID());
92 assertEquals("Step 5 values didn't match!", doc.getValue(), newDoc.getValue());
93 }
94 catch (java.rmi.RemoteException re) {
95 throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
96 }
97 }
98
99 /*
100 public void testStep7() {
101 test.wsdl.interop3.import1.step6.definitions.SoapInteropImport1PortType binding;
102 try {
103 binding = new SoapInteropImport1PortTypeServiceLocator().getSoapInteropImport1Port();
104 }
105 catch (Throwable t) {
106 throw new junit.framework.AssertionFailedError("Throwable caught: " + t);
107 }
108 assertTrue("binding is null", binding != null);
109
110 try {
111 String value = null;
112 value = binding.echoString(new String());
113 }
114 catch (java.rmi.RemoteException re) {
115 throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
116 }
117 }
118
119 /* doesn't work yet
120 public void testStep8() {
121 test.wsdl.interop3.import1.step6.definitions.SoapInteropImport1PortType binding;
122 try {
123 binding = new SoapInteropImport1PortTypeServiceLocator().getSoapInteropImport1Port(new java.net.URL("http://mssoapinterop.org/stkV3/wsdl/import2.wsdl"));
124 }
125 catch (Throwable t) {
126 throw new junit.framework.AssertionFailedError("Throwable caught: " + t);
127 }
128 assertTrue("binding is null", binding != null);
129
130 try {
131 java.lang.String value = null;
132 value = binding.echoString(new java.lang.String());
133 }
134 catch (java.rmi.RemoteException re) {
135 re.printStackTrace();
136 throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
137 }
138 }
139 */
140
141
142 public static void main(String[] args) {
143 if (args.length == 1) {
144 try {
145 url = new URL(args[0]);
146 } catch (Exception e) {
147 }
148 }
149
150 junit.textui.TestRunner.run(new junit.framework.TestSuite(Compound1TestCase.class));
151 } // main
152 }
153