KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > attachments > AttachmentTestCase


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

7
8 package test.wsdl.attachments;
9
10 import javax.mail.internet.MimeBodyPart JavaDoc;
11 import javax.mail.internet.MimeMultipart JavaDoc;
12 import java.util.Arrays JavaDoc;
13
14 public class AttachmentTestCase extends junit.framework.TestCase {
15     public AttachmentTestCase(java.lang.String JavaDoc name) {
16         super(name);
17     }
18
19     private MimeMultipart JavaDoc createMimeMultipart(String JavaDoc data) throws Exception JavaDoc {
20         // create the root multipart
21
MimeMultipart JavaDoc mpRoot = new MimeMultipart JavaDoc("mixed");
22         
23         // Add text
24
MimeBodyPart JavaDoc mbp1 = new MimeBodyPart JavaDoc();
25         mbp1.setText(data);
26         mpRoot.addBodyPart(mbp1);
27         return mpRoot;
28     }
29
30     public void test1AttachmentPortRPCGetCompanyInfo2() throws Exception JavaDoc {
31         test.wsdl.attachments.Pt1 binding;
32         try {
33             binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC();
34         } catch (javax.xml.rpc.ServiceException JavaDoc jre) {
35             if (jre.getLinkedCause() != null)
36                 jre.getLinkedCause().printStackTrace();
37             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
38         }
39         assertTrue("binding is null", binding != null);
40
41         // Test operation
42
java.lang.String JavaDoc value = null;
43         value = binding.getCompanyInfo2(0, new java.lang.String JavaDoc("GetCompanyInfo2"), null);
44         assertEquals(value, "GetCompanyInfo2");
45     }
46
47     public void test2AttachmentPortRPCInputPlainText() throws Exception JavaDoc {
48         test.wsdl.attachments.Pt1 binding;
49         try {
50             binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC();
51         } catch (javax.xml.rpc.ServiceException JavaDoc jre) {
52             if (jre.getLinkedCause() != null)
53                 jre.getLinkedCause().printStackTrace();
54             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
55         }
56         assertTrue("binding is null", binding != null);
57
58         // Test operation
59
binding.inputPlainText(new java.lang.String JavaDoc("InputPlainText"));
60         // TBD - validate results
61
}
62
63     public void test3AttachmentPortRPCInoutPlainText() throws Exception JavaDoc {
64         test.wsdl.attachments.Pt1 binding;
65         try {
66             binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC();
67         } catch (javax.xml.rpc.ServiceException JavaDoc jre) {
68             if (jre.getLinkedCause() != null)
69                 jre.getLinkedCause().printStackTrace();
70             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
71         }
72         assertTrue("binding is null", binding != null);
73
74         // Test operation
75
java.lang.String JavaDoc value = null;
76         value = binding.inoutPlainText(new java.lang.String JavaDoc("InoutPlainText"));
77         // TBD - validate results
78
assertEquals(value, "InoutPlainText");
79     }
80
81     public void test4AttachmentPortRPCEchoPlainText() throws Exception JavaDoc {
82         test.wsdl.attachments.Pt1 binding;
83         try {
84             binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC();
85         } catch (javax.xml.rpc.ServiceException JavaDoc jre) {
86             if (jre.getLinkedCause() != null)
87                 jre.getLinkedCause().printStackTrace();
88             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
89         }
90         assertTrue("binding is null", binding != null);
91
92         // Test operation
93
java.lang.String JavaDoc value = null;
94         value = binding.echoPlainText(new java.lang.String JavaDoc("EchoPlainText"));
95         // TBD - validate results
96
assertEquals(value, "EchoPlainText");
97     }
98
99     public void test5AttachmentPortRPCOutputPlainText() throws Exception JavaDoc {
100         test.wsdl.attachments.Pt1 binding;
101         try {
102             binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC();
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         // Test operation
111
java.lang.String JavaDoc value = null;
112         value = binding.outputPlainText();
113         // TBD - validate results
114
assertEquals(value, "OutputPlainText");
115     }
116
117     public void test6AttachmentPortRPCInputMimeMultipart() throws Exception JavaDoc {
118         test.wsdl.attachments.Pt1 binding;
119         try {
120             binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC();
121         } catch (javax.xml.rpc.ServiceException JavaDoc jre) {
122             if (jre.getLinkedCause() != null)
123                 jre.getLinkedCause().printStackTrace();
124             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
125         }
126         assertTrue("binding is null", binding != null);
127
128         // Test operation
129
binding.inputMimeMultipart(createMimeMultipart("InputMimeMultipart"));
130         // TBD - validate results
131
}
132
133     public void test7AttachmentPortRPCInoutMimeMultipart() throws Exception JavaDoc {
134         test.wsdl.attachments.Pt1 binding;
135         try {
136             binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC();
137         } catch (javax.xml.rpc.ServiceException JavaDoc jre) {
138             if (jre.getLinkedCause() != null)
139                 jre.getLinkedCause().printStackTrace();
140             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
141         }
142         assertTrue("binding is null", binding != null);
143
144         // Test operation
145
javax.mail.internet.MimeMultipart JavaDoc value = null;
146         value = binding.inoutMimeMultipart(createMimeMultipart("InoutMimeMultipart"));
147         // TBD - validate results
148
}
149
150     public void test8AttachmentPortRPCEchoMimeMultipart() throws Exception JavaDoc {
151         test.wsdl.attachments.Pt1 binding;
152         try {
153             binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC();
154         } catch (javax.xml.rpc.ServiceException JavaDoc jre) {
155             if (jre.getLinkedCause() != null)
156                 jre.getLinkedCause().printStackTrace();
157             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
158         }
159         assertTrue("binding is null", binding != null);
160
161         // Test operation
162
javax.mail.internet.MimeMultipart JavaDoc value = null;
163         value = binding.echoMimeMultipart(createMimeMultipart("EchoMimeMultipart"));
164         // TBD - validate results
165
}
166
167     public void test9AttachmentPortRPCOutputMimeMultipart() throws Exception JavaDoc {
168         test.wsdl.attachments.Pt1 binding;
169         try {
170             binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC();
171         } catch (javax.xml.rpc.ServiceException JavaDoc jre) {
172             if (jre.getLinkedCause() != null)
173                 jre.getLinkedCause().printStackTrace();
174             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
175         }
176         assertTrue("binding is null", binding != null);
177
178         // Test operation
179
javax.mail.internet.MimeMultipart JavaDoc value = null;
180         value = binding.outputMimeMultipart();
181         // TBD - validate results
182
}
183
184     public void test10AttachmentPortRPCEchoAttachment() throws Exception JavaDoc {
185         test.wsdl.attachments.Pt1 binding;
186         try {
187             binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC();
188         }
189         catch (javax.xml.rpc.ServiceException JavaDoc jre) {
190             if(jre.getLinkedCause()!=null)
191                 jre.getLinkedCause().printStackTrace();
192             throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
193         }
194         assertTrue("binding is null", binding != null);
195
196         // Test operation
197
org.apache.axis.attachments.OctetStream input = new org.apache.axis.attachments.OctetStream("EchoAttachment".getBytes());
198         org.apache.axis.attachments.OctetStream output = null;
199         output = binding.echoAttachment(input);
200         // TBD - validate results
201
assertTrue(Arrays.equals(input.getBytes(), output.getBytes()));
202     }
203 }
204
Popular Tags