whitlock 2003/03/20 08:15:21
Modified: java/test/mime MimeTest.java MimeImpl.java
java/src/org/apache/wsif/providers/soap/apacheaxis
WSIFOperation_ApacheAxis.java
Log:
16993: Get more attachments tests working
Revision Changes Path
1.25 +53 -65 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.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- MimeTest.java 19 Mar 2003 17:11:36 -0000 1.24
+++ MimeTest.java 20 Mar 2003 16:15:20 -0000 1.25
@@ -206,7 +206,7 @@
/* ***************************************************/
/* AXIS/HTTP tests */
/* ***************************************************/
-
+
public void testSendHandlerHttp() {
doit(server + "Port", SEND_DH, "Mime.wsdl");
}
@@ -231,7 +231,6 @@
* doit(server+"Port", BOUNCE_IMAGE, "Mime.wsdl");
* }
*/
-
public void testBounceImage2Http() {
doit(server + "Port", BOUNCE_IMAGE2, "Mime.wsdl");
}
@@ -248,20 +247,9 @@
doit(server + "Port", BOUNCE_IMAGE4_FALSE, "Mime.wsdl");
}
- public void testBounceImage4NullHttp() {
- doit(server+"Port", BOUNCE_IMAGE4_NULL, "Mime.wsdl");
- }
-
-
- /*
- * bounceImage5 doesn't work because the soap:body (which contains a
- * boolean) is within the mime:part. bounceImage4 works because the
- * soap:body is a direct child of the binding input. When I try to
- * run bounceImage5, WSDL4J says the soap:body doesn't contain any
- * parts. But having the soap:body inside the mime:part is valid WSDL
- * (according to the wsdl4j PopulatedExtensionRegistry). So what does
- * it mean?
- */
+ public void testBounceImage4NullHttp() {
+ doit(server + "Port", BOUNCE_IMAGE4_NULL, "Mime.wsdl");
+ }
/*
* public void testSendSourceHttp() {
@@ -303,9 +291,9 @@
* }
*/
-// public void testNoContentHttp() {
-// doit(server + "Port", NO_CONTENT, "Mime.wsdl");
-// }
+ public void testNoContentHttp() {
+ doit(server + "Port", NO_CONTENT, "Mime.wsdl");
+ }
public void testTypeStarHttp() {
doit(server + "Port", TYPE_STAR, "Mime.wsdl");
@@ -319,13 +307,13 @@
doit(server + "Port", SOAP_BODY_PARTS2, "Mime.wsdl");
}
-// public void testSoapBodyParts3Http() {
-// doit(server + "Port", SOAP_BODY_PARTS3, "Mime.wsdl");
-// }
-//
-// public void testSoapBodyParts4Http() {
-// doit(server + "Port", SOAP_BODY_PARTS4, "Mime.wsdl");
-// }
+ public void testSoapBodyParts3Http() {
+ doit(server + "Port", SOAP_BODY_PARTS3, "Mime.wsdl");
+ }
+
+ public void testSoapBodyParts4Http() {
+ doit(server + "Port", SOAP_BODY_PARTS4, "Mime.wsdl");
+ }
public void testArrayOfBinaryHttp() {
doit(server + "Port", ARRAY_OF_BINARY, "Mime.wsdl");
@@ -335,9 +323,9 @@
doit(server + "Port", MAP_TYPE, "Mime.wsdl");
}
-// public void testOptionalSoapBodyHttp() {
-// doit(server + "Port", OPTIONAL_SOAP_BODY, "Mime.wsdl");
-// }
+ public void testOptionalSoapBodyHttp() {
+ doit(server + "Port", OPTIONAL_SOAP_BODY, "Mime.wsdl");
+ }
public void testMixMimePartsHttp() {
doit(server + "Port", MIX_MIME_PARTS, "Mime.wsdl");
@@ -350,19 +338,19 @@
public void testSendUnrefAttachmentPartLotsHttp() {
doit(server + "Port", SEND_UNREF_AP_LOTS, "Mime.wsdl");
}
-
+
public void testSendAttachmentPartHttp() {
doit(server + "Port", SEND_AP, "Mime.wsdl");
}
-// public void testReceiveAttachmentPartHttp() {
-// doit(server + "Port", RECEIVE_AP, "Mime.wsdl");
-// }
+ // public void testReceiveAttachmentPartHttp() {
+ // doit(server + "Port", RECEIVE_AP, "Mime.wsdl");
+ // }
/* ***************************************************/
/* AXIS/JMS tests */
/* ***************************************************/
-
+
public void testSendHandlerJms() {
doit("SOAPJMSPort", SEND_DH, "Mime.wsdl");
}
@@ -371,25 +359,25 @@
doit("SOAPJMSPort", RECEIVE_DH, "Mime.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 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 testBounceImage4NullJms() {
- doit("SOAPJMSPort", BOUNCE_IMAGE4_NULL, "Mime.wsdl");
- }
+ public void testBounceImage4NullJms() {
+ doit("SOAPJMSPort", BOUNCE_IMAGE4_NULL, "Mime.wsdl");
+ }
public void testOrMultiParts1Jms() {
doit("SOAPJMSPort", OR_MULTIPARTS1, "Mime.wsdl");
@@ -403,9 +391,9 @@
doit("SOAPJMSPort", AND_MULTIPARTS, "Mime.wsdl");
}
-// public void testNoContentJms() {
-// doit("SOAPJMSPort", NO_CONTENT, "Mime.wsdl");
-// }
+ public void testNoContentJms() {
+ doit("SOAPJMSPort", NO_CONTENT, "Mime.wsdl");
+ }
public void testTypeStarJms() {
doit("SOAPJMSPort", TYPE_STAR, "Mime.wsdl");
@@ -419,13 +407,13 @@
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 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");
@@ -435,9 +423,9 @@
doit("SOAPJMSPort", MAP_TYPE, "Mime.wsdl");
}
-// public void testOptionalSoapBodyJms() {
-// doit("SOAPJMSPort", OPTIONAL_SOAP_BODY, "Mime.wsdl");
-// }
+ public void testOptionalSoapBodyJms() {
+ doit("SOAPJMSPort", OPTIONAL_SOAP_BODY, "Mime.wsdl");
+ }
public void testMixMimePartsJms() {
doit("SOAPJMSPort", MIX_MIME_PARTS, "Mime.wsdl");
@@ -450,7 +438,7 @@
public void testSendUnrefAttachmentPartLotsJms() {
doit("SOAPJMSPort", SEND_UNREF_AP_LOTS, "Mime.wsdl");
}
-
+
public void testSendAttachmentPartJms() {
doit("SOAPJMSPort", SEND_AP, "Mime.wsdl");
}
@@ -458,7 +446,7 @@
/* ***************************************************/
/* Java tests */
/* ***************************************************/
-
+
public void testSendHandlerJava() {
doit("JavaPort", SEND_DH, "Mime.wsdl");
}
@@ -474,7 +462,7 @@
public void testSendUnrefAttachmentPartLotsJava() {
doit("JavaPort", SEND_UNREF_AP_LOTS, "Mime.wsdl");
}
-
+
public void testSendAttachmentPartJava() {
doit("JavaPort", SEND_AP, "Mime.wsdl");
}
@@ -951,7 +939,7 @@
private void optional_soap_body(WSIFService service, Mime stub)
throws Exception {
- DataHandler dh1 = new DataHandler(new FileDataSource(imageLocation));
+ DataHandler dh1 = new DataHandler(new FileDataSource(flatfileLocation));
DataHandler dh2 = stub.optionalSoapBody(dh1);
assertTrue(compareFiles(dh1, dh2));
}
1.18 +19 -1 xml-axis-wsif/java/test/mime/MimeImpl.java
Index: MimeImpl.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/mime/MimeImpl.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- MimeImpl.java 18 Mar 2003 15:10:03 -0000 1.17
+++ MimeImpl.java 20 Mar 2003 16:15:20 -0000 1.18
@@ -78,6 +78,7 @@
*/
public class MimeImpl {
+ private static final boolean verbose = false;
public String dataHandlerToString(DataHandler dh) {
try {
@@ -233,7 +234,24 @@
}
public DataHandler optionalSoapBody(DataHandler ds) {
- return bounceImage(ds);
+ if (verbose)
+ System.out.println(
+ "MimeImpl.optionalSoapBody ds="
+ + (ds == null ? "<null>" : ds.toString()));
+
+ String s = dataHandlerToString(ds);
+ if (verbose)
+ System.out.println(
+ "MimeImpl.optionalSoapBody s="
+ + (s == null ? "<null>" : s));
+
+ DataHandler dh = stringToDataHandler(s);
+ if (verbose)
+ System.out.println(
+ "MimeImpl.optionalSoapBody dh="
+ + (dh == null ? "<null>" : dh.toString()));
+
+ return dh;
}
public String mixMimeParts(
1.82 +11 -1
xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java
Index: WSIFOperation_ApacheAxis.java
===================================================================
RCS file:
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- WSIFOperation_ApacheAxis.java 19 Mar 2003 15:19:55 -0000 1.81
+++ WSIFOperation_ApacheAxis.java 20 Mar 2003 16:15:20 -0000 1.82
@@ -766,7 +766,7 @@
}
}
- ArrayList mimePartList = null;
+ ArrayList mimePartList = new ArrayList();
if (mimePartNames != null && !mimePartNames.isEmpty()) {
javax.wsdl.Message m = null;
if (isInput) {
@@ -1294,12 +1294,22 @@
} else {
soapParts = outputSOAPParts;
}
+
+ if (!outputMIMEParts.isEmpty()) {
+ soapParts = new ArrayList(soapParts);
+ soapParts.removeAll(outputMIMEParts);
+ }
+
for (int i=1; i < soapParts.size(); i++) {
Part p = (Part) soapParts.get(i);
String name = p.getName();
Object value = respParms.get(name);
setSOAPMessagePart(outMsg, name, value);
}
+
+ // TODO: Bug: this next code assumes that if a method
returns
+ // attachments and non-attachments, the return part is
+ // never an attachment.
int startMIMEindex;
if (soapParts.size() > 0) {
startMIMEindex = 0;