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 2022/11/03 23:53:29 UTC
[ws-axiom] branch master updated: Remove some more legacy/compatibility classes
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/ws-axiom.git
The following commit(s) were added to refs/heads/master by this push:
new 730497d94 Remove some more legacy/compatibility classes
730497d94 is described below
commit 730497d94cdedef2b98685a7a1b76b40bfea8f4c
Author: Andreas Veithen <an...@gmail.com>
AuthorDate: Thu Nov 3 23:53:22 2022 +0000
Remove some more legacy/compatibility classes
---
.../org/apache/axiom/mime/MultipartWriter.java | 142 ------------------
.../apache/axiom/mime/MultipartWriterFactory.java | 42 ------
.../impl/axiom/AxiomMultipartWriterFactory.java | 38 -----
.../axiom/mime/impl/axiom/MultipartWriterImpl.java | 69 ---------
.../org/apache/axiom/mime/impl/axiom/package.html | 23 ---
.../javamail/JavaMailMultipartWriterFactory.java | 44 ------
.../mime/impl/javamail/MultipartWriterImpl.java | 160 ---------------------
.../apache/axiom/mime/impl/javamail/package.html | 23 ---
.../axiom/mime/AbstractMultipartWriterTest.java | 68 ---------
.../axiom/mime/impl/axiom/MultipartWriterTest.java | 27 ----
.../mime/impl/javamail/MultipartWriterTest.java | 28 ----
11 files changed, 664 deletions(-)
diff --git a/axiom-compat/src/main/java/org/apache/axiom/mime/MultipartWriter.java b/axiom-compat/src/main/java/org/apache/axiom/mime/MultipartWriter.java
deleted file mode 100644
index 7f2e9cb90..000000000
--- a/axiom-compat/src/main/java/org/apache/axiom/mime/MultipartWriter.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.mime;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.List;
-
-import javax.activation.DataHandler;
-
-/**
- * Writes a MIME multipart package as used by XOP/MTOM and SOAP with Attachments.
- * Objects implementing this interface are created using a {@link MultipartWriterFactory}. MIME
- * parts are written using {@link #writePart(String, String, String)} or
- * {@link #writePart(DataHandler, String, String)}. Calls to both methods can be mixed, i.e. it
- * is not required to use the same method for all MIME parts. Instead, the caller should choose
- * the most convenient method for each part (depending on the form in which the content is
- * available). After all parts have been written, {@link #complete()} must be called to write the
- * final MIME boundary.
- * <p>
- * The following semantics are defined for the <code>contentTransferEncoding</code> and
- * <code>contentID</code> arguments of the two write methods:
- * <ul>
- * <li>It is the responsibility of the implementation to apply the content transfer encoding
- * as specified by the <code>contentTransferEncoding</code> argument. The caller only
- * provides the unencoded data. The implementation should support at least {@code binary}
- * and {@code base64}. If it doesn't support the specified encoding, it may use an
- * alternative one. In any case, the implementation must make sure that the MIME part
- * has a {@code Content-Transfer-Encoding} header appropriate for the applied
- * encoding.</li>
- * <li>The content ID passed as argument is always the raw ID (without the angle brackets).
- * It is the responsibility of the implementation to properly format the value
- * of the {@code Content-ID} header.</li>
- * </ul>
- *
- * @deprecated Use {@link MultipartBodyWriter} instead.
- */
-public interface MultipartWriter {
- /**
- * Start writing a MIME part. The methods returns an {@link OutputStream} that the caller can
- * use to write the content of the MIME part. After writing the content,
- * {@link OutputStream#close()} must be called to complete the writing of the MIME part.
- *
- * @param contentType
- * the value of the {@code Content-Type} header of the MIME part
- * @param contentTransferEncoding
- * the content transfer encoding to be used (see above); must not be
- * <code>null</code>
- * @param contentID
- * the content ID of the MIME part (see above)
- * @return an output stream to write the content of the MIME part
- * @throws IOException
- * if an I/O error occurs when writing to the underlying stream
- */
- OutputStream writePart(String contentType, String contentTransferEncoding, String contentID)
- throws IOException;
-
- /**
- * Start writing a MIME part. The method is similar to
- * {@link #writePart(String, String, String)} but accepts a list of additional headers for the
- * MIME part.
- *
- * @param contentType
- * the value of the {@code Content-Type} header of the MIME part
- * @param contentTransferEncoding
- * the content transfer encoding to be used (see above); must not be
- * <code>null</code>
- * @param contentID
- * the content ID of the MIME part (see above)
- * @param extraHeaders
- * a list of {@link Header} objects with additional headers to write to the MIME part
- * @return an output stream to write the content of the MIME part
- * @throws IOException
- * if an I/O error occurs when writing to the underlying stream
- */
- OutputStream writePart(String contentType, String contentTransferEncoding,
- String contentID, List<Header> extraHeaders) throws IOException;
-
- /**
- * Write a MIME part. The content is provided by a {@link DataHandler} object, which also
- * specifies the content type of the part.
- *
- * @param dataHandler
- * the content of the MIME part to write
- * @param contentTransferEncoding
- * the content transfer encoding to be used (see above); must not be
- * <code>null</code>
- * @param contentID
- * the content ID of the MIME part (see above)
- * @throws IOException
- * if an I/O error occurs when writing the part to the underlying stream
- */
- void writePart(DataHandler dataHandler, String contentTransferEncoding, String contentID)
- throws IOException;
-
- /**
- * Write a MIME part. The content is provided by a {@link DataHandler} object, which also
- * specifies the content type of the part. The method is similar to
- * {@link #writePart(DataHandler, String, String)} but accepts a list of additional headers for
- * the MIME part.
- *
- * @param dataHandler
- * the content of the MIME part to write
- * @param contentTransferEncoding
- * the content transfer encoding to be used (see above); must not be
- * <code>null</code>
- * @param contentID
- * the content ID of the MIME part (see above)
- * @param extraHeaders
- * a list of {@link Header} objects with additional headers to write to the MIME part
- * @throws IOException
- * if an I/O error occurs when writing the part to the underlying stream
- */
- void writePart(DataHandler dataHandler, String contentTransferEncoding,
- String contentID, List<Header> extraHeaders) throws IOException;
-
- /**
- * Complete writing of the MIME multipart package. This method does <b>not</b> close the
- * underlying stream.
- *
- * @throws IOException
- * if an I/O error occurs when writing to the underlying stream
- */
- void complete() throws IOException;
-}
diff --git a/axiom-compat/src/main/java/org/apache/axiom/mime/MultipartWriterFactory.java b/axiom-compat/src/main/java/org/apache/axiom/mime/MultipartWriterFactory.java
deleted file mode 100644
index 771a74962..000000000
--- a/axiom-compat/src/main/java/org/apache/axiom/mime/MultipartWriterFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.mime;
-
-import java.io.OutputStream;
-
-/**
- * Factory for {@link MultipartWriter} instances.
- *
- * @deprecated
- */
-public interface MultipartWriterFactory {
- /**
- * Create a new {@link MultipartWriter} instance that writes a MIME multipart package to a given
- * output stream.
- *
- * @param out
- * The output stream to write the MIME package to.
- * @param boundary
- * The MIME boundary to use. The value should not include the leading dashes, i.e. it
- * is the same value as used in the {@code boundary} content type parameter.
- * @return the writer instance
- */
- MultipartWriter createMultipartWriter(OutputStream out, String boundary);
-}
diff --git a/axiom-compat/src/main/java/org/apache/axiom/mime/impl/axiom/AxiomMultipartWriterFactory.java b/axiom-compat/src/main/java/org/apache/axiom/mime/impl/axiom/AxiomMultipartWriterFactory.java
deleted file mode 100644
index 1c109c500..000000000
--- a/axiom-compat/src/main/java/org/apache/axiom/mime/impl/axiom/AxiomMultipartWriterFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.mime.impl.axiom;
-
-import java.io.OutputStream;
-
-import org.apache.axiom.mime.MultipartWriter;
-import org.apache.axiom.mime.MultipartWriterFactory;
-
-/**
- * Factory for Axiom's own {@link MultipartWriter} implementation.
- *
- * @deprecated
- */
-public class AxiomMultipartWriterFactory implements MultipartWriterFactory {
- public static final MultipartWriterFactory INSTANCE = new AxiomMultipartWriterFactory();
-
- @Override
- public MultipartWriter createMultipartWriter(OutputStream out, String boundary) {
- return new MultipartWriterImpl(out, boundary);
- }
-}
diff --git a/axiom-compat/src/main/java/org/apache/axiom/mime/impl/axiom/MultipartWriterImpl.java b/axiom-compat/src/main/java/org/apache/axiom/mime/impl/axiom/MultipartWriterImpl.java
deleted file mode 100644
index 1b77b1d18..000000000
--- a/axiom-compat/src/main/java/org/apache/axiom/mime/impl/axiom/MultipartWriterImpl.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.mime.impl.axiom;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.List;
-
-import javax.activation.DataHandler;
-
-import org.apache.axiom.mime.Header;
-import org.apache.axiom.mime.MultipartBodyWriter;
-import org.apache.axiom.mime.MultipartWriter;
-
-/**
- * @deprecated
- */
-class MultipartWriterImpl implements MultipartWriter {
- private final MultipartBodyWriter writer;
-
- public MultipartWriterImpl(OutputStream out, String boundary) {
- writer = new MultipartBodyWriter(out, boundary);
- }
-
- @Override
- public OutputStream writePart(String contentType, String contentTransferEncoding,
- String contentID, List<Header> extraHeaders) throws IOException {
- return writer.writePart(contentType, contentTransferEncoding, contentID, extraHeaders);
- }
-
- @Override
- public OutputStream writePart(String contentType, String contentTransferEncoding,
- String contentID) throws IOException {
- return writer.writePart(contentType, contentTransferEncoding, contentID, null);
- }
-
- @Override
- public void writePart(DataHandler dataHandler, String contentTransferEncoding, String contentID, List<Header> extraHeaders)
- throws IOException {
- writer.writePart(dataHandler, contentTransferEncoding, contentID, extraHeaders);
- }
-
- @Override
- public void writePart(DataHandler dataHandler, String contentTransferEncoding,
- String contentID) throws IOException {
- writer.writePart(dataHandler, contentTransferEncoding, contentID, null);
- }
-
- @Override
- public void complete() throws IOException {
- writer.complete();
- }
-}
diff --git a/axiom-compat/src/main/java/org/apache/axiom/mime/impl/axiom/package.html b/axiom-compat/src/main/java/org/apache/axiom/mime/impl/axiom/package.html
deleted file mode 100644
index af8ab3e3d..000000000
--- a/axiom-compat/src/main/java/org/apache/axiom/mime/impl/axiom/package.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!--
- ~ 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.
- -->
-<html>
-<body>
-Default MIME message processing API implementation.
-</body>
-</html>
\ No newline at end of file
diff --git a/axiom-compat/src/main/java/org/apache/axiom/mime/impl/javamail/JavaMailMultipartWriterFactory.java b/axiom-compat/src/main/java/org/apache/axiom/mime/impl/javamail/JavaMailMultipartWriterFactory.java
deleted file mode 100644
index c2334d0df..000000000
--- a/axiom-compat/src/main/java/org/apache/axiom/mime/impl/javamail/JavaMailMultipartWriterFactory.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.mime.impl.javamail;
-
-import java.io.OutputStream;
-
-import org.apache.axiom.mime.MultipartWriter;
-import org.apache.axiom.mime.MultipartWriterFactory;
-import org.apache.axiom.mime.impl.axiom.AxiomMultipartWriterFactory;
-
-/**
- * Factory for the JavaMail based {@link MultipartWriter} implementation.
- *
- * @deprecated The original purpose of this class was to provide an alternative implementation
- * should bugs be discovered in {@link AxiomMultipartWriterFactory}. However,
- * {@link AxiomMultipartWriterFactory} exists for several releases now and has no known
- * issues. It should therefore always be used as {@link MultipartWriterFactory}
- * implementation.
- */
-public class JavaMailMultipartWriterFactory implements MultipartWriterFactory {
- public static final MultipartWriterFactory INSTANCE = new JavaMailMultipartWriterFactory();
-
- @Override
- public MultipartWriter createMultipartWriter(OutputStream out, String boundary) {
- return new MultipartWriterImpl(out, boundary);
- }
-}
diff --git a/axiom-compat/src/main/java/org/apache/axiom/mime/impl/javamail/MultipartWriterImpl.java b/axiom-compat/src/main/java/org/apache/axiom/mime/impl/javamail/MultipartWriterImpl.java
deleted file mode 100644
index 8d73ee413..000000000
--- a/axiom-compat/src/main/java/org/apache/axiom/mime/impl/javamail/MultipartWriterImpl.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * 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.mime.impl.javamail;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.activation.DataHandler;
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeBodyPart;
-
-import org.apache.axiom.mime.Header;
-import org.apache.axiom.mime.MultipartWriter;
-import org.apache.axiom.util.blob.BlobDataSource;
-import org.apache.axiom.util.blob.MemoryBlob;
-import org.apache.axiom.util.blob.WritableBlob;
-
-/**
- * @deprecated
- */
-@SuppressWarnings("rawtypes")
-class MultipartWriterImpl implements MultipartWriter {
- private static final byte[] DASH_DASH = { '-', '-' };
- private static final byte[] CR_LF = { 13, 10 };
-
- class PartOutputStream extends OutputStream {
- private final String contentType;
- private final String contentTransferEncoding;
- private final String contentID;
- private final WritableBlob blob;
- private final OutputStream parent;
- private final List/*<Header>*/ extraHeaders;
-
- public PartOutputStream(String contentType, String contentTransferEncoding,
- String contentID, List/*<Header>*/ extraHeaders) {
- this.contentType = contentType;
- this.contentTransferEncoding = contentTransferEncoding;
- this.contentID = contentID;
- this.extraHeaders = extraHeaders;
- blob = new MemoryBlob();
- parent = blob.getOutputStream();
- }
-
- @Override
- public void write(int b) throws IOException {
- parent.write(b);
- }
-
- @Override
- public void write(byte[] b, int off, int len) throws IOException {
- parent.write(b, off, len);
- }
-
- @Override
- public void write(byte[] b) throws IOException {
- parent.write(b);
- }
-
- @Override
- public void close() throws IOException {
- parent.close();
- writePart(new DataHandler(new BlobDataSource(blob, contentType)),
- contentTransferEncoding, contentID, extraHeaders);
- }
- }
-
- private final OutputStream out;
- private final byte[] boundary;
-
- public MultipartWriterImpl(OutputStream out, String boundary) {
- this.out = out;
- try {
- this.boundary = boundary.getBytes("ascii");
- } catch (UnsupportedEncodingException ex) {
- // If we ever get here, then there is something really wrong with the JRE...
- throw new RuntimeException(ex);
- }
- }
-
- @Override
- public OutputStream writePart(String contentType, String contentTransferEncoding,
- String contentID) throws IOException {
- return new PartOutputStream(contentType, contentTransferEncoding, contentID, null);
- }
-
- @Override
- public OutputStream writePart(String contentType, String contentTransferEncoding,
- String contentID, List/*<Header>*/ extraHeaders) throws IOException {
- return new PartOutputStream(contentType, contentTransferEncoding, contentID,
- extraHeaders);
- }
-
- @Override
- public void writePart(DataHandler dataHandler, String contentTransferEncoding,
- String contentID, List/*<Header>*/ extraHeaders) throws IOException {
- MimeBodyPart mimeBodyPart = new MimeBodyPart();
- try {
- mimeBodyPart.setDataHandler(dataHandler);
- mimeBodyPart.addHeader("Content-ID", "<" + contentID + ">");
- mimeBodyPart.addHeader("Content-Type", dataHandler.getContentType());
- mimeBodyPart.addHeader("Content-Transfer-Encoding", contentTransferEncoding);
- mimeBodyPart.addHeader("Content-Transfer-Encoding", contentTransferEncoding);
- if (extraHeaders != null) {
- for (Iterator it = extraHeaders.iterator(); it.hasNext(); ) {
- Header header = (Header)it.next();
- mimeBodyPart.addHeader(header.getName(), header.getValue());
- }
- }
- } catch (MessagingException ex) {
- IOException ex2 = new IOException("Unable to create MimeBodyPart");
- ex2.initCause(ex);
- throw ex2;
- }
- out.write(DASH_DASH);
- out.write(boundary);
- out.write(CR_LF);
- try {
- mimeBodyPart.writeTo(out);
- } catch (MessagingException ex) {
- IOException ex2 = new IOException("Unable to write the MimeBodyPart object");
- ex2.initCause(ex);
- throw ex2;
- }
- out.write(CR_LF);
- }
-
- @Override
- public void writePart(DataHandler dataHandler, String contentTransferEncoding, String contentID)
- throws IOException {
- writePart(dataHandler, contentTransferEncoding, contentID, null);
- }
-
- @Override
- public void complete() throws IOException {
- out.write(DASH_DASH);
- out.write(boundary);
- out.write(DASH_DASH);
- out.write(CR_LF);
- }
-}
diff --git a/axiom-compat/src/main/java/org/apache/axiom/mime/impl/javamail/package.html b/axiom-compat/src/main/java/org/apache/axiom/mime/impl/javamail/package.html
deleted file mode 100644
index f20f89c13..000000000
--- a/axiom-compat/src/main/java/org/apache/axiom/mime/impl/javamail/package.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!--
- ~ 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.
- -->
-<html>
-<body>
-MIME message processing API implementation based on JavaMail (deprecated).
-</body>
-</html>
\ No newline at end of file
diff --git a/axiom-compat/src/test/java/org/apache/axiom/mime/AbstractMultipartWriterTest.java b/axiom-compat/src/test/java/org/apache/axiom/mime/AbstractMultipartWriterTest.java
deleted file mode 100644
index b39dcd743..000000000
--- a/axiom-compat/src/test/java/org/apache/axiom/mime/AbstractMultipartWriterTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.mime;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.Random;
-
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMultipart;
-
-import org.apache.axiom.attachments.ByteArrayDataSource;
-import org.apache.axiom.util.UIDGenerator;
-
-import junit.framework.TestCase;
-
-public abstract class AbstractMultipartWriterTest extends TestCase {
- private final MultipartWriterFactory factory;
-
- public AbstractMultipartWriterTest(MultipartWriterFactory factory) {
- this.factory = factory;
- }
-
- private void test(String contentTransferEncoding) throws Exception {
- Random random = new Random();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- MultipartWriter mpw = factory.createMultipartWriter(baos, UIDGenerator.generateMimeBoundary());
- byte[] content = new byte[8192];
- random.nextBytes(content);
- OutputStream partOutputStream = mpw.writePart("application/octet-stream", contentTransferEncoding, UIDGenerator.generateContentId());
- partOutputStream.write(content);
- partOutputStream.close();
- mpw.complete();
-
- MimeMultipart mp = new MimeMultipart(new ByteArrayDataSource(baos.toByteArray()));
- assertEquals(1, mp.getCount());
- MimeBodyPart bp = (MimeBodyPart)mp.getBodyPart(0);
- assertEquals(contentTransferEncoding, bp.getHeader("Content-Transfer-Encoding")[0]);
- baos.reset();
- bp.getDataHandler().writeTo(baos);
- assertTrue(Arrays.equals(content, baos.toByteArray()));
- }
-
- public void testBinary() throws Exception {
- test("binary");
- }
-
- public void testBase64() throws Exception {
- test("base64");
- }
-}
diff --git a/axiom-compat/src/test/java/org/apache/axiom/mime/impl/axiom/MultipartWriterTest.java b/axiom-compat/src/test/java/org/apache/axiom/mime/impl/axiom/MultipartWriterTest.java
deleted file mode 100644
index 67dc18b47..000000000
--- a/axiom-compat/src/test/java/org/apache/axiom/mime/impl/axiom/MultipartWriterTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.mime.impl.axiom;
-
-import org.apache.axiom.mime.AbstractMultipartWriterTest;
-
-public class MultipartWriterTest extends AbstractMultipartWriterTest {
- public MultipartWriterTest() {
- super(AxiomMultipartWriterFactory.INSTANCE);
- }
-}
diff --git a/axiom-compat/src/test/java/org/apache/axiom/mime/impl/javamail/MultipartWriterTest.java b/axiom-compat/src/test/java/org/apache/axiom/mime/impl/javamail/MultipartWriterTest.java
deleted file mode 100644
index c4ee10129..000000000
--- a/axiom-compat/src/test/java/org/apache/axiom/mime/impl/javamail/MultipartWriterTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.mime.impl.javamail;
-
-import org.apache.axiom.mime.AbstractMultipartWriterTest;
-
-@SuppressWarnings("deprecation")
-public class MultipartWriterTest extends AbstractMultipartWriterTest {
- public MultipartWriterTest() {
- super(JavaMailMultipartWriterFactory.INSTANCE);
- }
-}