Search in sources :

Example 1 with SelectByPosition

use of com.adaptris.util.text.mime.SelectByPosition in project interlok by adaptris.

the class DynamicServiceExecutorTest method testDoService_MimeServiceExtractor_ByPosition.

@Test
public void testDoService_MimeServiceExtractor_ByPosition() throws Exception {
    AddMetadataService metadataService = new AddMetadataService();
    metadataService.addMetadataElement(new MetadataElement(getName(), getName()));
    DynamicServiceExecutor dynamicService = createService();
    dynamicService.setServiceExtractor(new MimeServiceExtractor(new SelectByPosition(0)));
    AdaptrisMessage msg = createMimeMessage(new ServiceList(new Service[] { metadataService }), ENCODING_7BIT);
    execute(dynamicService, msg);
    assertEquals(getName(), msg.getMetadataValue(getName()));
}
Also used : AdaptrisMessage(com.adaptris.core.AdaptrisMessage) ServiceList(com.adaptris.core.ServiceList) Service(com.adaptris.core.Service) LogMessageService(com.adaptris.core.services.LogMessageService) AddMetadataService(com.adaptris.core.services.metadata.AddMetadataService) MetadataElement(com.adaptris.core.MetadataElement) SelectByPosition(com.adaptris.util.text.mime.SelectByPosition) AddMetadataService(com.adaptris.core.services.metadata.AddMetadataService) Test(org.junit.Test)

Aggregations

AdaptrisMessage (com.adaptris.core.AdaptrisMessage)1 MetadataElement (com.adaptris.core.MetadataElement)1 Service (com.adaptris.core.Service)1 ServiceList (com.adaptris.core.ServiceList)1 LogMessageService (com.adaptris.core.services.LogMessageService)1 AddMetadataService (com.adaptris.core.services.metadata.AddMetadataService)1 SelectByPosition (com.adaptris.util.text.mime.SelectByPosition)1 Test (org.junit.Test)1