use of org.opennms.netmgt.measurements.api.QueryRequestValidator in project opennms by OpenNMS.
the class AbstractMeasurementQueryExecutorTest method verifyHttpCalls.
protected void verifyHttpCalls(int number) {
// ensure a request was actually made and was only made <number> times
WireMock.verify(number, WireMock.postRequestedFor(WireMock.urlMatching("/opennms/rest/measurements")).withoutHeader("Authorization").withHeader("Content-Type", WireMock.equalTo("application/xml")));
// VERIFY that the Request Body is a valid QueryRequest
Assert.assertEquals(number, requestList.size());
for (Request eachRequest : requestList) {
QueryRequest queryRequest = JAXB.unmarshal(new ByteArrayInputStream(eachRequest.getBody()), QueryRequest.class);
try {
new QueryRequestValidator().validate(queryRequest);
} catch (ValidationException e) {
Throwables.propagate(e);
}
}
}
Aggregations