Search in sources :

Example 1 with VisorNodePingTaskArg

use of org.apache.ignite.internal.visor.node.VisorNodePingTaskArg 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.
 */
@Test
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) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 2 with VisorNodePingTaskArg

use of org.apache.ignite.internal.visor.node.VisorNodePingTaskArg in project ignite by apache.

the class GridInternalTasksLoadBalancingSelfTest method testInternalTaskBalancing.

/**
 * This test execute internal tasks over grid with custom balancer.
 *
 * @throws Exception In case of error.
 */
@Test
public void testInternalTaskBalancing() throws Exception {
    customLoadBalancer = true;
    ignite = startGrids(GRID_CNT);
    // Task with GridInternal should pass.
    assertEquals(TASK_RESULT, ignite.compute().execute(GridInternalTestTask.class.getName(), null));
    // Visor task should pass.
    UUID nid = ignite.cluster().localNode().id();
    VisorNodePingTaskResult ping = ignite.compute().execute(VisorNodePingTask.class.getName(), new VisorTaskArgument<>(nid, new VisorNodePingTaskArg(nid), false));
    assertTrue(ping.isAlive());
    // Custom task should fail, because special test load balancer SPI returns null as balanced node.
    try {
        ignite.compute().execute(CustomTestTask.class.getName(), null);
    } catch (IgniteException e) {
        assertTrue(e.getMessage().startsWith("Node can not be null " + "[mappedJob=org.apache.ignite.spi.loadbalancing.internal.GridInternalTasksLoadBalancingSelfTest$CustomTestJob"));
    }
}
Also used : VisorNodePingTaskResult(org.apache.ignite.internal.visor.node.VisorNodePingTaskResult) VisorNodePingTaskArg(org.apache.ignite.internal.visor.node.VisorNodePingTaskArg) IgniteException(org.apache.ignite.IgniteException) VisorNodePingTask(org.apache.ignite.internal.visor.node.VisorNodePingTask) UUID(java.util.UUID) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 3 with VisorNodePingTaskArg

use of org.apache.ignite.internal.visor.node.VisorNodePingTaskArg in project ignite by apache.

the class GridInternalTasksLoadBalancingSelfTest method testInternalTaskDefaultBalancing.

/**
 * This test execute internal tasks over grid with default balancer.
 *
 * @throws Exception In case of error.
 */
@Test
public void testInternalTaskDefaultBalancing() throws Exception {
    customLoadBalancer = false;
    ignite = startGrids(GRID_CNT);
    // Task with GridInternal should pass.
    assertEquals(TASK_RESULT, ignite.compute().execute(GridInternalTestTask.class.getName(), null));
    // Visor task should pass.
    UUID nid = ignite.cluster().localNode().id();
    VisorNodePingTaskResult ping = ignite.compute().execute(VisorNodePingTask.class.getName(), new VisorTaskArgument<>(nid, new VisorNodePingTaskArg(nid), false));
    assertTrue(ping.isAlive());
    // Custom task should pass.
    assertEquals(TASK_RESULT, ignite.compute().execute(CustomTestTask.class.getName(), null));
}
Also used : VisorNodePingTaskResult(org.apache.ignite.internal.visor.node.VisorNodePingTaskResult) VisorNodePingTaskArg(org.apache.ignite.internal.visor.node.VisorNodePingTaskArg) VisorNodePingTask(org.apache.ignite.internal.visor.node.VisorNodePingTask) UUID(java.util.UUID) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

UUID (java.util.UUID)3 VisorNodePingTask (org.apache.ignite.internal.visor.node.VisorNodePingTask)3 VisorNodePingTaskArg (org.apache.ignite.internal.visor.node.VisorNodePingTaskArg)3 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)3 Test (org.junit.Test)3 VisorNodePingTaskResult (org.apache.ignite.internal.visor.node.VisorNodePingTaskResult)2 IgniteException (org.apache.ignite.IgniteException)1 GridClient (org.apache.ignite.internal.client.GridClient)1 GridClientConfiguration (org.apache.ignite.internal.client.GridClientConfiguration)1 GridClientRoundRobinBalancer (org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer)1