KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > interop4 > groupG > mime > doc > MimeDOCInteropTestCase


1 /**
2  * MimeDOCInteropTestCase.java
3  *
4  * This file was auto-generated from WSDL
5  * by the Apache Axis WSDL2Java emitter.
6  */

7
8 package test.wsdl.interop4.groupG.mime.doc;
9
10 import org.apache.axis.attachments.OctetStream;
11
12 import java.util.Arrays JavaDoc;
13 import java.net.URL JavaDoc;
14
15 public class MimeDOCInteropTestCase extends junit.framework.TestCase {
16     public MimeDOCInteropTestCase(java.lang.String JavaDoc name) {
17         super(name);
18     }
19
20     public void testMimeDOCSoapPortWSDL() throws Exception JavaDoc {
21         javax.xml.rpc.ServiceFactory JavaDoc serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
22         java.net.URL JavaDoc url = new java.net.URL JavaDoc(new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPortAddress() + "?WSDL");
23         javax.xml.rpc.Service JavaDoc service = serviceFactory.createService(url, new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getServiceName());
24         assertTrue(service != null);
25     }
26
27     protected void setUp() throws Exception JavaDoc {
28         if(url == null) {
29             url = new URL JavaDoc(new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPortAddress());
30         }
31     }
32
33     public void test1MimeDOCSoapPortEchoAttachment() throws Exception JavaDoc {
34         test.wsdl.interop4.groupG.mime.doc.AttachmentsPortType binding;
35         try {
36             binding = new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPort(url);
37         }
38         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
39             if(jre.getLinkedCause()!=null)
40                 jre.getLinkedCause().printStackTrace();
41             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
42         }
43         assertTrue("binding is null", binding != null);
44
45         // Test operation
46
OctetStream input = new OctetStream("EchoAttachment".getBytes());
47         OctetStream output = null;
48         output = binding.echoAttachment(input);
49         // TBD - validate results
50
assertTrue(Arrays.equals(input.getBytes(), output.getBytes()));
51     }
52
53     public void test2MimeDOCSoapPortEchoAttachments() throws Exception JavaDoc {
54         test.wsdl.interop4.groupG.mime.doc.AttachmentsPortType binding;
55         try {
56             binding = new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPort(url);
57         }
58         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
59             if(jre.getLinkedCause()!=null)
60                 jre.getLinkedCause().printStackTrace();
61             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
62         }
63         assertTrue("binding is null", binding != null);
64
65         OctetStream[] input = new OctetStream[2];
66
67         input[0] = new OctetStream("EchoAttachments0".getBytes());
68         input[1] = new OctetStream("EchoAttachments1".getBytes());
69
70         // Test operation
71
OctetStream[] output = null;
72         output = binding.echoAttachments(input);
73         // TBD - validate results
74
assertTrue(Arrays.equals(input[0].getBytes(), output[0].getBytes()));
75         assertTrue(Arrays.equals(input[1].getBytes(), output[1].getBytes()));
76     }
77
78     public void test3MimeDOCSoapPortEchoAttachmentAsBase64() throws Exception JavaDoc {
79         test.wsdl.interop4.groupG.mime.doc.AttachmentsPortType binding;
80         try {
81             binding = new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPort(url);
82         }
83         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
84             if(jre.getLinkedCause()!=null)
85                 jre.getLinkedCause().printStackTrace();
86             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
87         }
88         assertTrue("binding is null", binding != null);
89
90         OctetStream input = new OctetStream("EchoAttachmentAsBase64".getBytes());
91         // Test operation
92
test.wsdl.interop4.groupG.mime.doc.xsd.Binary output = null;
93         output = binding.echoAttachmentAsBase64(input);
94         // TBD - validate results
95
assertTrue(Arrays.equals(input.getBytes(), output.get_value()));
96     }
97
98     public void test4MimeDOCSoapPortEchoBase64AsAttachment() throws Exception JavaDoc {
99         test.wsdl.interop4.groupG.mime.doc.AttachmentsPortType binding;
100         try {
101             binding = new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPort(url);
102         }
103         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
104             if(jre.getLinkedCause()!=null)
105                 jre.getLinkedCause().printStackTrace();
106             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
107         }
108         assertTrue("binding is null", binding != null);
109
110         byte[] input = "EchoBase64AsAttachment".getBytes();
111         // Test operation
112
OctetStream output = null;
113         output = binding.echoBase64AsAttachment(new test.wsdl.interop4.groupG.mime.doc.xsd.Binary(input));
114         // TBD - validate results
115
assertTrue(Arrays.equals(input, output.getBytes()));
116     }
117
118     public static URL JavaDoc url = null;
119     
120     public static void main(String JavaDoc[] args) throws Exception JavaDoc {
121         if (args.length == 1) {
122             url = new URL JavaDoc(args[0]);
123         } else {
124             url = new URL JavaDoc(new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPortAddress());
125         }
126         junit.textui.TestRunner.run(new junit.framework.TestSuite(MimeDOCInteropTestCase.class));
127     } // main
128
}
129
Popular Tags