use of com.adaptris.core.stubs.DefectiveMessageFactory in project interlok by adaptris.
the class AggregatingFtpConsumeServiceTest method testService_MultipleFiles_Failure.
@Test
public void testService_MultipleFiles_Failure() 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 = new DefectiveMessageFactory().newMessage();
try {
execute(service, msg);
fail();
} catch (ServiceException expected) {
}
} finally {
server.stop();
}
}
use of com.adaptris.core.stubs.DefectiveMessageFactory in project interlok by adaptris.
the class MessageHelperTest method testCopyPayload_Failure.
@Test(expected = IOException.class)
public void testCopyPayload_Failure() throws Exception {
AdaptrisMessage reply = new DefectiveMessageFactory(WhenToBreak.BOTH).newMessage();
AdaptrisMessage original = new DefaultMessageFactory().newMessage();
MessageHelper.copyPayload(reply, original);
}
use of com.adaptris.core.stubs.DefectiveMessageFactory in project interlok by adaptris.
the class FormDataFromMetadataTest method testService_Failure.
@Test
public void testService_Failure() throws Exception {
AdaptrisMessage msg = new DefectiveMessageFactory(WhenToBreak.METADATA_GET).newMessage();
msg.addMetadata("param1", "this is a field");
msg.addMetadata("param3", "was it clear (already)?");
FormDataToMetadata service = new FormDataToMetadata();
try {
execute(createService(), msg);
fail();
} catch (ServiceException expected) {
}
}
use of com.adaptris.core.stubs.DefectiveMessageFactory in project interlok by adaptris.
the class IgnoreOriginalXmlAggregatorTest method testJoinMessage_NoTemplate.
@Test
public void testJoinMessage_NoTemplate() throws Exception {
XmlDocumentAggregator aggr = new IgnoreOriginalXmlDocumentAggregator();
aggr.setMergeImplementation(new InsertNode(XPATH_ENVELOPE));
AdaptrisMessage original = AdaptrisMessageFactory.getDefaultInstance().newMessage("<envelope/>");
AdaptrisMessage splitMsg1 = AdaptrisMessageFactory.getDefaultInstance().newMessage("<document>hello</document>");
AdaptrisMessage splitMsg2 = new DefectiveMessageFactory().newMessage("<document>world</document>");
try {
aggr.joinMessage(original, Arrays.asList(new AdaptrisMessage[] { splitMsg1, splitMsg2 }));
fail();
} catch (CoreException expected) {
}
}
use of com.adaptris.core.stubs.DefectiveMessageFactory in project interlok by adaptris.
the class MimeAggregatorCase method testJoinMessage_Fails.
@Test
public void testJoinMessage_Fails() throws Exception {
MimeAggregator aggr = createAggregatorForTests();
AdaptrisMessage original = new DefectiveMessageFactory().newMessage("<envelope/>");
AdaptrisMessage splitMsg1 = AdaptrisMessageFactory.getDefaultInstance().newMessage("<document>hello</document>");
AdaptrisMessage splitMsg2 = AdaptrisMessageFactory.getDefaultInstance().newMessage("<document>world</document>");
try {
aggr.joinMessage(original, Arrays.asList(new AdaptrisMessage[] { splitMsg1, splitMsg2 }));
fail();
} catch (CoreException expected) {
}
}
Aggregations