Search in sources :

Example 1 with AddTimestampMetadataService

use of com.adaptris.core.services.metadata.AddTimestampMetadataService in project interlok by adaptris.

the class JavaxValidationCheckerTest method createAdapterConfig.

private Adapter createAdapterConfig(boolean validates, boolean channels) throws Exception {
    Adapter adapter = new Adapter();
    if (validates) {
        // have a unique-id
        adapter.setUniqueId("MyAdapter");
        AddTimestampMetadataService ts = new AddTimestampMetadataService();
        ts.setUniqueId("valid-add-timestamp-service");
        PayloadHashingService ph = new PayloadHashingService();
        ph.setUniqueId("valid-payload-hasher");
        ph.setMetadataKey("payloadHash");
        ph.setHashAlgorithm("SHA-256");
        adapter.getSharedComponents().addService(ts);
        adapter.getSharedComponents().addService(ph);
    } else {
        // no adapter unique-id
        // explicitly set add timestamp to have an empty key, thankfully
        // no checks on the setter...
        AddTimestampMetadataService ts = new AddTimestampMetadataService();
        ts.setUniqueId("invalid-add-timestamp-service");
        ts.setMetadataKey("");
        // don't specify the hash algo or the metadata-key
        PayloadHashingService ph = new PayloadHashingService();
        ph.setUniqueId("invalid-payload-hasher");
        adapter.getSharedComponents().addService(ts);
        adapter.getSharedComponents().addService(ph);
    }
    if (channels) {
        Channel c = new Channel();
        c.setUniqueId("channel");
        StandardWorkflow w = new StandardWorkflow();
        w.setUniqueId("workflow");
        if (!validates) {
            PayloadHashingService ph = new PayloadHashingService();
            ph.setUniqueId("invalid-payload-hasher-2");
            w.getServiceCollection().add(ph);
        }
        c.getWorkflowList().add(w);
        adapter.getChannelList().add(c);
    }
    return adapter;
}
Also used : PayloadHashingService(com.adaptris.core.services.metadata.PayloadHashingService) StandardWorkflow(com.adaptris.core.StandardWorkflow) AddTimestampMetadataService(com.adaptris.core.services.metadata.AddTimestampMetadataService) Channel(com.adaptris.core.Channel) Adapter(com.adaptris.core.Adapter)

Example 2 with AddTimestampMetadataService

use of com.adaptris.core.services.metadata.AddTimestampMetadataService 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 3 with AddTimestampMetadataService

use of com.adaptris.core.services.metadata.AddTimestampMetadataService in project interlok by adaptris.

the class JdbcRawDataCaptureServiceTest method createMessage.

private AdaptrisMessage createMessage() throws Exception {
    AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(CONTENT);
    msg.addMetadata(METADATA_KEY, METADATA_VALUE);
    execute(new AddTimestampMetadataService(), msg);
    return msg;
}
Also used : AdaptrisMessage(com.adaptris.core.AdaptrisMessage) AddTimestampMetadataService(com.adaptris.core.services.metadata.AddTimestampMetadataService)

Aggregations

AddTimestampMetadataService (com.adaptris.core.services.metadata.AddTimestampMetadataService)3 Adapter (com.adaptris.core.Adapter)2 Channel (com.adaptris.core.Channel)2 StandardWorkflow (com.adaptris.core.StandardWorkflow)2 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)1 NullMessageConsumer (com.adaptris.core.NullMessageConsumer)1 PayloadHashingService (com.adaptris.core.services.metadata.PayloadHashingService)1