use of org.apache.druid.java.util.http.client.response.StatusResponseHolder in project druid by druid-io.
the class CompactionResourceTestClient method getCoordinatorCompactionConfigs.
public CoordinatorCompactionConfig getCoordinatorCompactionConfigs() throws Exception {
String url = StringUtils.format("%sconfig/compaction", getCoordinatorURL());
StatusResponseHolder response = httpClient.go(new Request(HttpMethod.GET, new URL(url)), responseHandler).get();
if (!response.getStatus().equals(HttpResponseStatus.OK)) {
throw new ISE("Error while getting compaction config status[%s] content[%s]", response.getStatus(), response.getContent());
}
return jsonMapper.readValue(response.getContent(), new TypeReference<CoordinatorCompactionConfig>() {
});
}
use of org.apache.druid.java.util.http.client.response.StatusResponseHolder in project druid by druid-io.
the class CompactionResourceTestClient method forceTriggerAutoCompaction.
public void forceTriggerAutoCompaction() throws Exception {
String url = StringUtils.format("%scompaction/compact", getCoordinatorURL());
StatusResponseHolder response = httpClient.go(new Request(HttpMethod.POST, new URL(url)), responseHandler).get();
if (!response.getStatus().equals(HttpResponseStatus.OK)) {
throw new ISE("Error while force trigger auto compaction status[%s] content[%s]", response.getStatus(), response.getContent());
}
}
use of org.apache.druid.java.util.http.client.response.StatusResponseHolder in project druid by druid-io.
the class CoordinatorResourceTestClient method getSegmentIntervals.
// return a list of the segment dates for the specified datasource
public List<String> getSegmentIntervals(final String dataSource) {
List<String> segments;
try {
StatusResponseHolder response = makeRequest(HttpMethod.GET, getIntervalsURL(dataSource));
segments = jsonMapper.readValue(response.getContent(), new TypeReference<List<String>>() {
});
} catch (Exception e) {
throw new RuntimeException(e);
}
return segments;
}
use of org.apache.druid.java.util.http.client.response.StatusResponseHolder in project druid by druid-io.
the class CoordinatorResourceTestClient method getLoadStatus.
private Map<String, Integer> getLoadStatus(String dataSorce) {
String url = getLoadStatusURL(dataSorce);
Map<String, Integer> status;
try {
StatusResponseHolder response = httpClient.go(new Request(HttpMethod.GET, new URL(url)), responseHandler).get();
if (response.getStatus().getCode() == HttpResponseStatus.NO_CONTENT.getCode()) {
return null;
}
if (response.getStatus().getCode() != HttpResponseStatus.OK.getCode()) {
throw new ISE("Error while making request to url[%s] status[%s] content[%s]", url, response.getStatus(), response.getContent());
}
status = jsonMapper.readValue(response.getContent(), new TypeReference<Map<String, Integer>>() {
});
} catch (Exception e) {
throw new RuntimeException(e);
}
return status;
}
use of org.apache.druid.java.util.http.client.response.StatusResponseHolder in project druid by druid-io.
the class CoordinatorResourceTestClient method postDynamicConfig.
public void postDynamicConfig(CoordinatorDynamicConfig coordinatorDynamicConfig) throws Exception {
String url = StringUtils.format("%sconfig", getCoordinatorURL());
StatusResponseHolder response = httpClient.go(new Request(HttpMethod.POST, new URL(url)).setContent("application/json", jsonMapper.writeValueAsBytes(coordinatorDynamicConfig)), responseHandler).get();
if (!response.getStatus().equals(HttpResponseStatus.OK)) {
throw new ISE("Error while setting dynamic config[%s] status[%s] content[%s]", url, response.getStatus(), response.getContent());
}
}
Aggregations