use of org.apache.ignite.internal.managers.deployment.GridDeploymentResponse in project ignite by apache.
the class GridPeerDeploymentRetryModifiedTest method deploymentTest.
/**
* @throws Exception If failed.
*/
private void deploymentTest() throws Exception {
Ignite g1 = startGrid(1);
IgniteEx g2 = startGrid(2);
try {
GridTestExternalClassLoader ldr = new GridTestExternalClassLoader(URLS);
ClusterNode node = g1.cluster().node(g2.cluster().localNode().id());
g1.compute(g1.cluster().forRemotes()).execute((ComputeTask<Object, T2>) ldr.loadClass(EXT_TASK_CLASS_NAME).newInstance(), new T2<>(node, null));
TestRecordingCommunicationSpi rec1 = (TestRecordingCommunicationSpi) g1.configuration().getCommunicationSpi();
rec1.blockMessages((n, message) -> message instanceof GridDeploymentResponse);
ComputeTask<Object, T2> task = (ComputeTask<Object, T2>) ldr.loadClass(EXT_TASK_CLASS_NAME).newInstance();
try {
g1.compute(g1.cluster().forRemotes()).withTimeout(2000).execute(task, new T2<>(node, "foo"));
fail("Exception should be thrown");
} catch (IgniteException ignore) {
// Expected exception.
// ignore.printStackTrace();
}
rec1.stopBlock(false, null, true, true);
try {
g1.compute(g1.cluster().forRemotes()).execute(task, new T2<>(node, "bar"));
} catch (Exception e) {
throw new RuntimeException(e);
}
assertFalse(g2.cache(DEFAULT_CACHE_NAME).containsKey("foo"));
assertTrue(g2.cache(DEFAULT_CACHE_NAME).containsKey("bar"));
} finally {
stopAllGrids(true);
}
}
use of org.apache.ignite.internal.managers.deployment.GridDeploymentResponse in project ignite by apache.
the class GridPeerDeploymentRetryTest method deploymentTest.
/**
* @throws Exception If failed.
*/
private void deploymentTest() throws Exception {
Ignite g1 = startGrid(1);
Ignite g2 = startGrid(2);
try {
GridTestExternalClassLoader ldr = new GridTestExternalClassLoader(URLS);
TestRecordingCommunicationSpi rec1 = (TestRecordingCommunicationSpi) g1.configuration().getCommunicationSpi();
rec1.blockMessages((node, message) -> message instanceof GridDeploymentResponse);
ComputeTask<Object, ?> task = (ComputeTask<Object, ?>) ldr.loadClass(EXT_TASK_CLASS_NAME).newInstance();
ClusterNode node = g1.cluster().node(g2.cluster().localNode().id());
try {
g1.compute(g1.cluster().forRemotes()).execute(task, node);
fail("Exception should be thrown");
} catch (IgniteException ignore) {
// Expected exception.
}
rec1.stopBlock(false, null, true, true);
g1.compute(g1.cluster().forRemotes()).execute(task, node);
} finally {
stopAllGrids(true);
}
}
Aggregations