Search in sources :

Example 66 with StandardWorkflow

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

the class SharedConnectionConfigurationCheckerTest method createAdapterConfig.

private static String createAdapterConfig(AdaptrisConnection sharedComponent, AdaptrisConnection consumeConnection, AdaptrisConnection produceConnection, AdaptrisConnection serviceConnection) throws Exception {
    Adapter adapter = new Adapter();
    if (sharedComponent != null) {
        adapter.getSharedComponents().addConnection(sharedComponent);
    }
    Channel channel = new Channel();
    if (consumeConnection != null) {
        channel.setConsumeConnection(consumeConnection);
    }
    if (produceConnection != null) {
        channel.setProduceConnection(produceConnection);
    }
    if (serviceConnection != null) {
        StandardWorkflow standardWorkflow = new StandardWorkflow();
        StandaloneProducer sp = new StandaloneProducer(serviceConnection, new NullMessageProducer());
        standardWorkflow.getServiceCollection().add(sp);
        channel.getWorkflowList().add(standardWorkflow);
    }
    adapter.getChannelList().add(channel);
    return DefaultMarshaller.getDefaultMarshaller().marshal(adapter);
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) Channel(com.adaptris.core.Channel) Adapter(com.adaptris.core.Adapter) StandaloneProducer(com.adaptris.core.StandaloneProducer) NullMessageProducer(com.adaptris.core.NullMessageProducer)

Example 67 with StandardWorkflow

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

the class SharedServiceConfigurationCheckerTest method createAdapterConfig.

private static String createAdapterConfig(Service sharedComponent, Service service) throws Exception {
    Adapter adapter = new Adapter();
    if (sharedComponent != null) {
        adapter.getSharedComponents().addService(sharedComponent);
    }
    Channel channel = new Channel();
    StandardWorkflow standardWorkflow = new StandardWorkflow();
    channel.getWorkflowList().add(standardWorkflow);
    adapter.getChannelList().add(channel);
    if (service != null) {
        standardWorkflow.getServiceCollection().add(service);
    }
    return DefaultMarshaller.getDefaultMarshaller().marshal(adapter);
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) Channel(com.adaptris.core.Channel) Adapter(com.adaptris.core.Adapter)

Example 68 with StandardWorkflow

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

the class DeprecatedConfigurationCheckerTest method createAdapterConfig.

private Adapter createAdapterConfig(boolean validates, boolean channels) throws Exception {
    Adapter adapter = new Adapter();
    // have a unique-id
    adapter.setUniqueId("MyAdapter");
    AddTimestampMetadataService atms = new AddTimestampMetadataService();
    atms.setUniqueId("valid-add-timestamp-service");
    adapter.getSharedComponents().addService(atms);
    if (!validates) {
        // Add a deprecated service
        DeprecatedService ds = new DeprecatedService();
        adapter.getSharedComponents().addService(ds);
        // Add a service with deprecated member
        DeprecatedMemberService dms = new DeprecatedMemberService();
        dms.setDeprecated("value");
        adapter.getSharedComponents().addService(dms);
    }
    if (channels) {
        Channel c = new Channel();
        StandardWorkflow w = new StandardWorkflow();
        if (!validates) {
            NullMessageConsumer consumer = new NullMessageConsumer();
            w.setConsumer(consumer);
            w.getServiceCollection().add(new DeprecatedService());
        }
        c.getWorkflowList().add(w);
        adapter.getChannelList().add(c);
    }
    return adapter;
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) AddTimestampMetadataService(com.adaptris.core.services.metadata.AddTimestampMetadataService) Channel(com.adaptris.core.Channel) Adapter(com.adaptris.core.Adapter) NullMessageConsumer(com.adaptris.core.NullMessageConsumer)

Example 69 with StandardWorkflow

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

the class StatisticsMBeanCase method createWorkflow.

protected static StandardWorkflow createWorkflow(String uid, WorkflowInterceptor... interceptors) throws CoreException {
    StandardWorkflow wf = new StandardWorkflow();
    wf.setUniqueId(uid);
    for (WorkflowInterceptor wi : interceptors) {
        wf.addInterceptor(wi);
    }
    return wf;
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) WorkflowInterceptor(com.adaptris.core.WorkflowInterceptor)

Example 70 with StandardWorkflow

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

the class ThrottlingInterceptorWorkflowTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    Channel c = new Channel();
    StandardWorkflow wf = new StandardWorkflow();
    ThrottlingInterceptor ti = new ThrottlingInterceptor();
    ti.setMaximumMessages(60);
    ti.setCacheName("60msgsPerMinute");
    ti.setTimeSliceInterval(new TimeInterval(1L, TimeUnit.MINUTES.name()));
    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)

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