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;
}
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;
}
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;
}
Aggregations