Author: veithen
Date: Sun Mar 20 15:46:12 2011
New Revision: 1083472
URL: http://svn.apache.org/viewvc?rev=1083472&view=rev
Log:
Merged r1083446 to the 1.6 branch.
Modified:
axis/axis2/java/core/branches/1_6/ (props changed)
axis/axis2/java/core/branches/1_6/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
Propchange: axis/axis2/java/core/branches/1_6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Mar 20 15:46:12 2011
@@ -1 +1 @@
-/axis/axis2/java/core/trunk:1070439,1072077,1072271,1072499,1072510,1078242,1081563,1081587,1081590,1082316,1082322,1082702,1082726,1082738,1083180,1083192,1083379,1083381
+/axis/axis2/java/core/trunk:1070439,1072077,1072271,1072499,1072510,1078242,1081563,1081587,1081590,1082316,1082322,1082702,1082726,1082738,1083180,1083192,1083379,1083381,1083446
Modified:
axis/axis2/java/core/branches/1_6/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java?rev=1083472&r1=1083471&r2=1083472&view=diff
==============================================================================
---
axis/axis2/java/core/branches/1_6/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
(original)
+++
axis/axis2/java/core/branches/1_6/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
Sun Mar 20 15:46:12 2011
@@ -228,24 +228,20 @@ public class AttachmentTest extends Asse
@Validated @Test
public void testGetContent() throws Exception {
- try {
- MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage msg = factory.createMessage();
- AttachmentPart ap = msg.createAttachmentPart();
- Image image = ImageIO.read(TestUtils.getTestFileURL("attach.gif"));
- ap = msg.createAttachmentPart(image, "image/gif");
-
- //Getting Content should return an Image object
- Object o = ap.getContent();
- if (o != null) {
- if (o instanceof Image) {
- //Image object was returned (ok)
- } else {
- fail("Unexpected object was returned");
- }
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage msg = factory.createMessage();
+ AttachmentPart ap = msg.createAttachmentPart();
+ Image image = ImageIO.read(TestUtils.getTestFileURL("attach.gif"));
+ ap = msg.createAttachmentPart(image, "image/gif");
+
+ //Getting Content should return an Image object
+ Object o = ap.getContent();
+ if (o != null) {
+ if (o instanceof Image) {
+ //Image object was returned (ok)
+ } else {
+ fail("Unexpected object was returned");
}
- } catch (Exception e) {
- fail("Exception: " + e);
}
}
@@ -269,39 +265,35 @@ public class AttachmentTest extends Asse
}
@Validated @Test
- public void testSetBase64Content() {
- try {
- MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage msg = factory.createMessage();
- AttachmentPart ap = msg.createAttachmentPart();
-
- String urlString = "http://ws.apache.org/images/project-logo.jpg";
- if (isNetworkedResourceAvailable(urlString)) {
- URL url = new URL(urlString);
- DataHandler dh = new DataHandler(url);
- //Create InputStream from DataHandler's InputStream
- InputStream is = dh.getInputStream();
-
- byte buf[] = IOUtils.getStreamAsByteArray(is);
- //Setting Content via InputStream for image/jpeg mime type
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- Base64.encode(buf, 0, buf.length, bos);
- buf = bos.toByteArray();
- InputStream stream = new ByteArrayInputStream(buf);
- ap.setBase64Content(stream, "image/jpeg");
-
- //Getting Content.. should return InputStream object
- InputStream r = ap.getBase64Content();
- if (r != null) {
- if (r instanceof InputStream) {
- //InputStream object was returned (ok)
- } else {
- fail("Unexpected object was returned");
- }
+ public void testSetBase64Content() throws Exception {
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage msg = factory.createMessage();
+ AttachmentPart ap = msg.createAttachmentPart();
+
+ String urlString = "http://ws.apache.org/images/project-logo.jpg";
+ if (isNetworkedResourceAvailable(urlString)) {
+ URL url = new URL(urlString);
+ DataHandler dh = new DataHandler(url);
+ //Create InputStream from DataHandler's InputStream
+ InputStream is = dh.getInputStream();
+
+ byte buf[] = IOUtils.getStreamAsByteArray(is);
+ //Setting Content via InputStream for image/jpeg mime type
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ Base64.encode(buf, 0, buf.length, bos);
+ buf = bos.toByteArray();
+ InputStream stream = new ByteArrayInputStream(buf);
+ ap.setBase64Content(stream, "image/jpeg");
+
+ //Getting Content.. should return InputStream object
+ InputStream r = ap.getBase64Content();
+ if (r != null) {
+ if (r instanceof InputStream) {
+ //InputStream object was returned (ok)
+ } else {
+ fail("Unexpected object was returned");
}
}
- } catch (Exception e) {
- fail("Exception: " + e);
}
}