use of co.cask.common.http.HttpRequest in project cdap by caskdata.
the class DatasetInstanceHandlerTest method validatePut.
private void validatePut(URL url, String body, Integer... expected) throws IOException {
HttpRequest request = HttpRequest.put(url).withBody(body).build();
assertStatus(HttpRequests.execute(request).getResponseCode(), url, expected);
}
use of co.cask.common.http.HttpRequest in project cdap by caskdata.
the class DatasetInstanceHandlerTest method getInstanceObject.
private ObjectResponse<DatasetMeta> getInstanceObject(String instanceName) throws IOException {
HttpRequest request = HttpRequest.get(getUrl("/data/datasets/" + instanceName)).build();
HttpResponse response = HttpRequests.execute(request);
return ObjectResponse.fromJsonBody(response, DatasetMeta.class);
}
use of co.cask.common.http.HttpRequest in project cdap by caskdata.
the class DatasetInstanceHandlerTest method validateDelete.
private void validateDelete(URL url, Integer... expected) throws IOException {
HttpRequest request = HttpRequest.delete(url).build();
assertStatus(HttpRequests.execute(request).getResponseCode(), url, expected);
}
use of co.cask.common.http.HttpRequest in project cdap by caskdata.
the class DatasetInstanceHandlerTest method getInstance.
private HttpResponse getInstance(DatasetId instance) throws IOException {
URL instanceUrl = getUrl(instance.getNamespace(), "/data/datasets/" + instance.getEntityName());
HttpRequest request = HttpRequest.get(instanceUrl).build();
return HttpRequests.execute(request);
}
use of co.cask.common.http.HttpRequest in project cdap by caskdata.
the class DatasetServiceTestBase method deployModule.
protected HttpResponse deployModule(DatasetModuleId module, Class moduleClass, boolean force) throws Exception {
Location moduleJar = createModuleJar(moduleClass);
String urlPath = "/data/modules/" + module.getEntityName();
urlPath = force ? urlPath + "?force=true" : urlPath;
HttpRequest request = HttpRequest.put(getUrl(module.getNamespace(), urlPath)).addHeader("X-Class-Name", moduleClass.getName()).withBody(Locations.newInputSupplier(moduleJar)).build();
return HttpRequests.execute(request);
}
Aggregations