@Test public void testSetTransactionNullWithExternalConnection() throws Exception { JDBCTransactionState state = new JDBCTransactionState(mockConnection, dataStore, true); state.setTransaction(mockTransaction); state.setTransaction(null); verify(mockConnection, times(0)).close(); testLogWarnings(state); }
public void setTransaction(Transaction tx) { if (tx != null && this.tx != null) { throw new IllegalStateException( "New transaction set without " + "closing old transaction first."); } if (tx == null) { if (cx != null) { if (!external) { dataStore.closeSafe(cx); } } else { dataStore .getLogger() .warning( "Transaction is attempting to " + "close an already closed connection"); } cx = null; } this.tx = tx; }
JDBCTransactionState implements State { public void setTransaction(Transaction tx) { if (tx != null && this.tx != null) { throw new IllegalStateException( "New transaction set without " + "closing old transaction first."); } if (tx == null) { if (cx != null) { if (!external) { dataStore.closeSafe(cx); } } else { dataStore .getLogger() .warning( "Transaction is attempting to " + "close an already closed connection"); } cx = null; } this.tx = tx; } }
JDBCTransactionState implements State { public void setTransaction(Transaction tx) { if (tx != null && this.tx != null) { throw new IllegalStateException( "New transaction set without " + "closing old transaction first."); } if (tx == null) { if (cx != null) { if (!external) { dataStore.closeSafe(cx); } } else { dataStore .getLogger() .warning( "Transaction is attempting to " + "close an already closed connection"); } cx = null; } this.tx = tx; } JDBCTransactionState(Connection cx, JDBCDataStore dataStore);  JDBCTransactionState(Connection cx, JDBCDataStore dataStore, boolean external); }
JDBCTransactionState implements State { public void setTransaction(Transaction tx) { if (tx != null && this.tx != null) { throw new IllegalStateException( "New transaction set without " + "closing old transaction first."); } if (tx == null) { if (cx != null) { if (!external) { dataStore.closeSafe(cx); } } else { dataStore .getLogger() .warning( "Transaction is attempting to " + "close an already closed connection"); } cx = null; } this.tx = tx; } JDBCTransactionState(Connection cx, JDBCDataStore dataStore);  JDBCTransactionState(Connection cx, JDBCDataStore dataStore, boolean external); void setTransaction(Transaction tx); void addAuthorization(String AuthID); void commit(); void rollback(); }
JDBCTransactionState implements State { public void setTransaction(Transaction tx) { if (tx != null && this.tx != null) { throw new IllegalStateException( "New transaction set without " + "closing old transaction first."); } if (tx == null) { if (cx != null) { if (!external) { dataStore.closeSafe(cx); } } else { dataStore .getLogger() .warning( "Transaction is attempting to " + "close an already closed connection"); } cx = null; } this.tx = tx; } JDBCTransactionState(Connection cx, JDBCDataStore dataStore);  JDBCTransactionState(Connection cx, JDBCDataStore dataStore, boolean external); void setTransaction(Transaction tx); void addAuthorization(String AuthID); void commit(); void rollback();  }