ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.
Date Wed, 02 Oct 2019 14:05:12 GMT
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330566135
 
 

 ##########
 File path: modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/metric/SqlViewExporterSpiTest.java
 ##########
 @@ -332,6 +336,81 @@ public void testTransactions() throws Exception {
         assertTrue(res);
     }
 
+    /** */
+    @Test
+    public void testContinuousQuery() throws Exception {
+        try(IgniteEx g1 = startGrid(1)) {
+            IgniteCache<Integer, Integer> cache = ignite.createCache("cache-1");
+
+            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);
+
+            List<List<?>> qrys = execute(ignite,
+                "SELECT " +
+                "  CACHE_NAME, " +
+                "  BUFFER_SIZE, " +
+                "  INTERVAL, " +
+                "  NODE_ID, " +
+                "  LOCAL_LISTENER, " +
+                "  REMOTE_FILTER, " +
+                "  LOCAL_TRANSFORMED_LISTENER, " +
+                "  REMOTE_TRANSFORMER " +
+                "FROM SYS.QUERY_CONTINUOUS");
+
+            assertEquals(1, qrys.size());
+
+            //Info on originating node.
+            for (List<?> cq : qrys) {
+                assertEquals("cache-1", cq.get(0));
+                assertEquals(100, cq.get(1));
+                assertEquals(1000L, cq.get(2));
+                assertEquals(ignite.localNode().id(), cq.get(3));
+                //Local listener not null on originating node.
+                assertTrue(cq.get(4).toString().startsWith(getClass().getName()));
+                assertTrue(cq.get(5).toString().startsWith(getClass().getName()));
+                assertNull(cq.get(6));
+                assertNull(cq.get(7));
+            }
+
+            qrys = execute(g1,
+                "SELECT " +
+                    "  CACHE_NAME, " +
+                    "  BUFFER_SIZE, " +
+                    "  INTERVAL, " +
+                    "  NODE_ID, " +
+                    "  LOCAL_LISTENER, " +
+                    "  REMOTE_FILTER, " +
+                    "  LOCAL_TRANSFORMED_LISTENER, " +
+                    "  REMOTE_TRANSFORMER " +
+                    "FROM SYS.QUERY_CONTINUOUS");
+
+            assertEquals(1, qrys.size());
+
+            //Info on remote node.
+            for (List<?> cq : qrys) {
+                assertEquals("cache-1", cq.get(0));
+                assertEquals(100, cq.get(1));
+                assertEquals(1000L, cq.get(2));
+                assertEquals(ignite.localNode().id(), cq.get(3));
+                //Local listener is null on remote nodes.
+                assertNull(cq.get(4));
+                assertTrue(cq.get(5).toString().startsWith(getClass().getName()));
+                assertNull(cq.get(6));
+                assertNull(cq.get(7));
+            }
 
 Review comment:
   code duplication

----------------------------------------------------------------
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