use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class RollingUpgradeIT method doRollingUpgrade.
protected void doRollingUpgrade(RestClient client) {
RestResponse response = join(client.cache(CACHE_NAME).synchronizeData());
assertEquals(response.getBody(), 200, response.getStatus());
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class XSiteRestMetricsOperations method assertSiteStatusMetrics.
private static void assertSiteStatusMetrics(RestMetricsClient client, String metric, int expected) throws Exception {
try (RestResponse response = sync(client.metrics())) {
assertEquals(200, response.getStatus());
RestMetricsResource.checkIsPrometheus(response.contentType());
RestMetricsResource.checkRule(response.getBody(), "vendor_" + metric, (stringValue) -> {
int parsed = (int) Double.parseDouble(stringValue);
assertThat(parsed).isEqualTo(expected);
});
}
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class StaticResourceTest method testConsole.
@Test
public void testConsole() {
RestResponse response1 = call("/console/page.htm");
RestResponse response2 = call("/console/folder/test.css");
RestResponse response3 = call("/console");
assertResponse(response1, "static-test/console/page.htm", "console", TEXT_HTML);
assertResponse(response2, "static-test/console/folder/test.css", ".a", TEXT_CSS);
ResponseAssertion.assertThat(response2).isOk();
assertResponse(response3, "static-test/console/index.html", "console", TEXT_HTML);
RestResponse response = call("/console/");
ResponseAssertion.assertThat(response).isOk();
response = call("/console/create");
ResponseAssertion.assertThat(response).isOk();
response = call("/notconsole/");
ResponseAssertion.assertThat(response).isNotFound();
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class StaticResourceTest method testGetFile.
@Test
public void testGetFile() {
RestResponse response = call("/static/nonexistent.html");
ResponseAssertion.assertThat(response).isNotFound();
response = call("/static");
assertResponse(response, "static-test/index.html", "<h1>Hello</h1>", TEXT_HTML);
response = call("/static/index.html");
assertResponse(response, "static-test/index.html", "<h1>Hello</h1>", TEXT_HTML);
response = call("/static/xml/file.xml");
assertResponse(response, "static-test/xml/file.xml", "<distributed-cache", MediaType.fromString("text/xml"), APPLICATION_XML);
response = call("/static/other/text/file.txt");
assertResponse(response, "static-test/other/text/file.txt", "This is a text file", TEXT_PLAIN);
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class TasksResourceTest method testParameterizedTaskExec.
@Test
public void testParameterizedTaskExec() {
RestTaskClient taskClient = client.tasks();
CompletionStage<RestResponse> response = taskClient.exec("PARAMETERIZED_TASK", singletonMap("parameter", "Hello"));
ResponseAssertion.assertThat(response).isOk();
Json jsonNode = Json.read(join(response).getBody());
assertEquals("Hello", jsonNode.asString());
}
Aggregations