xtern commented on code in PR #1880:
URL: https://github.com/apache/ignite-3/pull/1880#discussion_r1169991945
##########
modules/client-handler/src/test/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImplTest.java:
##########
@@ -174,14 +182,71 @@ void sessionIdIsUsedForQueryExecution() {
long connectionId = acquireConnectionId();
await(eventHandler.queryAsync(connectionId, new
JdbcQueryExecuteRequest(
- JdbcStatementType.SELECT_STATEMENT_TYPE, "my_schema", 1024,
1024, "SELECT 1", ArrayUtils.OBJECT_EMPTY_ARRAY
+ JdbcStatementType.SELECT_STATEMENT_TYPE, "my_schema", 1024,
1024, "SELECT 1", ArrayUtils.OBJECT_EMPTY_ARRAY, true
)));
verify(queryProcessor).createSession(any());
verify(queryProcessor).querySingleAsync(eq(expectedSessionId), any(),
any(), any());
verifyNoMoreInteractions(queryProcessor);
}
+ @Test
+ public void explicitTxRollbackOnCloseRegistry() {
+ Transaction tx = mock(Transaction.class);
+
+
when(tx.rollbackAsync()).thenReturn(CompletableFuture.completedFuture(null));
+ when(igniteTransactions.begin()).thenReturn(tx);
+
+ long connectionId = acquireConnectionId();
+
+ await(eventHandler.batchAsync(connectionId, new
JdbcBatchExecuteRequest("schema", List.of("UPDATE 1"), false)));
+
+ verify(igniteTransactions).begin();
+ verify(tx, times(0)).rollbackAsync();
+
+ resourceRegistry.close();
+ verify(tx, times(1)).rollbackAsync();
+ verifyNoMoreInteractions(tx);
+ }
+
+ @Test
+ public void singleTxUsedForMultipleOperations() {
Review Comment:
This test already verifies this command
(JdbcQueryEventHandler#finishTxAsync).
Are you suggesting to split it into two separate tests (one for commit and
one for rollback)?
--
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]