You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2022/05/30 19:28:26 UTC

[ignite-3] branch ignite-14972 updated: wip testExecuteAsyncDdlDml

This is an automated email from the ASF dual-hosted git repository.

ptupitsyn pushed a commit to branch ignite-14972
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/ignite-14972 by this push:
     new 357f71ff4 wip testExecuteAsyncDdlDml
357f71ff4 is described below

commit 357f71ff4b6df6dc509d0550a160e61bdd25e187
Author: Pavel Tupitsyn <pt...@apache.org>
AuthorDate: Mon May 30 22:28:16 2022 +0300

    wip testExecuteAsyncDdlDml
---
 .../runner/app/client/ItThinClientSqlTest.java     | 31 +++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientSqlTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientSqlTest.java
index 54a2a0ed0..170ce83e2 100644
--- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientSqlTest.java
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientSqlTest.java
@@ -19,10 +19,13 @@ package org.apache.ignite.internal.runner.app.client;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.List;
 import org.apache.ignite.sql.ColumnMetadata;
+import org.apache.ignite.sql.NoRowSetExpectedException;
+import org.apache.ignite.sql.Session;
 import org.apache.ignite.sql.SqlRow;
 import org.apache.ignite.sql.async.AsyncResultSet;
 import org.junit.jupiter.api.Test;
@@ -32,7 +35,7 @@ import org.junit.jupiter.api.Test;
  */
 public class ItThinClientSqlTest extends ItAbstractThinClientTest {
     @Test
-    void testExecuteAsyncSimple() {
+    void testExecuteAsyncSimpleSelect() {
         AsyncResultSet resultSet = client().sql()
                 .createSession()
                 .executeAsync(null, "select 1 as num, 'hello' as str")
@@ -40,6 +43,8 @@ public class ItThinClientSqlTest extends ItAbstractThinClientTest {
 
         assertTrue(resultSet.hasRowSet());
         assertFalse(resultSet.wasApplied());
+        assertFalse(resultSet.hasMorePages());
+        assertEquals(0, resultSet.affectedRows());
         assertEquals(1, resultSet.currentPageSize());
 
         SqlRow row = resultSet.currentPage().iterator().next();
@@ -51,4 +56,28 @@ public class ItThinClientSqlTest extends ItAbstractThinClientTest {
         assertEquals("NUM", columns.get(0).name());
         assertEquals("STR", columns.get(1).name());
     }
+
+    @Test
+    void testExecuteAsyncDdlDml() {
+        Session session = client().sql().createSession();
+
+        AsyncResultSet createRes = session.executeAsync(null, "CREATE TABLE TEST(ID INT PRIMARY KEY, VAL VARCHAR)").join();
+
+        assertFalse(createRes.hasRowSet());
+        assertTrue(createRes.wasApplied());
+        assertEquals(-1, createRes.affectedRows());
+        assertThrows(NoRowSetExpectedException.class, createRes::currentPageSize);
+
+        AsyncResultSet insertRes = session.executeAsync(null, "INSERT INTO TEST VALUES (?, ?)", 1, "hello").join();
+
+        assertFalse(insertRes.hasRowSet());
+        assertTrue(insertRes.wasApplied());
+        assertEquals(1, insertRes.affectedRows());
+        assertThrows(NoRowSetExpectedException.class, createRes::currentPage);
+    }
+
+    @Test
+    void testFetchNextPage() {
+        // TODO
+    }
 }