use of com.adaptris.core.BranchingServiceCollection in project interlok by adaptris.
the class EmbeddedScriptingServiceTest method testBranchingServiceExcecution_NextServiceId.
@Test
public void testBranchingServiceExcecution_NextServiceId() throws Exception {
BranchingServiceCollection bsc = new BranchingServiceCollection();
bsc.setFirstServiceId(getName());
bsc.add(createServiceForBranch(getName(), NEXT_SERVICE_ID));
AddMetadataService next = new AddMetadataService(new ArrayList<>(Arrays.asList(new MetadataElement(MY_METADATA_KEY2, MY_METADATA_VALUE))));
next.setUniqueId(NEXT_SERVICE_ID);
bsc.add(next);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
msg.addMetadata(MY_METADATA_KEY, MY_METADATA_VALUE);
execute(bsc, msg);
assertEquals(MY_METADATA_VALUE, msg.getMetadataValue(MY_METADATA_KEY));
assertEquals(MY_METADATA_VALUE, msg.getMetadataValue(MY_METADATA_KEY2));
}
use of com.adaptris.core.BranchingServiceCollection in project interlok by adaptris.
the class SizeBasedBranchingServiceTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
SizeBasedBranchingService s = setupForTests();
BranchingServiceCollection sl = new BranchingServiceCollection();
sl.addService(s);
sl.setFirstServiceId(s.getUniqueId());
sl.addService(new LogMessageService(SMALL_MESSAGE));
sl.addService(new LogMessageService(LARGE_MESSAGE));
return sl;
}
use of com.adaptris.core.BranchingServiceCollection in project interlok by adaptris.
the class CheckMetadataValueServiceTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
CheckMetadataValueService s = createChecker();
s.setNextServiceIdIfDuplicate("duplicate");
s.setNextServiceIdIfUnique("unique");
s.setUniqueId("CheckMetadataAgainstPreviousValues");
BranchingServiceCollection sl = new BranchingServiceCollection();
sl.addService(s);
sl.setFirstServiceId(s.getUniqueId());
sl.addService(new LogMessageService("duplicate"));
sl.addService(new LogMessageService("unique"));
return sl;
}
use of com.adaptris.core.BranchingServiceCollection in project interlok by adaptris.
the class MetadataBranchingServiceTest method createBaseFileName.
@Override
protected String createBaseFileName(Object object) {
BranchingServiceCollection bs = (BranchingServiceCollection) object;
MetadataValueBranchingService s = (MetadataValueBranchingService) bs.getServices().get(0);
return s.getClass().getCanonicalName() + "-" + s.getValueMatcher().getClass().getSimpleName();
}
use of com.adaptris.core.BranchingServiceCollection in project interlok by adaptris.
the class BranchingHttpRequestServiceTest method retrieveObjectForSampleConfig.
@Override
protected BranchingServiceCollection retrieveObjectForSampleConfig() {
BranchingHttpRequestService service = createForExamples();
BranchingServiceCollection sl = new BranchingServiceCollection();
sl.addService(service);
sl.setFirstServiceId(service.getUniqueId());
sl.addService(new ThrowExceptionService("5XX Server Error", new ConfiguredException("Got 5XX error from server")));
sl.addService(new ThrowExceptionService("4XX Client Error", new ConfiguredException("Got 4XX error from server")));
sl.addService(new NullService("Not Found"));
sl.addService(new LogMessageService("2XX OK"));
sl.addService(new ThrowExceptionService("DefaultServiceId", new ConfiguredException("Unmatched Response")));
return sl;
}
Aggregations