use of com.adaptris.core.services.metadata.AddMetadataService 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) {
}
}
use of com.adaptris.core.services.metadata.AddMetadataService in project interlok by adaptris.
the class ExceptionHandlingServiceWrapperTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
ExceptionHandlingServiceWrapper service = create();
service.setService(new ServiceList(new Service[] { new ThrowExceptionService(new ConfiguredException("Fail")), new AddMetadataService(Arrays.asList(new MetadataElement[] { new MetadataElement("servicesComplete", "true") })) }));
return service;
}
use of com.adaptris.core.services.metadata.AddMetadataService in project interlok by adaptris.
the class ExceptionHandlingServiceWrapperTest method testNoExceptionFromWrappedServices.
@Test
public void testNoExceptionFromWrappedServices() throws Exception {
AddMetadataService s1 = new AddMetadataService();
s1.addMetadataElement("servicesComplete", "true");
ExceptionHandlingServiceWrapper service = create();
service.setService(s1);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
execute(service, msg);
assertEquals("true", msg.getMetadataValue("servicesComplete"));
assertNull(msg.getMetadataValue("exceptionServiceTriggered"));
}
use of com.adaptris.core.services.metadata.AddMetadataService in project interlok by adaptris.
the class ExceptionHandlingServiceWrapperTest method testWithExceptionFromWrappedServices.
@Test
public void testWithExceptionFromWrappedServices() throws Exception {
ExceptionHandlingServiceWrapper service = create();
service.registerEventHandler(new DefaultEventHandler());
service.setService(new ServiceList(new Service[] { new ThrowExceptionService(new ConfiguredException("Fail")), new AddMetadataService(Arrays.asList(new MetadataElement[] { new MetadataElement("servicesComplete", "true") })) }));
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
assertNotNull(service.wrappedServices());
// ExceptionService defaults to NullService
assertEquals(2, service.wrappedServices().length);
execute(service, msg);
assertEquals("true", msg.getMetadataValue("exceptionServiceTriggered"));
assertNull(msg.getMetadataValue("servicesComplete"));
}
use of com.adaptris.core.services.metadata.AddMetadataService in project interlok by adaptris.
the class ExampleChannelCase method createServiceCollection.
private ServiceCollection createServiceCollection() throws CoreException {
ServiceCollection services = new ServiceList();
AddMetadataService service = new AddMetadataService();
service.addMetadataElement("key1", "val1");
services.addService(service);
services.addService(new LogMessageService());
return services;
}
Aggregations