KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > interop3 > groupE > client > InteropTestListServiceTestCase


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 <glyn@apache.org>
22  */

23
24 package test.wsdl.interop3.groupE.client;
25
26 import junit.framework.AssertionFailedError;
27
28 import java.net.URL JavaDoc;
29
30 public class InteropTestListServiceTestCase extends junit.framework.TestCase {
31     public static URL JavaDoc url;
32
33     public InteropTestListServiceTestCase(String JavaDoc name) {
34         super(name);
35     }
36
37     public void testInteropTestListEchoLinkedList() {
38         InteropTestList binding;
39         try {
40             if (url == null) {
41                 binding = new InteropTestListServiceLocator().getInteropTestList();
42             } else {
43                 binding = new InteropTestListServiceLocator().getInteropTestList(url);
44             }
45         } catch (javax.xml.rpc.ServiceException JavaDoc jre) {
46             throw new AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
47         }
48         assertTrue("binding is null", binding != null);
49
50         try {
51             List node1 = new List();
52             node1.setVarInt(1);
53             node1.setVarString("last");
54             List node2 = new List();
55             node2.setVarInt(2);
56             node2.setVarString("middle");
57             node2.setChild(node1);
58             List list = new List();
59             list.setVarInt(3);
60             list.setVarString("first");
61             list.setChild(node2);
62
63             List value = binding.echoLinkedList(list);
64             List vnode2 = value.getChild();
65             List vnode1 = null;
66             if (vnode2 != null) {
67                 vnode1 = vnode2.getChild();
68             }
69                 
70             if (value.getVarInt() != list.getVarInt() ||
71                 !value.getVarString().equals(list.getVarString()) ||
72                 vnode2 == null ||
73                 vnode2.getVarInt() != node2.getVarInt() ||
74                 !vnode2.getVarString().equals(node2.getVarString()) ||
75                 vnode1 == null ||
76                 vnode1.getVarInt() != node1.getVarInt() ||
77                 !vnode1.getVarString().equals(node1.getVarString()) ||
78                 vnode1.getChild() != null) {
79                 throw new AssertionFailedError("List echo failed");
80             }
81         }
82         catch (java.rmi.RemoteException JavaDoc re) {
83             throw new AssertionFailedError("Remote Exception caught: " + re);
84         }
85     }
86
87 }
88
89
Popular Tags