use of com.adaptris.core.services.metadata.PayloadHashingService 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;
}
Aggregations