WFSDataStore wfs = getWFSDataStore(new TinyOwsMockHttpClient() {
@Override
public HTTPResponse post(URL url, InputStream postContent, String postContentType) throws IOException {
String request = new String(IOUtils.toByteArray(postContent), "UTF-8");
if (isHitsRequest(request, idQueryTokens)) {
return new MockHttpResponse(TestData.getResource(this, "tinyows/CountFeatureById.xml"), "text/xml");
} else if (isResultsRequest(request, idQueryTokens)) {
return new MockHttpResponse(TestData.getResource(this, "tinyows/GetFeatureById.xml"), "text/xml");
} else if (isResultsRequest(request, bboxQueryTokens)) {
return new MockHttpResponse(TestData.getResource(this, "tinyows/GetFeaturesByBBox.xml"), "text/xml");
} else {
return super.post(url, new ByteArrayInputStream(request.getBytes("UTF-8")), postContentType);
}
}
});