use of com.adaptris.interlok.InterlokException in project interlok by adaptris.
the class InterlokJmxClientTest method testConnectFailure.
@Test
public void testConnectFailure() throws Exception {
InterlokJmxClient client = new InterlokJmxClient(new JMXServiceURL(String.format(JMXMP_LOCALHOST, "1234")));
try {
client.connect();
fail();
} catch (InterlokException expected) {
} finally {
client.disconnect();
}
}
use of com.adaptris.interlok.InterlokException in project interlok by adaptris.
the class BlobListRendererTest method testWrapException.
@Test
public void testWrapException() {
InterlokException ex = new InterlokException("exception");
assertEquals(ex, BlobListRenderer.wrapInterlokException(ex));
assertNotEquals(ex, BlobListRenderer.wrapInterlokException(new Exception("exception")));
}
use of com.adaptris.interlok.InterlokException 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.InterlokException in project interlok by adaptris.
the class FilesystemRetryStore method report.
@Override
public Iterable<RemoteBlob> report() throws InterlokException {
List<RemoteBlob> result = new ArrayList<>();
try {
File target = validateDir(FsHelper.toFile(getBaseUrl()), false);
File[] files = fsWorker.listFiles(target, DirectoryFileFilter.DIRECTORY);
for (File msgId : files) {
Optional.ofNullable(createForReport(msgId)).ifPresent((blob) -> result.add(blob));
}
} catch (Exception e) {
throw ExceptionHelper.wrapInterlokException(e);
}
return result;
}
use of com.adaptris.interlok.InterlokException in project interlok by adaptris.
the class InterlokJmxClient method findWorkflow.
private MessageProcessor findWorkflow(MessageTarget target) throws InterlokException {
MessageProcessor workflowProxy = null;
try {
ObjectName queryName = ObjectName.getInstance(String.format(JMX_WORKFLOW_MANAGER_NAME, target.getAdapter(), target.getChannel(), target.getWorkflow()));
MBeanServerConnection mbeanServer = getConnection();
ArrayList<ObjectName> names = new ArrayList(mbeanServer.queryNames(queryName, null));
if (names.size() == 0 || names.size() > 1) {
throw new InterlokException(queryName + " does not narrow to a single workflow");
}
workflowProxy = JMX.newMBeanProxy(mbeanServer, names.get(0), MessageProcessor.class);
} catch (Exception e) {
rethrowInterlokException(e);
}
return workflowProxy;
}
Aggregations