Search in sources :

Example 1 with XMLContentFilter

use of com.predic8.membrane.core.interceptor.xmlcontentfilter.XMLContentFilter in project service-proxy by membrane.

the class ReassembleTest method testXMLContentFilter.

private void testXMLContentFilter(String xpath, int expectedNumberOfRemainingElements) throws IOException, XPathExpressionException {
    XMLContentFilter cf = new XMLContentFilter(xpath);
    Message m = getResponse();
    cf.removeMatchingElements(m);
    Assert.assertEquals("text/xml", m.getHeader().getContentType());
    Assert.assertEquals(expectedNumberOfRemainingElements + 1, StringUtils.countMatches(m.getBody().toString(), "<"));
}
Also used : XMLContentFilter(com.predic8.membrane.core.interceptor.xmlcontentfilter.XMLContentFilter) Message(com.predic8.membrane.core.http.Message)

Example 2 with XMLContentFilter

use of com.predic8.membrane.core.interceptor.xmlcontentfilter.XMLContentFilter in project service-proxy by membrane.

the class XMLContentFilterTest method applyXPath.

private String applyXPath(String xpath) throws XPathExpressionException {
    Message m = getMessage();
    new XMLContentFilter(xpath).removeMatchingElements(m);
    return m.getBody().toString();
}
Also used : Message(com.predic8.membrane.core.http.Message)

Aggregations

Message (com.predic8.membrane.core.http.Message)2 XMLContentFilter (com.predic8.membrane.core.interceptor.xmlcontentfilter.XMLContentFilter)1