| 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; |
| 13 |
import java.net.URL; |
| 14 |
|
| 15 |
public class MimeDOCInteropTestCase extends junit.framework.TestCase { |
| 16 |
public MimeDOCInteropTestCase(java.lang.String name) { |
| 17 |
super(name); |
| 18 |
} |
| 19 |
|
| 20 |
public void testMimeDOCSoapPortWSDL() throws Exception { |
| 21 |
javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance(); |
| 22 |
java.net.URL url = new java.net.URL(new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPortAddress() + "?WSDL"); |
| 23 |
javax.xml.rpc.Service 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 { |
| 28 |
if(url == null) { |
| 29 |
url = new URL(new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPortAddress()); |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
public void test1MimeDOCSoapPortEchoAttachment() throws Exception { |
| 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 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 { |
| 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 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 { |
| 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 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 { |
| 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 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 url = null; |
| 119 |
|
| 120 |
public static void main(String[] args) throws Exception { |
| 121 |
if (args.length == 1) { |
| 122 |
url = new URL(args[0]); |
| 123 |
} else { |
| 124 |
url = new URL(new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPortAddress()); |
| 125 |
} |
| 126 |
junit.textui.TestRunner.run(new junit.framework.TestSuite(MimeDOCInteropTestCase.class)); |
| 127 |
} // main |
| 128 |
} |