use of org.infinispan.client.rest.configuration.RestClientConfiguration in project infinispan by infinispan.
the class RestConnectorTest method testUrlWithoutPort.
@Test
public void testUrlWithoutPort() {
RestConnector connector = new RestConnector();
RestConnection connection = (RestConnection) connector.getConnection("http://localhost", null);
RestClientConfigurationBuilder builder = connection.getBuilder();
RestClientConfiguration configuration = builder.build();
assertEquals(80, configuration.servers().get(0).port());
assertEquals("localhost", configuration.servers().get(0).host());
assertFalse(configuration.security().authentication().enabled());
}
use of org.infinispan.client.rest.configuration.RestClientConfiguration in project infinispan by infinispan.
the class RestConnectorTest method testUrlWithCredentials.
@Test
public void testUrlWithCredentials() {
RestConnector connector = new RestConnector();
RestConnection connection = (RestConnection) connector.getConnection("http://user:password@localhost:11222", null);
RestClientConfigurationBuilder builder = connection.getBuilder();
RestClientConfiguration configuration = builder.build();
assertEquals(11222, configuration.servers().get(0).port());
assertEquals("localhost", configuration.servers().get(0).host());
assertTrue(configuration.security().authentication().enabled());
assertEquals("user", configuration.security().authentication().username());
assertArrayEquals("password".toCharArray(), configuration.security().authentication().password());
}
use of org.infinispan.client.rest.configuration.RestClientConfiguration in project infinispan by infinispan.
the class RestConnectorTest method testEmptyUrl.
@Test
public void testEmptyUrl() {
RestConnector connector = new RestConnector();
RestConnection connection = (RestConnection) connector.getConnection("", null);
RestClientConfigurationBuilder builder = connection.getBuilder();
RestClientConfiguration configuration = builder.build();
assertEquals(11222, configuration.servers().get(0).port());
assertEquals("localhost", configuration.servers().get(0).host());
}
use of org.infinispan.client.rest.configuration.RestClientConfiguration in project infinispan by infinispan.
the class XSiteResourceTest method startServers.
@BeforeClass
public void startServers() {
sites.forEach(site -> {
String siteName = site.getSiteName();
EmbeddedCacheManager cm = site.cacheManagers().iterator().next();
RestServerHelper restServerHelper = new RestServerHelper(cm);
restServerHelper.start(TestResourceTracker.getCurrentTestShortName());
restServerPerSite.put(siteName, restServerHelper);
RestClientConfiguration clientConfig = new RestClientConfigurationBuilder().addServer().host("127.0.0.1").port(restServerHelper.getPort()).build();
RestClient client = RestClient.forConfiguration(clientConfig);
clientPerSite.put(siteName, client);
});
}
use of org.infinispan.client.rest.configuration.RestClientConfiguration in project infinispan by infinispan.
the class EndpointInteroperabilityTest method setup.
@BeforeClass
protected void setup() throws Exception {
cacheManager = TestCacheManagerFactory.createServerModeCacheManager();
cacheManager.defineConfiguration(DEFAULT_CACHE_NAME, getDefaultCacheConfiguration().build());
cacheManager.defineConfiguration(MARSHALLED_CACHE_NAME, getMarshalledCacheConfiguration().build());
cacheManager.defineConfiguration(STRING_CACHE_NAME, getStringsCacheConfiguration().build());
RestServerConfigurationBuilder builder = new RestServerConfigurationBuilder();
builder.port(findFreePort());
restServer = new RestServer();
restServer.setServerManagement(new DummyServerManagement(), true);
restServer.start(builder.build(), cacheManager);
RestClientConfigurationBuilder clientBuilder = new RestClientConfigurationBuilder();
RestClientConfiguration configuration = clientBuilder.addServer().host(restServer.getHost()).port(restServer.getPort()).build();
restClient = RestClient.forConfiguration(configuration);
HotRodServerConfigurationBuilder serverBuilder = new HotRodServerConfigurationBuilder();
serverBuilder.adminOperationsHandler(new EmbeddedServerAdminOperationHandler());
hotRodServer = startHotRodServer(cacheManager, serverBuilder);
defaultRemoteCache = createRemoteCacheManager(IdentityMarshaller.INSTANCE).getCache(DEFAULT_CACHE_NAME);
defaultMarshalledRemoteCache = createRemoteCacheManager(null).getCache(MARSHALLED_CACHE_NAME);
stringRemoteCache = createRemoteCacheManager(new UTF8StringMarshaller()).getCache(STRING_CACHE_NAME);
}
Aggregations