Search in sources :

Example 96 with Response

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("]");
}
Also used : SecretDeliveryResponse(keywhiz.api.SecretDeliveryResponse) Response(okhttp3.Response) Request(okhttp3.Request) Test(org.junit.Test)

Example 97 with Response

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();
}
Also used : Response(okhttp3.Response) Request(okhttp3.Request) Test(org.junit.Test)

Example 98 with Response

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;
}
Also used : okhttp3(okhttp3) Request(okhttp3.Request) Response(okhttp3.Response)

Example 99 with Response

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);
}
Also used : ClientDetailResponse(keywhiz.api.ClientDetailResponse) Response(okhttp3.Response) CreateClientRequest(keywhiz.api.CreateClientRequest) Request(okhttp3.Request) CreateClientRequest(keywhiz.api.CreateClientRequest) RequestBody(okhttp3.RequestBody) Test(org.junit.Test)

Example 100 with Response

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);
}
Also used : ClientDetailResponse(keywhiz.api.ClientDetailResponse) Response(okhttp3.Response) CreateClientRequest(keywhiz.api.CreateClientRequest) Request(okhttp3.Request) CreateClientRequest(keywhiz.api.CreateClientRequest) Test(org.junit.Test)

Aggregations

Response (okhttp3.Response)444 Request (okhttp3.Request)320 Test (org.junit.Test)209 IOException (java.io.IOException)158 Response (retrofit2.Response)150 ResponseBody (okhttp3.ResponseBody)128 ServiceResponse (com.microsoft.rest.ServiceResponse)114 Observable (rx.Observable)98 Call (okhttp3.Call)97 MockResponse (okhttp3.mockwebserver.MockResponse)76 RequestBody (okhttp3.RequestBody)65 OkHttpClient (okhttp3.OkHttpClient)60 Callback (okhttp3.Callback)41 List (java.util.List)39 TestClients.clientRequest (keywhiz.TestClients.clientRequest)37 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)32 HttpUrl (okhttp3.HttpUrl)25 ANResponse (com.androidnetworking.common.ANResponse)23 Interceptor (okhttp3.Interceptor)23 MediaType (okhttp3.MediaType)23