public class SetQueryTimeoutTest
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SetQueryTimeoutTest.StatementExecutor |
private static class |
SetQueryTimeoutTest.TestFailedException
This Exception class is used for getting fail-fast behaviour in
this test.
|
Modifier and Type | Field and Description |
---|---|
private static int |
CONNECTIONS |
private static int |
TIMEOUT |
Constructor and Description |
---|
SetQueryTimeoutTest() |
Modifier and Type | Method and Description |
---|---|
static int |
delay(int seconds,
int value)
This is the user-defined function which is called from our queries
|
private static void |
dropTables(java.sql.Connection conn,
java.lang.String tablePrefix) |
private static void |
exec(java.sql.Connection connection,
java.lang.String queryString) |
private static void |
exec(java.sql.Connection connection,
java.lang.String queryString,
java.util.Collection ignoreExceptions)
Used for executing the SQL statements for setting up this test
(the preparation phase).
|
private static void |
expectException(java.lang.String expectSqlState,
java.sql.SQLException sqlException,
java.lang.String failMsg)
This method compares a thrown SQLException's SQLState value
to an expected SQLState.
|
private static java.lang.String |
getExecQuery(java.lang.String tablePrefix) |
private static java.lang.String |
getFetchQuery(java.lang.String tablePrefix) |
void |
go(java.lang.String[] args)
The actual main bulk of this test.
|
static void |
main(java.lang.String[] args)
Main program, makes this class invocable from the command line
|
private static java.sql.PreparedStatement |
prepare(java.sql.Connection conn,
java.lang.String query) |
private static void |
prepareForTimedQueries(java.sql.Connection conn) |
private static void |
prepareTables(java.sql.Connection conn,
java.lang.String tablePrefix) |
private static void |
printSQLException(java.sql.SQLException e) |
private static void |
testInvalidTimeoutValue(java.sql.Connection conn) |
private static void |
testRememberTimeoutValue(java.sql.Connection conn)
Test for DERBY-1692.
|
private static void |
testStatementRemembersTimeout(java.sql.PreparedStatement ps)
Test that a prepared statement remembers its timeout value when
executed multiple times.
|
private static void |
testStatementRemembersTimeout(java.sql.Statement stmt)
Test that a statement remembers its timeout value when executed
multiple times.
|
private static void |
testTimeoutWithExec(java.sql.Connection[] connections)
Part two of this test.
|
private static void |
testTimeoutWithExecuteUpdate(java.sql.Connection conn)
This tests timeout with executeUpdate call.
|
private static void |
testTimeoutWithFetch(java.sql.Connection conn1,
java.sql.Connection conn2)
Part 1 of this test.
|
private static final int TIMEOUT
private static final int CONNECTIONS
private static void printSQLException(java.sql.SQLException e)
private static void exec(java.sql.Connection connection, java.lang.String queryString, java.util.Collection ignoreExceptions) throws SetQueryTimeoutTest.TestFailedException
private static void exec(java.sql.Connection connection, java.lang.String queryString) throws SetQueryTimeoutTest.TestFailedException
private static void dropTables(java.sql.Connection conn, java.lang.String tablePrefix) throws SetQueryTimeoutTest.TestFailedException
private static void prepareTables(java.sql.Connection conn, java.lang.String tablePrefix) throws SetQueryTimeoutTest.TestFailedException
public static int delay(int seconds, int value) throws java.sql.SQLException
java.sql.SQLException
private static void prepareForTimedQueries(java.sql.Connection conn) throws SetQueryTimeoutTest.TestFailedException
private static java.lang.String getFetchQuery(java.lang.String tablePrefix)
private static java.lang.String getExecQuery(java.lang.String tablePrefix)
private static void expectException(java.lang.String expectSqlState, java.sql.SQLException sqlException, java.lang.String failMsg) throws SetQueryTimeoutTest.TestFailedException
private static java.sql.PreparedStatement prepare(java.sql.Connection conn, java.lang.String query) throws SetQueryTimeoutTest.TestFailedException
private static void testTimeoutWithFetch(java.sql.Connection conn1, java.sql.Connection conn2) throws SetQueryTimeoutTest.TestFailedException
private static void testTimeoutWithExec(java.sql.Connection[] connections) throws SetQueryTimeoutTest.TestFailedException
private static void testInvalidTimeoutValue(java.sql.Connection conn) throws SetQueryTimeoutTest.TestFailedException
private static void testTimeoutWithExecuteUpdate(java.sql.Connection conn) throws SetQueryTimeoutTest.TestFailedException
private static void testRememberTimeoutValue(java.sql.Connection conn) throws SetQueryTimeoutTest.TestFailedException
private static void testStatementRemembersTimeout(java.sql.Statement stmt) throws java.sql.SQLException, SetQueryTimeoutTest.TestFailedException
java.sql.SQLException
SetQueryTimeoutTest.TestFailedException
private static void testStatementRemembersTimeout(java.sql.PreparedStatement ps) throws java.sql.SQLException, SetQueryTimeoutTest.TestFailedException
java.sql.SQLException
SetQueryTimeoutTest.TestFailedException
public static void main(java.lang.String[] args)
public void go(java.lang.String[] args)
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.