use of com.adaptris.core.services.metadata.xpath.XpathObjectQuery in project interlok by adaptris.
the class XpathObjectMetadataServiceTest method testDoService_NotXML.
@Test
public void testDoService_NotXML() throws Exception {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage("ABCDEFG");
XpathObjectMetadataService service = new XpathObjectMetadataService();
service.setXpathQueries(new ArrayList<XpathObjectQuery>(Arrays.asList(new ConfiguredXpathQuery("source", "//source-id"), new ConfiguredXpathQuery("destination", "//destination-id"))));
try {
execute(service, msg);
fail();
} catch (ServiceException expected) {
}
}
use of com.adaptris.core.services.metadata.xpath.XpathObjectQuery 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