org.apache.derbyTesting.functionTests.tests.jdbcapi
Class XATest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.derbyTesting.junit.BaseTestCase
              extended by org.apache.derbyTesting.junit.BaseJDBCTestCase
                  extended by org.apache.derbyTesting.functionTests.tests.jdbcapi.XATest
All Implemented Interfaces:
junit.framework.Test

public class XATest
extends BaseJDBCTestCase


Field Summary
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
XATest(java.lang.String name)
           
 
Method Summary
static junit.framework.Test baseSuite(java.lang.String name)
           
private static void checkHeldRS(java.sql.Connection conn, java.sql.Statement s, java.sql.ResultSet rs)
          Check the held state of a ResultSet by fetching one row, executing a commit and then fetching the next.
static junit.framework.Test suite()
          Runs the test fixtures in embedded and client.
 void testDerby4310CallableStatement()
          This test checks the fix on DERBY-4310, for not repreparing CallableStatements upon calling close() on them.
 void testDerby4310PreparedStatement()
          This test checks the fix on DERBY-4310, for not repreparing PreparedStatements upon calling close() on them.
 void testDerby966()
          Derby-966 holdability and global/location transactions.
 void testInterleavingTransactions()
           
 void testMorph()
          Morph a connection between local anf global transactions.
 void testNoTransaction()
          Tests on INIT STATE (no tr Original SQL from xaStateTran.sql.
 void testSingleConnectionOnePhaseCommit()
          A single connection and 1 phase commit.
static void zeroArg()
          Dummy method for testDerby4310* fixtures
 
Methods inherited from class org.apache.derbyTesting.junit.BaseJDBCTestCase
assertCallError, assertCheckTable, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertGetIntError, assertNextError, assertPreparedStatementError, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertTableRowCount, assertUpdateCount, assertUpdateCount, checkAllConsistency, checkEstimatedRowCount, commit, createStatement, createStatement, createStatement, dropTable, dropTable, getConnection, getDatabaseProperty, getLastSQLException, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbedded
 
Methods inherited from class org.apache.derbyTesting.junit.BaseTestCase
alarm, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertSecurityManager, assertThrowableEquals, execJavaCmd, fail, getFailureFolder, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeSystemProperty, runBare, setSystemProperty, traceit
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, setUp, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XATest

public XATest(java.lang.String name)
Method Detail

testSingleConnectionOnePhaseCommit

public void testSingleConnectionOnePhaseCommit()
                                        throws java.sql.SQLException,
                                               javax.transaction.xa.XAException
A single connection and 1 phase commit. Original "SQL" from xaSimplePositive.sql xa_connect ; xa_start xa_noflags 0; xa_getconnection; drop table foo; create table foo (a int); insert into foo values (0); select * from foo; run resource '/org/apache/derbyTesting/functionTests/tests/store/global_xactTable.view'; select * from global_xactTable where gxid is not null order by gxid; xa_end xa_success 0; xa_commit xa_1phase 0; xa_datasource 'wombat' shutdown;

Throws:
java.sql.SQLException
javax.transaction.xa.XAException
javax.transaction.xa.XAException

testInterleavingTransactions

public void testInterleavingTransactions()
                                  throws java.sql.SQLException,
                                         javax.transaction.xa.XAException
Throws:
java.sql.SQLException
javax.transaction.xa.XAException

testNoTransaction

public void testNoTransaction()
                       throws java.sql.SQLException,
                              javax.transaction.xa.XAException
Tests on INIT STATE (no tr Original SQL from xaStateTran.sql. -- the following should error XAER_NOTA xa_start xa_join 11; -- the following should error XAER_NOTA xa_start xa_resume 11; -- the following should error XAER_NOTA xa_end xa_success 11; -- the following should error XAER_NOTA xa_end xa_fail 11; -- the following should error XAER_NOTA xa_end xa_suspend 11; -- the following should error XAER_NOTA xa_prepare 11; -- the following should error XAER_NOTA xa_commit xa_1phase 11; -- the following should error XAER_NOTA xa_commit xa_2phase 11; -- the following should error XAER_NOTA xa_rollback 11; -- the following should error XAER_NOTA xa_forget 11;

Throws:
java.sql.SQLException
javax.transaction.xa.XAException

testMorph

public void testMorph()
               throws java.sql.SQLException,
                      javax.transaction.xa.XAException
Morph a connection between local anf global transactions.

Throws:
java.sql.SQLException
javax.transaction.xa.XAException

testDerby4310PreparedStatement

public void testDerby4310PreparedStatement()
                                    throws java.sql.SQLException,
                                           javax.transaction.xa.XAException
This test checks the fix on DERBY-4310, for not repreparing PreparedStatements upon calling close() on them.

Throws:
java.sql.SQLException
javax.transaction.xa.XAException

testDerby4310CallableStatement

public void testDerby4310CallableStatement()
                                    throws java.sql.SQLException,
                                           javax.transaction.xa.XAException
This test checks the fix on DERBY-4310, for not repreparing CallableStatements upon calling close() on them.

Throws:
java.sql.SQLException
javax.transaction.xa.XAException

testDerby966

public void testDerby966()
                  throws java.sql.SQLException,
                         javax.transaction.xa.XAException
Derby-966 holdability and global/location transactions. (work in progress)

Throws:
java.sql.SQLException
javax.transaction.xa.XAException

checkHeldRS

private static void checkHeldRS(java.sql.Connection conn,
                                java.sql.Statement s,
                                java.sql.ResultSet rs)
                         throws java.sql.SQLException
Check the held state of a ResultSet by fetching one row, executing a commit and then fetching the next. Checks the held state matches the behaviour.

Throws:
java.sql.SQLException

zeroArg

public static void zeroArg()
Dummy method for testDerby4310* fixtures


baseSuite

public static junit.framework.Test baseSuite(java.lang.String name)

suite

public static junit.framework.Test suite()
Runs the test fixtures in embedded and client.

Returns:
test suite

Built on Sat 2009-11-28 18:44:18-0800, from revision 885187

Apache Derby V10.6 Internals - Copyright © 2004,2008 The Apache Software Foundation. All Rights Reserved.