alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r325246134
 
 

 ##########
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/JmxMetricExporterSpiTest.java
 ##########
 @@ -144,4 +196,129 @@ public void testFilterAndExport() throws Exception {
 
         assertEquals(44L, bean2.getAttribute("test3"));
     }
+
+    /** */
+    @Test
+    public void testCachesView() throws Exception {
+        Set<String> cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+        for (String name : cacheNames)
+            ignite.createCache(name);
+
+        TabularDataSupport data = systemView(CACHES_VIEW);
+
+        assertEquals(ignite.context().cache().cacheDescriptors().size(), 
data.size());
+
+        for (int i = 0; i < data.size(); i++) {
+            CompositeData row = data.get(new Object[] {i});
+
+            cacheNames.remove(row.get("cacheName"));
+        }
+
+        assertTrue(cacheNames.toString(), cacheNames.isEmpty());
+    }
+
+    /** */
+    @Test
+    public void testCacheGroupsView() throws Exception {
+        Set<String> grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2"));
+
+        for (String grpName : grpNames)
+            ignite.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+        TabularDataSupport grps = systemView(CACHE_GRPS_VIEW);
+
+        assertEquals(ignite.context().cache().cacheGroupDescriptors().size(), 
grps.size());
+
+        for (Map.Entry entry : grps.entrySet()) {
+            CompositeData row = (CompositeData)entry.getValue();
+
+            grpNames.remove(row.get("cacheGroupName"));
+        }
+
+        assertTrue(grpNames.toString(), grpNames.isEmpty());
+    }
+
+    /** */
+    @Test
+    public void testServices() throws Exception {
+        ServiceConfiguration srvcCfg = new ServiceConfiguration();
+
+        srvcCfg.setName("service");
+        srvcCfg.setMaxPerNodeCount(1);
+        srvcCfg.setService(new DummyService());
+
+        ignite.services().deploy(srvcCfg);
+
+        TabularDataSupport srvs = systemView(SVCS_VIEW);
+
+        assertEquals(ignite.context().service().serviceDescriptors().size(), 
srvs.size());
+
+        CompositeData sysView = srvs.get(new Object[] {0});
+
+        assertEquals(srvcCfg.getName(), sysView.get("name"));
+        assertEquals(srvcCfg.getMaxPerNodeCount(), 
sysView.get("maxPerNodeCount"));
+        assertEquals(DummyService.class.getName(), 
sysView.get("serviceClass"));
+    }
+
+    /** */
+    @Test
+    public void testComputeBroadcast() throws Exception {
+        latch = new CountDownLatch(1);
+
+        for (int i = 0; i < 5; i++) {
+            ignite.compute().broadcastAsync(() -> {
+                try {
+                    latch.await();
+                }
+                catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+            });
+        }
+
+        TabularDataSupport tasks = systemView(TASKS_VIEW);
+
+        assertEquals(5, tasks.size());
 
 Review comment:
   Perhaps we can get flaky failure here, I think it's better to use 
`CyclicBarrier` instead of the latch (before checks and after checks).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to