use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.
the class ClientTcpDirectSelfTest method clientConfiguration.
/** {@inheritDoc} */
@Override
protected GridClientConfiguration clientConfiguration() throws GridClientException {
GridClientConfiguration cfg = super.clientConfiguration();
cfg.setServers(Collections.<String>emptySet());
cfg.setRouters(Collections.singleton(HOST + ":" + BINARY_PORT));
return cfg;
}
use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.
the class RestProcessorStartSelfTest method testTcpStart.
/**
* @throws Exception If failed.
*/
public void testTcpStart() throws Exception {
GridClientConfiguration clCfg = new GridClientConfiguration();
clCfg.setProtocol(GridClientProtocol.TCP);
clCfg.setServers(Collections.singleton(HOST + ":" + TCP_PORT));
doTest(clCfg);
}
use of org.apache.ignite.internal.client.GridClientConfiguration 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.GridClientConfiguration 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;
}
use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.
the class CommandHandler method main.
/**
* @param args Args.
*/
public static void main(String[] args) throws GridClientException {
String host = "127.0.0.1";
String port = "11212";
Boolean activate = null;
if (args.length == 1 && "help".equals(args[0])) {
System.out.println("Example: --host {ip} --port {port} --{activate/deactivate} " + "or without command --host {ip} --port {port} then will print status.");
return;
}
if (args.length > 5)
throw new IllegalArgumentException("incorrect number of arguments");
for (int i = 0; i < args.length; i++) {
String str = args[i];
if ("--host".equals(str))
host = args[i + 1];
else if ("--port".equals(str))
port = args[i + 1];
else if ("--activate".equals(str))
activate = true;
else if ("--deactivate".equals(str))
activate = false;
}
if (host == null)
throw new IllegalArgumentException("host can not be empty");
if (port == null)
throw new IllegalArgumentException("port can not be empty");
GridClientConfiguration cfg = new GridClientConfiguration();
cfg.setServers(Collections.singletonList(host + ":" + port));
try (GridClient client = GridClientFactory.start(cfg)) {
GridClientClusterState state = client.state();
if (activate != null)
try {
state.active(activate);
System.out.println(host + ":" + port + " - was " + (activate ? "activate" : "deactivate"));
} catch (Exception e) {
System.out.println("Something fail during " + (activate ? "activation" : "deactivation") + ", exception message: " + e.getMessage());
}
else
System.out.println(host + ":" + port + " - " + (state.active() ? "active" : "inactive"));
}
}
Aggregations