Search in sources :

Example 6 with ByteArrayIterator

use of com.adaptris.util.text.mime.ByteArrayIterator in project interlok by adaptris.

the class TestMultipartOutput method testCreateMultiPartWithNullPayload.

@Test
public void testCreateMultiPartWithNullPayload() {
    try {
        MultiPartOutput output = new MultiPartOutput(guid.getUUID());
        byte[] nullOutput = null;
        output.addPart(nullOutput, guid.getUUID());
        byte[] mimePayload = output.getBytes();
        ByteArrayIterator input = new ByteArrayIterator(output.getBytes());
        assertEquals(NUMBER_OF_PARTS, 1, input.size());
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : MultiPartOutput(com.adaptris.util.text.mime.MultiPartOutput) ByteArrayIterator(com.adaptris.util.text.mime.ByteArrayIterator) Test(org.junit.Test)

Example 7 with ByteArrayIterator

use of com.adaptris.util.text.mime.ByteArrayIterator in project interlok by adaptris.

the class TestMultipartOutput method testCreateQuotedPrintableMimeOutput.

@Test
public void testCreateQuotedPrintableMimeOutput() {
    try {
        MultiPartOutput output = new MultiPartOutput(guid.getUUID());
        output.addPart(PAYLOAD_1, ENCODING_QUOTED, guid.getUUID());
        ByteArrayIterator input = new ByteArrayIterator(output.getBytes());
        assertEquals(NUMBER_OF_PARTS, 1, input.size());
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : MultiPartOutput(com.adaptris.util.text.mime.MultiPartOutput) ByteArrayIterator(com.adaptris.util.text.mime.ByteArrayIterator) Test(org.junit.Test)

Example 8 with ByteArrayIterator

use of com.adaptris.util.text.mime.ByteArrayIterator in project interlok by adaptris.

the class TestMultipartOutput method testCreateMultiPartWithRemovedParts.

@Test
public void testCreateMultiPartWithRemovedParts() {
    try {
        MultiPartOutput output = new MultiPartOutput(guid.getUUID());
        String matchingContentId = guid.getUUID();
        output.addPart(PAYLOAD_1, guid.getUUID());
        output.addPart(PAYLOAD_1, matchingContentId);
        output.addPart(PAYLOAD_1, guid.getUUID());
        output.addPart(PAYLOAD_1, matchingContentId);
        output.removePart(matchingContentId);
        byte[] mimePayload = output.getBytes();
        ByteArrayIterator input = new ByteArrayIterator(output.getBytes());
        assertEquals(NUMBER_OF_PARTS, 2, input.size());
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : MultiPartOutput(com.adaptris.util.text.mime.MultiPartOutput) ByteArrayIterator(com.adaptris.util.text.mime.ByteArrayIterator) Test(org.junit.Test)

Example 9 with ByteArrayIterator

use of com.adaptris.util.text.mime.ByteArrayIterator in project interlok by adaptris.

the class TestMultipartOutput method testCreatePlainMimeOutput.

@Test
public void testCreatePlainMimeOutput() {
    try {
        MultiPartOutput output = new MultiPartOutput(guid.getUUID());
        output.addPart(PAYLOAD_1, guid.getUUID());
        ByteArrayIterator input = new ByteArrayIterator(output.getBytes());
        assertEquals(NUMBER_OF_PARTS, 1, input.size());
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : MultiPartOutput(com.adaptris.util.text.mime.MultiPartOutput) ByteArrayIterator(com.adaptris.util.text.mime.ByteArrayIterator) Test(org.junit.Test)

Example 10 with ByteArrayIterator

use of com.adaptris.util.text.mime.ByteArrayIterator in project interlok by adaptris.

the class TestMultipartOutput method testCreate8bitMimeOutput.

@Test
public void testCreate8bitMimeOutput() {
    try {
        MultiPartOutput output = new MultiPartOutput(guid.getUUID());
        output.addPart(PAYLOAD_1, ENCODING_8BIT, guid.getUUID());
        ByteArrayIterator input = new ByteArrayIterator(output.getBytes());
        assertEquals(NUMBER_OF_PARTS, 1, input.size());
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : MultiPartOutput(com.adaptris.util.text.mime.MultiPartOutput) ByteArrayIterator(com.adaptris.util.text.mime.ByteArrayIterator) Test(org.junit.Test)

Aggregations

ByteArrayIterator (com.adaptris.util.text.mime.ByteArrayIterator)11 Test (org.junit.Test)11 MultiPartOutput (com.adaptris.util.text.mime.MultiPartOutput)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1