use of com.adaptris.core.services.metadata.xpath.ConfiguredXpathNodeQuery in project interlok by adaptris.
the class XpathObjectMetadataServiceTest method testDoService_UsingXpathQuery.
@Test
public void testDoService_UsingXpathQuery() throws Exception {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML);
XpathObjectMetadataService service = new XpathObjectMetadataService();
service.setXpathQueries(new ArrayList<XpathObjectQuery>(Arrays.asList(new ConfiguredXpathNodeQuery("source", "//source-id"), new ConfiguredXpathNodeQuery("destination", "//destination-id"))));
execute(service, msg);
assertFalse(msg.containsKey("source"));
assertFalse(msg.containsKey("destination"));
assertTrue(msg.getObjectHeaders().containsKey("source"));
assertTrue(msg.getObjectHeaders().containsKey("destination"));
}
use of com.adaptris.core.services.metadata.xpath.ConfiguredXpathNodeQuery in project interlok by adaptris.
the class XpathObjectMetadataServiceTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
XpathObjectMetadataService service = new XpathObjectMetadataService();
service.setXpathQueries(new ArrayList<XpathObjectQuery>(Arrays.asList(new ConfiguredXpathNodeQuery("key1", "//source-id"), new ConfiguredXpathNodeListQuery("key3", "//xpath/that/resolves/to/multiple/items"), new MetadataXpathNodeQuery("key4", "metadata_containing_an_xpath"), new MetadataXpathNodeListQuery("key5", "metadata_containing_a_nodelist_xpath"))));
service.setNamespaceContext(createContextEntries());
return service;
}
use of com.adaptris.core.services.metadata.xpath.ConfiguredXpathNodeQuery in project interlok by adaptris.
the class XpathObjectMetadataServiceTest method testDoService_UsingXpathQuery_WithNamespaceContext.
@Test
public void testDoService_UsingXpathQuery_WithNamespaceContext() throws CoreException {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML_WITH_NAMESPACE);
XpathObjectMetadataService service = new XpathObjectMetadataService();
service.setXpathQueries(new ArrayList<XpathObjectQuery>(Arrays.asList(new ConfiguredXpathNodeQuery("failureCount", "/svrl:schematron-output/svrl:failed-assert"))));
service.setNamespaceContext(createContextEntries());
execute(service, msg);
assertFalse(msg.containsKey("failureCount"));
assertTrue(msg.getObjectHeaders().containsKey("failureCount"));
}
Aggregations