Search in sources :

Example 31 with GridClientConfiguration

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

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 32 with GridClientConfiguration

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

the class RestProcessorStartSelfTest method testTcpStart.

/**
 *  @throws Exception If failed.
 */
@Test
public void testTcpStart() throws Exception {
    GridClientConfiguration clCfg = new GridClientConfiguration();
    clCfg.setProtocol(GridClientProtocol.TCP);
    clCfg.setServers(Collections.singleton(HOST + ":" + TCP_PORT));
    doTest(clCfg);
}
Also used : GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 33 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)

Example 34 with GridClientConfiguration

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

the class ClientFailedInitSelfTest method testRoutersAndServersAddressesProvided.

/**
 */
@Test
public void testRoutersAndServersAddressesProvided() {
    try {
        GridClientConfiguration c = new GridClientConfiguration();
        c.setRouters(Collections.singleton("127.0.0.1:10000"));
        c.setServers(Collections.singleton("127.0.0.1:10000"));
        GridClientFactory.start(c);
        assert false;
    } catch (GridClientException e) {
        info("Caught expected exception: " + e);
    }
}
Also used : GridClientException(org.apache.ignite.internal.client.GridClientException) GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 35 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)

Aggregations

GridClientConfiguration (org.apache.ignite.internal.client.GridClientConfiguration)64 GridClient (org.apache.ignite.internal.client.GridClient)18 Test (org.junit.Test)13 ArrayList (java.util.ArrayList)11 GridClientDataConfiguration (org.apache.ignite.internal.client.GridClientDataConfiguration)11 UUID (java.util.UUID)10 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)10 List (java.util.List)9 Logger (java.util.logging.Logger)9 Collectors (java.util.stream.Collectors)9 GridClientNode (org.apache.ignite.internal.client.GridClientNode)9 GridClientException (org.apache.ignite.internal.client.GridClientException)8 F (org.apache.ignite.internal.util.typedef.F)7 Map (java.util.Map)6 VisorTaskArgument (org.apache.ignite.internal.visor.VisorTaskArgument)6 GridClientDisconnectedException (org.apache.ignite.internal.client.GridClientDisconnectedException)5 CommandLogger.optional (org.apache.ignite.internal.commandline.CommandLogger.optional)5 SecurityCredentials (org.apache.ignite.plugin.security.SecurityCredentials)5 SecurityCredentialsBasicProvider (org.apache.ignite.plugin.security.SecurityCredentialsBasicProvider)5 File (java.io.File)4