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"));
}
}
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));
}
Aggregations