Search in sources :

Example 6 with RestRawClient

use of org.infinispan.client.rest.RestRawClient in project infinispan by infinispan.

the class CacheResourceV2Test method testConversionFromYAML.

@Test
public void testConversionFromYAML() throws Exception {
    RestRawClient rawClient = client.raw();
    String yaml = "distributedCache:\n" + "  mode: 'SYNC'\n" + "  memory:\n" + "    storage: 'OBJECT'\n" + "    maxCount: 20";
    CompletionStage<RestResponse> response = rawClient.post("/rest/v2/caches?action=convert", Collections.singletonMap("Accept", APPLICATION_XML_TYPE), yaml, APPLICATION_YAML_TYPE);
    assertThat(response).isOk();
    checkXML(response);
    response = rawClient.post("/rest/v2/caches?action=convert", Collections.singletonMap("Accept", APPLICATION_JSON_TYPE), yaml, APPLICATION_YAML_TYPE);
    assertThat(response).isOk();
    checkJSON(response);
}
Also used : RestRawClient(org.infinispan.client.rest.RestRawClient) RestResponse(org.infinispan.client.rest.RestResponse) Util.getResourceAsString(org.infinispan.commons.util.Util.getResourceAsString) Test(org.testng.annotations.Test)

Example 7 with RestRawClient

use of org.infinispan.client.rest.RestRawClient in project infinispan by infinispan.

the class BaseCacheResourceTest method shouldReturnNotExistingOnWrongContext.

@Test
public void shouldReturnNotExistingOnWrongContext() {
    putStringValueInCache("default", "test", "test");
    RestRawClient rawClient = client.raw();
    String path = String.format("/wrongContext/%s/%s", "default", "test");
    CompletionStage<RestResponse> response = rawClient.get(path);
    // then
    ResponseAssertion.assertThat(response).doesntExist();
}
Also used : RestRawClient(org.infinispan.client.rest.RestRawClient) RestResponse(org.infinispan.client.rest.RestResponse) Test(org.testng.annotations.Test)

Aggregations

RestRawClient (org.infinispan.client.rest.RestRawClient)7 RestResponse (org.infinispan.client.rest.RestResponse)5 Test (org.testng.annotations.Test)5 Util.getResourceAsString (org.infinispan.commons.util.Util.getResourceAsString)4 HashMap (java.util.HashMap)2 RestClientConfigurationBuilder (org.infinispan.client.rest.configuration.RestClientConfigurationBuilder)1 ServerConfigurationBuilder (org.infinispan.client.rest.configuration.ServerConfigurationBuilder)1 Router (org.infinispan.server.router.Router)1 RouterConfigurationBuilder (org.infinispan.server.router.configuration.builder.RouterConfigurationBuilder)1 EndpointRouter (org.infinispan.server.router.router.EndpointRouter)1 Route (org.infinispan.server.router.routes.Route)1 RestRouteSource (org.infinispan.server.router.routes.rest.RestRouteSource)1 RestServerRouteDestination (org.infinispan.server.router.routes.rest.RestServerRouteDestination)1 Test (org.junit.Test)1