use of org.apache.ignite.internal.metric.SystemViewSelfTest.TestTransformer in project ignite by apache.
the class JmxExporterSpiTest method testLocalScanQuery.
/**
*/
@Test
public void testLocalScanQuery() throws Exception {
IgniteCache<Integer, Integer> cache1 = ignite.createCache(new CacheConfiguration<Integer, Integer>("cache1").setGroupName("group1"));
int part = ignite.affinity("cache1").primaryPartitions(ignite.localNode())[0];
List<Integer> partKeys = partitionKeys(cache1, part, 11, 0);
for (Integer key : partKeys) cache1.put(key, key);
TabularDataSupport qrySysView0 = systemView(SCAN_QRY_SYS_VIEW);
assertNotNull(qrySysView0);
assertEquals(0, qrySysView0.size());
QueryCursor<Integer> qryRes1 = cache1.query(new ScanQuery<Integer, Integer>().setFilter(new TestPredicate()).setLocal(true).setPartition(part).setPageSize(10), new TestTransformer());
assertTrue(qryRes1.iterator().hasNext());
boolean res = waitForCondition(() -> !systemView(SCAN_QRY_SYS_VIEW).isEmpty(), 5_000);
assertTrue(res);
CompositeData view = systemView(SCAN_QRY_SYS_VIEW).get(new Object[] { 0 });
assertEquals(ignite.localNode().id().toString(), view.get("originNodeId"));
assertEquals(0L, view.get("queryId"));
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"));
assertTrue((Boolean) view.get("local"));
assertEquals(part, view.get("partition"));
assertEquals(toStringSafe(ignite.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"));
qryRes1.close();
res = waitForCondition(() -> systemView(SCAN_QRY_SYS_VIEW).isEmpty(), 5_000);
assertTrue(res);
}
Aggregations