public void testConsume_OverrideUrl() throws Exception { if (areTestsEnabled()) { MockMessageListener listener = new MockMessageListener(); RelaxedFtpConsumer ftpConsumer = new RelaxedFtpConsumer(); ConfiguredConsumeDestination ccd = new ConfiguredConsumeDestination(getDestinationStringWithOverride()); ccd.setConfiguredThreadName("testBasicConsumeWithOverride"); ftpConsumer.setDestination(ccd); ftpConsumer.setOlderThan(DEFAULT_QUIET_PERIOD); ftpConsumer.registerAdaptrisMessageListener(listener); // Pass in a QuartzId so we don't print out the uname+password. ftpConsumer.setPoller(new QuartzCronPoller("*/1 * * * * ?", "testBasicConsumeWithOverride")); FileTransferConnectionUsingPassword con = createConnection(); con.setDefaultPassword(null); con.setDefaultUserName(null); StandaloneConsumer sc = new StandaloneConsumer(con, ftpConsumer); start(sc); int count = 1; try { produce(new StandaloneProducer(createConnection(), createFtpProducer()), count); waitForMessages(listener, count); assertMessages(listener.getMessages(), count); } finally { stop(sc); } } }
public void testConnect_OverrideUserOnly() throws Exception { if (areTestsEnabled()) { FileTransferConnectionUsingPassword connection = (FileTransferConnectionUsingPassword) createConnection(); connection.setDefaultUserName(null); try { start(connection); FileTransferClient client = connection.connect(getDestinationStringWithOverrideUserOnly()); } finally { stop(connection); } } }