private static final String JSON_SELECTOR = ".json";
private static final String REPLICATION_ROOT_PATH = "/libs/sling/replication";
private static String assertPostResourceWithParameters(SlingInstance slingInstance,
int status, String path, String... parameters) throws IOException {
Request request = slingInstance.getRequestBuilder().buildPostRequest(path);
if (parameters != null) {
assertEquals(0, parameters.length % 2);
List<NameValuePair> valuePairList = new ArrayList<NameValuePair>();
for (int i = 0; i < parameters.length; i += 2) {
valuePairList.add(new BasicNameValuePair(parameters[i], parameters[i + 1]));
}
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(valuePairList);
request.withEntity(entity);
}
return slingInstance.getRequestExecutor().execute(
request.withCredentials(slingInstance.getServerUsername(), slingInstance.getServerPassword())
).assertStatus(status).getContent();
}