use of org.apache.ignite.internal.client.GridClientDataConfiguration in project ignite by apache.
the class ClientPropertiesConfigurationSelfTest method testSpringConfig.
/**
* Validate spring client configuration.
*
* @throws Exception In case of any exception.
*/
public void testSpringConfig() throws Exception {
GridClientConfiguration cfg = new FileSystemXmlApplicationContext(GRID_CLIENT_SPRING_CONFIG.toString()).getBean(GridClientConfiguration.class);
assertEquals(Arrays.asList("127.0.0.1:11211"), new ArrayList<>(cfg.getServers()));
assertNull(cfg.getSecurityCredentialsProvider());
Collection<GridClientDataConfiguration> dataCfgs = cfg.getDataConfigurations();
assertEquals(1, dataCfgs.size());
GridClientDataConfiguration dataCfg = dataCfgs.iterator().next();
assertEquals("partitioned", dataCfg.getName());
assertNotNull(dataCfg.getPinnedBalancer());
assertEquals(GridClientRandomBalancer.class, dataCfg.getPinnedBalancer().getClass());
assertNotNull(dataCfg.getAffinity());
assertEquals(GridClientPartitionAffinity.class, dataCfg.getAffinity().getClass());
}
use of org.apache.ignite.internal.client.GridClientDataConfiguration in project ignite by apache.
the class ClientAbstractMultiNodeSelfTest method clientConfiguration.
/**
* @return Client configuration for the test.
*/
protected GridClientConfiguration clientConfiguration() throws GridClientException {
GridClientConfiguration cfg = new GridClientConfiguration();
cfg.setBalancer(getBalancer());
cfg.setTopologyRefreshFrequency(TOP_REFRESH_FREQ);
cfg.setProtocol(protocol());
cfg.setServers(Arrays.asList(serverAddress()));
cfg.setSslContextFactory(sslContextFactory());
GridClientDataConfiguration loc = new GridClientDataConfiguration();
GridClientDataConfiguration partitioned = new GridClientDataConfiguration();
partitioned.setName(PARTITIONED_CACHE_NAME);
partitioned.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));
return cfg;
}
use of org.apache.ignite.internal.client.GridClientDataConfiguration in project ignite by apache.
the class ClientAbstractSelfTest method clientConfiguration.
/**
* @return Test client configuration.
*/
protected GridClientConfiguration clientConfiguration() throws GridClientException {
GridClientConfiguration cfg = new GridClientConfiguration();
GridClientDataConfiguration nullCache = new GridClientDataConfiguration();
GridClientDataConfiguration cache = new GridClientDataConfiguration();
cache.setName(CACHE_NAME);
cfg.setDataConfigurations(Arrays.asList(nullCache, cache));
cfg.setProtocol(protocol());
cfg.setServers(Collections.singleton(serverAddress()));
// Setting custom executor, to avoid failures on client shutdown.
// And applying custom naming scheme to ease debugging.
cfg.setExecutorService(Executors.newCachedThreadPool(new ThreadFactory() {
private AtomicInteger cntr = new AtomicInteger();
@SuppressWarnings("NullableProblems")
@Override
public Thread newThread(Runnable r) {
return new Thread(r, "client-worker-thread-" + cntr.getAndIncrement());
}
}));
if (useSsl())
cfg.setSslContextFactory(sslContextFactory());
return cfg;
}
use of org.apache.ignite.internal.client.GridClientDataConfiguration in project ignite by apache.
the class TaskCommandHandlerSelfTest method clientConfiguration.
/**
* @return Client configuration.
*/
private GridClientConfiguration clientConfiguration() {
GridClientConfiguration cfg = new GridClientConfiguration();
GridClientDataConfiguration nullCache = new GridClientDataConfiguration();
GridClientDataConfiguration cache = new GridClientDataConfiguration();
cache.setName(CACHE_NAME);
cfg.setDataConfigurations(Arrays.asList(nullCache, cache));
cfg.setProtocol(TCP);
cfg.setServers(Arrays.asList("localhost:" + BINARY_PORT));
return cfg;
}
use of org.apache.ignite.internal.client.GridClientDataConfiguration in project ignite by apache.
the class ClientCacheBenchmark method configuration.
/**
* @return Test client configuration.
*/
private GridClientConfiguration configuration() {
GridClientConfiguration cfg = new GridClientConfiguration();
cfg.setServers(Collections.singleton("localhost:11211"));
GridClientDataConfiguration cacheCfg = new GridClientDataConfiguration();
cacheCfg.setName("partitioned");
cacheCfg.setAffinity(new GridClientPartitionAffinity());
cfg.setDataConfigurations(Collections.singletonList(cacheCfg));
return cfg;
}
Aggregations