Search in sources :

Example 61 with StandardWorkflow

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

the class FailedMessageRetrierCase method createWorkflow.

protected StandardWorkflow createWorkflow(String uniqueId) throws Exception {
    AdaptrisMessageConsumer consumer = new MockMessageConsumer();
    AdaptrisMessageProducer producer = new MockMessageProducer();
    StandardWorkflow workflow = new StandardWorkflow();
    workflow.setUniqueId(uniqueId);
    workflow.setConsumer(consumer);
    workflow.setProducer(producer);
    Channel channel = new MockChannel();
    channel.setUniqueId(null);
    channel.getWorkflowList().add(workflow);
    channel.prepare();
    return workflow;
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) MockChannel(com.adaptris.core.stubs.MockChannel) MockMessageProducer(com.adaptris.core.stubs.MockMessageProducer) AdaptrisMessageConsumer(com.adaptris.core.AdaptrisMessageConsumer) AdaptrisMessageProducer(com.adaptris.core.AdaptrisMessageProducer) MockChannel(com.adaptris.core.stubs.MockChannel) Channel(com.adaptris.core.Channel) MockMessageConsumer(com.adaptris.core.stubs.MockMessageConsumer)

Example 62 with StandardWorkflow

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

the class FsConsumerCase method testFsMonitor.

@Test
public void testFsMonitor() throws Exception {
    String subdir = new GuidGenerator().safeUUID();
    FsConsumerImpl fs = createConsumer(subdir);
    fs.setUniqueId(getName());
    Adapter adapter = new Adapter();
    adapter.setUniqueId(getName());
    Channel channel = new Channel();
    channel.setUniqueId(getName());
    StandardWorkflow wf = new StandardWorkflow();
    wf.setUniqueId(getName());
    wf.setConsumer(fs);
    channel.getWorkflowList().add(wf);
    adapter.getChannelList().add(channel);
    AdapterManager am = new AdapterManager(adapter);
    try {
        am.registerMBean();
        am.requestInit();
        String objectNameString = String.format("com.adaptris:type=ConsumerMonitor,adapter=%s,channel=%s,workflow=%s,id=%s", getName(), getName(), getName(), getName());
        MBeanServer mBeanServer = JmxHelper.findMBeanServer();
        FsConsumerMonitorMBean mbean = JMX.newMBeanProxy(mBeanServer, ObjectName.getInstance(objectNameString), FsConsumerMonitorMBean.class);
        assertEquals(0, mbean.messagesRemaining());
    } finally {
        am.requestClose();
        am.unregisterMBean();
    }
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) AdapterManager(com.adaptris.core.runtime.AdapterManager) Channel(com.adaptris.core.Channel) Adapter(com.adaptris.core.Adapter) GuidGenerator(com.adaptris.util.GuidGenerator) MBeanServer(javax.management.MBeanServer) Test(org.junit.Test)

Example 63 with StandardWorkflow

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

the class JmsConnectionErrorHandlerTest method createWorkflow.

private Workflow createWorkflow(EmbeddedActiveMq mq, String destination) throws Exception {
    StandardWorkflow wf = new StandardWorkflow();
    PasConsumer consumer = new PasConsumer().withTopic(destination);
    wf.setProducer(new MockMessageProducer());
    wf.setConsumer(consumer);
    return wf;
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) PasConsumer(com.adaptris.core.jms.PasConsumer) MockMessageProducer(com.adaptris.core.stubs.MockMessageProducer)

Example 64 with StandardWorkflow

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

the class BasicActiveMqConsumerTest method testTopic_ProduceWhenConsumerStopped.

@Test
public void testTopic_ProduceWhenConsumerStopped() throws Exception {
    PasConsumer consumer = new PasConsumer().withTopic(getName());
    consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
    StandardWorkflow workflow = new StandardWorkflow();
    MockMessageProducer producer = new MockMessageProducer();
    workflow.setConsumer(consumer);
    workflow.setProducer(producer);
    Channel channel = createChannel(activeMqBroker.getJmsConnection(createVendorImpl()), workflow);
    try {
        StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), new PasProducer().withTopic(getName()));
        channel.requestStart();
        workflow.requestStop();
        start(standaloneProducer);
        AdaptrisMessage msg = createMessage(null);
        standaloneProducer.produce(msg);
        Thread.sleep(250);
        assertEquals(0, producer.messageCount());
        stop(standaloneProducer);
    } finally {
        channel.requestClose();
    }
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) PasConsumer(com.adaptris.core.jms.PasConsumer) MockMessageProducer(com.adaptris.core.stubs.MockMessageProducer) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) MockChannel(com.adaptris.core.stubs.MockChannel) Channel(com.adaptris.core.Channel) PasProducer(com.adaptris.core.jms.PasProducer) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Example 65 with StandardWorkflow

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

the class ActiveMqPasPollingConsumerTest method create.

private static PasPollingConsumer create() {
    PasPollingConsumer consumer = new PasPollingConsumer().withTopic("destination");
    consumer.setVendorImplementation(new BasicActiveMqImplementation());
    consumer.registerAdaptrisMessageListener(new StandardWorkflow());
    return consumer;
}
Also used : PasPollingConsumer(com.adaptris.core.jms.PasPollingConsumer) StandardWorkflow(com.adaptris.core.StandardWorkflow)

Aggregations

StandardWorkflow (com.adaptris.core.StandardWorkflow)102 Test (org.junit.Test)78 Channel (com.adaptris.core.Channel)67 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)55 Adapter (com.adaptris.core.Adapter)53 ObjectName (javax.management.ObjectName)41 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)38 TimeInterval (com.adaptris.util.TimeInterval)25 StandaloneProducer (com.adaptris.core.StandaloneProducer)20 BaseComponentMBean (com.adaptris.core.runtime.BaseComponentMBean)16 SimpleNotificationListener (com.adaptris.core.runtime.SimpleNotificationListener)16 ArrayList (java.util.ArrayList)14 StandaloneRequestor (com.adaptris.core.StandaloneRequestor)12 MockChannel (com.adaptris.core.stubs.MockChannel)11 Notification (javax.management.Notification)11 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)10 ServiceList (com.adaptris.core.ServiceList)10 JettyMessageConsumer (com.adaptris.core.http.jetty.JettyMessageConsumer)10 ConfiguredRequestMethodProvider (com.adaptris.core.http.client.ConfiguredRequestMethodProvider)9 HttpConnection (com.adaptris.core.http.jetty.HttpConnection)9