public interface TransactionQueryTestCase
1. Setup phase is about setting the global environment for the testing
#setConnectionStrategy(ConnectionStrategy)
- called first to provide
the environment (i.e, type of connection, parameters, etc) that the test will
be run under.
#hasRequiredDataSources()
- called after the connection
strategy is set so the determination can be made if this test has the
required datasources defined and available in order to run the test. If not,
then the test is bypassed.
setup()
- called to enable the test to
perform any pretest (i.e., global) setup. Example would be data source setup.
setConnection(Connection)
- called to set the client driver (i.e.,
Teiid) connection that will be used to execute queries against
#setExecutionProperties(Properties)
- called at this time so that the
overriding class can obtain / initialize settings that will be assigned when
AbstractQueryTest.assignExecutionProperties(Statement)
is called
prior to sql execution. (Example: set fetch size, batch time, or timeout)
2. Test phase are the methods for executing a test, including any
before/after test logic to support the test
before()
called before the execution of the test so that the
transaction boundary can be set and any other pretest conditions
testCase()
called to execute the specific test
after()
called after the test is executed, which will commit/rollback the transaction
and perform any other post conditions
3. Validation phase is meant to enable data validation post transaction
completion. This is especially helpful when performing XA transactions
because the results are not completed and available until after the after()
step
is performed.
#validateTestCase()
4. Cleanup
cleanup()
Called to allow the testcase to perform any cleanup after execution.
================
Other Notes:
The following methods were exposed from AbstractQueryTest
:
exceptionExpected()
- when an exception is expected to occur, the
underlying logic will treat the execution as if it succeeded. exceptionOccurred()
- this method indicates when an exception
actually occurred outside of the normal expected results. getConnection()
and getXAConnection()
- these connection
methods are exposed for before()
and after()
methodsrollbackAllways()
- this is exposed for the after()
method
as to what behavior is expected after the execution of the testModifier and Type | Method and Description |
---|---|
void |
after()
Override
after if there is behavior that needs to be
performed after testCase() being called. |
void |
before()
Override
before if there is behavior that needs to be
performed prior to testCase() being called. |
void |
cleanup()
Called at the end of the test so that the testcase can clean itself up by
releasing any resources, closing any open connections, etc.
|
boolean |
exceptionExpected() |
boolean |
exceptionOccurred() |
Throwable |
getApplicationException() |
Connection |
getConnection()
Returns the connection being used in the test.
|
ConnectionStrategy |
getConnectionStrategy()
Called to get the current connection strategy being used.
|
String |
getTestName()
Returns the name of the test so that better tracing of what tests are
running/completing.
|
XAConnection |
getXAConnection() |
boolean |
rollbackAllways()
Indicates what should be done when a failure occurs in
testCase() |
void |
setApplicationException(Throwable t) |
void |
setConnection(Connection conn)
Called by the @link TransactionContainer to set the Teiid connection to
be used in the test.
|
void |
setup()
Called by the
TransactionContainer prior to testcase processing
so that the responsibility for performing an setup duties (ie..,
datasource setup) can be done |
void |
testCase()
Implement testCase(), it is the entry point to the execution of the test.
|
String getTestName()
ConnectionStrategy getConnectionStrategy()
void setup() throws QueryTestFailedException
TransactionContainer
prior to testcase processing
so that the responsibility for performing an setup duties (ie..,
datasource setup) can be doneQueryTestFailedException
void setConnection(Connection conn)
conn
- void before()
before
if there is behavior that needs to be
performed prior to testCase()
being called.void testCase() throws Exception
Exception
void after()
after
if there is behavior that needs to be
performed after testCase()
being called.boolean rollbackAllways()
testCase()
void cleanup()
Connection getConnection()
XAConnection getXAConnection()
boolean exceptionExpected()
boolean exceptionOccurred()
void setApplicationException(Throwable t)
Throwable getApplicationException()
Copyright © 2017 JBoss by Red Hat. All rights reserved.