use of com.walmartlabs.concord.it.common.ServerCompatModule in project concord by walmartlabs.
the class ProcessMetadataIT method list.
private List<ProcessEntry> list(String orgName, String projectName, String... kv) throws Exception {
ApiClient apiClient = getApiClient();
HttpUrl.Builder b = HttpUrl.parse(apiClient.getBasePath() + "/api/v2/process").newBuilder().addQueryParameter("orgName", orgName).addQueryParameter("projectName", projectName);
for (int i = 0; i < kv.length - 1; i += 2) {
b.addQueryParameter(kv[i], kv[i + 1]);
}
Request req = new Request.Builder().url(b.build()).header("Authorization", ServerClient.DEFAULT_API_KEY).build();
OkHttpClient httpClient = apiClient.getHttpClient();
Response resp = null;
try {
resp = httpClient.newCall(req).execute();
if (!resp.isSuccessful()) {
throw new RuntimeException("Request failed: " + resp);
}
ObjectMapper om = new ObjectMapper();
// to parse timestamps
om.registerModule(new ServerCompatModule());
return om.readValue(resp.body().byteStream(), LIST_OF_PROCESS_ENTRIES);
} finally {
if (resp != null && resp.body() != null) {
resp.body().close();
}
}
}
Aggregations