use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class BackupManagerIT method testManagerBackupFromFile.
@Test
public void testManagerBackupFromFile() throws Exception {
String name = "testManagerBackup";
performTest(client -> {
RestCacheManagerClient cm = client.cacheManager("clustered");
RestResponse response = await(cm.createBackup(name));
assertEquals(202, response.getStatus());
response.close();
return awaitOk(() -> cm.getBackup(name, false));
}, client -> await(client.cacheManager("clustered").deleteBackup(name)), (zip, client) -> {
RestCacheManagerClient cm = client.cacheManager("clustered");
RestResponse response = await(cm.restore(name, zip.getPath(), null));
assertEquals(202, response.getStatus());
return awaitCreated(() -> cm.getRestore(name));
}, this::assertWildcardContent, true);
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class BackupManagerIT method testClusterBackupUpload.
@Test
public void testClusterBackupUpload() throws Exception {
String name = "testClusterBackup";
performTest(client -> {
RestClusterClient cluster = client.cluster();
RestResponse response = await(cluster.createBackup(name));
assertEquals(202, response.getStatus());
return awaitOk(() -> cluster.getBackup(name, false));
}, client -> await(client.cacheManager("clustered").deleteBackup(name)), (zip, client) -> {
RestClusterClient c = client.cluster();
RestResponse response = await(c.restore(name, zip));
assertEquals(202, response.getStatus());
return awaitCreated(() -> c.getRestore(name));
}, this::assertWildcardContent, false);
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class RestLoggingResource method testManipulateLogger.
@Test
public void testManipulateLogger() {
RestClient client = SERVER_TEST.rest().create();
// Create the logger
RestResponse response = sync(client.server().logging().setLogger("org.infinispan.TESTLOGGER", "WARN", "STDOUT"));
assertEquals(204, response.getStatus());
response = sync(client.server().logging().listLoggers());
assertTrue("Logger not found", findLogger(response, "org.infinispan.TESTLOGGER", "WARN", "STDOUT"));
// Update it
response = sync(client.server().logging().setLogger("org.infinispan.TESTLOGGER", "ERROR", "FILE"));
assertEquals(204, response.getStatus());
response = sync(client.server().logging().listLoggers());
assertTrue("Logger not found", findLogger(response, "org.infinispan.TESTLOGGER", "ERROR", "FILE"));
// Remove it
response = sync(client.server().logging().removeLogger("org.infinispan.TESTLOGGER"));
assertEquals(204, response.getStatus());
response = sync(client.server().logging().listLoggers());
assertFalse("Logger should not be found", findLogger(response, "org.infinispan.TESTLOGGER", "ERROR"));
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class RestLoggingResource method testListAppenders.
@Test
public void testListAppenders() {
RestClient client = SERVER_TEST.rest().create();
RestResponse response = sync(client.server().logging().listAppenders());
String body = response.getBody();
Json appenders = Json.read(body);
assertEquals(body, 5, appenders.asMap().size());
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class RestLoggingResource method testListLoggers.
@Test
public void testListLoggers() {
RestClient client = SERVER_TEST.rest().create();
RestResponse response = sync(client.server().logging().listLoggers());
Json loggers = Json.read(response.getBody());
assertTrue(loggers.asJsonList().size() > 0);
}
Aggregations