use of com.adaptris.util.text.mime.ByteArrayIterator in project interlok by adaptris.
the class TestMultipartOutput method testCreateMultiPartMimeOutput.
@Test
public void testCreateMultiPartMimeOutput() {
try {
MultiPartOutput output = new MultiPartOutput(guid.getUUID());
output.addPart(PAYLOAD_1, guid.getUUID());
output.addPart(PAYLOAD_2, guid.getUUID());
ByteArrayOutputStream out = new ByteArrayOutputStream();
System.getProperties().store(out, PROPERTY_FILE_HEADER);
output.addPart(out.toByteArray(), guid.getUUID());
ByteArrayIterator input = new ByteArrayIterator(output.getBytes());
assertEquals(NUMBER_OF_PARTS, 3, input.size());
} catch (Exception e) {
fail(e.getMessage());
}
}
use of com.adaptris.util.text.mime.ByteArrayIterator in project interlok by adaptris.
the class MimeHelperTest method testByteArrayIterator_CreateFromInvalid.
@Test
public void testByteArrayIterator_CreateFromInvalid() throws Exception {
try {
ByteArrayIterator m = MimeHelper.createByteArrayIterator(AdaptrisMessageFactory.getDefaultInstance().newMessage("AAAAAAAA"));
fail("Failed");
} catch (Exception expected) {
}
}
use of com.adaptris.util.text.mime.ByteArrayIterator in project interlok by adaptris.
the class MimeHelperTest method testByteArrayIterator_CreateFromFake.
@Test
public void testByteArrayIterator_CreateFromFake() throws Exception {
ByteArrayIterator m = MimeHelper.createByteArrayIterator(AdaptrisMessageFactory.getDefaultInstance().newMessage(MIME_PAYLOAD));
assertNotNull(m);
assertEquals(2, m.size());
}
use of com.adaptris.util.text.mime.ByteArrayIterator in project interlok by adaptris.
the class MimeHelperTest method testByteArrayIterator_CreateFromReal.
@Test
public void testByteArrayIterator_CreateFromReal() throws Exception {
ByteArrayIterator m = MimeHelper.createByteArrayIterator(AdaptrisMessageFactory.getDefaultInstance().newMessage(MIME_HEADER + "\r\n\r\n" + MIME_PAYLOAD));
assertNotNull(m);
assertEquals(2, m.size());
}
use of com.adaptris.util.text.mime.ByteArrayIterator in project interlok by adaptris.
the class TestMultipartOutput method testCreate7bitMimeOutput.
@Test
public void testCreate7bitMimeOutput() {
try {
MultiPartOutput output = new MultiPartOutput(guid.getUUID());
output.addPart(PAYLOAD_1, ENCODING_7BIT, guid.getUUID());
ByteArrayIterator input = new ByteArrayIterator(output.getBytes());
assertEquals(NUMBER_OF_PARTS, 1, input.size());
} catch (Exception e) {
fail(e.getMessage());
}
}
Aggregations