use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class SecretsDeliveryResourceIntegrationTest method returnsJsonArray.
@Test
public void returnsJsonArray() throws Exception {
Request get = new Request.Builder().get().url(testUrl("/secrets")).build();
Response response = client.newCall(get).execute();
assertThat(response.code()).isEqualTo(200);
assertThat(response.body().string()).startsWith("[").endsWith("]");
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class StatusResourceIntegrationTest method successWhenHealthy.
@Test
public void successWhenHealthy() throws Exception {
Request request = new Request.Builder().url("http://localhost:8081/status/enable").post(RequestBody.create(MediaType.parse("text/plain"), "")).build();
Response disableResponse = httpClient.newCall(request).execute();
assertThat(disableResponse.code()).isEqualTo(200);
Thread.sleep(3500);
assertThat(isHealthy()).isTrue();
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class StatusResourceIntegrationTest method isHealthy.
private boolean isHealthy() throws Exception {
Request get = new Request.Builder().get().url(testUrl("/_status")).build();
okhttp3.Response statusResponse = httpsClient.newCall(get).execute();
return statusResponse.code() == 200;
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class AutomationClientResourceIntegrationTest method addClients.
@Test
public void addClients() throws Exception {
CreateClientRequest request = new CreateClientRequest("User1");
String requestJSON = mapper.writeValueAsString(request);
RequestBody body = RequestBody.create(KeywhizClient.JSON, requestJSON);
Request post = new Request.Builder().post(body).url(testUrl("/automation/clients")).addHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON).addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
Response httpResponse = mutualSslClient.newCall(post).execute();
assertThat(httpResponse.code()).isEqualTo(200);
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class AutomationClientResourceIntegrationTest method addClientRedundant.
@Test
public void addClientRedundant() throws Exception {
CreateClientRequest request = new CreateClientRequest("CN=User1");
String json = mapper.writeValueAsString(request);
Request post = new Request.Builder().post(RequestBody.create(KeywhizClient.JSON, json)).url(testUrl("/automation/clients")).addHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON).addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
Response httpResponse = mutualSslClient.newCall(post).execute();
assertThat(httpResponse.code()).isEqualTo(409);
}
Aggregations