1 7 8 package test.wsdl.attachments; 9 10 import javax.mail.internet.MimeBodyPart ; 11 import javax.mail.internet.MimeMultipart ; 12 import java.util.Arrays ; 13 14 public class AttachmentTestCase extends junit.framework.TestCase { 15 public AttachmentTestCase(java.lang.String name) { 16 super(name); 17 } 18 19 private MimeMultipart createMimeMultipart(String data) throws Exception { 20 MimeMultipart mpRoot = new MimeMultipart ("mixed"); 22 23 MimeBodyPart mbp1 = new MimeBodyPart (); 25 mbp1.setText(data); 26 mpRoot.addBodyPart(mbp1); 27 return mpRoot; 28 } 29 30 public void test1AttachmentPortRPCGetCompanyInfo2() throws Exception { 31 test.wsdl.attachments.Pt1 binding; 32 try { 33 binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC(); 34 } catch (javax.xml.rpc.ServiceException 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 java.lang.String value = null; 43 value = binding.getCompanyInfo2(0, new java.lang.String ("GetCompanyInfo2"), null); 44 assertEquals(value, "GetCompanyInfo2"); 45 } 46 47 public void test2AttachmentPortRPCInputPlainText() throws Exception { 48 test.wsdl.attachments.Pt1 binding; 49 try { 50 binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC(); 51 } catch (javax.xml.rpc.ServiceException 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 binding.inputPlainText(new java.lang.String ("InputPlainText")); 60 } 62 63 public void test3AttachmentPortRPCInoutPlainText() throws Exception { 64 test.wsdl.attachments.Pt1 binding; 65 try { 66 binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC(); 67 } catch (javax.xml.rpc.ServiceException 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 java.lang.String value = null; 76 value = binding.inoutPlainText(new java.lang.String ("InoutPlainText")); 77 assertEquals(value, "InoutPlainText"); 79 } 80 81 public void test4AttachmentPortRPCEchoPlainText() throws Exception { 82 test.wsdl.attachments.Pt1 binding; 83 try { 84 binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC(); 85 } catch (javax.xml.rpc.ServiceException 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 java.lang.String value = null; 94 value = binding.echoPlainText(new java.lang.String ("EchoPlainText")); 95 assertEquals(value, "EchoPlainText"); 97 } 98 99 public void test5AttachmentPortRPCOutputPlainText() throws Exception { 100 test.wsdl.attachments.Pt1 binding; 101 try { 102 binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC(); 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 java.lang.String value = null; 112 value = binding.outputPlainText(); 113 assertEquals(value, "OutputPlainText"); 115 } 116 117 public void test6AttachmentPortRPCInputMimeMultipart() throws Exception { 118 test.wsdl.attachments.Pt1 binding; 119 try { 120 binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC(); 121 } catch (javax.xml.rpc.ServiceException 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 binding.inputMimeMultipart(createMimeMultipart("InputMimeMultipart")); 130 } 132 133 public void test7AttachmentPortRPCInoutMimeMultipart() throws Exception { 134 test.wsdl.attachments.Pt1 binding; 135 try { 136 binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC(); 137 } catch (javax.xml.rpc.ServiceException 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 javax.mail.internet.MimeMultipart value = null; 146 value = binding.inoutMimeMultipart(createMimeMultipart("InoutMimeMultipart")); 147 } 149 150 public void test8AttachmentPortRPCEchoMimeMultipart() throws Exception { 151 test.wsdl.attachments.Pt1 binding; 152 try { 153 binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC(); 154 } catch (javax.xml.rpc.ServiceException 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 javax.mail.internet.MimeMultipart value = null; 163 value = binding.echoMimeMultipart(createMimeMultipart("EchoMimeMultipart")); 164 } 166 167 public void test9AttachmentPortRPCOutputMimeMultipart() throws Exception { 168 test.wsdl.attachments.Pt1 binding; 169 try { 170 binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC(); 171 } catch (javax.xml.rpc.ServiceException 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 javax.mail.internet.MimeMultipart value = null; 180 value = binding.outputMimeMultipart(); 181 } 183 184 public void test10AttachmentPortRPCEchoAttachment() throws Exception { 185 test.wsdl.attachments.Pt1 binding; 186 try { 187 binding = new test.wsdl.attachments.AttachmentLocator().getAttachmentPortRPC(); 188 } 189 catch (javax.xml.rpc.ServiceException 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 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 assertTrue(Arrays.equals(input.getBytes(), output.getBytes())); 202 } 203 } 204 | Popular Tags |