use of com.arjuna.ats.internal.jdbc.ConnectionImple in project narayana by jbosstm.
the class ConnectionImpleTest method closeConnectionWithoutTransaction.
@Test
public void closeConnectionWithoutTransaction() throws SQLException {
ConnectionImple connectionToTest = getConnectionToTest();
// Initialises the connection
connectionToTest.clearWarnings();
connectionToTest.close();
verify(connection, times(1)).close();
}
use of com.arjuna.ats.internal.jdbc.ConnectionImple in project narayana by jbosstm.
the class ConnectionImpleTest method checkIfConnectionIsClosedInAfterCompletion.
@Test
public void checkIfConnectionIsClosedInAfterCompletion() throws Exception {
transactionManager.begin();
ConnectionImple connectionToTest = getConnectionToTest();
// Initialises the connection
connectionToTest.clearWarnings();
transactionManager.getTransaction().registerSynchronization(new Synchronization() {
@Override
public void beforeCompletion() {
}
@Override
public void afterCompletion(int status) {
try {
connectionToTest.isClosed();
} catch (SQLException e) {
fail("Could not check isClosed on connection: " + e.getMessage());
}
}
});
transactionManager.commit();
verify(connection, times(2)).isClosed();
}
use of com.arjuna.ats.internal.jdbc.ConnectionImple in project narayana by jbosstm.
the class ConnectionImpleTest method closeConnectionWithTransaction.
@Test
public void closeConnectionWithTransaction() throws Exception {
transactionManager.begin();
// Normally driver does this
transactionManager.getTransaction().enlistResource(xaResource);
ConnectionImple connectionToTest = getConnectionToTest();
// Initialises the connection
connectionToTest.clearWarnings();
connectionToTest.close();
verify(connection, times(1)).close();
}
use of com.arjuna.ats.internal.jdbc.ConnectionImple in project narayana by jbosstm.
the class ConnectionImpleTest method closeConnectionInAfterCompletion.
@Test
public void closeConnectionInAfterCompletion() throws Exception {
transactionManager.begin();
// Normally driver does this
transactionManager.getTransaction().enlistResource(xaResource);
ConnectionImple connectionToTest = getConnectionToTest();
// Initialises the connection
connectionToTest.clearWarnings();
transactionManager.getTransaction().registerSynchronization(new Synchronization() {
@Override
public void beforeCompletion() {
}
@Override
public void afterCompletion(int status) {
try {
connectionToTest.close();
} catch (SQLException e) {
fail("Could not close the connection: " + e);
}
}
});
transactionManager.commit();
verify(connection, times(1)).close();
}
use of com.arjuna.ats.internal.jdbc.ConnectionImple in project narayana by jbosstm.
the class ConnectionImpleTest method checkIfConnectionIsClosedWithoutTransaction.
@Test
public void checkIfConnectionIsClosedWithoutTransaction() throws SQLException {
ConnectionImple connectionToTest = getConnectionToTest();
// Initialises the connection
connectionToTest.clearWarnings();
connectionToTest.isClosed();
verify(connection, times(2)).isClosed();
}
Aggregations