You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2018/10/14 23:09:22 UTC
svn commit: r1843866 - in /webservices/axiom/trunk: ./ axiom-api/
axiom-api/src/test/java/org/apache/axiom/attachments/ axiom-compat/
axiom-compat/src/test/java/org/apache/axiom/attachments/impl/
testing/axiom-testsuite/ testing/axiom-testsuite/src/mai...
Author: veithen
Date: Sun Oct 14 23:09:22 2018
New Revision: 1843866
URL: http://svn.apache.org/viewvc?rev=1843866&view=rev
Log:
Clean up Activation dependencies.
Added:
webservices/axiom/trunk/testing/testutils/src/main/java/org/apache/axiom/testutils/activation/TextDataSource.java (with props)
Modified:
webservices/axiom/trunk/axiom-api/pom.xml
webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
webservices/axiom/trunk/axiom-compat/pom.xml
webservices/axiom/trunk/axiom-compat/src/test/java/org/apache/axiom/attachments/impl/BufferUtilsTest.java
webservices/axiom/trunk/pom.xml
webservices/axiom/trunk/testing/axiom-testsuite/pom.xml
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithMTOM.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithoutMTOM.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestGetTextCharactersFromDataHandler.java
webservices/axiom/trunk/testing/dom-testsuite/pom.xml
webservices/axiom/trunk/testing/soap-testsuite/pom.xml
webservices/axiom/trunk/testing/testutils/pom.xml
Modified: webservices/axiom/trunk/axiom-api/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/pom.xml?rev=1843866&r1=1843865&r2=1843866&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/pom.xml (original)
+++ webservices/axiom/trunk/axiom-api/pom.xml Sun Oct 14 23:09:22 2018
@@ -127,11 +127,6 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>com.sun.activation</groupId>
- <artifactId>javax.activation</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
Modified: webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java?rev=1843866&r1=1843865&r2=1843866&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java (original)
+++ webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java Sun Oct 14 23:09:22 2018
@@ -54,6 +54,7 @@ import org.apache.axiom.om.AbstractTestC
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.impl.MTOMConstants;
import org.apache.axiom.testutils.activation.RandomDataSource;
+import org.apache.axiom.testutils.activation.TextDataSource;
import org.apache.axiom.testutils.io.ExceptionInputStream;
import org.apache.axiom.testutils.io.IOTestUtils;
import org.apache.axiom.ts.soap.MTOMSample;
@@ -172,7 +173,7 @@ public class AttachmentsTest extends Abs
MimeMessage message = new MimeMessage((Session)null);
MimeMultipart mp = new MimeMultipart("related");
MimeBodyPart rootPart = new MimeBodyPart();
- rootPart.setText("<root/>", "utf-8", "xml");
+ rootPart.setDataHandler(new DataHandler(new TextDataSource("<root/>", "utf-8", "xml")));
rootPart.addHeader("Content-Transfer-Encoding", "binary");
rootPart.addHeader("Content-ID", "<" + contentId + ">");
mp.addBodyPart(rootPart);
@@ -444,7 +445,7 @@ public class AttachmentsTest extends Abs
// Prepare the "SOAP" part
MimeBodyPart bp1 = new MimeBodyPart();
// Obviously this is not SOAP, but this is irrelevant for this test
- bp1.setText("<root/>", "utf-8", "xml");
+ bp1.setDataHandler(new DataHandler(new TextDataSource("<root/>", "utf-8", "xml")));
bp1.addHeader("Content-Transfer-Encoding", "binary");
bp1.addHeader("Content-ID", "part1@apache.org");
mp.addBodyPart(bp1);
@@ -598,7 +599,7 @@ public class AttachmentsTest extends Abs
// Prepare the "SOAP" part
MimeBodyPart bp1 = new MimeBodyPart();
// Obviously this is not SOAP, but this is irrelevant for this test
- bp1.setText("<root/>", "utf-8", "xml");
+ bp1.setDataHandler(new DataHandler(new TextDataSource("<root/>", "utf-8", "xml")));
bp1.addHeader("Content-Transfer-Encoding", "binary");
bp1.addHeader("Content-ID", "part1@apache.org");
mp.addBodyPart(bp1);
@@ -654,14 +655,14 @@ public class AttachmentsTest extends Abs
MimeMultipart mp = new MimeMultipart("related");
MimeBodyPart bp1 = new MimeBodyPart();
- bp1.setText("<root/>", "utf-8", "xml");
+ bp1.setDataHandler(new DataHandler(new TextDataSource("<root/>", "utf-8", "xml")));
bp1.addHeader("Content-Transfer-Encoding", "binary");
mp.addBodyPart(bp1);
MimeBodyPart bp2 = new MimeBodyPart();
byte[] content = new byte[8192];
new Random().nextBytes(content);
- bp2.setDataHandler(new DataHandler("Test", "text/plain"));
+ bp2.setDataHandler(new DataHandler(new TextDataSource("Test", "utf-8", "plain")));
bp2.addHeader("Content-Transfer-Encoding", "binary");
bp2.addHeader(contentIDHeaderName, "part@apache.org");
mp.addBodyPart(bp2);
@@ -799,14 +800,15 @@ public class AttachmentsTest extends Abs
public void testFakeRootPartContentID() throws Exception {
MimeMessage message = new MimeMessage((Session)null);
MimeMultipart mp = new MimeMultipart("related");
-
+
+ DataHandler expectedRootPart = new DataHandler(new TextDataSource("<root/>", "utf-8", "xml"));
MimeBodyPart bp1 = new MimeBodyPart();
- bp1.setText("<root/>", "utf-8", "xml");
+ bp1.setDataHandler(expectedRootPart);
bp1.addHeader("Content-Transfer-Encoding", "binary");
mp.addBodyPart(bp1);
MimeBodyPart bp2 = new MimeBodyPart();
- bp2.setDataHandler(new DataHandler("Test", "text/plain"));
+ bp2.setDataHandler(new DataHandler(new TextDataSource("Test", "utf-8", "plain")));
bp2.addHeader("Content-Transfer-Encoding", "binary");
mp.addBodyPart(bp2);
@@ -823,6 +825,6 @@ public class AttachmentsTest extends Abs
String rootPartContentID = attachments.getRootPartContentID();
assertThat(rootPartContentID).isNotNull();
DataHandler rootPart = attachments.getDataHandler(rootPartContentID);
- assertThat(rootPart.getContent()).isEqualTo("<root/>");
+ IOTestUtils.compareStreams(rootPart.getInputStream(), expectedRootPart.getInputStream());
}
}
Modified: webservices/axiom/trunk/axiom-compat/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-compat/pom.xml?rev=1843866&r1=1843865&r2=1843866&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-compat/pom.xml (original)
+++ webservices/axiom/trunk/axiom-compat/pom.xml Sun Oct 14 23:09:22 2018
@@ -95,11 +95,6 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>com.sun.activation</groupId>
- <artifactId>javax.activation</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
Modified: webservices/axiom/trunk/axiom-compat/src/test/java/org/apache/axiom/attachments/impl/BufferUtilsTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-compat/src/test/java/org/apache/axiom/attachments/impl/BufferUtilsTest.java?rev=1843866&r1=1843865&r2=1843866&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-compat/src/test/java/org/apache/axiom/attachments/impl/BufferUtilsTest.java (original)
+++ webservices/axiom/trunk/axiom-compat/src/test/java/org/apache/axiom/attachments/impl/BufferUtilsTest.java Sun Oct 14 23:09:22 2018
@@ -22,6 +22,8 @@ import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.util.ByteArrayDataSource;
+import org.apache.axiom.testutils.activation.TextDataSource;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -108,7 +110,7 @@ public class BufferUtilsTest extends Tes
public void testObjectBackedDataHandlerExceedLimit() throws Exception {
String str = "This is a test String";
- DataHandler dh = new DataHandler(str, "text/plain");
+ DataHandler dh = new DataHandler(new TextDataSource(str, "utf-8", "plain"));
int unsupported= BufferUtils.doesDataHandlerExceedLimit(dh, 0);
assertEquals(-1, unsupported);
int doesExceed = BufferUtils.doesDataHandlerExceedLimit(dh, 10);
Modified: webservices/axiom/trunk/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/pom.xml?rev=1843866&r1=1843865&r2=1843866&view=diff
==============================================================================
--- webservices/axiom/trunk/pom.xml (original)
+++ webservices/axiom/trunk/pom.xml Sun Oct 14 23:09:22 2018
@@ -306,6 +306,12 @@
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
Modified: webservices/axiom/trunk/testing/axiom-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/pom.xml?rev=1843866&r1=1843865&r2=1843866&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/pom.xml (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/pom.xml Sun Oct 14 23:09:22 2018
@@ -107,10 +107,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>com.sun.activation</groupId>
- <artifactId>javax.activation</artifactId>
- </dependency>
- <dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-core</artifactId>
</dependency>
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithMTOM.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithMTOM.java?rev=1843866&r1=1843865&r2=1843866&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithMTOM.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithMTOM.java Sun Oct 14 23:09:22 2018
@@ -36,8 +36,10 @@ import org.apache.axiom.om.OMXMLBuilderF
import org.apache.axiom.om.ds.jaxb.JAXBOMDataSource;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.testutils.activation.TextDataSource;
import org.apache.axiom.ts.AxiomTestCase;
import org.apache.axiom.ts.jaxb.beans.DocumentBean;
+import org.apache.commons.io.IOUtils;
/**
* Tests that an {@link OMSourcedElement} backed by a {@link JAXBOMDataSource} with a bean
@@ -56,7 +58,7 @@ public class TestDataHandlerSerializatio
// Construct the original message
DocumentBean object = new DocumentBean();
object.setId("123456");
- object.setContent(new DataHandler("some content", "text/plain; charset=utf-8"));
+ object.setContent(new DataHandler(new TextDataSource("some content", "utf-8", "plain")));
SOAPEnvelope orgEnvelope = factory.getDefaultEnvelope();
OMSourcedElement element = factory.createOMElement(new JAXBOMDataSource(context, object));
orgEnvelope.getBody().addChild(element);
@@ -83,6 +85,6 @@ public class TestDataHandlerSerializatio
assertTrue(content.isBinary());
assertTrue(content.isOptimized());
DataHandler dh = content.getDataHandler();
- assertEquals("some content", dh.getContent());
+ assertEquals("some content", IOUtils.toString(dh.getInputStream(), "utf-8"));
}
}
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithoutMTOM.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithoutMTOM.java?rev=1843866&r1=1843865&r2=1843866&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithoutMTOM.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/jaxb/TestDataHandlerSerializationWithoutMTOM.java Sun Oct 14 23:09:22 2018
@@ -30,6 +30,7 @@ import org.apache.axiom.om.OMXMLBuilderF
import org.apache.axiom.om.ds.jaxb.JAXBOMDataSource;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.testutils.activation.TextDataSource;
import org.apache.axiom.ts.AxiomTestCase;
import org.apache.axiom.ts.jaxb.beans.DocumentBean;
import org.apache.commons.io.IOUtils;
@@ -51,7 +52,7 @@ public class TestDataHandlerSerializatio
// Construct the original message
DocumentBean orgObject = new DocumentBean();
orgObject.setId("123456");
- orgObject.setContent(new DataHandler("some content", "text/plain; charset=utf-8"));
+ orgObject.setContent(new DataHandler(new TextDataSource("some content", "utf-8", "plain")));
SOAPEnvelope orgEnvelope = factory.getDefaultEnvelope();
OMSourcedElement element = factory.createOMElement(new JAXBOMDataSource(context, orgObject));
orgEnvelope.getBody().addChild(element);
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestGetTextCharactersFromDataHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestGetTextCharactersFromDataHandler.java?rev=1843866&r1=1843865&r2=1843866&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestGetTextCharactersFromDataHandler.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestGetTextCharactersFromDataHandler.java Sun Oct 14 23:09:22 2018
@@ -22,6 +22,7 @@ import javax.activation.DataHandler;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.om.OMText;
+import org.apache.axiom.testutils.activation.TextDataSource;
import org.apache.axiom.ts.AxiomTestCase;
import org.apache.commons.codec.binary.Base64;
@@ -37,7 +38,7 @@ public class TestGetTextCharactersFromDa
@Override
protected void runTest() throws Throwable {
- DataHandler dh = new DataHandler("test content", "text/plain; charset=utf-8");
+ DataHandler dh = new DataHandler(new TextDataSource("test content", "utf-8", "plain"));
OMText text = metaFactory.getOMFactory().createOMText(dh, true);
char[] chars = text.getTextCharacters();
byte[] decoded = Base64.decodeBase64(new String(chars));
Modified: webservices/axiom/trunk/testing/dom-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/dom-testsuite/pom.xml?rev=1843866&r1=1843865&r2=1843866&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/dom-testsuite/pom.xml (original)
+++ webservices/axiom/trunk/testing/dom-testsuite/pom.xml Sun Oct 14 23:09:22 2018
@@ -75,6 +75,10 @@
<artifactId>jaxp-testsuite</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>javax.activation-api</artifactId>
+ </dependency>
</dependencies>
<build>
Modified: webservices/axiom/trunk/testing/soap-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/pom.xml?rev=1843866&r1=1843865&r2=1843866&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/soap-testsuite/pom.xml (original)
+++ webservices/axiom/trunk/testing/soap-testsuite/pom.xml Sun Oct 14 23:09:22 2018
@@ -50,6 +50,10 @@
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>javax.activation-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
Modified: webservices/axiom/trunk/testing/testutils/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/testutils/pom.xml?rev=1843866&r1=1843865&r2=1843866&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/testutils/pom.xml (original)
+++ webservices/axiom/trunk/testing/testutils/pom.xml Sun Oct 14 23:09:22 2018
@@ -55,6 +55,7 @@
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
+ <optional>true</optional>
</dependency>
</dependencies>
</project>
Added: webservices/axiom/trunk/testing/testutils/src/main/java/org/apache/axiom/testutils/activation/TextDataSource.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/testutils/src/main/java/org/apache/axiom/testutils/activation/TextDataSource.java?rev=1843866&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/testutils/src/main/java/org/apache/axiom/testutils/activation/TextDataSource.java (added)
+++ webservices/axiom/trunk/testing/testutils/src/main/java/org/apache/axiom/testutils/activation/TextDataSource.java Sun Oct 14 23:09:22 2018
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.testutils.activation;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringReader;
+
+import javax.activation.DataSource;
+
+import org.apache.commons.io.input.ReaderInputStream;
+
+public class TextDataSource implements DataSource {
+ private final String content;
+ private final String charset;
+ private final String subtype;
+
+ public TextDataSource(String content, String charset, String subtype) {
+ this.content = content;
+ this.charset = charset;
+ this.subtype = subtype;
+ }
+
+ @Override
+ public String getContentType() {
+ return "text/" + subtype + "; charset='" + charset + "'";
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return new ReaderInputStream(new StringReader(content), charset);
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public OutputStream getOutputStream() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+}
Propchange: webservices/axiom/trunk/testing/testutils/src/main/java/org/apache/axiom/testutils/activation/TextDataSource.java
------------------------------------------------------------------------------
svn:eol-style = native