Debian Codegraph @

test/wsdl/interop4/groupH/simpleDocLit/SimpleDocLitServiceTestCase.java

raw
1 /**
2 * SimpleDocLitServiceTestCase.java
3 *
4 * This file was auto-generated from WSDL
5 * by the Apache Axis WSDL2Java emitter.
6 */
7
8 package test.wsdl.interop4.groupH.simpleDocLit;
9
10 import java.net.URL;
11
12 public class SimpleDocLitServiceTestCase extends junit.framework.TestCase {
13
14 public static URL url = null;
15
16 public static void main(String[] args) throws Exception {
17 if (args.length == 1) {
18 url = new URL(args[0]);
19 } else {
20 url = new URL(new SimpleDocLitServiceLocator().getSimpleDocLitPortAddress());
21 }
22 junit.textui.TestRunner.run(new junit.framework.TestSuite(SimpleDocLitServiceTestCase.class));
23 } // main
24
25 public SimpleDocLitServiceTestCase(java.lang.String name) throws Exception {
26 super(name);
27 if (url == null) {
28 url = new URL(new SimpleDocLitServiceLocator().getSimpleDocLitPortAddress());
29 }
30 }
31
32 public void test1SimpleDocLitPortEchoEmptyFault() throws Exception {
33 SimpleDocLitPortType binding;
34 try {
35 binding = new SimpleDocLitServiceLocator().getSimpleDocLitPort(url);
36 }
37 catch (javax.xml.rpc.ServiceException jre) {
38 if(jre.getLinkedCause()!=null)
39 jre.getLinkedCause().printStackTrace();
40 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
41 }
42 assertTrue("binding is null", binding != null);
43
44 // Test operation
45 try {
46 binding.echoEmptyFault(new EchoEmptyFaultRequest());
47 }
48 catch (EmptyPart e1) {
49 return; // success!
50 }
51
52 fail("Should have caught exception");
53 }
54
55 public void test2SimpleDocLitPortEchoStringFault() throws Exception {
56 SimpleDocLitPortType binding;
57 try {
58 binding = new SimpleDocLitServiceLocator().getSimpleDocLitPort(url);
59 }
60 catch (javax.xml.rpc.ServiceException jre) {
61 if(jre.getLinkedCause()!=null)
62 jre.getLinkedCause().printStackTrace();
63 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
64 }
65 assertTrue("binding is null", binding != null);
66
67 // Test operation
68 try {
69 binding.echoStringFault("testString");
70 }
71 catch (StringFault e1) {
72 assertEquals("String values didn't match", "testString", e1.getPart2());
73 return;
74 }
75
76 fail("Should have caught exception");
77 }
78
79 public void test3SimpleDocLitPortEchoIntArrayFault() throws Exception {
80 SimpleDocLitPortType binding;
81 try {
82 binding = new SimpleDocLitServiceLocator().getSimpleDocLitPort(url);
83 }
84 catch (javax.xml.rpc.ServiceException jre) {
85 if(jre.getLinkedCause()!=null)
86 jre.getLinkedCause().printStackTrace();
87 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
88 }
89 assertTrue("binding is null", binding != null);
90
91 int[] param = new int[] {1, 2, 3};
92
93 // Test operation
94 try {
95 binding.echoIntArrayFault(new ArrayOfInt(param));
96 }
97 catch (ArrayOfInt e1) {
98 int[] ret = e1.getValue();
99 assertEquals("Array element 1", param[0], ret[0]);
100 assertEquals("Array element 2", param[1], ret[1]);
101 assertEquals("Array element 3", param[2], ret[2]);
102 return;
103 }
104
105 fail("Should have caught exception");
106 }
107
108 public void test4SimpleDocLitPortEchoMultipleFaults1() throws Exception {
109 SimpleDocLitPortType binding;
110 try {
111 binding = new SimpleDocLitServiceLocator().getSimpleDocLitPort(url);
112 }
113 catch (javax.xml.rpc.ServiceException jre) {
114 if(jre.getLinkedCause()!=null)
115 jre.getLinkedCause().printStackTrace();
116 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
117 }
118 assertTrue("binding is null", binding != null);
119
120 // Test operation
121 float[] floatParam = new float[] {1.0F, 2.2F, 3.5F};
122 String stringParam = "HELLO";
123 for (int i=1; i < 4; i++) {
124 try {
125 EchoMultipleFaults1Request request =
126 new EchoMultipleFaults1Request();
127 request.setWhichFault(i);
128 request.setParam1(stringParam);
129 request.setParam2(new ArrayOfFloat(floatParam));
130 binding.echoMultipleFaults1(request);
131 }
132 catch (ArrayOfFloat e1) {
133 assertEquals("Wrong fault thrown: " + e1.getClass(), 3, i);
134 float[] ret = e1.getValue();
135 assertEquals(floatParam[0], ret[0], 0.01F);
136 assertEquals(floatParam[1], ret[1], 0.01F);
137 assertEquals(floatParam[2], ret[2], 0.01F);
138 continue;
139 }
140 catch (StringFault e2) {
141 assertEquals("Wrong fault thrown: " + e2.getClass(), 2, i);
142 assertEquals("HELLO", e2.getPart2());
143 continue;
144 }
145 catch (EmptyPart e3) {
146 assertEquals("Wrong fault thrown: " + e3.getClass(), 1, i);
147 continue;
148 }
149
150 fail("Should have caught exception");
151 }
152 }
153
154 public void test5SimpleDocLitPortEchoMultipleFaults2() throws Exception {
155 SimpleDocLitPortType binding;
156 try {
157 binding = new SimpleDocLitServiceLocator().getSimpleDocLitPort(url);
158 }
159 catch (javax.xml.rpc.ServiceException jre) {
160 if(jre.getLinkedCause()!=null)
161 jre.getLinkedCause().printStackTrace();
162 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
163 }
164 assertTrue("binding is null", binding != null);
165
166 // Test operation
167 String stringParam = "HELLO";
168 String[] stringArrayParam = new String[] {"one", "two", "three"};
169 float floatParam = 9.7F;
170 for (int i=1; i < 4; i++) {
171 try {
172 EchoMultipleFaults2Request request =
173 new EchoMultipleFaults2Request();
174 request.setWhichFault(i);
175 request.setParam1(stringParam);
176 request.setParam2(floatParam);
177 request.setParam3(new ArrayOfString(stringArrayParam));
178 binding.echoMultipleFaults2(request);
179 }
180 catch (ArrayOfString e1) {
181 assertEquals("Wrong fault thrown: " + e1.getClass(), 3, i);
182 String[] ret = e1.getValue();
183 assertEquals("Array element 1", stringArrayParam[0], ret[0]);
184 assertEquals("Array element 2", stringArrayParam[1], ret[1]);
185 assertEquals("Array element 3", stringArrayParam[2], ret[2]);
186 continue;
187 }
188 catch (FloatFault e2) {
189 assertEquals("Wrong fault thrown: " + e2.getClass(), 1, i);
190 assertEquals(floatParam, e2.getPart4(), 0.01F);
191 continue;
192 }
193 catch (StringFault e3) {
194 assertEquals("Wrong fault thrown: " + e3.getClass(), 2, i);
195 assertEquals(stringParam, e3.getPart2());
196 continue;
197 }
198
199 fail("Should have caught exception");
200 }
201 }
202
203 public void test6SimpleDocLitPortEchoMultipleFaults3() throws Exception {
204 SimpleDocLitPortType binding;
205 try {
206 binding = new SimpleDocLitServiceLocator().getSimpleDocLitPort(url);
207 }
208 catch (javax.xml.rpc.ServiceException jre) {
209 if(jre.getLinkedCause()!=null)
210 jre.getLinkedCause().printStackTrace();
211 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
212 }
213 assertTrue("binding is null", binding != null);
214
215 // Test operation
216 String param1 = "Param1";
217 String param2 = "Param2";
218 for (int i=1; i < 3; i++) {
219 try {
220 EchoMultipleFaults3Request request =
221 new EchoMultipleFaults3Request();
222 request.setWhichFault(i);
223 request.setParam1(param1);
224 request.setParam2(param2);
225 binding.echoMultipleFaults3(request);
226 }
227 catch (String2Fault e1) {
228 assertEquals("Wrong fault thrown: " + e1.getClass(), 2, i);
229 assertEquals(param2, e1.getPart2());
230 continue;
231 }
232 catch (StringFault e2) {
233 assertEquals("Wrong fault thrown: " + e2.getClass(), 1, i);
234 assertEquals(param1, e2.getPart2());
235 continue;
236 }
237
238 fail("Should have caught exception");
239 }
240 }
241
242 public void test7SimpleDocLitPortEchoMultipleFaults4() throws Exception {
243 SimpleDocLitPortType binding;
244 try {
245 binding = new SimpleDocLitServiceLocator().getSimpleDocLitPort(url);
246 }
247 catch (javax.xml.rpc.ServiceException jre) {
248 if(jre.getLinkedCause()!=null)
249 jre.getLinkedCause().printStackTrace();
250 throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
251 }
252 assertTrue("binding is null", binding != null);
253
254 // Test operation
255 int intParam = 66;
256 Enum enumParam = new Enum(1);
257 for (int i=1; i < 3; i++) {
258 try {
259 EchoMultipleFaults4Request request =
260 new EchoMultipleFaults4Request();
261 request.setWhichFault(i);
262 request.setParam1(intParam);
263 request.setParam2(enumParam);
264 binding.echoMultipleFaults4(request);
265 }
266 catch (EnumFault e1) {
267 assertEquals("Wrong fault thrown: " + e1.getClass(), 2, i);
268 assertEquals(enumParam.getValue(), e1.getPart9().getValue());
269 continue;
270 }
271 catch (IntFault e2) {
272 assertEquals("Wrong fault thrown: " + e2.getClass(), 1, i);
273 assertEquals(intParam, e2.getPart3());
274 continue;
275 }
276
277 fail("Should have caught exception");
278 }
279 }
280
281 }