use of com.adaptris.core.stubs.DefectiveMessageFactory in project interlok by adaptris.
the class XmlAggregatorCase method testJoinMessage_Fails.
@Test
public void testJoinMessage_Fails() throws Exception {
XmlDocumentAggregator aggr = createAggregatorForTests();
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 AppendinglMessageAggregatorTest method testJoin_WithException.
@Test
public void testJoin_WithException() {
AppendingMessageAggregator aggr = createAggregatorForTests();
AdaptrisMessage original = new DefectiveMessageFactory(EnumSet.of(WhenToBreak.INPUT, WhenToBreak.OUTPUT)).newMessage("Goodbye");
AdaptrisMessage splitMsg1 = AdaptrisMessageFactory.getDefaultInstance().newMessage(" Cruel ");
AdaptrisMessage splitMsg2 = AdaptrisMessageFactory.getDefaultInstance().newMessage("World");
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 FormDataToMetadataTest method testService_Failure.
@Test
public void testService_Failure() throws Exception {
String payload = formatAsFormData(createProperties());
AdaptrisMessage msg = new DefectiveMessageFactory(WhenToBreak.METADATA_GET).newMessage(payload);
msg.addMetadata(Http.CONTENT_TYPE, "application/x-www-form-urlencoded");
FormDataToMetadata service = new FormDataToMetadata();
try {
execute(service, msg);
fail();
} catch (ServiceException expected) {
}
}
use of com.adaptris.core.stubs.DefectiveMessageFactory in project interlok by adaptris.
the class PayloadHashingServiceTest method testServiceException.
@Test
public void testServiceException() throws Exception {
PayloadHashingService service = new PayloadHashingService(SHA256, METADATA_KEY);
AdaptrisMessage msg = new DefectiveMessageFactory().newMessage(PAYLOAD);
try {
execute(service, msg);
fail();
} catch (ServiceException e) {
;
}
}
use of com.adaptris.core.stubs.DefectiveMessageFactory in project interlok by adaptris.
the class MultipartMessageBuilderTest method testService_Exception.
@Test
public void testService_Exception() throws Exception {
AdaptrisMessage msg = new DefectiveMessageFactory(WhenToBreak.OUTPUT).newMessage("Hello World");
MultipartMessageBuilder service = new MultipartMessageBuilder().withMimeParts(new InlineMimePartBuilder());
try {
ExampleServiceCase.execute(service, msg);
fail();
} catch (ServiceException expected) {
}
}
Aggregations