BackendConnection implements JDBCExecutionConnection { public boolean isSerialExecute() { return transactionStatus.isInTransaction() && (TransactionType.LOCAL == transactionStatus.getTransactionType() || TransactionType.XA == transactionStatus.getTransactionType()); } BackendConnection(final TransactionType initialTransactionType); void setCurrentSchema(final String schemaName); @Override List<Connection> getConnections(final String dataSourceName, final int connectionSize, final ConnectionMode connectionMode); @Override Statement createStorageResource(final Connection connection, final ConnectionMode connectionMode, final StatementOption option); @Override PreparedStatement createStorageResource(final String sql, final List<Object> parameters, 
                                                   final Connection connection, final ConnectionMode connectionMode, final StatementOption option); boolean isSerialExecute(); int getConnectionSize(); void add(final Statement statement); void add(final ResultSet resultSet); synchronized Collection<SQLException> closeResultSets(); synchronized Collection<SQLException> closeStatements(); synchronized Collection<SQLException> closeConnections(final boolean forceRollback);  }
@Test public void assertIsNotSerialExecuteWhenNotInTransaction() { backendConnection.getTransactionStatus().setInTransaction(false); assertFalse(backendConnection.isSerialExecute()); }
@Test public void assertIsNotSerialExecuteWhenInTransactionAndBaseTransactionType() { backendConnection.getTransactionStatus().setInTransaction(false); backendConnection.getTransactionStatus().setTransactionType(TransactionType.BASE); assertFalse(backendConnection.isSerialExecute()); }
@Test public void assertIsSerialExecuteWhenInTransactionAndLocalTransactionType() { backendConnection.getTransactionStatus().setTransactionType(TransactionType.LOCAL); backendConnection.getTransactionStatus().setInTransaction(true); assertTrue(backendConnection.isSerialExecute()); }
@Test public void assertIsSerialExecuteWhenInTransactionAndXaTransactionType() { backendConnection.getTransactionStatus().setTransactionType(TransactionType.XA); backendConnection.getTransactionStatus().setInTransaction(true); assertTrue(backendConnection.isSerialExecute()); }