This is an automated email from the ASF dual-hosted git repository.
veithen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git
The following commit(s) were added to refs/heads/master by this push:
new ecfe305a0a Adapt to changes in Axiom
ecfe305a0a is described below
commit ecfe305a0a26e73d14d1e0c4c9c4b291e8dc5784
Author: Andreas Veithen <[email protected]>
AuthorDate: Mon Nov 7 22:54:37 2022 +0000
Adapt to changes in Axiom
---
databinding-tests/jaxbri-tests/pom.xml | 5 +++++
.../test/java/org/apache/axis2/jaxbri/mtom/MtomTest.java | 13 ++++++-------
modules/adb-tests/pom.xml | 5 +++++
.../java/org/apache/axis2/databinding/mtom/MTOMTest.java | 4 ++--
.../axis2/databinding/mtom/service/MTOMServiceImpl.java | 5 +++--
.../apache/axis2/schema/base64binary/Base64BinaryTest.java | 9 +++++----
.../src/org/apache/axis2/databinding/utils/BeanUtil.java | 3 ++-
modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java | 5 +++--
.../apache/axis2/mtom/EchoRawMTOMCommonsChunkingTest.java | 3 ++-
.../test/org/apache/axis2/mtom/EchoRawMTOMLoadTest.java | 3 ++-
.../org/apache/axis2/mtom/EchoRawMTOMStreamingTest.java | 11 ++++-------
.../test/org/apache/axis2/mtom/EchoRawMTOMTest.java | 3 ++-
.../test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java | 8 ++++----
.../axis2/mtom/MessageSaveAndRestoreWithMTOMTest.java | 3 ++-
.../test/org/apache/axis2/swa/EchoRawSwATest.java | 5 +++--
modules/integration/test/org/apache/axis2/swa/EchoSwA.java | 3 ++-
.../axis2/datasource/jaxb/JAXBAttachmentMarshaller.java | 3 ++-
.../axis2/datasource/jaxb/XMLStreamWriterFilterBase.java | 6 +++---
.../axis2/jaxws/message/attachments/AttachmentUtils.java | 3 ++-
.../axis2/jaxws/attachments/MTOMSerializationTests.java | 3 ++-
.../kernel/src/org/apache/axis2/builder/BuilderUtil.java | 3 ++-
.../builder/unknowncontent/UnknownContentOMDataSource.java | 3 ++-
modules/saaj/pom.xml | 5 +++++
.../saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java | 3 ++-
.../org/apache/axis2/saaj/integration/IntegrationTest.java | 11 ++++++-----
modules/transport/base/pom.xml | 4 ++++
.../main/java/org/apache/axis2/format/BinaryBuilder.java | 3 ++-
.../main/java/org/apache/axis2/format/PlainTextBuilder.java | 2 +-
.../axis2/transport/testkit/message/MessageEncoder.java | 7 ++-----
pom.xml | 10 ++++++++++
30 files changed, 97 insertions(+), 57 deletions(-)
diff --git a/databinding-tests/jaxbri-tests/pom.xml
b/databinding-tests/jaxbri-tests/pom.xml
index 496212427b..4c38b85132 100644
--- a/databinding-tests/jaxbri-tests/pom.xml
+++ b/databinding-tests/jaxbri-tests/pom.xml
@@ -79,6 +79,11 @@
<artifactId>testutils</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>blob-testutils</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>jakarta.mail</artifactId>
diff --git
a/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/mtom/MtomTest.java
b/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/mtom/MtomTest.java
index 4a2ca5dafb..1e97f53a4a 100644
---
a/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/mtom/MtomTest.java
+++
b/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/mtom/MtomTest.java
@@ -18,11 +18,10 @@
*/
package org.apache.axis2.jaxbri.mtom;
-import javax.activation.DataHandler;
-import javax.activation.DataSource;
-
-import org.apache.axiom.testutils.activation.RandomDataSource;
+import org.apache.axiom.blob.Blob;
+import org.apache.axiom.testutils.blob.RandomBlob;
import org.apache.axiom.testutils.io.IOTestUtils;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.testutils.Axis2Server;
import org.apache.axis2.testutils.ClientHelper;
import org.junit.ClassRule;
@@ -39,12 +38,12 @@ public class MtomTest {
public void test() throws Exception {
MtomStub stub = clientHelper.createStub(MtomStub.class, "mtom");
UploadDocument uploadRequest = new UploadDocument();
- DataSource contentDS = new RandomDataSource(1234567L, 1024);
- uploadRequest.setContent(new DataHandler(contentDS));
+ Blob blob = new RandomBlob(1234567L, 1024);
+ uploadRequest.setContent(DataHandlerUtils.toDataHandler(blob));
UploadDocumentResponse uploadResponse =
stub.uploadDocument(uploadRequest);
RetrieveDocument retrieveRequest = new RetrieveDocument();
retrieveRequest.setId(uploadResponse.getId());
RetrieveDocumentResponse retrieveResponse =
stub.retrieveDocument(retrieveRequest);
- IOTestUtils.compareStreams(contentDS.getInputStream(),
retrieveResponse.getContent().getInputStream());
+ IOTestUtils.compareStreams(blob.getInputStream(),
retrieveResponse.getContent().getInputStream());
}
}
diff --git a/modules/adb-tests/pom.xml b/modules/adb-tests/pom.xml
index b81c620fac..50a7fb4f7c 100644
--- a/modules/adb-tests/pom.xml
+++ b/modules/adb-tests/pom.xml
@@ -73,6 +73,11 @@
<artifactId>testutils</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>blob-testutils</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>axis2-testutils</artifactId>
diff --git
a/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/MTOMTest.java
b/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/MTOMTest.java
index 82b240bbe7..f35d9e3b9d 100644
---
a/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/MTOMTest.java
+++
b/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/MTOMTest.java
@@ -20,7 +20,7 @@ package org.apache.axis2.databinding.mtom;
import javax.activation.DataHandler;
-import org.apache.axiom.testutils.activation.RandomDataSource;
+import org.apache.axiom.testutils.blob.RandomBlob;
import org.apache.axiom.testutils.io.IOTestUtils;
import org.apache.axis2.Constants;
import org.apache.axis2.databinding.mtom.client.MTOMServiceStub;
@@ -45,7 +45,7 @@ public class MTOMTest {
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
DataHandler content = stub.getContent(new GetContent()).getContent();
IOTestUtils.compareStreams(
- new RandomDataSource(654321L, 1000000).getInputStream(),
"expected",
+ new RandomBlob(654321L, 1000000).getInputStream(), "expected",
content.getInputStream(), "actual");
}
}
diff --git
a/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/service/MTOMServiceImpl.java
b/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/service/MTOMServiceImpl.java
index c843d30c2b..bdedb4b12d 100644
---
a/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/service/MTOMServiceImpl.java
+++
b/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/service/MTOMServiceImpl.java
@@ -22,13 +22,14 @@ import javax.activation.DataHandler;
import javax.jws.WebService;
import javax.xml.ws.soap.MTOM;
-import org.apache.axiom.testutils.activation.RandomDataSource;
+import org.apache.axiom.testutils.blob.RandomBlob;
+import org.apache.axiom.util.activation.DataHandlerUtils;
@WebService(endpointInterface="org.apache.axis2.databinding.mtom.service.MTOMService")
@MTOM
public class MTOMServiceImpl implements MTOMService {
@Override
public DataHandler getContent() {
- return new DataHandler(new RandomDataSource(654321L, 1000000));
+ return DataHandlerUtils.toDataHandler(new RandomBlob(654321L,
1000000));
}
}
diff --git
a/modules/adb-tests/src/test/java/org/apache/axis2/schema/base64binary/Base64BinaryTest.java
b/modules/adb-tests/src/test/java/org/apache/axis2/schema/base64binary/Base64BinaryTest.java
index bb760444a8..0db31d9027 100644
---
a/modules/adb-tests/src/test/java/org/apache/axis2/schema/base64binary/Base64BinaryTest.java
+++
b/modules/adb-tests/src/test/java/org/apache/axis2/schema/base64binary/Base64BinaryTest.java
@@ -20,7 +20,8 @@
package org.apache.axis2.schema.base64binary;
import org.apache.axiom.attachments.ByteArrayDataSource;
-import org.apache.axiom.testutils.activation.RandomDataSource;
+import org.apache.axiom.testutils.blob.RandomBlob;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.schema.AbstractTestCase;
import org.w3.www._2005._05.xmlmime.*;
@@ -82,9 +83,9 @@ public class Base64BinaryTest extends AbstractTestCase {
public void testBase64BinaryUnbounded() throws Exception {
TestBase64BinaryUnbounded bean = new TestBase64BinaryUnbounded();
bean.setParam(new DataHandler[] {
- new DataHandler(new RandomDataSource(1024)),
- new DataHandler(new RandomDataSource(1024)),
- new DataHandler(new RandomDataSource(1024))
+ DataHandlerUtils.toDataHandler(new RandomBlob(1024)),
+ DataHandlerUtils.toDataHandler(new RandomBlob(1024)),
+ DataHandlerUtils.toDataHandler(new RandomBlob(1024)),
});
testSerializeDeserialize(bean);
}
diff --git a/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
b/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
index e9c5e53252..d545f4a2bc 100644
--- a/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
+++ b/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
@@ -55,6 +55,7 @@ import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
import org.apache.axiom.om.*;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axiom.util.base64.Base64Utils;
import org.apache.axis2.AxisFault;
import org.apache.axis2.classloader.BeanInfoCache;
@@ -1215,7 +1216,7 @@ public class BeanUtil {
} else {
wrappingElement = fac.createOMElement(partName,
null);
}
- OMText text = fac.createOMText((DataHandler)arg, true);
+ OMText text =
fac.createOMText(DataHandlerUtils.toBlob((DataHandler)arg), true);
wrappingElement.addChild(text);
objects.add(wrappingElement);
}else if (SimpleTypeMapper.isEnum(arg.getClass())) {
diff --git a/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java
b/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java
index b2ba2d79b6..ca6615bd94 100644
--- a/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java
+++ b/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java
@@ -27,6 +27,7 @@ import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axiom.util.base64.Base64Utils;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
@@ -356,7 +357,7 @@ public class RPCUtil {
} else {
resElemt = fac.createOMElement(partName, null);
}
- OMText text = fac.createOMText((DataHandler)resObject,
true);
+ OMText text =
fac.createOMText(DataHandlerUtils.toBlob((DataHandler)resObject), true);
resElemt.addChild(text);
envelope.getBody().addChild(resElemt);
} else {
@@ -515,7 +516,7 @@ public class RPCUtil {
} else if
(SimpleTypeMapper.isDataHandler(resObject.getClass())) {
OMElement resElemt =
fac.createOMElement(method.getName() + "Response", ns);
- OMText text = fac.createOMText((DataHandler)resObject,
true);
+ OMText text =
fac.createOMText(DataHandlerUtils.toBlob((DataHandler)resObject), true);
OMElement returnElement;
if (service.isElementFormDefault()) {
returnElement =
fac.createOMElement(Constants.RETURN_WRAPPER, ns);
diff --git
a/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMCommonsChunkingTest.java
b/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMCommonsChunkingTest.java
index 0fb914e288..910a0fbbb8 100755
---
a/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMCommonsChunkingTest.java
+++
b/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMCommonsChunkingTest.java
@@ -28,6 +28,7 @@ import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMText;
import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.Constants;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
@@ -83,7 +84,7 @@ public class EchoRawMTOMCommonsChunkingTest extends
UtilServerBasedTestCase
FileDataSource dataSource = new FileDataSource(fileName);
expectedDH = new DataHandler(dataSource);
OMElement subData = fac.createOMElement("subData", omNs);
- OMText textData = fac.createOMText(expectedDH, true);
+ OMText textData =
fac.createOMText(DataHandlerUtils.toBlob(expectedDH), true);
subData.addChild(textData);
data.addChild(subData);
rpcWrapEle.addChild(data);
diff --git
a/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMLoadTest.java
b/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMLoadTest.java
index 4d3c4b77b8..1880d3ba2b 100644
--- a/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMLoadTest.java
+++ b/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMLoadTest.java
@@ -27,6 +27,7 @@ import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMText;
import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.Constants;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
@@ -95,7 +96,7 @@ public class EchoRawMTOMLoadTest extends
UtilServerBasedTestCase implements Test
OMElement subData = fac.createOMElement("subData", omNs);
DataHandler dataHandler = new DataHandler("Thilina", "text/plain");
//new ByteArrayDataSource(expectedByteArray));
- textData = fac.createOMText(dataHandler, true);
+ textData = fac.createOMText(DataHandlerUtils.toBlob(dataHandler),
true);
subData.addChild(textData);
data.addChild(subData);
diff --git
a/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMStreamingTest.java
b/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMStreamingTest.java
index d0e0ce0039..af7c884e9a 100644
---
a/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMStreamingTest.java
+++
b/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMStreamingTest.java
@@ -22,7 +22,8 @@ package org.apache.axis2.mtom;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.axiom.attachments.ByteArrayDataSource;
+import org.apache.axiom.blob.Blob;
+import org.apache.axiom.blob.Blobs;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
@@ -42,7 +43,6 @@ import org.apache.axis2.integration.UtilServer;
import org.apache.axis2.integration.UtilServerBasedTestCase;
import org.apache.axis2.util.Utils;
-import javax.activation.DataHandler;
import javax.xml.namespace.QName;
import java.io.InputStream;
@@ -84,16 +84,13 @@ public class EchoRawMTOMStreamingTest extends
UtilServerBasedTestCase implements
private OMElement createEnvelope() throws Exception {
- DataHandler expectedDH;
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
OMElement rpcWrapEle = fac.createOMElement("mtomSample", omNs);
data = fac.createOMElement("data", omNs);
- expectedDH = new DataHandler(
- new ByteArrayDataSource(new byte[] { 13, 56, 65, 32, 12, 12,
7, -3, -2, -1,
- 98 }));
+ Blob blob = Blobs.createBlob(new byte[] { 13, 56, 65, 32, 12, 12, 7,
-3, -2, -1, 98 });
OMElement subData = fac.createOMElement("subData", omNs);
- OMText textData = fac.createOMText(expectedDH, true);
+ OMText textData = fac.createOMText(blob, true);
subData.addChild(textData);
data.addChild(subData);
rpcWrapEle.addChild(data);
diff --git
a/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java
b/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java
index 7218e942a0..fa8c98bfc2 100644
--- a/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java
+++ b/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java
@@ -31,6 +31,7 @@ import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMText;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.client.Options;
@@ -99,7 +100,7 @@ public class EchoRawMTOMTest extends UtilServerBasedTestCase
implements TestCons
OMElement data = fac.createOMElement("data", omNs);
FileDataSource fileDataSource = new
FileDataSource(TestingUtils.prefixBaseDirectory("test-resources/mtom/test.jpg"));
expectedDH = new DataHandler(fileDataSource);
- expectedTextData = fac.createOMText(expectedDH, true);
+ expectedTextData =
fac.createOMText(DataHandlerUtils.toBlob(expectedDH), true);
data.addChild(expectedTextData);
rpcWrapEle.addChild(data);
return rpcWrapEle;
diff --git
a/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java
b/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java
index 5e40ecf660..f51a7833d9 100644
---
a/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java
+++
b/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java
@@ -22,7 +22,8 @@ package org.apache.axis2.mtom;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.axiom.attachments.ByteArrayDataSource;
+import org.apache.axiom.blob.Blob;
+import org.apache.axiom.blob.Blobs;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
@@ -48,7 +49,6 @@ import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.activation.DataHandler;
import javax.xml.namespace.QName;
public class EchoRawMTOMToBase64Test extends UtilServerBasedTestCase {
@@ -96,8 +96,8 @@ public class EchoRawMTOMToBase64Test extends
UtilServerBasedTestCase {
OMElement rpcWrapEle = fac.createOMElement("echoMTOMtoBase64", omNs);
OMElement data = fac.createOMElement("data", omNs);
byte[] byteArray = new byte[] { 13, 56, 65, 32, 12, 12, 7, 98 };
- DataHandler dataHandler = new DataHandler(new
ByteArrayDataSource(byteArray));
- expectedTextData = fac.createOMText(dataHandler, true);
+ Blob blob = Blobs.createBlob(byteArray);
+ expectedTextData = fac.createOMText(blob, true);
data.addChild(expectedTextData);
rpcWrapEle.addChild(data);
return rpcWrapEle;
diff --git
a/modules/integration/test/org/apache/axis2/mtom/MessageSaveAndRestoreWithMTOMTest.java
b/modules/integration/test/org/apache/axis2/mtom/MessageSaveAndRestoreWithMTOMTest.java
index 1a99db59e5..5f08cb8015 100644
---
a/modules/integration/test/org/apache/axis2/mtom/MessageSaveAndRestoreWithMTOMTest.java
+++
b/modules/integration/test/org/apache/axis2/mtom/MessageSaveAndRestoreWithMTOMTest.java
@@ -30,6 +30,7 @@ import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMText;
import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.client.Options;
@@ -174,7 +175,7 @@ public class MessageSaveAndRestoreWithMTOMTest extends
UtilServerBasedTestCase
FileDataSource fileDataSource = new
FileDataSource(TestingUtils.prefixBaseDirectory("test-resources/mtom/test.jpg"));
DataHandler expectedDataHandler = new DataHandler(fileDataSource);
- expectedTextData = omFactory.createOMText(expectedDataHandler, true);
+ expectedTextData =
omFactory.createOMText(DataHandlerUtils.toBlob(expectedDataHandler), true);
data.addChild(expectedTextData);
rpcWrapperElement.addChild(data);
return rpcWrapperElement;
diff --git a/modules/integration/test/org/apache/axis2/swa/EchoRawSwATest.java
b/modules/integration/test/org/apache/axis2/swa/EchoRawSwATest.java
index 4edc507615..7a68b1b984 100644
--- a/modules/integration/test/org/apache/axis2/swa/EchoRawSwATest.java
+++ b/modules/integration/test/org/apache/axis2/swa/EchoRawSwATest.java
@@ -29,6 +29,7 @@ import org.apache.axiom.om.OMText;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.Constants;
import org.apache.axis2.client.OperationClient;
import org.apache.axis2.client.Options;
@@ -133,8 +134,8 @@ public class EchoRawSwATest extends UtilServerBasedTestCase
implements TestConst
protected void compareDataHandlers(DataHandler dataHandler, DataHandler
dataHandler2) {
OMFactory factory = OMAbstractFactory.getOMFactory();
- String originalTextValue = factory.createOMText(dataHandler,
true).getText();
- String returnedTextValue = factory.createOMText(dataHandler2,
true).getText();
+ String originalTextValue =
factory.createOMText(DataHandlerUtils.toBlob(dataHandler), true).getText();
+ String returnedTextValue =
factory.createOMText(DataHandlerUtils.toBlob(dataHandler2), true).getText();
assertEquals(returnedTextValue, originalTextValue);
}
}
\ No newline at end of file
diff --git a/modules/integration/test/org/apache/axis2/swa/EchoSwA.java
b/modules/integration/test/org/apache/axis2/swa/EchoSwA.java
index c05be2fae9..2277a07ad8 100644
--- a/modules/integration/test/org/apache/axis2/swa/EchoSwA.java
+++ b/modules/integration/test/org/apache/axis2/swa/EchoSwA.java
@@ -23,6 +23,7 @@ import org.apache.axiom.attachments.Attachments;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMText;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.wsdl.WSDLConstants;
@@ -50,7 +51,7 @@ public class EchoSwA {
Attachments attachment = (msgCtx).getAttachmentMap();
DataHandler dataHandler = attachment.getDataHandler(contentID);
- OMText textNode = omEle.getOMFactory().createOMText(dataHandler, true);
+ OMText textNode =
omEle.getOMFactory().createOMText(DataHandlerUtils.toBlob(dataHandler), true);
omEle.build();
child.detach();
omEle.addChild(textNode);
diff --git
a/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java
b/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java
index 9cc8e08976..3a839a49fd 100644
---
a/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java
+++
b/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java
@@ -22,6 +22,7 @@ package org.apache.axis2.datasource.jaxb;
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
import org.apache.axiom.util.UIDGenerator;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.Constants;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.java.security.AccessController;
@@ -202,7 +203,7 @@ public final class JAXBAttachmentMarshaller extends
AttachmentMarshaller {
log.debug("adding DataHandler for MTOM");
}
if (writer instanceof MTOMXMLStreamWriter) {
- cid = ((MTOMXMLStreamWriter)writer).prepareDataHandler(dh);
+ cid =
((MTOMXMLStreamWriter)writer).prepareBlob(DataHandlerUtils.toBlob(dh));
if (cid != null) {
if (log.isDebugEnabled()){
log.debug("The MTOM attachment is written as an
attachment part.");
diff --git
a/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterFilterBase.java
b/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterFilterBase.java
index 60c60e9aea..bc9aecbea4 100644
---
a/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterFilterBase.java
+++
b/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterFilterBase.java
@@ -20,10 +20,10 @@ package org.apache.axis2.datasource.jaxb;
import java.io.OutputStream;
-import javax.activation.DataHandler;
import javax.xml.namespace.NamespaceContext;
import javax.xml.stream.XMLStreamException;
+import org.apache.axiom.blob.Blob;
import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
@@ -226,8 +226,8 @@ public abstract class XMLStreamWriterFilterBase extends
MTOMXMLStreamWriter {
}
@Override
- public String prepareDataHandler(DataHandler dataHandler) {
- return delegate.prepareDataHandler(dataHandler);
+ public String prepareBlob(Blob blob) {
+ return delegate.prepareBlob(blob);
}
@Override
diff --git
a/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/AttachmentUtils.java
b/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/AttachmentUtils.java
index 493f54db6a..afae4b016f 100644
---
a/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/AttachmentUtils.java
+++
b/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/AttachmentUtils.java
@@ -24,6 +24,7 @@ import org.apache.axiom.attachments.CachedFileDataSource;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMText;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -49,7 +50,7 @@ public class AttachmentUtils {
*/
public static OMText makeBinaryOMNode(OMElement xop, DataHandler dh) {
OMFactory factory = xop.getOMFactory();
- OMText binaryNode = factory.createOMText(dh, true);
+ OMText binaryNode = factory.createOMText(DataHandlerUtils.toBlob(dh),
true);
return binaryNode;
}
diff --git
a/modules/jaxws/test/org/apache/axis2/jaxws/attachments/MTOMSerializationTests.java
b/modules/jaxws/test/org/apache/axis2/jaxws/attachments/MTOMSerializationTests.java
index 93b5f8dfa3..d9871c8fc0 100644
---
a/modules/jaxws/test/org/apache/axis2/jaxws/attachments/MTOMSerializationTests.java
+++
b/modules/jaxws/test/org/apache/axis2/jaxws/attachments/MTOMSerializationTests.java
@@ -29,6 +29,7 @@ import org.apache.axiom.om.OMText;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.jaxws.message.Block;
import org.apache.axis2.jaxws.message.Message;
import org.apache.axis2.jaxws.message.Protocol;
@@ -245,7 +246,7 @@ public class MTOMSerializationTests extends TestCase {
OMElement imageData = fac.createOMElement("imageData", omNs);
input.addChild(imageData);
- OMText binaryData = fac.createOMText(dataHandler, true);
+ OMText binaryData =
fac.createOMText(DataHandlerUtils.toBlob(dataHandler), true);
imageData.addChild(binaryData);
return sendImage;
diff --git a/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
b/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
index 09f34eaad1..0d8bcb1c63 100644
--- a/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
+++ b/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
@@ -38,6 +38,7 @@ import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPModelBuilder;
import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.context.MessageContext;
@@ -243,7 +244,7 @@ public class BuilderUtil {
if (parameter instanceof DataHandler) {
DataHandler dataHandler = (DataHandler)parameter;
OMText dataText = bodyFirstChild.getOMFactory().createOMText(
- dataHandler, true);
+ DataHandlerUtils.toBlob(dataHandler), true);
soapFactory.createOMElement(key, ns, bodyFirstChild).addChild(
dataText);
} else {
diff --git
a/modules/kernel/src/org/apache/axis2/builder/unknowncontent/UnknownContentOMDataSource.java
b/modules/kernel/src/org/apache/axis2/builder/unknowncontent/UnknownContentOMDataSource.java
index 075a4aa8f3..faa60dfbf0 100644
---
a/modules/kernel/src/org/apache/axis2/builder/unknowncontent/UnknownContentOMDataSource.java
+++
b/modules/kernel/src/org/apache/axis2/builder/unknowncontent/UnknownContentOMDataSource.java
@@ -34,6 +34,7 @@ import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.kernel.MessageFormatter;
public class UnknownContentOMDataSource implements OMDataSource {
@@ -74,7 +75,7 @@ public class UnknownContentOMDataSource implements
OMDataSource {
private OMElement createElement()
{
OMFactory factory = OMAbstractFactory.getOMFactory();
- OMText textNode = factory.createOMText(genericContent, true);
+ OMText textNode =
factory.createOMText(DataHandlerUtils.toBlob(genericContent), true);
OMElement wrapperElement =
factory.createOMElement(unknownContentQName);
wrapperElement.addChild(textNode);
return wrapperElement;
diff --git a/modules/saaj/pom.xml b/modules/saaj/pom.xml
index 4382f779f6..18eab0a63e 100644
--- a/modules/saaj/pom.xml
+++ b/modules/saaj/pom.xml
@@ -95,6 +95,11 @@
<artifactId>testutils</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>blob-testutils</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
diff --git a/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java
b/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java
index 4f6d9c1001..a1db828c68 100644
--- a/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java
+++ b/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java
@@ -21,6 +21,7 @@ package org.apache.axis2.saaj;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMText;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axiom.util.base64.Base64Utils;
import org.apache.axis2.saaj.util.SAAJDataSource;
import org.apache.axis2.kernel.http.HTTPConstants;
@@ -282,7 +283,7 @@ public class AttachmentPartImpl extends AttachmentPart {
if (datahandler != null) {
this.dataHandler = datahandler;
setMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE,
datahandler.getContentType());
- omText =
OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getOMFactory().createOMText(datahandler,
true);
+ omText =
OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getOMFactory().createOMText(DataHandlerUtils.toBlob(datahandler),
true);
} else {
throw new IllegalArgumentException("Cannot set null DataHandler");
}
diff --git
a/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
b/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
index 9c5eeddcb6..e3e3d435f8 100644
--- a/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
+++ b/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
@@ -20,8 +20,10 @@
package org.apache.axis2.saaj.integration;
import org.apache.axiom.attachments.Attachments;
-import org.apache.axiom.testutils.activation.RandomDataSource;
+import org.apache.axiom.blob.Blob;
+import org.apache.axiom.testutils.blob.RandomBlob;
import org.apache.axiom.testutils.io.IOTestUtils;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.Parameter;
@@ -40,7 +42,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.w3c.dom.Element;
-import javax.activation.DataHandler;
import javax.xml.namespace.QName;
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MessageFactory;
@@ -210,8 +211,8 @@ public class IntegrationTest {
request.addAttachmentPart(textAttach);
// Add an application/octet-stream attachment to the SOAP request
- DataHandler binaryDH = new DataHandler(new RandomDataSource(54321,
15000));
- AttachmentPart binaryAttach = request.createAttachmentPart(binaryDH);
+ Blob blob = new RandomBlob(54321, 15000);
+ AttachmentPart binaryAttach =
request.createAttachmentPart(DataHandlerUtils.toDataHandler(blob));
binaryAttach.addMimeHeader("Content-Transfer-Encoding", "binary");
binaryAttach.setContentId("[email protected]");
request.addAttachmentPart(binaryAttach);
@@ -228,7 +229,7 @@ public class IntegrationTest {
assertThat(attachIter.hasNext()).isTrue();
AttachmentPart attachment = (AttachmentPart)attachIter.next();
assertThat(attachment.getContentType()).isEqualTo("application/octet-stream");
- IOTestUtils.compareStreams(binaryDH.getInputStream(), "expected",
attachment.getDataHandler().getInputStream(), "actual");
+ IOTestUtils.compareStreams(blob.getInputStream(), "expected",
attachment.getDataHandler().getInputStream(), "actual");
assertThat(attachIter.hasNext()).isFalse();
sCon.close();
diff --git a/modules/transport/base/pom.xml b/modules/transport/base/pom.xml
index 78b9c6bcca..ae98782783 100644
--- a/modules/transport/base/pom.xml
+++ b/modules/transport/base/pom.xml
@@ -49,6 +49,10 @@
<artifactId>axis2-kernel</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-activation</artifactId>
+ </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
diff --git
a/modules/transport/base/src/main/java/org/apache/axis2/format/BinaryBuilder.java
b/modules/transport/base/src/main/java/org/apache/axis2/format/BinaryBuilder.java
index cd5c3e558e..47ec7db0e1 100644
---
a/modules/transport/base/src/main/java/org/apache/axis2/format/BinaryBuilder.java
+++
b/modules/transport/base/src/main/java/org/apache/axis2/format/BinaryBuilder.java
@@ -29,6 +29,7 @@ import org.apache.axiom.attachments.ByteArrayDataSource;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.util.activation.DataHandlerUtils;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.Parameter;
@@ -58,7 +59,7 @@ public class BinaryBuilder implements
DataSourceMessageBuilder {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMElement wrapper = factory.createOMElement(wrapperQName, null);
DataHandler dataHandler = new DataHandler(dataSource);
- wrapper.addChild(factory.createOMText(dataHandler, true));
+
wrapper.addChild(factory.createOMText(DataHandlerUtils.toBlob(dataHandler),
true));
msgContext.setDoingMTOM(true);
return wrapper;
}
diff --git
a/modules/transport/base/src/main/java/org/apache/axis2/format/PlainTextBuilder.java
b/modules/transport/base/src/main/java/org/apache/axis2/format/PlainTextBuilder.java
index 38a532f75e..a790ca0bcd 100644
---
a/modules/transport/base/src/main/java/org/apache/axis2/format/PlainTextBuilder.java
+++
b/modules/transport/base/src/main/java/org/apache/axis2/format/PlainTextBuilder.java
@@ -30,8 +30,8 @@ import javax.xml.namespace.QName;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromDataSource;
import org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromReader;
+import
org.apache.axiom.om.ds.activation.WrappedTextNodeOMDataSourceFromDataSource;
import org.apache.axis2.AxisFault;
import org.apache.axis2.builder.BuilderUtil;
import org.apache.axis2.context.MessageContext;
diff --git
a/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/message/MessageEncoder.java
b/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/message/MessageEncoder.java
index 63f79603ef..35a3d1dcc4 100644
---
a/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/message/MessageEncoder.java
+++
b/modules/transport/testkit/src/main/java/org/apache/axis2/transport/testkit/message/MessageEncoder.java
@@ -23,10 +23,8 @@ import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.StringWriter;
-import javax.activation.DataHandler;
-
import org.apache.axiom.attachments.Attachments;
-import org.apache.axiom.attachments.ByteArrayDataSource;
+import org.apache.axiom.blob.Blobs;
import org.apache.axiom.mime.ContentType;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
@@ -136,8 +134,7 @@ public interface MessageEncoder<T,U> {
SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
SOAPEnvelope envelope = factory.getDefaultEnvelope();
OMElement wrapper =
factory.createOMElement(BaseConstants.DEFAULT_BINARY_WRAPPER);
- DataHandler dataHandler = new DataHandler(new
ByteArrayDataSource(message));
- wrapper.addChild(factory.createOMText(dataHandler, true));
+ wrapper.addChild(factory.createOMText(Blobs.createBlob(message),
true));
envelope.getBody().addChild(wrapper);
result.setEnvelope(envelope);
return result;
diff --git a/pom.xml b/pom.xml
index 889f29684e..5806255be0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -669,6 +669,11 @@
<artifactId>axiom-dom</artifactId>
<version>${axiom.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-activation</artifactId>
+ <version>${axiom.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-jaxb</artifactId>
@@ -679,6 +684,11 @@
<artifactId>testutils</artifactId>
<version>${axiom.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>blob-testutils</artifactId>
+ <version>${axiom.version}</version>
+ </dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>