use of com.adaptris.util.text.mime.BodyPartIterator in project interlok by adaptris.
the class FlattenMimePartTest method testFlatten_NotNested.
@Test
public void testFlatten_NotNested() throws Exception {
FlattenMimeParts service = new FlattenMimeParts();
AdaptrisMessage msg = MimeJunitHelper.create();
execute(service, msg);
BodyPartIterator mime = MimeHelper.createBodyPartIterator(msg);
assertEquals(3, mime.size());
}
use of com.adaptris.util.text.mime.BodyPartIterator in project interlok by adaptris.
the class MimeHelperTest method testBodyPartIterator_CreateFromReal.
@Test
public void testBodyPartIterator_CreateFromReal() throws Exception {
BodyPartIterator m = MimeHelper.createBodyPartIterator(AdaptrisMessageFactory.getDefaultInstance().newMessage(MIME_HEADER + "\r\n\r\n" + MIME_PAYLOAD));
assertNotNull(m);
assertEquals(2, m.size());
}
use of com.adaptris.util.text.mime.BodyPartIterator in project interlok by adaptris.
the class MultiPayloadMessageMimeEncoder method readMessage.
@Override
public AdaptrisMessage readMessage(InputStream source) throws CoreException {
try {
MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) currentMessageFactory().newMessage();
BodyPartIterator input = new BodyPartIterator(source);
boolean deleteDefault = addPartsToMessage(input, message);
if (deleteDefault) {
// delete the unused default
message.deletePayload(MultiPayloadAdaptrisMessage.DEFAULT_PAYLOAD_ID);
}
return message;
} catch (Exception e) {
throw ExceptionHelper.wrapCoreException(e);
}
}
use of com.adaptris.util.text.mime.BodyPartIterator in project interlok by adaptris.
the class AggregatingFtpConsumeServiceTest method testService_MultipleFiles.
@Test
public void testService_MultipleFiles() throws Exception {
int count = 5;
EmbeddedFtpServer helper = new EmbeddedFtpServer();
MockMessageListener listener = new MockMessageListener();
FakeFtpServer server = helper.createAndStart(helper.createFilesystem(count));
try {
// should be ftp://localhost/home/user/work/ which is created when you
// create the filesystem.
String ftpConsumeUrl = "ftp://localhost" + DEFAULT_WORK_DIR_CANONICAL;
FtpConnection conn = createConnection(server);
AggregatingFtpConsumer consumer = createConsumer(ftpConsumeUrl, ".*", new IgnoreOriginalMimeAggregator());
AggregatingFtpConsumeService service = new AggregatingFtpConsumeService(conn, consumer);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
execute(service, msg);
BodyPartIterator input = MimeHelper.createBodyPartIterator(msg);
assertEquals(count, input.size());
} finally {
server.stop();
}
}
use of com.adaptris.util.text.mime.BodyPartIterator in project interlok by adaptris.
the class FlattenMimePartTest method testFlatten_Nested.
@Test
public void testFlatten_Nested() throws Exception {
FlattenMimeParts service = new FlattenMimeParts();
AdaptrisMessage msg = MimeJunitHelper.createNested();
execute(service, msg);
BodyPartIterator mime = MimeHelper.createBodyPartIterator(msg);
assertEquals(6, mime.size());
}
Aggregations