Search in sources :

Example 6 with QuartzCronPoller

use of com.adaptris.core.QuartzCronPoller in project interlok by adaptris.

the class RelaxedFtpCase method testConsume_OverrideUrl.

@Test
public void testConsume_OverrideUrl() throws Exception {
    if (areTestsEnabled()) {
        MockMessageListener listener = new MockMessageListener();
        RelaxedFtpConsumer ftpConsumer = new RelaxedFtpConsumer();
        ftpConsumer.setFtpEndpoint(getDestinationStringWithOverride());
        ftpConsumer.setQuietInterval(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);
        }
    }
}
Also used : QuartzCronPoller(com.adaptris.core.QuartzCronPoller) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) StandaloneConsumer(com.adaptris.core.StandaloneConsumer) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Example 7 with QuartzCronPoller

use of com.adaptris.core.QuartzCronPoller in project interlok by adaptris.

the class FtpConsumerCase method testInit_UnknownFileFilter.

@Test
public void testInit_UnknownFileFilter() throws Exception {
    FtpConsumer ftpConsumer = new FtpConsumer();
    ftpConsumer.setFtpEndpoint(getDestinationString());
    ftpConsumer.setFileFilterImp(".*");
    ftpConsumer.setFileFilterImp("BlahDeBlahDeBlah");
    ftpConsumer.setPoller(new QuartzCronPoller("*/1 * * * * ?"));
    try {
        ftpConsumer.init();
        ftpConsumer.close();
        fail();
    } catch (CoreException expected) {
    }
}
Also used : QuartzCronPoller(com.adaptris.core.QuartzCronPoller) CoreException(com.adaptris.core.CoreException) Test(org.junit.Test)

Example 8 with QuartzCronPoller

use of com.adaptris.core.QuartzCronPoller in project interlok by adaptris.

the class FtpConsumerCase method testInit_ProcDir.

@Test
public void testInit_ProcDir() throws Exception {
    FtpConsumer ftpConsumer = new FtpConsumer();
    ftpConsumer.setFtpEndpoint(getDestinationString());
    ftpConsumer.setWorkDirectory("/work");
    ftpConsumer.setPoller(new QuartzCronPoller("*/1 * * * * ?"));
    ftpConsumer.init();
    ftpConsumer.close();
    ftpConsumer.setProcDirectory("/proc");
    ftpConsumer.init();
    ftpConsumer.close();
    ftpConsumer.setProcDirectory("proc");
    ftpConsumer.init();
    ftpConsumer.close();
}
Also used : QuartzCronPoller(com.adaptris.core.QuartzCronPoller) Test(org.junit.Test)

Example 9 with QuartzCronPoller

use of com.adaptris.core.QuartzCronPoller in project interlok by adaptris.

the class FtpConsumerCase method testInit_WorkDir.

@Test
public void testInit_WorkDir() throws Exception {
    FtpConsumer ftpConsumer = new FtpConsumer();
    ftpConsumer.setFtpEndpoint(getDestinationString());
    ftpConsumer.setFileFilterImp(null);
    ftpConsumer.setWorkDirectory(null);
    ftpConsumer.setPoller(new QuartzCronPoller("*/1 * * * * ?"));
    try {
        ftpConsumer.init();
        ftpConsumer.close();
        fail();
    } catch (CoreException expected) {
    }
    ftpConsumer.setWorkDirectory("work");
    ftpConsumer.init();
    ftpConsumer.close();
    ftpConsumer.setWorkDirectory("/work");
    ftpConsumer.init();
    ftpConsumer.close();
}
Also used : QuartzCronPoller(com.adaptris.core.QuartzCronPoller) CoreException(com.adaptris.core.CoreException) Test(org.junit.Test)

Example 10 with QuartzCronPoller

use of com.adaptris.core.QuartzCronPoller in project interlok by adaptris.

the class FtpCase method testBasicConsume.

@Test
public void testBasicConsume() throws Exception {
    Assume.assumeTrue(areTestsEnabled());
    MockMessageListener listener = new MockMessageListener();
    FtpConsumer ftpConsumer = new FtpConsumer();
    ftpConsumer.setFtpEndpoint(getDestinationString());
    ftpConsumer.setWorkDirectory(DEFAULT_WORK_DIR);
    ftpConsumer.registerAdaptrisMessageListener(listener);
    ftpConsumer.setPoller(new QuartzCronPoller("*/1 * * * * ?"));
    StandaloneConsumer sc = new StandaloneConsumer(createConnection(), ftpConsumer);
    start(sc);
    int count = 1;
    try {
        produce(new StandaloneProducer(createConnection(), createFtpProducer()), count);
        waitForMessages(listener, count);
        assertMessages(listener.getMessages(), count);
    } finally {
        stop(sc);
    }
}
Also used : QuartzCronPoller(com.adaptris.core.QuartzCronPoller) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) StandaloneConsumer(com.adaptris.core.StandaloneConsumer) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Aggregations

QuartzCronPoller (com.adaptris.core.QuartzCronPoller)19 Test (org.junit.Test)19 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)16 StandaloneProducer (com.adaptris.core.StandaloneProducer)16 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)16 CoreException (com.adaptris.core.CoreException)10 GlobFilenameFilter (org.apache.oro.io.GlobFilenameFilter)4 TimeInterval (com.adaptris.util.TimeInterval)3 MetadataFileNameCreator (com.adaptris.core.MetadataFileNameCreator)2 MimeEncoder (com.adaptris.core.MimeEncoder)2 GuidGenerator (com.adaptris.util.GuidGenerator)2 SafeGuidGenerator (com.adaptris.util.SafeGuidGenerator)1