use of org.infinispan.client.rest.configuration.Protocol in project infinispan by infinispan.
the class AuthenticationMultiEndpointIT method testRest.
private void testRest() {
Protocol proto = Protocol.valueOf(protocol);
RestClientConfigurationBuilder builder = new RestClientConfigurationBuilder().followRedirects(false);
if (useAuth) {
builder.protocol(proto).security().authentication().mechanism(mechanism).realm(realm).username(userPrefix + "all_user").password("all");
}
try {
RestClient client = SERVER_TEST.rest().withClientConfiguration(builder).withPort(port).create();
validateSuccess();
RestResponse response = sync(client.cache(SERVER_TEST.getMethodName()).post("k1", "v1"));
assertEquals(204, response.getStatus());
assertEquals(proto, response.getProtocol());
response = sync(client.cache(SERVER_TEST.getMethodName()).get("k1"));
assertEquals(200, response.getStatus());
assertEquals(proto, response.getProtocol());
assertEquals("v1", response.getBody());
response = sync(client.raw().get("/"));
assertEquals(isAdmin ? 307 : 404, response.getStatus());
response = sync(client.server().info());
assertEquals(isAdmin ? 200 : 404, response.getStatus());
} catch (SecurityException e) {
validateException(e);
}
}
Aggregations