Search in sources :

Example 56 with GridClientConfiguration

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

the class ClientAbstractConnectivitySelfTest method startClient.

/**
 * Starts a REST client.
 *
 * @param addr REST server address.
 * @param port REST server port.
 * @return A successfully started REST client.
 * @throws GridClientException If failed to start REST client.
 */
protected GridClient startClient(String addr, int port) throws GridClientException {
    GridClientConfiguration cliCfg = new GridClientConfiguration();
    cliCfg.setServers(Collections.singleton(addr + ":" + port));
    cliCfg.setProtocol(protocol());
    return GridClientFactory.start(cliCfg);
}
Also used : GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration)

Example 57 with GridClientConfiguration

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

the class TaskEventSubjectIdSelfTest method beforeTestsStarted.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTestsStarted() throws Exception {
    Ignite g = startGrid();
    g.events().localListen(new IgnitePredicate<Event>() {

        @Override
        public boolean apply(Event evt) {
            assert evt instanceof TaskEvent;
            evts.add((TaskEvent) evt);
            latch.countDown();
            return true;
        }
    }, EVTS_TASK_EXECUTION);
    nodeId = g.cluster().localNode().id();
    GridClientConfiguration cfg = new GridClientConfiguration();
    cfg.setServers(Collections.singleton("127.0.0.1:11211"));
    client = GridClientFactory.start(cfg);
}
Also used : TaskEvent(org.apache.ignite.events.TaskEvent) TaskEvent(org.apache.ignite.events.TaskEvent) Event(org.apache.ignite.events.Event) Ignite(org.apache.ignite.Ignite) GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration)

Example 58 with GridClientConfiguration

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

the class TcpRouterMultiNodeSelfTest method clientConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected GridClientConfiguration clientConfiguration() throws GridClientException {
    GridClientConfiguration cfg = super.clientConfiguration();
    cfg.setServers(Collections.<String>emptySet());
    Collection<String> rtrs = new ArrayList<>(ROUTERS_CNT);
    for (int i = 0; i < ROUTERS_CNT; i++) rtrs.add(HOST + ':' + (ROUTER_TCP_PORT_BASE + i));
    cfg.setRouters(rtrs);
    return cfg;
}
Also used : ArrayList(java.util.ArrayList) GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration)

Example 59 with GridClientConfiguration

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

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

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

the class ClientTcpUnreachableMultiNodeSelfTest method clientConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected GridClientConfiguration clientConfiguration() throws GridClientException {
    GridClientConfiguration cfg = super.clientConfiguration();
    // Setting low connection timeout to allow multiple threads
    // pass the unavailable address quickly.
    cfg.setConnectTimeout(100);
    return cfg;
}
Also used : 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