Search in sources :

Example 51 with Channel

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

the class MultipleInterceptorWorkflowTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    Channel c = new Channel();
    StandardWorkflow wf = new StandardWorkflow();
    wf.setUniqueId("MyWorkflowName");
    MessageMetricsInterceptor ti = new MessageMetricsInterceptor();
    ti.setUniqueId("Metrics_For_MyWorkflowName");
    ti.setTimesliceDuration(new TimeInterval(60L, TimeUnit.SECONDS));
    wf.addInterceptor(ti);
    ThrottlingInterceptor ti2 = new ThrottlingInterceptor();
    ti2.setMaximumMessages(60);
    ti2.setCacheName("60msgsPerMinute");
    ti2.setTimeSliceInterval(new TimeInterval(1L, TimeUnit.MINUTES.name()));
    wf.addInterceptor(ti2);
    c.setUniqueId(UUID.randomUUID().toString());
    wf.setUniqueId(UUID.randomUUID().toString());
    c.getWorkflowList().add(wf);
    return c;
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) TimeInterval(com.adaptris.util.TimeInterval) Channel(com.adaptris.core.Channel)

Example 52 with Channel

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

the class SlowMessageNotificationWorkflowTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    Channel c = new Channel();
    StandardWorkflow wf = new StandardWorkflow();
    SlowMessageNotification ti = new SlowMessageNotification("SlowMessages_For_MyWorkflowName", new TimeInterval(30L, TimeUnit.SECONDS));
    wf.addInterceptor(ti);
    c.getWorkflowList().add(wf);
    c.setUniqueId(UUID.randomUUID().toString());
    wf.setUniqueId(UUID.randomUUID().toString());
    return c;
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) TimeInterval(com.adaptris.util.TimeInterval) Channel(com.adaptris.core.Channel)

Example 53 with Channel

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

the class MessageThresholdNotificationWorkflowTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    Channel c = new Channel();
    StandardWorkflow wf = new StandardWorkflow();
    MessageThresholdNotification ti = new MessageThresholdNotification("MessageCount_For_MyWorkflowName");
    ti.setTimesliceDuration(new TimeInterval(30L, TimeUnit.SECONDS));
    ti.setCountThreshold(20L);
    wf.addInterceptor(ti);
    c.setUniqueId(UUID.randomUUID().toString());
    wf.setUniqueId(UUID.randomUUID().toString());
    c.getWorkflowList().add(wf);
    return c;
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) TimeInterval(com.adaptris.util.TimeInterval) Channel(com.adaptris.core.Channel)

Example 54 with Channel

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

the class MetadataCountWorkflowTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    Channel c = new Channel();
    StandardWorkflow wf = new StandardWorkflow();
    wf.setUniqueId("MyWorkflowName");
    MetadataCountInterceptor ti = new MetadataCountInterceptor("metadatakey1");
    ti.setUniqueId("Metrics_For_MyWorkflowName");
    ti.setTimesliceDuration(new TimeInterval(60L, TimeUnit.SECONDS));
    wf.addInterceptor(ti);
    c.setUniqueId(UUID.randomUUID().toString());
    wf.setUniqueId(UUID.randomUUID().toString());
    c.getWorkflowList().add(wf);
    return c;
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) TimeInterval(com.adaptris.util.TimeInterval) Channel(com.adaptris.core.Channel)

Example 55 with Channel

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

the class JmsTransactedWorkflowTest method testInit_UnsupportedConsumer.

@Test
public void testInit_UnsupportedConsumer() throws Exception {
    Channel channel = createStartableChannel(activeMqBroker);
    JmsTransactedWorkflow workflow = (JmsTransactedWorkflow) channel.getWorkflowList().get(0);
    workflow.setConsumer(new FsConsumer().withBaseDirectoryUrl("file:////path/to/directory"));
    try {
        channel.requestInit();
    } catch (CoreException expected) {
        assertEquals("JmsTransactedWorkflow must be used with a JMSConsumer", expected.getMessage());
    } finally {
        channel.requestClose();
    }
}
Also used : CoreException(com.adaptris.core.CoreException) FsConsumer(com.adaptris.core.fs.FsConsumer) MockChannel(com.adaptris.core.stubs.MockChannel) Channel(com.adaptris.core.Channel) Test(org.junit.Test)

Aggregations

Channel (com.adaptris.core.Channel)322 Test (org.junit.Test)276 Adapter (com.adaptris.core.Adapter)136 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)125 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)122 StandardWorkflow (com.adaptris.core.StandardWorkflow)111 ObjectName (javax.management.ObjectName)97 ArrayList (java.util.ArrayList)74 StandaloneProducer (com.adaptris.core.StandaloneProducer)64 PoolingWorkflow (com.adaptris.core.PoolingWorkflow)57 JettyHelper.createChannel (com.adaptris.core.http.jetty.JettyHelper.createChannel)52 Workflow (com.adaptris.core.Workflow)44 MockChannel (com.adaptris.core.stubs.MockChannel)43 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)37 TimeInterval (com.adaptris.util.TimeInterval)36 HttpConsumerTest (com.adaptris.core.http.jetty.HttpConsumerTest)35 StaticMockMessageProducer (com.adaptris.core.stubs.StaticMockMessageProducer)35 ServiceList (com.adaptris.core.ServiceList)31 StandaloneRequestor (com.adaptris.core.StandaloneRequestor)30 CoreException (com.adaptris.core.CoreException)29