Debian Codegraph @

test/wsdl/interop3/import2/Import2TestCase.java

raw
1 package test.wsdl.interop3.import2;
2
3 import test.wsdl.interop3.import2.definitions.SoapInteropImport2PortType;
4 import test.wsdl.interop3.import2.xsd.SOAPStruct;
5
6 import java.net.URL;
7
8 /*
9 <!-- SOAP Builder's round III web services -->
10 <!-- interoperability testing: import2 -->
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 Import2TestCase extends junit.framework.TestCase {
29 public static URL url;
30
31 public Import2TestCase(String name) {
32 super(name);
33 }
34
35 public void testStep3() {
36 SoapInteropImport2PortType binding;
37 try {
38 if (url == null) {
39 binding = new Import2Locator().getSoapInteropImport2Port();
40 } else {
41 binding = new Import2Locator().getSoapInteropImport2Port(url);
42 }
43 }
44 catch (javax.xml.rpc.ServiceException jre) {
45 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
46 }
47 assertTrue("binding is null", binding != null);
48
49 try {
50 SOAPStruct value = new SOAPStruct();
51 value.setVarString("import2 string");
52 value.setVarInt(5);
53 value.setVarFloat(4.5F);
54 SOAPStruct result = binding.echoStruct(value);
55 assertEquals("String members didn't match", value.getVarString(), result.getVarString());
56 assertEquals("int members didn't match", value.getVarInt(), result.getVarInt());
57 //assertEquals("float members didn't match", value.getVarFloat(), result.getVarFloat());
58 }
59 catch (java.rmi.RemoteException re) {
60 throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
61 }
62 }
63
64
65 /* doesn't work yet
66 public void testStep8() {
67 SoapInteropImport2PortType binding;
68 try {
69 binding = new SoapInteropImport2PortTypeServiceLocator().getSoapInteropImport2Port(new java.net.URL("http://mssoapinterop.org/stkV3/wsdl/import2.wsdl"));
70 }
71 catch (Throwable t) {
72 throw new junit.framework.AssertionFailedError("Throwable caught: " + t);
73 }
74 assertTrue("binding is null", binding != null);
75
76 try {
77 SOAPStruct value = null;
78 value = binding.echoStruct(new SOAPStruct());
79 }
80 catch (java.rmi.RemoteException re) {
81 throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
82 }
83 }
84 */
85
86 /*
87 Not working right now.
88 public void testAbsoluteStep3() {
89 test.wsdl.interop3.absimport2.definitions.SoapInteropImport2PortType binding;
90 try {
91 binding = new test.wsdl.interop3.absimport2.Import2Locator().getSoapInteropImport2Port();
92 }
93 catch (javax.xml.rpc.ServiceException jre) {
94 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
95 }
96 assertTrue("binding is null", binding != null);
97
98 try {
99 test.wsdl.interop3.absimport2.xsd.SOAPStruct value = null;
100 value = binding.echoStruct(new test.wsdl.interop3.absimport2.xsd.SOAPStruct());
101 }
102 catch (java.rmi.RemoteException re) {
103 throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
104 }
105 }
106
107 public void testAbsoluteStep5() {
108 test.wsdl.interop3.absimport2.definitions.SoapInteropImport2PortType binding;
109 try {
110 binding = new test.wsdl.interop3.absimport2.Import2Locator().getSoapInteropImport2Port(new java.net.URL("http://localhost:8080/axis/services/SoapInteropImport2Port"));
111 }
112 catch (Throwable t) {
113 throw new junit.framework.AssertionFailedError("Throwable caught: " + t);
114 }
115 assertTrue("binding is null", binding != null);
116
117 try {
118 test.wsdl.interop3.absimport2.xsd.SOAPStruct value = null;
119 value = binding.echoStruct(new test.wsdl.interop3.absimport2.xsd.SOAPStruct());
120 }
121 catch (java.rmi.RemoteException re) {
122 throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
123 }
124 }
125
126 public void testAbsoluteStep7() {
127 test.wsdl.interop3.absimport2.step6.definitions.SoapInteropImport2PortType binding;
128 try {
129 binding = new test.wsdl.interop3.absimport2.step6.definitions.SoapInteropImport2PortTypeServiceLocator().getSoapInteropImport2Port();
130 }
131 catch (javax.xml.rpc.ServiceException jre) {
132 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
133 }
134 assertTrue("binding is null", binding != null);
135
136 try {
137 test.wsdl.interop3.absimport2.step6.xsd.SOAPStruct value = null;
138 value = binding.echoStruct(new test.wsdl.interop3.absimport2.step6.xsd.SOAPStruct());
139 }
140 catch (java.rmi.RemoteException re) {
141 throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
142 }
143 }
144 */
145 /* doesn't work yet
146 public void testAbsoluteStep8() {
147 SoapInteropImport2PortType binding;
148 try {
149 binding = new SoapInteropImport2PortTypeServiceLocator().getSoapInteropImport2Port(new java.net.URL("http://mssoapinterop.org/stkV3/wsdl/import2.wsdl"));
150 }
151 catch (Throwable t) {
152 throw new junit.framework.AssertionFailedError("Throwable caught: " + t);
153 }
154 assertTrue("binding is null", binding != null);
155
156 try {
157 SOAPStruct value = null;
158 value = binding.echoStruct(new SOAPStruct());
159 }
160 catch (java.rmi.RemoteException re) {
161 throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
162 }
163 }
164 */
165
166 public static void main(String[] args) {
167 if (args.length == 1) {
168 try {
169 url = new URL(args[0]);
170 } catch (Exception e) {
171 }
172 }
173
174 junit.textui.TestRunner.run(new junit.framework.TestSuite(Import2TestCase.class));
175 } // main
176
177 }
178