xtern commented on code in PR #2846:
URL: https://github.com/apache/ignite-3/pull/2846#discussion_r1400092599


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItSqlMultiStatementTxTest.java:
##########
@@ -0,0 +1,219 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.sql.engine;
+
+import static 
org.apache.ignite.internal.sql.engine.util.SqlTestUtils.assertThrowsSqlException;
+import static org.apache.ignite.internal.testframework.IgniteTestUtils.await;
+import static org.apache.ignite.lang.ErrorGroups.Sql.RUNTIME_ERR;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasSize;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrowsExactly;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.List;
+import org.apache.ignite.internal.sql.BaseSqlMultiStatementTest;
+import org.apache.ignite.internal.tx.InternalTransaction;
+import org.apache.ignite.sql.ExternalTransactionNotSupportedException;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests to verify the execution of queries with transaction control 
statements.
+ *
+ * @see SqlQueryType#TX_CONTROL
+ */
+@SuppressWarnings("ThrowableNotThrown")
+public class ItSqlMultiStatementTxTest extends BaseSqlMultiStatementTest {
+    /** Number of completed transactions before the test started. */
+    private int numberOfFinishedTransactionsOnStart;
+
+    @BeforeAll
+    void createTable() {
+        sql("CREATE TABLE test (id INT PRIMARY KEY)");
+    }
+
+    @AfterEach
+    void clearTable() {
+        sql("DELETE FROM test");
+    }
+
+    @BeforeEach
+    void saveTxCount() {
+        numberOfFinishedTransactionsOnStart = txManager().finished();
+    }
+
+    void checkFinished(int expected) {
+        assertEquals(numberOfFinishedTransactionsOnStart + expected, 
txManager().finished());
+    }
+
+    @Test
+    void emptyTransactionControlStatement() {
+        List<AsyncSqlCursor<List<Object>>> cursors = fetchAllCursors(
+                runScript("START TRANSACTION; COMMIT"));
+
+        assertThat(cursors, hasSize(2));
+
+        validateSingleResult(cursors.get(0));
+        validateSingleResult(cursors.get(1));
+
+        checkFinished(1);
+    }
+
+    @Test
+    void basicTxStatements() {
+        fetchAllCursors(runScript(
+                "START TRANSACTION;"

Review Comment:
   I think the third one you noticed is the delete query that is called after 
every test, and is not part of this query.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to