use of org.infinispan.client.rest.configuration.RestClientConfigurationBuilder in project infinispan by infinispan.
the class AuthenticationKerberosIT method testRest.
public void testRest(Protocol protocol) {
RestClientConfigurationBuilder builder = new RestClientConfigurationBuilder();
if (!mechanism.isEmpty()) {
builder.protocol(protocol).security().authentication().mechanism(mechanism).clientSubject(Common.createSubject("admin", "INFINISPAN.ORG", "strongPassword".toCharArray()));
}
if (mechanism.isEmpty()) {
Exceptions.expectException(SecurityException.class, () -> SERVER_TEST.rest().withClientConfiguration(builder).create());
} else {
RestClient client = SERVER_TEST.rest().withClientConfiguration(builder).create();
RestResponse response = sync(client.cache(SERVER_TEST.getMethodName()).post("k1", "v1"));
assertEquals(204, response.getStatus());
assertEquals(protocol, response.getProtocol());
response = sync(client.cache(SERVER_TEST.getMethodName()).get("k1"));
assertEquals(200, response.getStatus());
assertEquals(protocol, response.getProtocol());
assertEquals("v1", response.getBody());
}
}
Aggregations