use of org.apache.ignite.internal.metric.SystemViewSelfTest.TEST_PREDICATE in project ignite by apache.
the class JmxExporterSpiTest method checkScanQueryView.
/**
*/
private void checkScanQueryView(IgniteEx client1, IgniteEx client2, IgniteEx server) throws Exception {
boolean res = waitForCondition(() -> systemView(server, SCAN_QRY_SYS_VIEW).size() > 1, 5_000);
assertTrue(res);
Consumer<CompositeData> cache1checker = view -> {
assertEquals(client1.localNode().id().toString(), view.get("originNodeId"));
assertTrue((Long) view.get("queryId") != 0);
assertEquals("cache1", view.get("cacheName"));
assertEquals(cacheId("cache1"), view.get("cacheId"));
assertEquals(cacheGroupId("cache1", "group1"), view.get("cacheGroupId"));
assertEquals("group1", view.get("cacheGroupName"));
assertTrue((Long) view.get("startTime") <= System.currentTimeMillis());
assertTrue((Long) view.get("duration") >= 0);
assertFalse((Boolean) view.get("canceled"));
assertEquals(TEST_PREDICATE, view.get("filter"));
assertFalse((Boolean) view.get("local"));
assertEquals(-1, view.get("partition"));
assertEquals(toStringSafe(client1.context().discovery().topologyVersionEx()), view.get("topology"));
assertEquals(TEST_TRANSFORMER, view.get("transformer"));
assertFalse((Boolean) view.get("keepBinary"));
assertNull(view.get("subjectId"));
assertNull(view.get("taskName"));
assertEquals(10, view.get("pageSize"));
};
Consumer<CompositeData> cache2checker = view -> {
assertEquals(client2.localNode().id().toString(), view.get("originNodeId"));
assertTrue((Long) view.get("queryId") != 0);
assertEquals("cache2", view.get("cacheName"));
assertEquals(cacheId("cache2"), view.get("cacheId"));
assertEquals(cacheGroupId("cache2", null), view.get("cacheGroupId"));
assertEquals("cache2", view.get("cacheGroupName"));
assertTrue((Long) view.get("startTime") <= System.currentTimeMillis());
assertTrue((Long) view.get("duration") >= 0);
assertFalse((Boolean) view.get("canceled"));
assertNull(view.get("filter"));
assertFalse((Boolean) view.get("local"));
assertEquals(-1, view.get("partition"));
assertEquals(toStringSafe(client2.context().discovery().topologyVersionEx()), view.get("topology"));
assertNull(view.get("transformer"));
assertTrue((Boolean) view.get("keepBinary"));
assertNull(view.get("subjectId"));
assertNull(view.get("taskName"));
assertEquals(20, view.get("pageSize"));
};
boolean found1 = false;
boolean found2 = false;
TabularDataSupport qrySysView = systemView(server, SCAN_QRY_SYS_VIEW);
for (int i = 0; i < qrySysView.size(); i++) {
CompositeData view = systemView(SCAN_QRY_SYS_VIEW).get(new Object[] { i });
if ("cache2".equals(view.get("cacheName"))) {
cache2checker.accept(view);
found1 = true;
} else {
cache1checker.accept(view);
found2 = true;
}
}
assertTrue(found1 && found2);
}
Aggregations