Debian Codegraph @

test/wsdl/interop3/groupE/client/InteropTestRpcEncServiceTestCase.java

raw
1 /*
2 * Copyright 2002-2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /**
18 * This file was based on a testcase auto-generated from WSDL by the
19 * Apache Axis Wsdl2java emitter.
20 *
21 * @author Glyn Normington <[email protected]>
22 */
23
24 package test.wsdl.interop3.groupE.client;
25
26 import junit.framework.AssertionFailedError;
27
28 import java.net.URL;
29
30 public class InteropTestRpcEncServiceTestCase extends junit.framework.TestCase {
31 public static URL url;
32
33 public InteropTestRpcEncServiceTestCase(String name) {
34 super(name);
35 }
36 public void testInteropTestRpcEncEchoString() {
37 InteropTestRpcEnc binding;
38 try {
39 if (url == null) {
40 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc();
41 } else {
42 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc(url);
43 }
44 } catch (javax.xml.rpc.ServiceException jre) {
45 throw new AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
46 }
47 assertTrue("binding is null", binding != null);
48
49 try {
50 String input = "a string";
51 String value = binding.echoString(input);
52 if (!value.equals(input)) {
53 throw new AssertionFailedError("String echo failed");
54 }
55 }
56 catch (java.rmi.RemoteException re) {
57 throw new AssertionFailedError("Remote Exception caught: " + re);
58 }
59 }
60
61 public void testInteropTestRpcEncEchoStringArray() {
62 InteropTestRpcEnc binding;
63 try {
64 if (url == null) {
65 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc();
66 } else {
67 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc(url);
68 }
69 }
70 catch (javax.xml.rpc.ServiceException jre) {
71 throw new AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
72 }
73 assertTrue("binding is null", binding != null);
74
75 try {
76 String[] input = {"string 1", "string 2"};
77 String[] value = binding.echoStringArray(input);
78
79 boolean equal = true;
80 if (input.length != value.length) {
81 equal = false;
82 } else {
83 for (int i = 0; i < value.length; i++) {
84 if (!input[i].equals(value[i])) {
85 equal = false;
86 }
87 }
88 }
89 if (!equal) {
90 throw new AssertionFailedError("StringArray echo failed");
91 }
92 }
93 catch (java.rmi.RemoteException re) {
94 throw new AssertionFailedError("Remote Exception caught: " + re);
95 }
96 }
97
98 public void testInteropTestRpcEncEchoStruct() {
99 InteropTestRpcEnc binding;
100 try {
101 if (url == null) {
102 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc();
103 } else {
104 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc(url);
105 }
106 }
107 catch (javax.xml.rpc.ServiceException jre) {
108 throw new AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
109 }
110 assertTrue("binding is null", binding != null);
111
112 try {
113 SOAPStruct input = new SOAPStruct();
114 input.setVarFloat(3.142f);
115 input.setVarInt(3);
116 input.setVarString("Pi");
117 SOAPStruct value = binding.echoStruct(input);
118 if (value.getVarFloat() != input.getVarFloat() ||
119 value.getVarInt() != input.getVarInt() ||
120 !value.getVarString().equals(input.getVarString())) {
121 throw new AssertionFailedError("Struct echo failed");
122 }
123 }
124 catch (java.rmi.RemoteException re) {
125 throw new AssertionFailedError("Remote Exception caught: " + re);
126 }
127 }
128
129 public void testInteropTestRpcEncEchoVoid() {
130 InteropTestRpcEnc binding;
131 try {
132 if (url == null) {
133 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc();
134 } else {
135 binding = new InteropTestRpcEncServiceLocator().getInteropTestRpcEnc(url);
136 }
137 }
138 catch (javax.xml.rpc.ServiceException jre) {
139 throw new AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
140 }
141 assertTrue("binding is null", binding != null);
142
143 try {
144 binding.echoVoid();
145 }
146 catch (java.rmi.RemoteException re) {
147 throw new AssertionFailedError("Remote Exception caught: " + re);
148 }
149 }
150
151 }
152