use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class BaseCacheResourceTest method shouldNegotiateOnlySupportedFromDefaultCacheWithMultipleAccept.
@Test
public void shouldNegotiateOnlySupportedFromDefaultCacheWithMultipleAccept() throws Exception {
String value = "<test/>";
putStringValueInCache("default", "test", value);
RestResponse getResponse = get("default", "test", "text/html, application/xml");
ResponseAssertion.assertThat(getResponse).hasReturnedText("<test/>");
ResponseAssertion.assertThat(getResponse).hasContentType("application/xml");
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class BaseCacheResourceTest method shouldNegotiateFromJsonCacheWithWildcardAccept.
@Test
public void shouldNegotiateFromJsonCacheWithWildcardAccept() throws Exception {
String cacheName = "json";
String key = "1";
String value = "{\"id\": 1}";
putJsonValueInCache(cacheName, key, value);
RestResponse jsonResponse = get(cacheName, key, "*/*");
ResponseAssertion.assertThat(jsonResponse).isOk();
ResponseAssertion.assertThat(jsonResponse).hasReturnedText(value);
ResponseAssertion.assertThat(jsonResponse).hasContentType(APPLICATION_JSON_TYPE);
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class BaseCacheResourceTest method shouldNegotiateFromDefaultCacheWithWildcardAccept.
@Test
public void shouldNegotiateFromDefaultCacheWithWildcardAccept() throws Exception {
putStringValueInCache("default", "test", "test");
RestResponse getResponse = get("default", "test", "*/*");
ResponseAssertion.assertThat(getResponse).isOk();
ResponseAssertion.assertThat(getResponse).hasReturnedText("test");
ResponseAssertion.assertThat(getResponse).hasContentType(APPLICATION_OCTET_STREAM_TYPE);
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class BaseCacheResourceTest method shouldNegotiateFromJsonCacheWithoutAccept.
@Test
public void shouldNegotiateFromJsonCacheWithoutAccept() throws Exception {
String cacheName = "json";
String key = "1";
String value = "{\"id\": 1}";
putJsonValueInCache(cacheName, key, value);
RestResponse getResponse = get(cacheName, key, null);
ResponseAssertion.assertThat(getResponse).hasReturnedText(value);
ResponseAssertion.assertThat(getResponse).hasContentType(APPLICATION_JSON_TYPE);
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class BaseCacheResourceTest method shouldPutImmortalEntryWithMinusOneTtlAndIdleTime.
@Test
public void shouldPutImmortalEntryWithMinusOneTtlAndIdleTime() {
RestCacheClient expirationCache = client.cache("expiration");
// when
CompletionStage<RestResponse> response = expirationCache.put("test", "test", -1, -1);
ResponseAssertion.assertThat(response).isOk();
RestResponse getResponse = join(expirationCache.get("test"));
// then
ResponseAssertion.assertThat(getResponse).isOk();
Assertions.assertThat(getLifespan(getResponse)).isNull();
Assertions.assertThat(getMaxIdle(getResponse)).isNull();
}
Aggregations