Search in sources :

Example 16 with GridClientConfiguration

use of org.apache.ignite.internal.client.GridClientConfiguration 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.
     */
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);
}
Also used : GridClientRoundRobinBalancer(org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer) VisorNodePingTaskArg(org.apache.ignite.internal.visor.node.VisorNodePingTaskArg) GridClient(org.apache.ignite.internal.client.GridClient) VisorNodePingTask(org.apache.ignite.internal.visor.node.VisorNodePingTask) UUID(java.util.UUID) GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration)

Example 17 with GridClientConfiguration

use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.

the class ClientPreferDirectSelfTest method client.

/**
     * @param b Balancer.
     * @return Client.
     * @throws Exception If failed.
     */
private GridClient client(GridClientLoadBalancer b) throws Exception {
    GridClientConfiguration cfg = new GridClientConfiguration();
    cfg.setBalancer(b);
    cfg.setTopologyRefreshFrequency(TOP_REFRESH_FREQ);
    Collection<String> rtrs = new ArrayList<>(3);
    for (int i = 0; i < NODES_CNT / 2; i++) rtrs.add(HOST + ':' + (REST_TCP_PORT_BASE + i));
    cfg.setRouters(rtrs);
    return GridClientFactory.start(cfg);
}
Also used : ArrayList(java.util.ArrayList) GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration)

Example 18 with GridClientConfiguration

use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.

the class ClientTcpDirectMultiNodeSelfTest method clientConfiguration.

/** {@inheritDoc} */
@Override
protected GridClientConfiguration clientConfiguration() throws GridClientException {
    assert NODES_CNT > 3 : "Too few nodes to execute direct multinode test";
    GridClientConfiguration cfg = super.clientConfiguration();
    cfg.setServers(Collections.<String>emptySet());
    Collection<String> srvs = new ArrayList<>(3);
    for (int i = 0; i < NODES_CNT / 2; i++) srvs.add(HOST + ':' + (REST_TCP_PORT_BASE + i));
    cfg.setRouters(srvs);
    return cfg;
}
Also used : ArrayList(java.util.ArrayList) GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration)

Example 19 with GridClientConfiguration

use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.

the class ChangeStateCommandHandlerTest method beforeTest.

/** {@inheritDoc} */
@Override
protected void beforeTest() throws Exception {
    GridClientConfiguration cfg = new GridClientConfiguration();
    cfg.setProtocol(TCP);
    cfg.setServers(Collections.singletonList("localhost:" + BINARY_PORT));
    client = GridClientFactory.start(cfg);
}
Also used : GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration)

Example 20 with GridClientConfiguration

use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.

the class ClientTcpSslDirectMultiNodeSelfTest method clientConfiguration.

/** {@inheritDoc} */
@Override
protected GridClientConfiguration clientConfiguration() throws GridClientException {
    assert NODES_CNT > 3 : "Too few nodes to execute direct multinode test";
    GridClientConfiguration cfg = super.clientConfiguration();
    cfg.setServers(Collections.<String>emptySet());
    Collection<String> srvs = new ArrayList<>(3);
    for (int i = 0; i < NODES_CNT / 2; i++) srvs.add(HOST + ':' + (REST_TCP_PORT_BASE + i));
    cfg.setRouters(srvs);
    return cfg;
}
Also used : ArrayList(java.util.ArrayList) GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration)

Aggregations

GridClientConfiguration (org.apache.ignite.internal.client.GridClientConfiguration)23 GridClientDataConfiguration (org.apache.ignite.internal.client.GridClientDataConfiguration)5 ArrayList (java.util.ArrayList)4 GridClient (org.apache.ignite.internal.client.GridClient)3 GridClientException (org.apache.ignite.internal.client.GridClientException)3 GridClientPartitionAffinity (org.apache.ignite.internal.client.GridClientPartitionAffinity)2 File (java.io.File)1 IOException (java.io.IOException)1 Map (java.util.Map)1 Properties (java.util.Properties)1 UUID (java.util.UUID)1 ThreadFactory (java.util.concurrent.ThreadFactory)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Ignite (org.apache.ignite.Ignite)1 Event (org.apache.ignite.events.Event)1 TaskEvent (org.apache.ignite.events.TaskEvent)1 GridClientClusterState (org.apache.ignite.internal.client.GridClientClusterState)1 GridClientRoundRobinBalancer (org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer)1 GridClientJdkMarshaller (org.apache.ignite.internal.client.marshaller.jdk.GridClientJdkMarshaller)1 VisorNodePingTask (org.apache.ignite.internal.visor.node.VisorNodePingTask)1