use of com.adaptris.core.services.metadata.xpath.ConfiguredXpathQuery in project interlok by adaptris.
the class XpathObjectMetadataServiceTest method testAddXpathQuery.
@Test
public void testAddXpathQuery() {
XpathObjectMetadataService service = new XpathObjectMetadataService();
service.setXmlDocumentFactoryConfig(null);
ConfiguredXpathQuery query = new ConfiguredXpathQuery("failureCount", "count(/svrl:schematron-output/svrl:failed-assert)");
service.addXpathQuery(query);
assertEquals(1, service.getXpathQueries().size());
assertEquals(query, service.getXpathQueries().get(0));
try {
service.addXpathQuery(null);
fail();
} catch (IllegalArgumentException expected) {
}
assertEquals(1, service.getXpathQueries().size());
assertEquals(query, service.getXpathQueries().get(0));
}
use of com.adaptris.core.services.metadata.xpath.ConfiguredXpathQuery 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.ConfiguredXpathQuery in project interlok by adaptris.
the class XpathMetadataServiceTest method testAddXpathQuery.
@Test
public void testAddXpathQuery() {
XpathMetadataService service = new XpathMetadataService();
ConfiguredXpathQuery query = new ConfiguredXpathQuery("failureCount", "count(/svrl:schematron-output/svrl:failed-assert)");
service.addXpathQuery(query);
assertEquals(1, service.getXpathQueries().size());
assertEquals(query, service.getXpathQueries().get(0));
try {
service.addXpathQuery(null);
fail();
} catch (IllegalArgumentException expected) {
}
assertEquals(1, service.getXpathQueries().size());
assertEquals(query, service.getXpathQueries().get(0));
}
use of com.adaptris.core.services.metadata.xpath.ConfiguredXpathQuery in project interlok by adaptris.
the class XpathMetadataServiceTest method testDoService_UsingXpathQuery.
@Test
public void testDoService_UsingXpathQuery() throws Exception {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML);
XpathMetadataService service = new XpathMetadataService();
service.setXpathQueries(new ArrayList<XpathQuery>(Arrays.asList(new ConfiguredXpathQuery("source", "//source-id"), new ConfiguredXpathQuery("destination", "//destination-id"))));
execute(service, msg);
assertEquals("partnera", msg.getMetadataValue("source"));
assertEquals("partnerb", msg.getMetadataValue("destination"));
}
Aggregations