@Test public void txHelperLockedTransactionWithCompletedStatus() throws SQLException, LockConflictException { UUID queryId = UUID.randomUUID(); TransactionHelper txHelper = pgConnection.getStrictTransactionHelper(null, "__digdag_status", Duration.ofDays(1)); ResultSet selectRs = setupMockSelectResultSet(queryId); when(selectRs.next()).thenReturn(true); when(selectRs.wasNull()).thenReturn(false); AtomicBoolean called = new AtomicBoolean(false); assertThat(txHelper.lockedTransaction(queryId, () -> called.set(true)), is(false)); verify(pgConnection).execute(eq("BEGIN")); verify(pgConnection).execute(eq("ROLLBACK")); }
@Override public TransactionHelper getStrictTransactionHelper(String statusTableSchema, String statusTableName, Duration cleanupDuration) { return new PgPersistentTransactionHelper(statusTableSchema, statusTableName, cleanupDuration); }
PgConnection extends AbstractJdbcConnection { @Override public TransactionHelper getStrictTransactionHelper(String statusTableSchema, String statusTableName, Duration cleanupDuration) { return new PgPersistentTransactionHelper(statusTableSchema, statusTableName, cleanupDuration); } }
PgConnection extends AbstractJdbcConnection { @Override public TransactionHelper getStrictTransactionHelper(String statusTableSchema, String statusTableName, Duration cleanupDuration) { return new PgPersistentTransactionHelper(statusTableSchema, statusTableName, cleanupDuration); } protected  PgConnection(Connection connection); }
PgConnection extends AbstractJdbcConnection { @Override public TransactionHelper getStrictTransactionHelper(String statusTableSchema, String statusTableName, Duration cleanupDuration) { return new PgPersistentTransactionHelper(statusTableSchema, statusTableName, cleanupDuration); } protected  PgConnection(Connection connection); @VisibleForTesting static PgConnection open(PgConnectionConfig config); @Override void executeReadOnlyQuery(String sql, Consumer<JdbcResultSet> resultHandler); @Override String escapeIdent(String ident); @Override TransactionHelper getStrictTransactionHelper(String statusTableSchema, String statusTableName, Duration cleanupDuration); }
PgConnection extends AbstractJdbcConnection { @Override public TransactionHelper getStrictTransactionHelper(String statusTableSchema, String statusTableName, Duration cleanupDuration) { return new PgPersistentTransactionHelper(statusTableSchema, statusTableName, cleanupDuration); } protected  PgConnection(Connection connection); @VisibleForTesting static PgConnection open(PgConnectionConfig config); @Override void executeReadOnlyQuery(String sql, Consumer<JdbcResultSet> resultHandler); @Override String escapeIdent(String ident); @Override TransactionHelper getStrictTransactionHelper(String statusTableSchema, String statusTableName, Duration cleanupDuration);  }