Skip to content

Commit

Permalink
Code format for MySQLAutoCommitTestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Sep 29, 2023
1 parent ebe886d commit 4904750
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,17 @@ public void executeTest(final TransactionContainerComposer containerComposer) th

private void assertAutoCommit() throws SQLException {
// TODO Currently XA transaction does not support two transactions in the same thread at the same time
try (Connection connection1 = getDataSource().getConnection(); Connection connection2 = getDataSource().getConnection()) {
try (
Connection connection1 = getDataSource().getConnection();
Connection connection2 = getDataSource().getConnection()) {
executeWithLog(connection1, "set session transaction isolation level read committed;");
executeWithLog(connection2, "set session transaction isolation level read committed;");
connection1.setAutoCommit(false);
connection2.setAutoCommit(false);
executeWithLog(connection1, "insert into account(id, balance, transaction_id) values(1, 100, 1);");
assertFalse(executeQueryWithLog(connection2, "select * from account;").next());
connection1.commit();
Awaitility.await().atMost(1L, TimeUnit.SECONDS).pollDelay(200L, TimeUnit.MILLISECONDS).until(
() -> executeQueryWithLog(connection2, "select * from account;").next());
Awaitility.await().atMost(1L, TimeUnit.SECONDS).pollDelay(200L, TimeUnit.MILLISECONDS).until(() -> executeQueryWithLog(connection2, "select * from account;").next());
assertTrue(executeQueryWithLog(connection2, "select * from account;").next());
}
}
Expand Down

0 comments on commit 4904750

Please sign in to comment.