Search in sources :

Example 71 with Response

use of org.openclinica.ns.response.v31.Response in project keywhiz by square.

the class SecretResourceTest method lookup.

SecretDetailResponseV2 lookup(String name) throws IOException {
    Request get = clientRequest("/automation/v2/secrets/" + name).get().build();
    Response httpResponse = mutualSslClient.newCall(get).execute();
    assertThat(httpResponse.code()).isEqualTo(200);
    return mapper.readValue(httpResponse.body().byteStream(), SecretDetailResponseV2.class);
}
Also used : Response(okhttp3.Response) Request(okhttp3.Request) TestClients.clientRequest(keywhiz.TestClients.clientRequest)

Example 72 with Response

use of org.openclinica.ns.response.v31.Response in project keywhiz by square.

the class SecretResourceTest method groupsListing.

List<String> groupsListing(String name) throws IOException {
    Request get = clientRequest(format("/automation/v2/secrets/%s/groups", name)).get().build();
    Response httpResponse = mutualSslClient.newCall(get).execute();
    assertThat(httpResponse.code()).isEqualTo(200);
    return mapper.readValue(httpResponse.body().byteStream(), new TypeReference<List<String>>() {
    });
}
Also used : Response(okhttp3.Response) Request(okhttp3.Request) TestClients.clientRequest(keywhiz.TestClients.clientRequest) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList)

Example 73 with Response

use of org.openclinica.ns.response.v31.Response in project keywhiz by square.

the class SecretResourceTest method setCurrentVersion.

private void setCurrentVersion(SetSecretVersionRequestV2 request) throws IOException {
    RequestBody body = RequestBody.create(JSON, mapper.writeValueAsString(request));
    Request post = clientRequest(format("/automation/v2/secrets/%s/setversion", request.name())).post(body).build();
    Response httpResponse = mutualSslClient.newCall(post).execute();
    assertThat(httpResponse.code()).isEqualTo(201);
}
Also used : Response(okhttp3.Response) Request(okhttp3.Request) TestClients.clientRequest(keywhiz.TestClients.clientRequest) RequestBody(okhttp3.RequestBody)

Example 74 with Response

use of org.openclinica.ns.response.v31.Response in project keywhiz by square.

the class GroupResourceTest method createClient.

private Response createClient(String client, String... groups) throws IOException {
    ClientResourceTest clientResourceTest = new ClientResourceTest();
    clientResourceTest.mutualSslClient = mutualSslClient;
    Response response = clientResourceTest.create(CreateClientRequestV2.builder().name(client).groups(groups).build());
    assertThat(response.code()).isEqualTo(201);
    return response;
}
Also used : Response(okhttp3.Response)

Example 75 with Response

use of org.openclinica.ns.response.v31.Response in project keywhiz by square.

the class SecretResourceTest method secretInfo_notFound.

//---------------------------------------------------------------------------------------
// secretInfo
//---------------------------------------------------------------------------------------
@Test
public void secretInfo_notFound() throws Exception {
    Request get = clientRequest("/automation/v2/secrets/non-existent").get().build();
    Response httpResponse = mutualSslClient.newCall(get).execute();
    assertThat(httpResponse.code()).isEqualTo(404);
}
Also used : Response(okhttp3.Response) Request(okhttp3.Request) TestClients.clientRequest(keywhiz.TestClients.clientRequest) Test(org.junit.Test)

Aggregations

Response (okhttp3.Response)478 Request (okhttp3.Request)354 Test (org.junit.Test)213 IOException (java.io.IOException)177 Response (retrofit2.Response)156 ResponseBody (okhttp3.ResponseBody)137 ServiceResponse (com.microsoft.rest.ServiceResponse)114 Call (okhttp3.Call)104 Observable (rx.Observable)98 MockResponse (okhttp3.mockwebserver.MockResponse)76 RequestBody (okhttp3.RequestBody)71 OkHttpClient (okhttp3.OkHttpClient)67 Callback (okhttp3.Callback)44 List (java.util.List)39 TestClients.clientRequest (keywhiz.TestClients.clientRequest)37 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)32 MediaType (okhttp3.MediaType)27 HttpUrl (okhttp3.HttpUrl)26 Interceptor (okhttp3.Interceptor)26 ANResponse (com.androidnetworking.common.ANResponse)23