use of org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.CQ_SYS_VIEW in project ignite by apache.
the class JmxExporterSpiTest method testContinuousQuery.
/**
*/
@Test
public void testContinuousQuery() throws Exception {
try (IgniteEx remoteNode = startGrid(1)) {
IgniteCache<Integer, Integer> cache = ignite.createCache("cache-1");
assertEquals(0, systemView(CQ_SYS_VIEW).size());
assertEquals(0, systemView(remoteNode, CQ_SYS_VIEW).size());
try (QueryCursor qry = cache.query(new ContinuousQuery<>().setInitialQuery(new ScanQuery<>()).setPageSize(100).setTimeInterval(1000).setLocalListener(evts -> {
// No-op.
}).setRemoteFilterFactory(() -> evt -> true))) {
for (int i = 0; i < 100; i++) cache.put(i, i);
checkContinuousQueryView(ignite, ignite);
checkContinuousQueryView(ignite, remoteNode);
}
assertEquals(0, systemView(CQ_SYS_VIEW).size());
assertTrue(waitForCondition(() -> systemView(remoteNode, CQ_SYS_VIEW).isEmpty(), getTestTimeout()));
}
}
use of org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.CQ_SYS_VIEW in project ignite by apache.
the class SystemViewSelfTest method testContinuousQuery.
/**
*/
@Test
public void testContinuousQuery() throws Exception {
try (IgniteEx originNode = startGrid(0);
IgniteEx remoteNode = startGrid(1)) {
IgniteCache<Integer, Integer> cache = originNode.createCache("cache-1");
SystemView<ContinuousQueryView> origQrys = originNode.context().systemView().view(CQ_SYS_VIEW);
SystemView<ContinuousQueryView> remoteQrys = remoteNode.context().systemView().view(CQ_SYS_VIEW);
assertEquals(0, origQrys.size());
assertEquals(0, remoteQrys.size());
try (QueryCursor qry = cache.query(new ContinuousQuery<>().setInitialQuery(new ScanQuery<>()).setPageSize(100).setTimeInterval(1000).setLocalListener(evts -> {
// No-op.
}).setRemoteFilterFactory(() -> evt -> true))) {
for (int i = 0; i < 100; i++) cache.put(i, i);
checkContinuousQueryView(originNode, origQrys, true);
checkContinuousQueryView(originNode, remoteQrys, false);
}
assertEquals(0, origQrys.size());
assertTrue(waitForCondition(() -> remoteQrys.size() == 0, getTestTimeout()));
}
}
use of org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.CQ_SYS_VIEW 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));
}
Aggregations