ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.
Date Fri, 13 Sep 2019 09:24:13 GMT
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324107703
 
 

 ##########
 File path: modules/core/src/test/java/org/apache/ignite/internal/metric/JmxMetricExporterSpiTest.java
 ##########
 @@ -144,4 +210,125 @@ public void testFilterAndExport() throws Exception {
 
         assertEquals(44L, bean2.getAttribute("test3"));
     }
+
+    /** */
+    @Test
+    public void testCachesList() throws Exception {
+        Set<String> cacheNames = new HashSet<>(Arrays.asList("cache-1", "cache-2"));
+
+        for (String name : cacheNames)
+            ignite.createCache(name);
+
+        TabularDataSupport data = monitoringList("caches");
+
+        assertEquals(3, 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 testCacheGroupsList() 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 = monitoringList("cacheGroups");
+
+        assertEquals("ignite-sys, grp-1, grp-2", 3, 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 = monitoringList("services");
+
+        assertEquals(1, srvs.size());
+
+        CompositeData sview = srvs.get(new Object[] {0});
+
+        assertEquals(srvcCfg.getName(), sview.get("name"));
+        assertEquals(srvcCfg.getMaxPerNodeCount(), sview.get("maxPerNodeCount"));
+        assertEquals(DummyService.class.getName(), sview.get("serviceClass"));
+    }
+
+    /** */
+    @Test
+    public void testComputeBroadcast() throws Exception {
+        for (int i = 0; i < 5; i++) {
+            ignite.compute().broadcastAsync(() -> {
+                try {
+                    Thread.sleep(3_000L);
 
 Review comment:
   Please use some synchronizer, but not `sleep()`.
   Also, you need synchronization before checking the list. I think CyclicBarrier will be
helpful here, which can be used twice.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message