timoninmaxim commented on a change in pull request #8252:
URL: https://github.com/apache/ignite/pull/8252#discussion_r494364687



##########
File path: 
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
##########
@@ -1545,6 +1555,98 @@ private void checkSqlQueryEvents() throws Exception {
         }
     }
 
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testQueryExecutionEvents() throws Exception {
+        CountDownLatch execLatch = new CountDownLatch(13);
+
+        IgnitePredicate<Event> lsnr = evt -> {
+            assert evt instanceof QueryExecutionEvent;
+
+            System.out.println(">>> EVENT: " + evt);
+
+            QueryExecutionEvent qe = (QueryExecutionEvent)evt;
+
+            if (SQL_FIELDS.name().equals(qe.queryType()) ||
+                TEXT.name().equals(qe.queryType())
+            )
+                assertNotNull(qe.queryType() + " query clause is empty!", 
qe.clause());
+            else
+                assertNull(qe.queryType() + " query clause is not empty!", 
qe.clause());
+
+            execLatch.countDown();
+
+            return true;
+        };
+
+        ignite().events().localListen(lsnr, EVT_QUERY_EXECUTION);
+
+        String cacheName = "CACHE_NAME";
+
+        CacheConfiguration<String, String> ccfg = new CacheConfiguration<>();
+
+        ccfg.setName(cacheName);
+        ccfg.setIndexedTypes(String.class, String.class);
+
+        ClientConfiguration cc = new 
ClientConfiguration().setAddresses(Config.SERVER);
+
+        try (IgniteClient client = Ignition.startClient(cc)) {
+            ignite().createCache(ccfg).query(new TextQuery<>(String.class, 
"text"))
+                .getAll();
+
+            ignite().getOrCreateCache(ccfg).query(new SpiQuery<Integer, 
Integer>())
+                .getAll();
+
+            ignite().getOrCreateCache(ccfg).query(new ScanQuery<>())
+                .getAll();
+
+            client.query(new SqlFieldsQuery("create table TEST_TABLE(key int 
primary key, val int)"))
+                .getAll();
+
+            client.query(new SqlFieldsQuery("insert into TEST_TABLE values (?, 
?)").setArgs(1, 1))
+                .getAll();
+
+            client.query(new SqlFieldsQuery("update TEST_TABLE set val = ?2 
where key = ?1").setArgs(1, 2))
+                .getAll();
+
+            client.query(new SqlFieldsQuery("select * from TEST_TABLE"))
+                .getAll();
+
+            client.query(new SqlFieldsQuery("create index idx_1 on 
TEST_TABLE(key)"))
+                .getAll();
+
+            client.query(new SqlFieldsQuery("drop index idx_1"))
+                .getAll();
+
+            client.query(new SqlFieldsQuery("alter table TEST_TABLE add column 
val2 int"))
+                .getAll();
+
+            client.query(new SqlFieldsQuery("alter table TEST_TABLE drop 
val2"))
+                .getAll();
+
+            client.query(new SqlFieldsQuery("drop table TEST_TABLE"))
+                .getAll();
+
+            // Currently, not supported.
+//            client.getOrCreateCache(cacheName).query(new 
TextQuery<>(String.class, "text"))

Review comment:
       Remove commented code.




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


Reply via email to