use of com.adaptris.filetransfer.FileTransferException in project interlok by adaptris.
the class RelaxedFtpConsumerTest method testSingleFileConsumeDeleteFailsWithExceptionOnFail.
@Test
public void testSingleFileConsumeDeleteFailsWithExceptionOnFail() throws Exception {
setFilesToConsume(new String[] { "/MySingleFile.txt" }, new String[] { "My file payload" }, new long[] { calendarOneYearAgo.getTimeInMillis() });
consumer.setFailOnDeleteFailure(true);
doThrow(new FileTransferException("expected")).when(mockFileTransferClient).delete(anyString());
LifecycleHelper.init(consumer);
LifecycleHelper.start(consumer);
waitForConsumer(1, 3000);
assertEquals(1, messageListener.getMessages().size());
}
use of com.adaptris.filetransfer.FileTransferException in project interlok by adaptris.
the class StandardSftpConnectionTest method testConnectOnly_StrictKnownHosts_UnknownHost.
@Test
public void testConnectOnly_StrictKnownHosts_UnknownHost() throws Exception {
Assume.assumeTrue(areTestsEnabled());
File tempHostsFile = copyHostsFile(new File(PROPERTIES.getProperty(CFG_UNKNOWN_HOSTS_FILE)));
StandardSftpConnection conn = createConnection();
conn.setConfiguration(new InlineConfigRepositoryBuilder(true).build());
conn.setKnownHostsFile(tempHostsFile.getCanonicalPath());
try {
start(conn);
FileTransferClient c = conn.connect(getDestinationString());
fail();
} catch (FileTransferException expected) {
} finally {
stop(conn);
}
}
use of com.adaptris.filetransfer.FileTransferException in project interlok by adaptris.
the class RelaxedFtpConsumerTest method testIncorrectPathConsume.
@Test
public void testIncorrectPathConsume() throws Exception {
when(mockFtpConnection.connect(consumeDestination)).thenThrow(new FileTransferException("testIncorrectPathConsume"));
setFilesToConsume(new String[] { "/MySingleFile.txt" }, new String[] { "My file payload" }, new long[] { calendarOneYearAgo.getTimeInMillis() });
LifecycleHelper.init(consumer);
LifecycleHelper.start(consumer);
waitForConsumer(1, 1000);
assertEquals(0, messageListener.getMessages().size());
}
Aggregations