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