whitlock 2003/02/12 08:48:48
Modified: java/test/mime Mime.wsdl MimeTest.java
java/src/org/apache/wsif/providers/soap/apacheaxis
WSIFJmsSender.java
java/src/org/apache/wsif/util/jms JMS2HTTPBridge.java
Log:
16993: Add in MIME/Jms tests and improved diagnostics in JMS2HTTPBridge
Revision Changes Path
1.10 +412 -5 xml-axis-wsif/java/test/mime/Mime.wsdl
Index: Mime.wsdl
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/mime/Mime.wsdl,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Mime.wsdl 21 Jan 2003 17:12:02 -0000 1.9
+++ Mime.wsdl 12 Feb 2003 16:48:47 -0000 1.10
@@ -163,6 +163,10 @@
</portType>
<!-- binding declns -->
+ <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
+ <!-- SOAP HTTP BINDING -->
+ <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
+
<binding name="SOAPHttpBinding" type="tns:Mime">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
@@ -567,12 +571,415 @@
</output>
</operation>
</binding>
+
+ <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
+ <!-- SOAP JMS BINDING -->
+ <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
- <!-- Mime/Axis/Jms is not supported at present
- binding name="SOAPJmsBinding" type="tns:Mime">
+ <binding name="SOAPJmsBinding" type="tns:Mime">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/jms"/>
- </binding -->
+ <operation name="dataHandlerToString">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/html"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <operation name="stringToDataHandler">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/html"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </output>
+ </operation>
+
+ <operation name="plainTextToString">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="plaintext" type="text/plain"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <operation name="stringToPlainText">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="plaintext" type="text/plain"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </output>
+ </operation>
+
+ <operation name="bounceImage">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="image1" type="image/jpeg"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="image2" type="image/jpeg"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </output>
+ </operation>
+
+ <operation name="bounceImage2">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="image/jpeg"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file2" type="image/jpeg"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </output>
+ </operation>
+
+ <!-- bounceImage4 takes a boolean as well as an image. The boolean says
+ whether the image should be returned. This allows us to test mixing
+ soap and mime parts, and passing and returning null attachments -->
+ <operation name="bounceImage4">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="image/jpeg"/>
+ </mime:part>
+ <mime:part>
+ <soap:body use="encoded" parts="shouldBounce"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file2" type="image/jpeg"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </output>
+ </operation>
+
+ <!-- orMultiMimeParts tests passing in one of two different mime parts -->
+ <operation name="orMultiMimeParts">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/html"/>
+ <mime:content part="file" type="image/jpeg"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <!-- andMultiMimeParts tests passing in two different mime parts -->
+ <operation name="andMultiMimeParts">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/plain"/>
+ </mime:part>
+ <mime:part>
+ <mime:content part="file2" type="text/plain"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <!-- multiOutMimeParts tests returning multiple output mime parts -->
+ <operation name="multiOutMimeParts">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/plain"/>
+ </mime:part>
+ <mime:part>
+ <mime:content part="file2" type="text/plain"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </output>
+ </operation>
+
+ <!-- multiInoutMimeParts tests multiple inout mime parts -->
+ <operation name="multiInoutMimeParts">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/plain"/>
+ </mime:part>
+ <mime:part>
+ <mime:content part="file2" type="text/plain"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/plain"/>
+ </mime:part>
+ <mime:part>
+ <mime:content part="file2" type="text/plain"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </output>
+ </operation>
+
+ <!-- Defining a mime message that doesn't contain any attachments is
+ probably valid. Anyway we allow it -->
+ <operation name="noContent">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <!-- Test out type="text/*" -->
+ <operation name="typeStar">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/*"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <!-- Test out soap:body parts="a b c" -->
+ <operation name="soapBodyParts1">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ parts="shouldBounce" />
+ </mime:part>
+ <mime:part>
+ <mime:content part="file" type="text/plain"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <operation name="soapBodyParts2">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/plain"/>
+ </mime:part>
+ <mime:part>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ parts="" />
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <operation name="soapBodyParts3">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ parts="shouldBounce" />
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <operation name="soapBodyParts4">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ parts="" />
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <operation name="arrayOfBinary">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/html"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <operation name="optionalSoapBody">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/html"/>
+ </mime:part>
+ <mime:part>
+ <!-- This soap:body deliberately doesn't have a parts=""
+ to test that the soap body defaults to excluding the
+ attachment -->
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file2" type="text/html"/>
+ </mime:part>
+ <mime:part>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </output>
+ </operation>
+
+ <operation name="mixMimeParts">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file1" type="text/html"/>
+ </mime:part>
+ <mime:part>
+ <mime:content part="file2" type="text/html"/>
+ </mime:part>
+ <mime:part>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ parts="position1 position2 position3"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+ </binding>
<!-- service decln -->
<service name="MimeService">
@@ -582,7 +989,7 @@
<port name="AXISPort" binding="tns:SOAPHttpBinding">
<soap:address location="http://localhost:8080/axis/services/Mime"/>
</port>
- <!-- port name="SOAPJMSPort" binding="tns:SOAPJmsBinding">
+ <port name="SOAPJMSPort" binding="tns:SOAPJmsBinding">
<jms:address jndiDestinationName="SoapJmsAddressBookQueue"
destinationStyle="queue"
jndiConnectionFactoryName="WSIFSampleQCF"
@@ -590,7 +997,7 @@
jndiProviderURL="file:///JNDI-Directory">
<jms:propertyValue name="SOAPAction" type="xsd:string" value=" "/>
</jms:address>
- </port -->
+ </port>
</service>
</definitions>
1.11 +368 -230 xml-axis-wsif/java/test/mime/MimeTest.java
Index: MimeTest.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/mime/MimeTest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- MimeTest.java 21 Jan 2003 17:12:02 -0000 1.10
+++ MimeTest.java 12 Feb 2003 16:48:47 -0000 1.11
@@ -111,8 +111,7 @@
private final static String imageLocation = wsdlPath + "axis.jpg";
private final static String flatfileLocation = wsdlPath + "test.txt";
private final static String flatfileLocation2 = wsdlPath + "test2.txt";
- private final static String portName =
- TestUtilities.getSoapServer().toUpperCase() + "Port";
+ private String server = TestUtilities.getSoapServer().toUpperCase();
private final static String SEND_DH = "SEND-DH";
private final static String RECEIVE_DH = "RECEIVE-DH";
@@ -147,21 +146,23 @@
private final static String BAD_PART = "BAD-PART";
private final static String BAD_NESTED = "BAD-NESTED";
private final static String BAD_MIX_SOAP_MIME = "BAD-MIX-SOAP-MIME";
- private final static String BAD_MULTIPLE_SOAP_BODIES =
"BAD-MULTIPLE-SOAP-BODIES";
+ private final static String BAD_MULTIPLE_SOAP_BODIES =
+ "BAD-MULTIPLE-SOAP-BODIES";
private final static String BAD_SOAP_BODY_TYPE = "BAD-SOAP-BODY-TYPE";
/**
* Milliseconds to sleep while the user looks at the displayed images.
*/
private int SLEEPY_TIME = 0;
-
+
private final static String[] rhyme =
- { "The owl and the pussy cat went to sea in a beautiful pea-green boat,",
- "They took some honey and plenty of money wrapped up in a five pound
note" };
+ {
+ "The owl and the pussy cat went to sea in a beautiful pea-green boat,",
+ "They took some honey and plenty of money wrapped up in a five pound
note" };
private final boolean SYNC = true;
private final boolean ASYNC = false;
-
+
public MimeTest(String name) {
super(name);
@@ -176,9 +177,9 @@
}
public static void main(String[] args) {
- // TestUtilities.startListeners(TestUtilities.ADDRESSBOOK_LISTENER);
- junit.textui.TestRunner.run (suite());
- // TestUtilities.stopListeners();
+ TestUtilities.startListeners(TestUtilities.MIME_LISTENER);
+ junit.textui.TestRunner.run(suite());
+ TestUtilities.stopListeners();
}
public static Test suite() {
@@ -189,53 +190,57 @@
TestUtilities.setUpExtensionsAndProviders();
}
- public void testSendHandler() {
- doit(SEND_DH, "Mime.wsdl");
+ /* ***************************************************/
+ /* AXIS/HTTP tests */
+ /* ***************************************************/
+
+ public void testSendHandlerHttp() {
+ doit(server + "Port", SEND_DH, "Mime.wsdl");
}
- public void testReceiveHandler() {
- doit(RECEIVE_DH, "Mime.wsdl");
+ public void testReceiveHandlerHttp() {
+ doit(server + "Port", RECEIVE_DH, "Mime.wsdl");
}
/*
* Attachments that are Strings, Images, are not supported at present.
* Attachments can only be DataHandlers.
*
- * public void testSendPlainText() {
- * doit(SEND_PLAINTEXT, "Mime.wsdl");
+ * public void testSendPlainTextHttp() {
+ * doit(server+"Port", SEND_PLAINTEXT, "Mime.wsdl");
* }
*
- * public void testReceivePlainText() {
- * doit(RECEIVE_PLAINTEXT, "Mime.wsdl");
+ * public void testReceivePlainTextHttp() {
+ * doit(server+"Port", RECEIVE_PLAINTEXT, "Mime.wsdl");
* }
*
- * public void testBounceImage() {
- * doit(BOUNCE_IMAGE, "Mime.wsdl");
+ * public void testBounceImageHttp() {
+ * doit(server+"Port", BOUNCE_IMAGE, "Mime.wsdl");
* }
*/
- public void testBounceImage2() {
- doit(BOUNCE_IMAGE2, "Mime.wsdl");
+ public void testBounceImage2Http() {
+ doit(server + "Port", BOUNCE_IMAGE2, "Mime.wsdl");
}
- public void testBounceImage3() {
- doit(BOUNCE_IMAGE3, "Mime.wsdl");
+ public void testBounceImage3Http() {
+ doit(server + "Port", BOUNCE_IMAGE3, "Mime.wsdl");
}
- public void testBounceImage4Default() {
- doit(BOUNCE_IMAGE4_DEFAULT, "Mime.wsdl");
+ public void testBounceImage4DefaultHttp() {
+ doit(server + "Port", BOUNCE_IMAGE4_DEFAULT, "Mime.wsdl");
}
-
- public void testBounceImage4False() {
- doit(BOUNCE_IMAGE4_FALSE, "Mime.wsdl");
+
+ public void testBounceImage4FalseHttp() {
+ doit(server + "Port", BOUNCE_IMAGE4_FALSE, "Mime.wsdl");
}
/*
* This next test fails because axis will not allow null
* parameters to be passed in.
*
- * public void testBounceImage4Null() {
- * doit(BOUNCE_IMAGE4_NULL, "Mime.wsdl");
+ * public void testBounceImage4NullHttp() {
+ * doit(server+"Port", BOUNCE_IMAGE4_NULL, "Mime.wsdl");
* }
*/
@@ -250,20 +255,20 @@
*/
/*
- * public void testSendSource() {
- * doit(SEND_SOURCE, "Mime.wsdl");
+ * public void testSendSourceHttp() {
+ * doit(server+"Port", SEND_SOURCE, "Mime.wsdl");
* }
*
- * public void testReceiveSource() {
- * doit(RECEIVE_SOURCE, "Mime.wsdl");
+ * public void testReceiveSourceHttp() {
+ * doit(server+"Port", RECEIVE_SOURCE, "Mime.wsdl");
* }
*
- * public void testSendMimeMultipart() {
- * doit(SEND_MIMEMULTIPART, "Mime.wsdl");
+ * public void testSendMimeMultipartHttp() {
+ * doit(server+"Port", SEND_MIMEMULTIPART, "Mime.wsdl");
* }
*
- * public void testReceiveMimeMultipart() {
- * doit(RECEIVE_MIMEMULTIPART, "Mime.wsdl");
+ * public void testReceiveMimeMultipartHttp() {
+ * doit(server+"Port", RECEIVE_MIMEMULTIPART, "Mime.wsdl");
* }
*/
@@ -279,97 +284,182 @@
* commented out this Jms test (and omitted other JMS tests like
* the async tests) because it fails.
*
- * public void testJmsSend() {
- * doit("SOAPJMSPort", SEND, "Mime.wsdl");
+ * public void testJmsSendHttp() {
+ * doit(server+"Port", "SOAPJMSPort", SEND, "Mime.wsdl");
* }
*/
- public void testOrMultiParts1() {
- doit(OR_MULTIPARTS1, "Mime.wsdl");
+ public void testOrMultiParts1Http() {
+ doit(server + "Port", OR_MULTIPARTS1, "Mime.wsdl");
}
- public void testOrMultiParts2() {
- doit(OR_MULTIPARTS2, "Mime.wsdl");
+ public void testOrMultiParts2Http() {
+ doit(server + "Port", OR_MULTIPARTS2, "Mime.wsdl");
}
- public void testAndMultiParts() {
- doit(AND_MULTIPARTS, "Mime.wsdl");
+ public void testAndMultiPartsHttp() {
+ doit(server + "Port", AND_MULTIPARTS, "Mime.wsdl");
}
/*
- * public void testMultiOutParts() {
- * doit(MULTI_OUT_PARTS, "Mime.wsdl");
+ * public void testMultiOutPartsHttp() {
+ * doit(server+"Port", MULTI_OUT_PARTS, "Mime.wsdl");
* }
*
- * public void testMultiInoutParts() {
- * doit(MULTI_INOUT_PARTS, "Mime.wsdl");
+ * public void testMultiInoutPartsHttp() {
+ * doit(server+"Port", MULTI_INOUT_PARTS, "Mime.wsdl");
* }
*/
- public void testNoContent() {
- doit(NO_CONTENT, "Mime.wsdl");
+ public void testNoContentHttp() {
+ doit(server + "Port", NO_CONTENT, "Mime.wsdl");
}
- public void testTypeStar() {
- doit(TYPE_STAR, "Mime.wsdl");
+ public void testTypeStarHttp() {
+ doit(server + "Port", TYPE_STAR, "Mime.wsdl");
}
- public void testSoapBodyParts1() {
- doit(SOAP_BODY_PARTS1, "Mime.wsdl");
+ public void testSoapBodyParts1Http() {
+ doit(server + "Port", SOAP_BODY_PARTS1, "Mime.wsdl");
}
- public void testSoapBodyParts2() {
- doit(SOAP_BODY_PARTS2, "Mime.wsdl");
+ public void testSoapBodyParts2Http() {
+ doit(server + "Port", SOAP_BODY_PARTS2, "Mime.wsdl");
}
- public void testSoapBodyParts3() {
- doit(SOAP_BODY_PARTS3, "Mime.wsdl");
+ public void testSoapBodyParts3Http() {
+ doit(server + "Port", SOAP_BODY_PARTS3, "Mime.wsdl");
}
- public void testSoapBodyParts4() {
- doit(SOAP_BODY_PARTS4, "Mime.wsdl");
+ public void testSoapBodyParts4Http() {
+ doit(server + "Port", SOAP_BODY_PARTS4, "Mime.wsdl");
}
- public void testArrayOfBinary() {
- doit(ARRAY_OF_BINARY, "Mime.wsdl");
+ public void testArrayOfBinaryHttp() {
+ doit(server + "Port", ARRAY_OF_BINARY, "Mime.wsdl");
}
- public void testMapType() {
- doit(MAP_TYPE, "Mime.wsdl");
+ public void testMapTypeHttp() {
+ doit(server + "Port", MAP_TYPE, "Mime.wsdl");
}
- public void testOptionalSoapBody() {
- doit(OPTIONAL_SOAP_BODY, "Mime.wsdl");
+ public void testOptionalSoapBodyHttp() {
+ doit(server + "Port", OPTIONAL_SOAP_BODY, "Mime.wsdl");
}
- public void testMixMimeParts() {
- doit(MIX_MIME_PARTS, "Mime.wsdl");
+ public void testMixMimePartsHttp() {
+ doit(server + "Port", MIX_MIME_PARTS, "Mime.wsdl");
}
- /* ************ ERRORS **************** */
+ /* ***************************************************/
+ /* AXIS/JMS tests */
+ /* ***************************************************/
+
+ public void testSendHandlerJms() {
+ doit("SOAPJMSPort", SEND_DH, "Mime.wsdl");
+ }
- public void testBadNoPart() {
- doit(BAD_NO_PART, "MimeBadNoPart.wsdl");
+ public void testReceiveHandlerJms() {
+ doit("SOAPJMSPort", RECEIVE_DH, "Mime.wsdl");
}
- public void testBadPart() {
- doit(BAD_PART, "MimeBadPart.wsdl");
+// public void testBounceImage2Jms() {
+// doit("SOAPJMSPort", BOUNCE_IMAGE2, "Mime.wsdl");
+// }
+//
+// public void testBounceImage3Jms() {
+// doit("SOAPJMSPort", BOUNCE_IMAGE3, "Mime.wsdl");
+// }
+//
+// public void testBounceImage4DefaultJms() {
+// doit("SOAPJMSPort", BOUNCE_IMAGE4_DEFAULT, "Mime.wsdl");
+// }
+
+ public void testBounceImage4FalseJms() {
+ doit("SOAPJMSPort", BOUNCE_IMAGE4_FALSE, "Mime.wsdl");
}
- public void testBadNested() {
- doit(BAD_NESTED, "MimeBadNested.wsdl");
+ public void testOrMultiParts1Jms() {
+ doit("SOAPJMSPort", OR_MULTIPARTS1, "Mime.wsdl");
}
- public void testBadMixSoapMime() {
- doit(BAD_MIX_SOAP_MIME, "MimeBadMixSoapMime.wsdl");
+ public void testOrMultiParts2Jms() {
+ doit("SOAPJMSPort", OR_MULTIPARTS2, "Mime.wsdl");
}
- public void testBadMultipleSoapBodies() {
- doit(BAD_MULTIPLE_SOAP_BODIES, "MimeBadMultipleSoapBodies.wsdl");
+ public void testAndMultiPartsJms() {
+ doit("SOAPJMSPort", AND_MULTIPARTS, "Mime.wsdl");
}
- public void testBadSoapBodyType() {
- doit(BAD_SOAP_BODY_TYPE, "MimeBadSoapBodyType.wsdl");
+ public void testNoContentJms() {
+ doit("SOAPJMSPort", NO_CONTENT, "Mime.wsdl");
+ }
+
+ public void testTypeStarJms() {
+ doit("SOAPJMSPort", TYPE_STAR, "Mime.wsdl");
+ }
+
+ public void testSoapBodyParts1Jms() {
+ doit("SOAPJMSPort", SOAP_BODY_PARTS1, "Mime.wsdl");
+ }
+
+ public void testSoapBodyParts2Jms() {
+ doit("SOAPJMSPort", SOAP_BODY_PARTS2, "Mime.wsdl");
+ }
+
+ public void testSoapBodyParts3Jms() {
+ doit("SOAPJMSPort", SOAP_BODY_PARTS3, "Mime.wsdl");
+ }
+
+ public void testSoapBodyParts4Jms() {
+ doit("SOAPJMSPort", SOAP_BODY_PARTS4, "Mime.wsdl");
+ }
+
+ public void testArrayOfBinaryJms() {
+ doit("SOAPJMSPort", ARRAY_OF_BINARY, "Mime.wsdl");
+ }
+
+ public void testMapTypeJms() {
+ doit("SOAPJMSPort", MAP_TYPE, "Mime.wsdl");
+ }
+
+// public void testOptionalSoapBodyJms() {
+// doit("SOAPJMSPort", OPTIONAL_SOAP_BODY, "Mime.wsdl");
+// }
+
+ public void testMixMimePartsJms() {
+ doit("SOAPJMSPort", MIX_MIME_PARTS, "Mime.wsdl");
+ }
+
+ /* ***************************************************/
+ /* ERROR tests */
+ /* ***************************************************/
+
+ public void testBadNoPartHttp() {
+ doit(server + "Port", BAD_NO_PART, "MimeBadNoPart.wsdl");
+ }
+
+ public void testBadPartHttp() {
+ doit(server + "Port", BAD_PART, "MimeBadPart.wsdl");
+ }
+
+ public void testBadNestedHttp() {
+ doit(server + "Port", BAD_NESTED, "MimeBadNested.wsdl");
+ }
+
+ public void testBadMixSoapMimeHttp() {
+ doit(server + "Port", BAD_MIX_SOAP_MIME, "MimeBadMixSoapMime.wsdl");
+ }
+
+ public void testBadMultipleSoapBodiesHttp() {
+ doit(
+ server + "Port",
+ BAD_MULTIPLE_SOAP_BODIES,
+ "MimeBadMultipleSoapBodies.wsdl");
+ }
+
+ public void testBadSoapBodyTypeHttp() {
+ doit(server + "Port", BAD_SOAP_BODY_TYPE, "MimeBadSoapBodyType.wsdl");
}
/**
@@ -382,13 +472,21 @@
* DataHandler, not a String. So be careful where mapTypes(plaintext,String)
* is done.
*/
- private void doit(String cmd, String wsdl) {
+ private void doit(String portName, String cmd, String wsdl) {
if (!TestUtilities.areWeTesting("mime"))
return;
-
+ if (portName.toUpperCase().indexOf("JMS") != -1
+ && !TestUtilities.areWeTesting("jms"))
+ return;
+
WSIFPluggableProviders.overrideDefaultProvider(
"http://schemas.xmlsoap.org/wsdl/soap/",
- new org.apache.wsif.providers.soap.apacheaxis
+ new org
+ .apache
+ .wsif
+ .providers
+ .soap
+ .apacheaxis
.WSIFDynamicProvider_ApacheAxis());
try {
@@ -408,75 +506,75 @@
stub = (Mime) service.getStub(portName, Mime.class);
if (cmd.equals(SEND_DH))
- send_dh(service,stub);
+ send_dh(service, stub);
else if (cmd.equals(RECEIVE_DH))
- receive_dh(service,stub);
+ receive_dh(service, stub);
else if (cmd.equals(SEND_PLAINTEXT))
- send_plaintext(service,stub);
+ send_plaintext(service, stub);
else if (cmd.equals(RECEIVE_PLAINTEXT))
- receive_plaintext(service,stub);
+ receive_plaintext(service, stub);
else if (cmd.equals(BOUNCE_IMAGE))
- bounce_image(service,stub);
+ bounce_image(service, stub);
else if (cmd.equals(BOUNCE_IMAGE2))
- bounce_image2(service,stub,portName);
+ bounce_image2(service, stub, portName);
else if (cmd.equals(BOUNCE_IMAGE3))
- bounce_image3(service,stub,portName);
+ bounce_image3(service, stub, portName);
else if (cmd.equals(BOUNCE_IMAGE4_DEFAULT))
- bounce_image4_default(service,stub,portName);
+ bounce_image4_default(service, stub, portName);
else if (cmd.equals(BOUNCE_IMAGE4_FALSE))
- bounce_image4_false(service,stub,portName);
+ bounce_image4_false(service, stub, portName);
else if (cmd.equals(BOUNCE_IMAGE4_NULL))
- bounce_image4_null(service,stub,portName);
+ bounce_image4_null(service, stub, portName);
else if (cmd.equals(SEND_SOURCE))
- send_source(service,stub);
+ send_source(service, stub);
else if (cmd.equals(RECEIVE_SOURCE))
- receive_source(service,stub);
+ receive_source(service, stub);
else if (cmd.equals(SEND_MIMEMULTIPART))
- send_mimemultipart(service,stub);
+ send_mimemultipart(service, stub);
else if (cmd.equals(RECEIVE_MIMEMULTIPART))
- receive_mimemultipart(service,stub);
+ receive_mimemultipart(service, stub);
else if (cmd.equals(OR_MULTIPARTS1))
- or_multiparts1(service,stub);
+ or_multiparts1(service, stub);
else if (cmd.equals(OR_MULTIPARTS2))
- or_multiparts2(service,stub);
+ or_multiparts2(service, stub);
else if (cmd.equals(AND_MULTIPARTS))
- and_multiparts(service,stub);
+ and_multiparts(service, stub);
else if (cmd.equals(MULTI_OUT_PARTS))
- multi_out_parts(service,stub);
+ multi_out_parts(service, stub);
else if (cmd.equals(MULTI_INOUT_PARTS))
- multi_inout_parts(service,stub);
+ multi_inout_parts(service, stub);
else if (cmd.equals(NO_CONTENT))
- no_content(service,stub);
+ no_content(service, stub);
else if (cmd.equals(TYPE_STAR))
- type_star(service,stub);
+ type_star(service, stub);
else if (cmd.equals(SOAP_BODY_PARTS1))
- soap_body_parts1(service,stub);
+ soap_body_parts1(portName, service, stub);
else if (cmd.equals(SOAP_BODY_PARTS2))
- soap_body_parts2(service,stub);
+ soap_body_parts2(portName, service, stub);
else if (cmd.equals(SOAP_BODY_PARTS3))
- soap_body_parts3(service,stub);
+ soap_body_parts3(portName, service, stub);
else if (cmd.equals(SOAP_BODY_PARTS4))
- soap_body_parts4(service,stub);
+ soap_body_parts4(portName, service, stub);
else if (cmd.equals(ARRAY_OF_BINARY))
- array_of_binary(service,stub);
+ array_of_binary(service, stub);
else if (cmd.equals(MAP_TYPE))
- map_type(service,stub);
+ map_type(service, stub);
else if (cmd.equals(OPTIONAL_SOAP_BODY))
- optional_soap_body(service,stub);
+ optional_soap_body(service, stub);
else if (cmd.equals(MIX_MIME_PARTS))
- mix_mime_parts(service,stub);
+ mix_mime_parts(portName, service, stub);
else if (cmd.equals(BAD_NO_PART))
- bad_no_part(service);
+ bad_no_part(portName, service);
else if (cmd.equals(BAD_PART))
- bad_part(service);
+ bad_part(portName, service);
else if (cmd.equals(BAD_NESTED))
- bad_nested(service);
+ bad_nested(portName, service);
else if (cmd.equals(BAD_MIX_SOAP_MIME))
- bad_mix_soap_mime(service);
+ bad_mix_soap_mime(portName, service);
else if (cmd.equals(BAD_MULTIPLE_SOAP_BODIES))
- bad_multiple_soap_bodies(service);
+ bad_multiple_soap_bodies(portName, service);
else if (cmd.equals(BAD_SOAP_BODY_TYPE))
- bad_soap_body_type(service);
+ bad_soap_body_type(portName, service);
else
assertTrue(false);
@@ -489,7 +587,7 @@
WSIFPluggableProviders.overrideDefaultProvider(
"http://schemas.xmlsoap.org/wsdl/soap/",
null);
-
+
WSIFFrame.close();
}
@@ -508,40 +606,35 @@
private void send_plaintext(WSIFService service, Mime stub)
throws Exception {
- service.mapType(
- new QName("http://mime/", "plaintext"),
- String.class);
+ service.mapType(new QName("http://mime/", "plaintext"), String.class);
String buff = stub.plainTextToString(rhyme[0]);
assertTrue(rhyme[0].equals(buff));
}
private void receive_plaintext(WSIFService service, Mime stub)
throws Exception {
- service.mapType(
- new QName("http://mime/", "plaintext"),
- String.class);
+ service.mapType(new QName("http://mime/", "plaintext"), String.class);
String buff = stub.stringToPlainText(rhyme[1]);
assertTrue(rhyme[1].equals(buff));
}
- private void bounce_image(WSIFService service, Mime stub) throws Exception {
- service.mapType(
- new QName("http://mime/", "image"),
- Image.class);
+ private void bounce_image(WSIFService service, Mime stub)
+ throws Exception {
+ service.mapType(new QName("http://mime/", "image"), Image.class);
// This blocks until the image is loaded.
Image im1 = new ImageIcon(imageLocation).getImage();
- WSIFFrame.display(im1,"Original image");
+ WSIFFrame.display(im1, "Original image");
// Could use Image image2 =
Toolkit.getDefaultToolkit().getImage("image.gif");
// which loads the image in the background.
Image im2 = stub.bounceImage(im1);
- WSIFFrame.display(im2,"Bounced image");
+ WSIFFrame.display(im2, "Bounced image");
- System.out.println("Sleeping");
- Thread.sleep(SLEEPY_TIME);
- System.out.println("Woken up");
+ System.out.println("Sleeping");
+ Thread.sleep(SLEEPY_TIME);
+ System.out.println("Woken up");
}
/**
@@ -557,112 +650,126 @@
WSIFMessage in = op.createInputMessage();
WSIFMessage out = op.createOutputMessage();
WSIFMessage fault = op.createFaultMessage();
- in.setObjectPart("file",dh1);
+ in.setObjectPart("file", dh1);
- boolean success = op.executeRequestResponseOperation(in,out,fault);
+ boolean success = op.executeRequestResponseOperation(in, out, fault);
assertTrue(success);
- DataHandler dh2 = (DataHandler)(out.getObjectPart("file2"));
+ DataHandler dh2 = (DataHandler) (out.getObjectPart("file2"));
-// This commented out code displays the image, so proving that the
-// bounced image is correct.
-//
-// InputStream is = dh2.getInputStream();
-// byte[] bBuff = new byte[is.available()];
-// is.read(bBuff);
-// Image im = new ImageIcon(bBuff).getImage();
-// WSIFFrame.display(im,"Image");
-
- assertTrue(compareFiles(dh1,dh2));
+ // This commented out code displays the image, so proving that the
+ // bounced image is correct.
+ //
+ // InputStream is = dh2.getInputStream();
+ // byte[] bBuff = new byte[is.available()];
+ // is.read(bBuff);
+ // Image im = new ImageIcon(bBuff).getImage();
+ // WSIFFrame.display(im,"Image");
+
+ assertTrue(compareFiles(dh1, dh2));
}
private void bounce_image3(WSIFService service, Mime stub, String portName)
throws Exception {
DataHandler dh1 = new DataHandler(new FileDataSource(imageLocation));
DataHandler dh2 = stub.bounceImage2(dh1);
- assertTrue(compareFiles(dh1,dh2));
+ assertTrue(compareFiles(dh1, dh2));
}
- private void bounce_image4_default(WSIFService service, Mime stub, String
portName)
+ private void bounce_image4_default(
+ WSIFService service,
+ Mime stub,
+ String portName)
throws Exception {
DataHandler dh1 = new DataHandler(new FileDataSource(imageLocation));
- DataHandler dh2 = stub.bounceImage4(true, dh1);
- assertTrue(compareFiles(dh1,dh2));
+ DataHandler dh2 = stub.bounceImage4(true, dh1);
+ assertTrue(compareFiles(dh1, dh2));
}
- private void bounce_image4_false(WSIFService service, Mime stub, String
portName)
+ private void bounce_image4_false(
+ WSIFService service,
+ Mime stub,
+ String portName)
throws Exception {
DataHandler dh1 = new DataHandler(new FileDataSource(imageLocation));
DataHandler dh2 = stub.bounceImage4(false, dh1);
- assertTrue(dh2==null);
+ assertTrue(dh2 == null);
}
- private void bounce_image4_null(WSIFService service, Mime stub, String portName)
+ private void bounce_image4_null(
+ WSIFService service,
+ Mime stub,
+ String portName)
throws Exception {
DataHandler dh2 = stub.bounceImage4(true, null);
- assertTrue(dh2==null);
+ assertTrue(dh2 == null);
}
private void send_source(WSIFService service, Mime stub) throws Exception {
- service.mapType(
- new QName("http://mime/", "source"),
- Source.class);
-// String buff = stub.plainTextToString(rhyme[0]);
-// assertTrue(rhyme[0].equals(buff));
+ service.mapType(new QName("http://mime/", "source"), Source.class);
+ // String buff = stub.plainTextToString(rhyme[0]);
+ // assertTrue(rhyme[0].equals(buff));
assertTrue(false);
}
- private void receive_source(WSIFService service, Mime stub) throws Exception {
- service.mapType(
- new QName("http://mime/", "source"),
- Source.class);
-// String buff = stub.stringToPlainText(rhyme[1]);
-// assertTrue(rhyme[1].equals(buff));
+ private void receive_source(WSIFService service, Mime stub)
+ throws Exception {
+ service.mapType(new QName("http://mime/", "source"), Source.class);
+ // String buff = stub.stringToPlainText(rhyme[1]);
+ // assertTrue(rhyme[1].equals(buff));
assertTrue(false);
}
- private void send_mimemultipart(WSIFService service, Mime stub) throws
Exception {
- service.mapType(
- new QName("http://mime/", "mimemultipart"),
- MimeMultipart.class);
-// String buff = stub.plainTextToString(rhyme[0]);
-// assertTrue(rhyme[0].equals(buff));
+ private void send_mimemultipart(WSIFService service, Mime stub)
+ throws Exception {
+ service.mapType(
+ new QName("http://mime/", "mimemultipart"),
+ MimeMultipart.class);
+ // String buff = stub.plainTextToString(rhyme[0]);
+ // assertTrue(rhyme[0].equals(buff));
assertTrue(false);
}
- private void receive_mimemultipart(WSIFService service, Mime stub) throws
Exception {
- service.mapType(
- new QName("http://mime/", "mimemultipart"),
- MimeMultipart.class);
-// String buff = stub.stringToPlainText(rhyme[1]);
-// assertTrue(rhyme[1].equals(buff));
+ private void receive_mimemultipart(WSIFService service, Mime stub)
+ throws Exception {
+ service.mapType(
+ new QName("http://mime/", "mimemultipart"),
+ MimeMultipart.class);
+ // String buff = stub.stringToPlainText(rhyme[1]);
+ // assertTrue(rhyme[1].equals(buff));
assertTrue(false);
}
- private void or_multiparts1(WSIFService service, Mime stub) throws Exception {
+ private void or_multiparts1(WSIFService service, Mime stub)
+ throws Exception {
DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation));
String buff = stub.orMultiMimeParts(dh);
assertTrue("text/plain".equals(buff));
}
- private void or_multiparts2(WSIFService service, Mime stub) throws Exception {
+ private void or_multiparts2(WSIFService service, Mime stub)
+ throws Exception {
DataHandler dh = new DataHandler(new FileDataSource(imageLocation));
String buff = stub.orMultiMimeParts(dh);
assertTrue("image/jpeg".equals(buff));
}
- private void and_multiparts(WSIFService service, Mime stub) throws Exception {
+ private void and_multiparts(WSIFService service, Mime stub)
+ throws Exception {
DataHandler dh1 = new DataHandler(new FileDataSource(flatfileLocation));
- DataHandler dh2 = new DataHandler(new FileDataSource(flatfileLocation2));
- String buff = stub.andMultiMimeParts(dh1,dh2);
- assertTrue(concat(flatfileLocation,flatfileLocation2).equals(buff));
+ DataHandler dh2 =
+ new DataHandler(new FileDataSource(flatfileLocation2));
+ String buff = stub.andMultiMimeParts(dh1, dh2);
+ assertTrue(concat(flatfileLocation, flatfileLocation2).equals(buff));
}
- private void multi_out_parts(WSIFService service, Mime stub) throws Exception {
+ private void multi_out_parts(WSIFService service, Mime stub)
+ throws Exception {
assertTrue(false);
}
- private void multi_inout_parts(WSIFService service, Mime stub) throws Exception
{
+ private void multi_inout_parts(WSIFService service, Mime stub)
+ throws Exception {
assertTrue(false);
}
@@ -681,7 +788,10 @@
* in the soap:body and the WSIFClientProxy doesn't look in the binding
* and so would not be able to find this signature in the portType.
*/
- private void soap_body_parts1(WSIFService service, Mime stub)
+ private void soap_body_parts1(
+ String portName,
+ WSIFService service,
+ Mime stub)
throws Exception {
DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation));
WSIFPort port = service.getPort(portName);
@@ -689,17 +799,20 @@
WSIFMessage in = op.createInputMessage();
WSIFMessage out = op.createOutputMessage();
WSIFMessage fault = op.createFaultMessage();
- in.setBooleanPart("shouldBounce",true);
- in.setObjectPart("file",dh);
+ in.setBooleanPart("shouldBounce", true);
+ in.setObjectPart("file", dh);
- boolean success = op.executeRequestResponseOperation(in,out,fault);
+ boolean success = op.executeRequestResponseOperation(in, out, fault);
assertTrue(success);
- String s = (String)(out.getObjectPart("buff"));
+ String s = (String) (out.getObjectPart("buff"));
assertTrue("1".equals(s));
}
- private void soap_body_parts2(WSIFService service, Mime stub)
+ private void soap_body_parts2(
+ String portName,
+ WSIFService service,
+ Mime stub)
throws Exception {
DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation));
WSIFPort port = service.getPort(portName);
@@ -707,32 +820,38 @@
WSIFMessage in = op.createInputMessage();
WSIFMessage out = op.createOutputMessage();
WSIFMessage fault = op.createFaultMessage();
- in.setObjectPart("file",dh);
+ in.setObjectPart("file", dh);
- boolean success = op.executeRequestResponseOperation(in,out,fault);
+ boolean success = op.executeRequestResponseOperation(in, out, fault);
assertTrue(success);
- String s = (String)(out.getObjectPart("buff"));
+ String s = (String) (out.getObjectPart("buff"));
assertTrue("2".equals(s));
}
- private void soap_body_parts3(WSIFService service, Mime stub)
+ private void soap_body_parts3(
+ String portName,
+ WSIFService service,
+ Mime stub)
throws Exception {
WSIFPort port = service.getPort(portName);
WSIFOperation op = port.createOperation("soapBodyParts3");
WSIFMessage in = op.createInputMessage();
WSIFMessage out = op.createOutputMessage();
WSIFMessage fault = op.createFaultMessage();
- in.setBooleanPart("shouldBounce",true);
+ in.setBooleanPart("shouldBounce", true);
- boolean success = op.executeRequestResponseOperation(in,out,fault);
+ boolean success = op.executeRequestResponseOperation(in, out, fault);
assertTrue(success);
- String s = (String)(out.getObjectPart("buff"));
+ String s = (String) (out.getObjectPart("buff"));
assertTrue("3".equals(s));
}
- private void soap_body_parts4(WSIFService service, Mime stub)
+ private void soap_body_parts4(
+ String portName,
+ WSIFService service,
+ Mime stub)
throws Exception {
WSIFPort port = service.getPort(portName);
WSIFOperation op = port.createOperation("soapBodyParts4");
@@ -740,14 +859,15 @@
WSIFMessage out = op.createOutputMessage();
WSIFMessage fault = op.createFaultMessage();
- boolean success = op.executeRequestResponseOperation(in,out,fault);
+ boolean success = op.executeRequestResponseOperation(in, out, fault);
assertTrue(success);
- String s = (String)(out.getObjectPart("buff"));
+ String s = (String) (out.getObjectPart("buff"));
assertTrue("4".equals(s));
}
- private void array_of_binary(WSIFService service, Mime stub) throws Exception {
+ private void array_of_binary(WSIFService service, Mime stub)
+ throws Exception {
DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation));
String buff = stub.arrayOfBinary(dh);
assertTrue(compareFiles(flatfileLocation, buff));
@@ -767,12 +887,15 @@
throws Exception {
DataHandler dh1 = new DataHandler(new FileDataSource(imageLocation));
DataHandler dh2 = stub.optionalSoapBody(dh1);
- assertTrue(compareFiles(dh1,dh2));
+ assertTrue(compareFiles(dh1, dh2));
}
- private void mix_mime_parts(WSIFService service, Mime stub)
- throws Exception
- {
+ private void mix_mime_parts(
+ String portName,
+ WSIFService service,
+ Mime stub)
+ throws Exception {
+
DataHandler dh1 = new DataHandler(new FileDataSource(flatfileLocation));
DataHandler dh2 =
new DataHandler(new FileDataSource(flatfileLocation2));
@@ -801,8 +924,9 @@
}
/* *********************** ERRORS ********************************** */
-
- private void bad_no_part(WSIFService service) throws Exception {
+
+ private void bad_no_part(String portName, WSIFService service)
+ throws Exception {
DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation));
boolean exceptionCaught = false;
try {
@@ -810,13 +934,14 @@
String buff = stub.badNoPart(dh);
} catch (WSIFException we) {
exceptionCaught = true;
- System.out.println("Expected exception="+we);
+ System.out.println("Expected exception=" + we);
we.printStackTrace();
}
assertTrue(exceptionCaught);
}
- private void bad_part(WSIFService service) throws Exception {
+ private void bad_part(String portName, WSIFService service)
+ throws Exception {
DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation));
boolean exceptionCaught = false;
try {
@@ -824,13 +949,14 @@
String buff = stub.badPart(dh);
} catch (WSIFException we) {
exceptionCaught = true;
- System.out.println("Expected exception="+we);
+ System.out.println("Expected exception=" + we);
we.printStackTrace();
}
assertTrue(exceptionCaught);
}
- private void bad_nested(WSIFService service) throws Exception {
+ private void bad_nested(String portName, WSIFService service)
+ throws Exception {
DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation));
boolean exceptionCaught = false;
try {
@@ -838,13 +964,14 @@
stub.badNested(dh);
} catch (WSIFException we) {
exceptionCaught = true;
- System.out.println("Expected exception="+we);
+ System.out.println("Expected exception=" + we);
we.printStackTrace();
}
assertTrue(exceptionCaught);
}
- private void bad_mix_soap_mime(WSIFService service) throws Exception {
+ private void bad_mix_soap_mime(String portName, WSIFService service)
+ throws Exception {
DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation));
boolean exceptionCaught = false;
try {
@@ -852,13 +979,14 @@
String buff = stub.badMixSoapMime(dh);
} catch (WSIFException we) {
exceptionCaught = true;
- System.out.println("Expected exception="+we);
+ System.out.println("Expected exception=" + we);
we.printStackTrace();
}
assertTrue(exceptionCaught);
}
- private void bad_multiple_soap_bodies(WSIFService service) throws Exception {
+ private void bad_multiple_soap_bodies(String portName, WSIFService service)
+ throws Exception {
DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation));
boolean exceptionCaught = false;
try {
@@ -866,13 +994,14 @@
String buff = stub.badMultipleSoapBodies(dh);
} catch (WSIFException we) {
exceptionCaught = true;
- System.out.println("Expected exception="+we);
+ System.out.println("Expected exception=" + we);
we.printStackTrace();
}
assertTrue(exceptionCaught);
}
- private void bad_soap_body_type(WSIFService service) throws Exception {
+ private void bad_soap_body_type(String portName, WSIFService service)
+ throws Exception {
DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation));
boolean exceptionCaught = false;
try {
@@ -880,16 +1009,17 @@
String buff = stub.badSoapBodyType(dh);
} catch (WSIFException we) {
exceptionCaught = true;
- System.out.println("Expected exception="+we);
+ System.out.println("Expected exception=" + we);
we.printStackTrace();
}
assertTrue(exceptionCaught);
}
/* ******************* UTILITIES ************************************* */
-
+
private boolean compareFiles(DataHandler dh1, DataHandler dh2)
throws FileNotFoundException, IOException {
+ assertTrue(dh1 != null && dh2 != null);
InputStream is1 = dh1.getInputStream();
InputStream is2 = dh2.getInputStream();
boolean success = false;
@@ -906,6 +1036,7 @@
private boolean compareFiles(DataHandler dh, String buff)
throws FileNotFoundException, IOException {
+ assertTrue(dh != null && buff != null);
InputStream is = dh.getInputStream();
boolean success = false;
try {
@@ -919,6 +1050,7 @@
private boolean compareFiles(String one, String buff)
throws FileNotFoundException, IOException {
+ assertTrue(one != null && buff != null);
BufferedInputStream oneStream = null;
File f1 = new File(one);
@@ -938,16 +1070,20 @@
private boolean compareFiles(InputStream is, String buff)
throws FileNotFoundException, IOException {
+ assertTrue(is != null && buff != null);
return compareFiles(is, new ByteArrayInputStream(buff.getBytes()));
}
-
- private boolean compareFiles(InputStream is1, InputStream is2)
+
+ private boolean compareFiles(InputStream is1, InputStream is2)
throws FileNotFoundException, IOException {
+ assertTrue(is1 != null && is2 != null);
int avail1 = is1.available();
int avail2 = is2.available();
- if (avail1 != avail2) return false;
- if (avail1==0) return true;
+ if (avail1 != avail2)
+ return false;
+ if (avail1 == 0)
+ return true;
byte[] buff1 = new byte[avail1];
byte[] buff2 = new byte[avail2];
@@ -965,9 +1101,10 @@
return false;
return true;
}
-
+
private String concat(String one, String two)
throws FileNotFoundException, IOException {
+ assertTrue(one != null && two != null);
InputStream is1 = null;
InputStream is2 = null;
try {
@@ -999,6 +1136,7 @@
}
private String readFile(DataHandler dh) {
+ assertTrue(dh != null);
try {
InputStream is = dh.getInputStream();
byte[] bBuff = new byte[is.available()];
1.12 +43 -33
xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFJmsSender.java
Index: WSIFJmsSender.java
===================================================================
RCS file:
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFJmsSender.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- WSIFJmsSender.java 12 Feb 2003 14:00:33 -0000 1.11
+++ WSIFJmsSender.java 12 Feb 2003 16:48:48 -0000 1.12
@@ -57,6 +57,7 @@
package org.apache.wsif.providers.soap.apacheaxis;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
@@ -81,7 +82,7 @@
* @author Mark Whitlock <[EMAIL PROTECTED]>
*/
public class WSIFJmsSender extends BasicHandler {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
private static final long SYNC_TIMEOUT = WSIFProperties.getSyncTimeout();
private static final long ASYNC_TIMEOUT = WSIFProperties.getAsyncTimeout();
private static final String DUMMY_RESPONSE =
@@ -94,23 +95,25 @@
boolean asyncMode =
messageContext.isPropertyTrue(WSIFJmsTransport.ASYNCOPERATION);
WSIFJMSDestination dest =
- (WSIFJMSDestination)
messageContext.getProperty(WSIFJmsTransport.DESTINATION);
+ (WSIFJMSDestination) messageContext.getProperty(
+ WSIFJmsTransport.DESTINATION);
- Long transportSyncTimeoutValue =
- (Long)messageContext.getProperty(WSIFJmsTransport.SYNC_TIMEOUT);
- long syncTimeout =
- transportSyncTimeoutValue==null
- ? SYNC_TIMEOUT
- : transportSyncTimeoutValue.longValue();
+ Long transportSyncTimeoutValue =
+ (Long) messageContext.getProperty(
+ WSIFJmsTransport.SYNC_TIMEOUT);
+ long syncTimeout =
+ transportSyncTimeoutValue == null
+ ? SYNC_TIMEOUT
+ : transportSyncTimeoutValue.longValue();
Message message = messageContext.getRequestMessage();
-
+
// The next line has the desired side effect of setting
// up MIME attachements correctly.
SOAPConstants sc = messageContext.getSOAPConstants();
String ct = message.getContentType(sc);
dest.setProperty("WSIFContentType", ct);
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
message.writeTo(baos);
String contents = baos.toString();
@@ -123,19 +126,26 @@
// System.out.println("WSIFJmsSender
response("+response.length()+") "+response);
ct = (String) dest.getProperty("WSIFContentType");
String cl = (String) dest.getProperty("WSIFContentLocation");
+
Message responseMessage;
if (ct != null || cl != null)
- responseMessage = new Message(response, false, ct, cl);
+ responseMessage =
+ new Message(
+ new ByteArrayInputStream(response.getBytes()),
+ false,
+ ct,
+ cl);
else
responseMessage = new Message(response);
messageContext.setResponseMessage(responseMessage);
}
} catch (IOException ioe) {
- Trc.exception(ioe);
+ Trc.exception(ioe);
throw new AxisFault(ioe.toString());
} catch (SOAPException se) {
- Trc.exception(se);
- throw new AxisFault(se.toString()); }
+ Trc.exception(se);
+ throw new AxisFault(se.toString());
+ }
Trc.exit();
}
@@ -167,27 +177,27 @@
WSIFCorrelationId cid;
// only save op in the correlation service if there's a response handler
- if ( wsifOp.getResponseHandler() == null ) {
- msgID = dest.send( data );
- cid = new WSIFJMSCorrelationId( msgID );
+ if (wsifOp.getResponseHandler() == null) {
+ msgID = dest.send(data);
+ cid = new WSIFJMSCorrelationId(msgID);
} else {
- Long transportAsyncTimeoutValue =
- (Long)messageContext.getProperty(WSIFJmsTransport.ASYNC_TIMEOUT);
- long asyncTimeout =
- transportAsyncTimeoutValue==null
- ? ASYNC_TIMEOUT
- : transportAsyncTimeoutValue.longValue();
- WSIFCorrelationService correlator =
- WSIFCorrelationServiceLocator.getCorrelationService();
- synchronized( correlator ) {
- msgID = dest.send( data );
- cid = new WSIFJMSCorrelationId( msgID );
- if ( correlator != null ) {
- correlator.put( cid, (Serializable)wsifOp, asyncTimeout );
- }
- }
+ Long transportAsyncTimeoutValue =
+ (Long) messageContext.getProperty(
+ WSIFJmsTransport.ASYNC_TIMEOUT);
+ long asyncTimeout =
+ transportAsyncTimeoutValue == null
+ ? ASYNC_TIMEOUT
+ : transportAsyncTimeoutValue.longValue();
+ WSIFCorrelationService correlator =
+ WSIFCorrelationServiceLocator.getCorrelationService();
+ synchronized (correlator) {
+ msgID = dest.send(data);
+ cid = new WSIFJMSCorrelationId(msgID);
+ if (correlator != null) {
+ correlator.put(cid, (Serializable) wsifOp, asyncTimeout);
+ }
+ }
}
-
// Save msg ID in the WSIFop for this calling client
wsifOp.setAsyncRequestID(new WSIFJMSCorrelationId(msgID));
1.10 +3 -1
xml-axis-wsif/java/src/org/apache/wsif/util/jms/JMS2HTTPBridge.java
Index: JMS2HTTPBridge.java
===================================================================
RCS file:
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/util/jms/JMS2HTTPBridge.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- JMS2HTTPBridge.java 12 Feb 2003 14:00:33 -0000 1.9
+++ JMS2HTTPBridge.java 12 Feb 2003 16:48:48 -0000 1.10
@@ -181,7 +181,7 @@
+ "Start Type = "
+ startType
+ "\n"
- + "syncTimeout = "
+ + "Synchronous Timeout = "
+ syncTimeout
+ "\n"
+ "Verbose = "
@@ -868,6 +868,8 @@
value = "";
}
Trc.event("name=", name, " value=", value);
+ if (verbose)
+ System.out.println("JMS2HTTPBridge name=" + name + " value=" +
value);
if (statusCode == null) {