use of org.apache.druid.java.util.http.client.response.StatusResponseHolder in project druid by druid-io.
the class CoordinatorResourceTestClient method getSegments.
/**
* return a list of the segment dates for the specified data source
*/
public List<String> getSegments(final String dataSource) {
List<String> segments;
try {
StatusResponseHolder response = makeRequest(HttpMethod.GET, getSegmentsMetadataURL(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 postLoadRules.
public void postLoadRules(String datasourceName, List<Rule> rules) throws Exception {
String url = StringUtils.format("%srules/%s", getCoordinatorURL(), datasourceName);
StatusResponseHolder response = httpClient.go(new Request(HttpMethod.POST, new URL(url)).setContent("application/json", jsonMapper.writeValueAsBytes(rules)), 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());
}
}
use of org.apache.druid.java.util.http.client.response.StatusResponseHolder in project druid by druid-io.
the class CoordinatorResourceTestClient method getFullSegmentsMetadata.
public List<DataSegment> getFullSegmentsMetadata(final String dataSource) {
List<DataSegment> segments;
try {
StatusResponseHolder response = makeRequest(HttpMethod.GET, getFullSegmentsMetadataURL(dataSource));
segments = jsonMapper.readValue(response.getContent(), new TypeReference<List<DataSegment>>() {
});
} 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 getLookupLoadStatus.
@Nullable
private Map<String, Map<HostAndPort, LookupsState<LookupExtractorFactoryMapContainer>>> getLookupLoadStatus() {
String url = StringUtils.format("%slookups/nodeStatus", getCoordinatorURL());
Map<String, Map<HostAndPort, LookupsState<LookupExtractorFactoryMapContainer>>> status;
try {
StatusResponseHolder response = httpClient.go(new Request(HttpMethod.GET, new URL(url)), responseHandler).get();
if (response.getStatus().getCode() == HttpResponseStatus.NOT_FOUND.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, Map<HostAndPort, LookupsState<LookupExtractorFactoryMapContainer>>>>() {
});
} 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 OverlordResourceTestClient method shutdownSupervisor.
public void shutdownSupervisor(String id) {
try {
StatusResponseHolder response = httpClient.go(new Request(HttpMethod.POST, new URL(StringUtils.format("%ssupervisor/%s/shutdown", getIndexerURL(), StringUtils.urlEncode(id)))), StatusResponseHandler.getInstance()).get();
if (!response.getStatus().equals(HttpResponseStatus.OK)) {
throw new ISE("Error while shutting down supervisor, response [%s %s]", response.getStatus(), response.getContent());
}
LOG.debug("Shutdown supervisor with id[%s]", id);
} catch (ISE e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations