KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > interop3 > import1 > Import1TestCase


1 package test.wsdl.interop3.import1;
2
3 import test.wsdl.interop3.import1.definitions.SoapInteropImport1PortType;
4
5 import java.net.URL JavaDoc;
6 /*
7     <!-- SOAP Builder's round III web services -->
8     <!-- interoperability testing: import1 -->
9     <!-- (see http://www.whitemesa.net/r3/plan.html) -->
10     <!-- Step 1. Start with predefined WSDL -->
11     <!-- Step 2. Generate client from predefined WSDL -->
12     <!-- Step 3. Test generated client against -->
13     <!-- pre-built server -->
14     <!-- Step 4. Generate server from predefined WSDL -->
15     <!-- Step 5. Test generated client against -->
16     <!-- generated server -->
17     <!-- Step 6. Generate second client from -->
18     <!-- generated server's WSDL (some clients -->
19     <!-- can do this dynamically) -->
20     <!-- Step 7. Test second generated client against -->
21     <!-- generated server -->
22     <!-- Step 8. Test second generated client against -->
23     <!-- pre-built server -->
24 */

25
26 public class Import1TestCase extends junit.framework.TestCase {
27     public static URL JavaDoc url = null;
28
29     public Import1TestCase(String JavaDoc name) {
30         super(name);
31     }
32
33     public void testStep3() {
34         SoapInteropImport1PortType binding;
35         try {
36             if (url == null) {
37                 binding = new Import1Locator().getSoapInteropImport1Port();
38             } else {
39                 binding = new Import1Locator().getSoapInteropImport1Port(url);
40             }
41         }
42         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
43             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
44         }
45         assertTrue("binding is null", binding != null);
46
47         try {
48             String JavaDoc value = "import1 test string";
49             String JavaDoc result = binding.echoString(value);
50             assertEquals("Strings didn't match", value, result);
51         }
52         catch (java.rmi.RemoteException JavaDoc re) {
53             throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
54         }
55     }
56
57 /* doesn't work yet
58     public void testStep8() {
59        test.wsdl.interop3.import1.step6.definitions.SoapInteropImport1PortType binding;
60         try {
61             binding = new SoapInteropImport1PortTypeServiceLocator().getSoapInteropImport1Port(new java.net.URL("http://mssoapinterop.org/stkV3/wsdl/import2.wsdl"));
62         }
63         catch (Throwable t) {
64             throw new junit.framework.AssertionFailedError("Throwable caught: " + t);
65         }
66         assertTrue("binding is null", binding != null);
67
68         try {
69             java.lang.String value = null;
70             value = binding.echoString(new java.lang.String());
71         }
72         catch (java.rmi.RemoteException re) {
73             re.printStackTrace();
74             throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re);
75         }
76     }
77 */

78
79     public static void main(String JavaDoc[] args) {
80         if (args.length == 1) {
81             try {
82                 url = new URL JavaDoc(args[0]);
83             } catch (Exception JavaDoc e) {
84             }
85         }
86
87         junit.textui.TestRunner.run(new junit.framework.TestSuite(Import1TestCase.class));
88     } // main
89

90 }
91
92
Popular Tags