Search in sources :

Example 1 with FsProducer

use of com.adaptris.core.fs.FsProducer in project interlok by adaptris.

the class RetryMessageErrorHandlerTest method createForExamples.

@Override
protected RetryMessageErrorHandler createForExamples() {
    RetryMessageErrorHandler meh = new RetryMessageErrorHandler();
    FsProducer producer = new FsProducer();
    producer.setBaseDirectoryUrl("/path/to/bad-directory");
    producer.setEncoder(new MimeEncoder(false, null, null));
    meh.setProcessingExceptionService(new ServiceList(new ArrayList(Arrays.asList(new Service[] { new StandaloneProducer(producer) }))));
    return meh;
}
Also used : FsProducer(com.adaptris.core.fs.FsProducer) ArrayList(java.util.ArrayList) EventHandlerAwareService(com.adaptris.core.stubs.EventHandlerAwareService) ThrowExceptionService(com.adaptris.core.services.exception.ThrowExceptionService)

Example 2 with FsProducer

use of com.adaptris.core.fs.FsProducer in project interlok by adaptris.

the class SharedComponentListTest method createAdapter.

private Adapter createAdapter() throws CoreException, PasswordException {
    Adapter adapter = new Adapter();
    adapter.setUniqueId("upbeat_liskov");
    JmsConnection jmsConnection = createPtpConnection("jms-connection");
    adapter.getSharedComponents().addConnection(jmsConnection);
    ServiceList serviceList = new ServiceList();
    serviceList.setUniqueId("shared-service-list");
    serviceList.add(new LogMessageService("log-message-service"));
    adapter.getSharedComponents().addService(serviceList);
    StandardWorkflow wf1 = new StandardWorkflow();
    wf1.setUniqueId("reverent-edison");
    wf1.setConsumer(new FsConsumer().withBaseDirectoryUrl("in-directory"));
    wf1.setProducer(new FsProducer().withBaseDirectoryUrl("out-directory"));
    wf1.getServiceCollection().add(new SharedService("shared-service-list"));
    StandardWorkflow wf = new StandardWorkflow();
    wf.setUniqueId("pedantic_brown");
    wf.setConsumer(new JmsConsumer().withEndpoint("jms:queue:SampleQueue1"));
    wf.setProducer(new NullMessageProducer());
    wf.getServiceCollection().add(new StandaloneProducer(new SharedConnection("jms-connection"), new JmsProducer().withEndpoint("jms:topic:MyTopicName")));
    Channel channel = new Channel();
    channel.setUniqueId("quirky_shannon");
    channel.setConsumeConnection(new SharedConnection("jms-connection"));
    channel.getWorkflowList().add(wf);
    channel.getWorkflowList().add(wf1);
    adapter.getChannelList().add(channel);
    return adapter;
}
Also used : JmsProducer(com.adaptris.core.jms.JmsProducer) LogMessageService(com.adaptris.core.services.LogMessageService) FsProducer(com.adaptris.core.fs.FsProducer) JmsConsumer(com.adaptris.core.jms.JmsConsumer) FsConsumer(com.adaptris.core.fs.FsConsumer) JmsConnection(com.adaptris.core.jms.JmsConnection)

Example 3 with FsProducer

use of com.adaptris.core.fs.FsProducer in project interlok by adaptris.

the class JmsTransactedWorkflowTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    Channel c = new Channel();
    try {
        c.setUniqueId(UUID.randomUUID().toString());
        c.setConsumeConnection(configure(new JmsConnection()));
        JmsTransactedWorkflow workflow = createWorkflow("Sample_Queue_1");
        workflow.setUniqueId(UUID.randomUUID().toString());
        workflow.setWaitPeriodAfterRollback(new TimeInterval(30L, TimeUnit.SECONDS.name()));
        workflow.getServiceCollection().addService(new WaitService());
        workflow.getServiceCollection().addService(new ThrowExceptionService(new ConfiguredException("Fail")));
        workflow.setProducer(new FsProducer().withBaseDirectoryUrl("file:////path/to/directory"));
        c.getWorkflowList().add(workflow);
    } catch (CoreException e) {
        throw new RuntimeException(e);
    }
    return c;
}
Also used : WaitService(com.adaptris.core.services.WaitService) TimeInterval(com.adaptris.util.TimeInterval) CoreException(com.adaptris.core.CoreException) ThrowExceptionService(com.adaptris.core.services.exception.ThrowExceptionService) MockChannel(com.adaptris.core.stubs.MockChannel) Channel(com.adaptris.core.Channel) FsProducer(com.adaptris.core.fs.FsProducer) ConfiguredException(com.adaptris.core.services.exception.ConfiguredException)

Example 4 with FsProducer

use of com.adaptris.core.fs.FsProducer in project interlok by adaptris.

the class StandaloneProducerTest method testCreateQualifier.

@Test
public void testCreateQualifier() throws Exception {
    FsProducer mp = new FsProducer();
    mp.setUniqueId("abc");
    StandaloneProducer service = new StandaloneProducer(mp);
    assertEquals("abc", service.createQualifier());
    assertEquals(service.getProducer().createQualifier(), service.createQualifier());
    mp.setUniqueId("");
    service.setUniqueId(StandaloneProducer.class.getSimpleName());
    assertEquals(StandaloneProducer.class.getSimpleName(), service.createQualifier());
    assertNotSame(service.getProducer().createQualifier(), service.createQualifier());
}
Also used : FsProducer(com.adaptris.core.fs.FsProducer) Test(org.junit.Test)

Example 5 with FsProducer

use of com.adaptris.core.fs.FsProducer in project interlok by adaptris.

the class StandardProcessingExceptionHandlerTest method createForExamples.

@Override
protected StandardProcessingExceptionHandler createForExamples() {
    StandardProcessingExceptionHandler meh = new StandardProcessingExceptionHandler();
    FsProducer producer = new FsProducer().withBaseDirectoryUrl("/path/to/bad-directory");
    producer.setEncoder(new MimeEncoder(false, null, null));
    meh.setProcessingExceptionService(new ServiceList(Arrays.asList(new Service[] { new StandaloneProducer(producer) })));
    return meh;
}
Also used : FsProducer(com.adaptris.core.fs.FsProducer)

Aggregations

FsProducer (com.adaptris.core.fs.FsProducer)5 ThrowExceptionService (com.adaptris.core.services.exception.ThrowExceptionService)2 Channel (com.adaptris.core.Channel)1 CoreException (com.adaptris.core.CoreException)1 FsConsumer (com.adaptris.core.fs.FsConsumer)1 JmsConnection (com.adaptris.core.jms.JmsConnection)1 JmsConsumer (com.adaptris.core.jms.JmsConsumer)1 JmsProducer (com.adaptris.core.jms.JmsProducer)1 LogMessageService (com.adaptris.core.services.LogMessageService)1 WaitService (com.adaptris.core.services.WaitService)1 ConfiguredException (com.adaptris.core.services.exception.ConfiguredException)1 EventHandlerAwareService (com.adaptris.core.stubs.EventHandlerAwareService)1 MockChannel (com.adaptris.core.stubs.MockChannel)1 TimeInterval (com.adaptris.util.TimeInterval)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1