/** * Validates an XML "query" response against an array of XPath test strings * * @param request the Query to process * @return null if all good, otherwise the first test that fails. * @exception Exception any exception in the response. * @exception java.io.IOException if there is a problem writing the XML */ public String validateQuery(String request, String... tests) throws Exception { String res = query(request); return validateXPath(res, tests); }
public String checkResponseStatus(String xml, String code) throws Exception { try { String response = query(xml); String valid = validateXPath(response, "//int[@name='status']="+code ); return (null == valid) ? null : response; } catch (XPathExpressionException e) { throw new RuntimeException("?!? static xpath has bug?", e); } }
public String checkAdminResponseStatus(String xml, String code) throws Exception { try { String response = adminQuery(xml); String valid = validateXPath(response, "//int[@name='status']="+code ); return (null == valid) ? null : response; } catch (XPathExpressionException e) { throw new RuntimeException("?!? static xpath has bug?", e); } } /**
/** * Validates an XML PUT response against an array of XPath test strings * * @param request the PUT request to process * @param content the content to send with the PUT request * @param tests the validating XPath tests * @return null if all good, otherwise the first test that fails. * @exception Exception any exception in the response. * @exception java.io.IOException if there is a problem writing the XML */ public String validatePut(String request, String content, String... tests) throws Exception { String res = put(request, content); return validateXPath(res, tests); }