use of org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer in project ignite by apache.
the class BinaryConfigurationCustomSerializerSelfTest method testThinClientConnected.
/**
* Test that thin client will be able to connect to node with custom binary serializer and custom consistent ID.
*
* @throws Exception If failed.
*/
@Test
public void testThinClientConnected() throws Exception {
UUID nid = ignite(0).cluster().localNode().id();
GridClientConfiguration clnCfg = new GridClientConfiguration();
clnCfg.setProtocol(GridClientProtocol.TCP);
clnCfg.setServers(Collections.singleton("127.0.0.1:11211"));
clnCfg.setBalancer(new GridClientRoundRobinBalancer());
// Start client.
GridClient client = GridClientFactory.start(clnCfg);
// Execute some task.
client.compute().execute(VisorNodePingTask.class.getName(), new VisorTaskArgument<>(nid, new VisorNodePingTaskArg(nid), false));
GridClientFactory.stop(client.id(), false);
}
use of org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer in project ignite by apache.
the class ClientPreferDirectSelfTest method testRoundRobinBalancer.
/**
* @throws Exception If failed.
*/
@Test
public void testRoundRobinBalancer() throws Exception {
GridClientRoundRobinBalancer b = new GridClientRoundRobinBalancer();
b.setPreferDirectNodes(true);
executeTest(b);
}
use of org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer in project ignite by apache.
the class ClientTcpSslAuthenticationSelfTest method createClient.
/**
* Creates client that will try to connect to only first node in grid.
*
* @return Client.
* @throws Exception If failed to create client.
*/
private GridClientImpl createClient() throws Exception {
GridClientConfiguration cfg = new GridClientConfiguration();
cfg.setServers(Arrays.asList(U.getLocalHost().getHostAddress() + ":" + REST_TCP_PORT));
cfg.setBalancer(new GridClientRoundRobinBalancer());
GridSslBasicContextFactory factory = (GridSslBasicContextFactory) GridTestUtils.sslContextFactory();
factory.setTrustManagers(clientTrustMgr);
cfg.setSslContextFactory(factory);
return (GridClientImpl) GridClientFactory.start(cfg);
}
use of org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer in project ignite by apache.
the class ClientAbstractMultiThreadedSelfTest method clientConfiguration.
/**
* Creates client that will try to connect to only first node in grid.
*
* @return Client.
*/
private GridClientConfiguration clientConfiguration() {
GridClientConfiguration cfg = new GridClientConfiguration();
cfg.setTopologyRefreshFrequency(topologyRefreshFrequency());
cfg.setMaxConnectionIdleTime(maxConnectionIdleTime());
cfg.setProtocol(protocol());
cfg.setServers(Arrays.asList(serverAddress()));
cfg.setBalancer(new GridClientRoundRobinBalancer());
if (useSsl())
cfg.setSslContextFactory(sslContextFactory());
GridClientDataConfiguration loc = new GridClientDataConfiguration();
GridClientDataConfiguration partitioned = new GridClientDataConfiguration();
partitioned.setName(PARTITIONED_CACHE_NAME);
partitioned.setAffinity(new GridClientPartitionAffinity());
GridClientDataConfiguration partitionedAsyncBackup = new GridClientDataConfiguration();
partitionedAsyncBackup.setName(PARTITIONED_ASYNC_BACKUP_CACHE_NAME);
partitionedAsyncBackup.setAffinity(new GridClientPartitionAffinity());
GridClientDataConfiguration replicated = new GridClientDataConfiguration();
replicated.setName(REPLICATED_CACHE_NAME);
GridClientDataConfiguration replicatedAsync = new GridClientDataConfiguration();
replicatedAsync.setName(REPLICATED_ASYNC_CACHE_NAME);
cfg.setDataConfigurations(Arrays.asList(loc, partitioned, replicated, replicatedAsync, partitionedAsyncBackup));
return cfg;
}
Aggregations