use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class CacheResourceV2Test method testConversionFromXML.
@Test
public void testConversionFromXML() {
RestRawClient rawClient = client.raw();
String xml = "<infinispan>\n" + " <cache-container>\n" + " <distributed-cache name=\"cacheName\" mode=\"SYNC\">\n" + " <memory>\n" + " <object size=\"20\"/>\n" + " </memory>\n" + " </distributed-cache>\n" + " </cache-container>\n" + "</infinispan>";
CompletionStage<RestResponse> response = rawClient.post("/rest/v2/caches?action=convert", Collections.singletonMap("Accept", APPLICATION_JSON_TYPE), xml, APPLICATION_XML_TYPE);
assertThat(response).isOk();
checkJSON(response);
response = rawClient.post("/rest/v2/caches?action=convert", Collections.singletonMap("Accept", APPLICATION_YAML_TYPE), xml, APPLICATION_XML_TYPE);
assertThat(response).isOk();
checkYaml(response);
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class ContainerResourceTest method testInfo.
@Test
public void testInfo() {
RestResponse response = join(cacheManagerClient.info());
ResponseAssertion.assertThat(response).isOk();
String json = response.getBody();
Json cmInfo = Json.read(json);
assertFalse(cmInfo.at("version").asString().isEmpty());
assertEquals(2, cmInfo.at("cluster_members").asList().size());
assertEquals(2, cmInfo.at("cluster_members_physical_addresses").asList().size());
assertEquals("LON-1", cmInfo.at("local_site").asString());
assertTrue(cmInfo.at("relay_node").asBoolean());
assertEquals(1, cmInfo.at("relay_nodes_address").asList().size());
assertEquals(1, cmInfo.at("sites_view").asList().size());
assertEquals("LON-1", cmInfo.at("sites_view").asList().get(0));
assertTrue(cmInfo.at("rebalancing_enabled").asBoolean());
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class ContainerResourceTest method createCache.
private void createCache(String json, String name) {
RestEntity jsonEntity = RestEntity.create(APPLICATION_JSON, json);
CompletionStage<RestResponse> response = client.cache(name).createWithConfiguration(jsonEntity);
assertThat(response).isOk();
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class ContainerResourceTest method testRebalancingActions.
@Test
public void testRebalancingActions() {
assertRebalancingStatus(true);
RestResponse response = join(adminCacheManagerClient.disableRebalancing());
ResponseAssertion.assertThat(response).isOk();
assertRebalancingStatus(false);
response = join(adminCacheManagerClient.enableRebalancing());
ResponseAssertion.assertThat(response).isOk();
assertRebalancingStatus(true);
}
use of org.infinispan.client.rest.RestResponse in project infinispan by infinispan.
the class ContainerResourceTest method testStats.
@Test
public void testStats() {
RestResponse response = join(adminCacheManagerClient.stats());
ResponseAssertion.assertThat(response).isOk();
String json = response.getBody();
Json cmStats = Json.read(json);
assertTrue(cmStats.at("statistics_enabled").asBoolean());
assertEquals(0, cmStats.at("stores").asInteger());
assertEquals(0, cmStats.at("number_of_entries").asInteger());
// Advance 1 second for the cached stats to expire
timeService.advance(1000);
cacheManagers.iterator().next().getCache("cache1").put("key", "value");
cmStats = Json.read(join(adminCacheManagerClient.stats()).getBody());
assertEquals(1, cmStats.at("stores").asInteger());
assertEquals(1, cmStats.at("number_of_entries").asInteger());
}
Aggregations