@Override protected SftpConnection createConnectionForExamples() { SftpConnection con = new SftpConnection(); con.setDefaultUserName("default-username-if-not-specified"); con.setDefaultPassword("default-password-if-not-specified"); con.setSftpConnectionBehaviour(new LenientKnownHosts()); return con; }
@Override protected String createBaseFileName(Object object) { SftpConnection con = (SftpConnection) ((StandaloneConsumer) object).getConnection(); return super.createBaseFileName(object) + "-" + con.getClass().getSimpleName() + "-" + con.getSftpConnectionBehaviour().getClass().getSimpleName(); }
private StandaloneConsumer createConsumerExample( SftpConnectionBehaviour behavior, Poller poller) { SftpConnection con = createConnectionForExamples(); RelaxedFtpConsumer cfgConsumer = new RelaxedFtpConsumer(); try { con.setSftpConnectionBehaviour(behavior); con.setDefaultUserName("UserName if Not configured in destination"); cfgConsumer.setDestination( new ConfiguredConsumeDestination( "sftp://overrideuser@hostname:port/path/to/directory", "*.xml")); cfgConsumer.setPoller(poller); } catch (Exception e) { throw new RuntimeException(e); } return new StandaloneConsumer(con, cfgConsumer); }