use of com.adaptris.interlok.types.InterlokMessage in project interlok by adaptris.
the class BlobListRendererTest method testRender.
@Test
public void testRender() throws Exception {
InterlokMessage msg = Mockito.mock(InterlokMessage.class);
StringWriter writer = new StringWriter();
Mockito.when(msg.getWriter()).thenReturn(writer);
BlobListRenderer render = new BlobListRenderer() {
};
Collection<RemoteBlob> blobs = createBlobs(10);
render.render(blobs, msg);
assertEquals(10, IOUtils.readLines(new StringReader(writer.toString())).size());
}
use of com.adaptris.interlok.types.InterlokMessage in project interlok by adaptris.
the class BlobListRendererTest method testRender_Fail.
@Test
public void testRender_Fail() throws Exception {
InterlokMessage msg = Mockito.mock(InterlokMessage.class);
StringWriter writer = new StringWriter();
Mockito.when(msg.getWriter()).thenThrow(new IOException());
BlobListRenderer render = new BlobListRenderer() {
};
Collection<RemoteBlob> blobs = createBlobs(10);
try {
render.render(blobs, msg);
fail();
} catch (InterlokException expected) {
}
}
use of com.adaptris.interlok.types.InterlokMessage in project interlok by adaptris.
the class FileDataInputParameterTest method testInterlokMessage.
@Test(expected = RuntimeException.class)
public void testInterlokMessage() throws Exception {
InterlokMessage msg = Mockito.mock(InterlokMessage.class);
FileDataInputParameter p = new FileDataInputParameter();
p.setUrl("file:////tmp/doesnotexist");
p.url(msg);
}
use of com.adaptris.interlok.types.InterlokMessage in project interlok by adaptris.
the class FileInputStreamDataInputParameterTest method testInterlokMessage.
@Test(expected = RuntimeException.class)
public void testInterlokMessage() throws Exception {
InterlokMessage msg = Mockito.mock(InterlokMessage.class);
FileInputStreamDataInputParameter p = new FileInputStreamDataInputParameter();
p.setUrl("file:////tmp/doesnotexist");
p.url(msg);
}
use of com.adaptris.interlok.types.InterlokMessage in project interlok by adaptris.
the class ExceptionAsStringReportTest method testDoService_Payload_Exception.
@Test
public void testDoService_Payload_Exception() throws Exception {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
msg.addObjectHeader(CoreConstants.OBJ_METADATA_EXCEPTION, new Exception("This is the exception"));
ExceptionReportService service = new ExceptionReportService(new ExceptionAsString().withTarget(new DataOutputParameter<String>() {
@Override
public void insert(String data, InterlokMessage msg) throws InterlokException {
throw new CoreException();
}
}));
try {
execute(service, msg);
fail();
} catch (ServiceException expected) {
}
}
Aggregations