Search in sources :

Example 1 with BranchingServiceCollection

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));
}
Also used : BranchingServiceCollection(com.adaptris.core.BranchingServiceCollection) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) MetadataElement(com.adaptris.core.MetadataElement) AddMetadataService(com.adaptris.core.services.metadata.AddMetadataService) Test(org.junit.Test)

Example 2 with BranchingServiceCollection

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;
}
Also used : BranchingServiceCollection(com.adaptris.core.BranchingServiceCollection)

Example 3 with BranchingServiceCollection

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;
}
Also used : BranchingServiceCollection(com.adaptris.core.BranchingServiceCollection) LogMessageService(com.adaptris.core.services.LogMessageService)

Example 4 with BranchingServiceCollection

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();
}
Also used : BranchingServiceCollection(com.adaptris.core.BranchingServiceCollection)

Example 5 with BranchingServiceCollection

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;
}
Also used : BranchingServiceCollection(com.adaptris.core.BranchingServiceCollection) ThrowExceptionService(com.adaptris.core.services.exception.ThrowExceptionService) NullService(com.adaptris.core.NullService) LogMessageService(com.adaptris.core.services.LogMessageService) ConfiguredException(com.adaptris.core.services.exception.ConfiguredException)

Aggregations

BranchingServiceCollection (com.adaptris.core.BranchingServiceCollection)13 LogMessageService (com.adaptris.core.services.LogMessageService)7 ConfiguredException (com.adaptris.core.services.exception.ConfiguredException)3 ThrowExceptionService (com.adaptris.core.services.exception.ThrowExceptionService)3 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)2 Test (org.junit.Test)2 MetadataElement (com.adaptris.core.MetadataElement)1 NullService (com.adaptris.core.NullService)1 AddMetadataService (com.adaptris.core.services.metadata.AddMetadataService)1