use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class AdapterComponentCheckerTest method createConnectedServices.
private String createConnectedServices(String sharedName) throws Exception {
ServiceList nestedList = new ServiceList();
nestedList.add(new StandaloneProducer(new MockAllowsRetriesConnection(6), new NullMessageProducer()));
if (!StringUtils.isEmpty(sharedName)) {
nestedList.add(new StatelessServiceWrapper(new StandaloneProducer(new SharedConnection(sharedName), new NullMessageProducer())));
} else {
nestedList.add(new StatelessServiceWrapper(new StandaloneProducer()));
}
nestedList.add(new AddMetadataService(new ArrayList(Arrays.asList(new MetadataElement[] { new MetadataElement("key", "value") }))));
ServiceList list = new ServiceList();
list.add(nestedList);
list.add(new JdbcServiceList());
return DefaultMarshaller.getDefaultMarshaller().marshal(list);
}
use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class DoWhileTest method testStopProcessingServiceCancelsLoop.
@Test
public void testStopProcessingServiceCancelsLoop() throws Exception {
when(mockCondition.evaluate(message)).thenReturn(true);
Service stopProcessingService = new StopProcessingService();
ServiceList services = new ServiceList();
services.add(stopProcessingService);
services.add(mockService);
thenService = new ThenService();
thenService.setService(services);
doWhile = new DoWhile().withThen(thenService).withCondition(mockCondition);
LifecycleHelper.init(doWhile);
LifecycleHelper.start(doWhile);
doWhile.doService(message);
// The default would loop 10 times, but the stop-processing-service should
// limit us to only a single loop and the condition will never be tested.
verify(mockCondition, times(0)).evaluate(message);
}
use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class DynamicServiceExecutorTest method testDoService_DefaultServiceExtractor_WithMarshaller.
@Test
public void testDoService_DefaultServiceExtractor_WithMarshaller() throws Exception {
AddMetadataService metadataService = new AddMetadataService();
metadataService.addMetadataElement(new MetadataElement(getName(), getName()));
DynamicServiceExecutor dynamicService = createService();
dynamicService.setMarshaller(new XStreamMarshaller());
AdaptrisMessage msg = createMessage(new ServiceList(new Service[] { metadataService }));
execute(dynamicService, msg);
assertEquals(getName(), msg.getMetadataValue(getName()));
}
use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class DynamicServiceExecutorTest method testDoService_MimeServiceExtractor_ByContentId_NotFound.
@Test
public void testDoService_MimeServiceExtractor_ByContentId_NotFound() throws Exception {
AddMetadataService metadataService = new AddMetadataService();
metadataService.addMetadataElement(new MetadataElement(getName(), getName()));
DynamicServiceExecutor dynamicService = createService();
dynamicService.setServiceExtractor(new MimeServiceExtractor(new SelectByContentId("Blah")));
AdaptrisMessage msg = createMimeMessage(new ServiceList(new Service[] { metadataService }), ENCODING_BASE64);
try {
execute(dynamicService, msg);
fail();
} catch (ServiceException expected) {
}
}
use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class DynamicServiceExecutorTest method testDoService_MimeServiceExtractor_NullSelector.
@Test
public void testDoService_MimeServiceExtractor_NullSelector() throws Exception {
AddMetadataService metadataService = new AddMetadataService();
metadataService.addMetadataElement(new MetadataElement(getName(), getName()));
DynamicServiceExecutor dynamicService = createService();
dynamicService.setServiceExtractor(new MimeServiceExtractor());
AdaptrisMessage msg = createMimeMessage(new ServiceList(new Service[] { metadataService }), ENCODING_BASE64);
try {
execute(dynamicService, msg);
fail();
} catch (ServiceException expected) {
}
}
Aggregations