@Test public void testTransactionManager() throws Exception { ConnectionSource connectionSource = createMock(ConnectionSource.class); DatabaseConnection conn = createMock(DatabaseConnection.class); expect(conn.isAutoCommitSupported()).andReturn(false); Savepoint savePoint = createMock(Savepoint.class); expect(savePoint.getSavepointName()).andReturn("name").anyTimes(); expect(conn.setSavePoint(isA(String.class))).andReturn(savePoint); conn.commit(savePoint); expect(connectionSource.getDatabaseType()).andReturn(databaseType); expect(connectionSource.getReadWriteConnection(null)).andReturn(conn); expect(connectionSource.saveSpecialConnection(conn)).andReturn(true); connectionSource.clearSpecialConnection(conn); connectionSource.releaseConnection(conn); replay(connectionSource, conn, savePoint); TransactionManager tm = new TransactionManager(connectionSource); tm.callInTransaction(new Callable<Void>() { @Override public Void call() { return null; } }); verify(connectionSource, conn, savePoint); }
public TransactionManager() { }
TransactionManager { public TransactionManager() { } }
TransactionManager { public TransactionManager() { } TransactionManager();  TransactionManager(ConnectionSource connectionSource); }
TransactionManager { public TransactionManager() { } TransactionManager();  TransactionManager(ConnectionSource connectionSource); void initialize(); T callInTransaction(final Callable<T> callable); T callInTransaction(String tableName, final Callable<T> callable); static T callInTransaction(final ConnectionSource connectionSource, final Callable<T> callable); static T callInTransaction(String tableName, final ConnectionSource connectionSource,
			final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, final DatabaseType databaseType,
			final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, boolean saved,
			final DatabaseType databaseType, final Callable<T> callable); void setConnectionSource(ConnectionSource connectionSource); }
TransactionManager { public TransactionManager() { } TransactionManager();  TransactionManager(ConnectionSource connectionSource); void initialize(); T callInTransaction(final Callable<T> callable); T callInTransaction(String tableName, final Callable<T> callable); static T callInTransaction(final ConnectionSource connectionSource, final Callable<T> callable); static T callInTransaction(String tableName, final ConnectionSource connectionSource,
			final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, final DatabaseType databaseType,
			final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, boolean saved,
			final DatabaseType databaseType, final Callable<T> callable); void setConnectionSource(ConnectionSource connectionSource);  }