use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class TasksResourceTest method testTaskList.
@Test
public void testTaskList() {
RestTaskClient taskClient = adminClient.tasks();
RestResponse response = join(taskClient.list(ALL));
ResponseAssertion.assertThat(response).isOk();
Json jsonNode = Json.read(response.getBody());
assertEquals(4, jsonNode.asList().size());
Json task = jsonNode.at(0);
assertEquals("Dummy", task.at("type").asString());
assertEquals("ONE_NODE", task.at("execution_mode").asString());
assertEquals("DummyRole", task.at("allowed_role").asString());
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class TasksResourceTest method testFailingTaskExec.
@Test
public void testFailingTaskExec() {
RestTaskClient taskClient = client.tasks();
CompletionStage<RestResponse> response = taskClient.exec("FAILING_TASK");
ResponseAssertion.assertThat(response).isError();
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class TasksResourceTest method testTaskExec.
@Test
public void testTaskExec() {
RestTaskClient taskClient = client.tasks();
RestResponse response = join(taskClient.exec("SUCCESSFUL_TASK"));
ResponseAssertion.assertThat(response).isOk();
Json jsonNode = Json.read(response.getBody());
assertEquals("result", jsonNode.asString());
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class AbstractRestResourceTest method putBinaryValueInCache.
void putBinaryValueInCache(String cacheName, String key, byte[] value, MediaType mediaType) {
RestEntity restEntity = RestEntity.create(mediaType, value);
CompletionStage<RestResponse> response = client.cache(cacheName).put(key, restEntity);
ResponseAssertion.assertThat(response).isOk();
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class BaseCacheResourceTest method shouldGetOctetStreamValueStoredInSpecificFormat.
@Test
public void shouldGetOctetStreamValueStoredInSpecificFormat() throws Exception {
// given
TestClass testClass = new TestClass();
testClass.setName("test");
putBinaryValueInCache("serialized", "test", convertToBytes(testClass), APPLICATION_SERIALIZED_OBJECT);
// when
RestResponse response = join(client.cache("serialized").get("test"));
TestClass convertedObject = convertFromBytes(response.getBodyAsByteArray());
// then
ResponseAssertion.assertThat(response).isOk();
ResponseAssertion.assertThat(response).hasContentType(APPLICATION_SERIALIZED_OBJECT.toString());
ResponseAssertion.assertThat(response).hasNoCharset();
Assertions.assertThat(convertedObject.getName()).isEqualTo("test");
}
Aggregations