use of com.adaptris.core.services.metadata.xpath.XpathQuery in project interlok by adaptris.
the class XpathMetadataServiceTest method testSetXpathQueryList.
@Test
public void testSetXpathQueryList() {
XpathMetadataService service = new XpathMetadataService();
assertEquals(0, service.getXpathQueries().size());
XpathQuery query = new ConfiguredXpathQuery("metadataKey", "//root");
List<XpathQuery> list = new ArrayList<>();
list.add(query);
service.setXpathQueries(list);
assertEquals(list, service.getXpathQueries());
try {
service.setXpathQueries(null);
fail();
} catch (IllegalArgumentException e) {
}
assertEquals(list, service.getXpathQueries());
}
use of com.adaptris.core.services.metadata.xpath.XpathQuery 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