use of org.apache.ignite.internal.managers.deployment.GridDeploymentRequest in project ignite by apache.
the class CacheContinuousQueryFilterDeploymentFailedTest method testContinuousQueryFilterDeploymentFailed.
/**
* Tests continuous query behavior in case of filter deployment obtaining failure.
*
* @throws Exception If failed.
*/
@Test
@SuppressWarnings({ "ThrowableNotThrown" })
public void testContinuousQueryFilterDeploymentFailed() throws Exception {
startGrids(NODES_CNT - 1);
IgniteEx cli = startClientGrid(NODES_CNT - 1);
IgniteCache<Integer, Integer> cache = cli.createCache(DEFAULT_CACHE_NAME);
ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();
Class<Factory<CacheEntryEventFilter<Integer, Integer>>> rmtFilterFactoryCls = (Class<Factory<CacheEntryEventFilter<Integer, Integer>>>) getExternalClassLoader().loadClass("org.apache.ignite.tests.p2p.CacheDeploymentEntryEventFilterFactory");
qry.setRemoteFilterFactory(rmtFilterFactoryCls.newInstance());
spi(grid(1)).blockMessages((node, msg) -> msg instanceof GridDeploymentRequest);
assertThrowsWithCause(() -> cache.query(qry), CacheException.class);
assertTrue(stopRoutineLatch.await(getTestTimeout(), MILLISECONDS));
assertTrue(allGrids().stream().allMatch(g -> ((IgniteEx) g).context().systemView().view(CQ_SYS_VIEW).size() == 0));
}
use of org.apache.ignite.internal.managers.deployment.GridDeploymentRequest in project ignite by apache.
the class ClassLoadingProblemExtendedLoggingTest method testTimeout.
/**
* Tests logging when executing job with communication problems.
*/
@Test
public void testTimeout() throws ClassNotFoundException {
LogListener lsnr1 = LogListener.matches(msg -> msg.replace("\n", "").matches(".*?Failed to get resource from node \\(is node alive\\?\\).*?" + TimeoutException.class.getName() + ".*")).build();
LogListener lsnr2 = LogListener.matches("Failed to send class-loading request to node").build();
listeningLog.registerListener(lsnr1);
listeningLog.registerListener(lsnr2);
TestRecordingCommunicationSpi clientSpi = spi(client);
AtomicInteger reqCntr = new AtomicInteger(0);
spi(ignite).closure((node, msg) -> {
if (msg instanceof GridDeploymentRequest && allowSuccessfulClassRequestsCnt - reqCntr.get() <= 0)
clientSpi.blockMessages(GridDeploymentResponse.class, ignite.name());
reqCntr.incrementAndGet();
});
Class cls = getExternalClassLoader().loadClass("org.apache.ignite.tests.p2p.P2PTestTaskExternalPath1");
try {
client.compute().execute(cls, ignite.cluster().localNode().id());
} catch (Exception ignored) {
/* No-op. */
}
doSleep(1500);
assertTrue(lsnr1.check() || lsnr2.check());
clientSpi.stopBlock();
}
use of org.apache.ignite.internal.managers.deployment.GridDeploymentRequest in project ignite by apache.
the class ClassLoadingProblemExtendedLoggingTest method testCNFE.
/**
* Tests logging when executing job and class is not found on initiator.
*/
@Test
public void testCNFE() throws Exception {
LogListener srvLsnr1 = LogListener.matches("Failed to get resource from node").build();
LogListener srvLsnr2 = LogListener.matches("Failed to find class on remote node").build();
LogListener clientLsnr = LogListener.matches("Failed to resolve class").build();
listeningLog.registerListener(srvLsnr1);
listeningLog.registerListener(srvLsnr2);
listeningLog.registerListener(clientLsnr);
AtomicInteger reqCntr = new AtomicInteger(0);
spi(ignite).closure((node, msg) -> {
if (msg instanceof GridDeploymentRequest && allowSuccessfulClassRequestsCnt - reqCntr.get() <= 0)
setFieldValue(msg, "rsrcName", "asdf");
reqCntr.incrementAndGet();
});
Class cls = getExternalClassLoader().loadClass("org.apache.ignite.tests.p2p.P2PTestTaskExternalPath1");
try {
client.compute().execute(cls, ignite.cluster().localNode().id());
} catch (Exception ignored) {
/* No-op. */
}
assertTrue(srvLsnr1.check() || srvLsnr2.check());
assertTrue(clientLsnr.check());
spi(ignite).closure(null);
}
use of org.apache.ignite.internal.managers.deployment.GridDeploymentRequest in project ignite by apache.
the class GridP2PContinuousDeploymentClientDisconnectTest method blockClassLoadingRequest.
/**
* Blocks peer-class loading for {@link #P2P_TEST_OBJ_RSRC_NAME} resource.
*
* @param node The node where peer-class loading should be blocked.
*/
private void blockClassLoadingRequest(IgniteEx node) {
GridKernalContext ctx = node.context();
GridDeploymentManager deploymentMgr = ctx.deploy();
Object comm = GridTestUtils.getFieldValue(deploymentMgr, "comm");
GridMessageListener peerLsnr = GridTestUtils.getFieldValue(comm, "peerLsnr");
ctx.io().removeMessageListener(TOPIC_CLASSLOAD, peerLsnr);
GridMessageListener newPeerLsnr = new GridMessageListener() {
@Override
public void onMessage(UUID nodeId, Object msg, byte plc) {
GridDeploymentRequest req = (GridDeploymentRequest) msg;
String rsrcName = GridTestUtils.getFieldValue(req, "rsrcName");
if (rsrcName.equals(P2P_TEST_OBJ_RSRC_NAME))
return;
peerLsnr.onMessage(nodeId, msg, plc);
}
};
ctx.io().addMessageListener(TOPIC_CLASSLOAD, newPeerLsnr);
}
Aggregations