Search in sources :

Example 1 with StringRestEntityOkHttp

use of org.infinispan.client.rest.impl.okhttp.StringRestEntityOkHttp in project infinispan by infinispan.

the class AbstractMultiClusterIT method createCache.

protected void createCache(String cacheName, ConfigurationBuilder builder, RestClient client) {
    String cacheConfig = Common.cacheConfigToJson(cacheName, builder.build());
    StringRestEntityOkHttp body = new StringRestEntityOkHttp(MediaType.APPLICATION_JSON, cacheConfig);
    RestResponse response = join(client.cache(cacheName).createWithConfiguration(body));
    assertEquals(response.getBody(), 200, response.getStatus());
}
Also used : StringRestEntityOkHttp(org.infinispan.client.rest.impl.okhttp.StringRestEntityOkHttp) RestResponse(org.infinispan.client.rest.RestResponse)

Example 2 with StringRestEntityOkHttp

use of org.infinispan.client.rest.impl.okhttp.StringRestEntityOkHttp in project infinispan by infinispan.

the class BaseRestSearchTest method write.

protected void write(int id, String contents, Method method, MediaType contentType) {
    RestEntity entity = new StringRestEntityOkHttp(contentType, contents);
    CompletionStage<RestResponse> response;
    if (method.equals(POST)) {
        response = client.cache(CACHE_NAME).post(String.valueOf(id), entity);
    } else {
        response = client.cache(CACHE_NAME).put(String.valueOf(id), entity);
    }
    ResponseAssertion.assertThat(response).isOk();
}
Also used : StringRestEntityOkHttp(org.infinispan.client.rest.impl.okhttp.StringRestEntityOkHttp) RestEntity(org.infinispan.client.rest.RestEntity) RestResponse(org.infinispan.client.rest.RestResponse)

Aggregations

RestResponse (org.infinispan.client.rest.RestResponse)2 StringRestEntityOkHttp (org.infinispan.client.rest.impl.okhttp.StringRestEntityOkHttp)2 RestEntity (org.infinispan.client.rest.RestEntity)1