use of org.infinispan.rest.TestClass in project infinispan by infinispan.
the class CacheResourceTest method shouldNegotiateFromPojoCacheWithoutAccept.
@Test
public void shouldNegotiateFromPojoCacheWithoutAccept() {
// given
TestClass testClass = new TestClass();
testClass.setName("test");
String json = testClass.toJson().toString();
RestCacheClient pojoCache = client.cache("pojoCache");
String key = "k1";
join(pojoCache.put("k1", json));
// when
RestResponse response = join(pojoCache.get(key, Collections.emptyMap()));
// then
assertThat(response).isOk();
assertThat(response).hasContentType(MediaType.TEXT_PLAIN_TYPE);
assertThat(response).hasReturnedText(json);
}
use of org.infinispan.rest.TestClass in project infinispan by infinispan.
the class CacheResourceTest method shouldConvertExistingSerializableObjectToXml.
@Test
public void shouldConvertExistingSerializableObjectToXml() {
// given
TestClass testClass = new TestClass();
testClass.setName("test");
RestCacheClient objectCache = client.cache("objectCache");
String xml = "<org.infinispan.rest.TestClass><name>test</name></org.infinispan.rest.TestClass>";
join(objectCache.put("test", RestEntity.create(APPLICATION_XML, xml)));
// when
RestResponse response = join(objectCache.get("test", APPLICATION_XML_TYPE));
// then
assertThat(response).isOk();
assertThat(response).hasContentType("application/xml");
assertThat(response).hasReturnedText(xml);
}
use of org.infinispan.rest.TestClass in project infinispan by infinispan.
the class CacheResourceTest method shouldReadAsBinaryWithPojoCache.
@Test
public void shouldReadAsBinaryWithPojoCache() {
// given
RestCacheClient pojoCache = client.cache("pojoCache");
String key = "test";
TestClass value = new TestClass();
value.setName("test");
join(pojoCache.put(key, value.toJson().toString()));
// when
RestResponse response = join(pojoCache.get(key, APPLICATION_OCTET_STREAM_TYPE));
// then
assertThat(response).isOk();
assertThat(response).hasContentType(APPLICATION_OCTET_STREAM_TYPE);
}
Aggregations