use of io.cdap.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, REQUEST_CONFIG);
}
use of io.cdap.common.http.HttpRequest in project cdap by caskdata.
the class DatasetInstanceHandlerTest method createInstance.
private HttpResponse createInstance(DatasetId instance, String typeName, @Nullable String description, @Nullable DatasetProperties props, @Nullable String ownerPrincipal) throws IOException {
DatasetInstanceConfiguration creationProperties;
if (props != null) {
creationProperties = new DatasetInstanceConfiguration(typeName, props.getProperties(), description, ownerPrincipal);
} else {
creationProperties = new DatasetInstanceConfiguration(typeName, null, description, ownerPrincipal);
}
HttpRequest request = HttpRequest.put(getUrl(instance.getNamespace(), "/data/datasets/" + instance.getEntityName())).withBody(GSON.toJson(creationProperties)).build();
return HttpRequests.execute(request, REQUEST_CONFIG);
}
use of io.cdap.common.http.HttpRequest in project cdap by caskdata.
the class DatasetInstanceHandlerTest method validateGet.
private void validateGet(URL url, Integer... expected) throws IOException {
HttpRequest request = HttpRequest.get(url).build();
assertStatus(HttpRequests.execute(request, REQUEST_CONFIG).getResponseCode(), url, expected);
}
use of io.cdap.common.http.HttpRequest in project cdap by caskdata.
the class DatasetInstanceHandlerTest method validatePost.
private void validatePost(URL url, String body, Integer... expected) throws IOException {
HttpRequest request = HttpRequest.post(url).withBody(body).build();
assertStatus(HttpRequests.execute(request, REQUEST_CONFIG).getResponseCode(), url, expected);
}
use of io.cdap.common.http.HttpRequest in project cdap by caskdata.
the class SparkProgramStatusMetricsProvider method doGet.
private HttpResponse doGet(String url) throws IOException {
URL requestURL = new URL(url);
HttpRequest httpRequest = HttpRequest.get(requestURL).build();
return HttpRequests.execute(httpRequest, httpRequestConfig);
}
Aggregations