Search in sources :

Example 1 with VisorNodePingTaskResult

use of org.apache.ignite.internal.visor.node.VisorNodePingTaskResult 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.
     */
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)

Example 2 with VisorNodePingTaskResult

use of org.apache.ignite.internal.visor.node.VisorNodePingTaskResult 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.
     */
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)

Aggregations

UUID (java.util.UUID)2 VisorNodePingTask (org.apache.ignite.internal.visor.node.VisorNodePingTask)2 VisorNodePingTaskArg (org.apache.ignite.internal.visor.node.VisorNodePingTaskArg)2 VisorNodePingTaskResult (org.apache.ignite.internal.visor.node.VisorNodePingTaskResult)2 IgniteException (org.apache.ignite.IgniteException)1