|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.derbyTesting.junit.BaseTestCase
org.apache.derbyTesting.junit.BaseJDBCTestCase
org.apache.derbyTesting.functionTests.tests.jdbcapi.ProcedureTest
public class ProcedureTest
Tests of stored procedures.
| Field Summary | |
|---|---|
private static java.lang.String[] |
PROCEDURES
Procedures that should be created before the tests are run and dropped when the tests have finished. |
private static java.lang.String[][] |
TABLES
Tables that should be created before the tests are run and dropped when the tests have finished. |
| Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase |
|---|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE |
| Constructor Summary | |
|---|---|
ProcedureTest(java.lang.String name)
Creates a new ProcedureTest instance. |
|
| Method Summary | |
|---|---|
private void |
assertMultipleResultsFromExecuteQuery(java.sql.SQLException sqle)
Raises an exception if the exception is not caused by executeQuery() returning multiple result sets. |
private void |
assertNoResultSetFromExecuteQuery(java.sql.SQLException sqle)
Raises an exception if the exception is not caused by executeQuery() returning no result set. |
private void |
assertResultsFromExecuteUpdate(java.sql.SQLException sqle)
Raises an exception if the exception is not caused by executeUpdate() returning result sets. |
private static junit.framework.Test |
baseSuite(java.lang.String name)
Creates the test suite and wraps it in a TestSetup
instance which sets up and tears down the test environment. |
private void |
checkCSCloseClosesResults(java.sql.CallableStatement cs,
java.sql.ResultSet[] allRS)
Check that CallableStatement.close() closes results |
private void |
checkExecuteClosesResults(java.sql.CallableStatement cs,
java.sql.ResultSet[] allRS)
Check that CallableStatement.execute() closes results |
private void |
closeCurrentGetMoreResults(java.sql.CallableStatement cs,
java.sql.ResultSet[] allRS)
|
private void |
defaultGetMoreResults(java.sql.CallableStatement cs,
java.sql.ResultSet[] allRS)
Test default getMoreResults() closes result set. |
private void |
keepCurrentGetMoreResults(java.sql.CallableStatement cs,
java.sql.ResultSet[] allRS)
Check getMoreResults(Statement.KEEP_CURRENT_RESULT) |
private void |
mixedGetMoreResults(java.sql.CallableStatement cs,
java.sql.ResultSet[] allRS)
|
static void |
nestedDynamicResultSets(java.lang.String procedureText,
java.sql.ResultSet[] rs1,
java.sql.ResultSet[] rs2,
java.sql.ResultSet[] rs3,
java.sql.ResultSet[] rs4,
java.sql.ResultSet[] rs5,
java.sql.ResultSet[] rs6)
Method for a Java procedure that calls another procedure and just passes on the dynamic results from that call. |
static void |
procWithSideEffects(int returnResults,
java.sql.ResultSet[] rs1,
java.sql.ResultSet[] rs2)
Stored procedure which inserts a row into SIMPLE_TABLE and optionally returns result sets. |
static void |
retrieveClosedResult(java.sql.ResultSet[] closed)
Stored procedure which produces a closed result set. |
static void |
retrieveDynamicResults(int number,
java.sql.ResultSet[] rs1,
java.sql.ResultSet[] rs2,
java.sql.ResultSet[] rs3,
java.sql.ResultSet[] rs4)
Stored procedure which returns 0, 1, 2, 3 or 4 ResultSets. |
static void |
retrieveExternalResult(java.lang.String dbName,
java.lang.String user,
java.lang.String password,
java.sql.ResultSet[] external)
Stored procedure which produces a result set in another connection. |
void |
setUp()
Sets up the connection for a test case and clears all tables used in the test cases. |
static junit.framework.Test |
suite()
Runs the test fixtures in embedded and client. |
void |
testClosedDynamicResultSetsFromExecuteQuery()
Tests that closed result sets are not returned when calling executeQuery(). |
void |
testClosedDynamicResultSetsFromExecuteUpdate()
Tests that closed result sets are ignored when calling executeUpdate(). |
void |
testDynamicResultSetsFromOtherConnectionWithExecuteQuery()
Tests that dynamic result sets from other connections are ignored when calling executeQuery. |
void |
testDynamicResultSetsFromOtherConnectionWithExecuteUpdate()
Tests that dynamic result sets from other connections are ignored when calling executeUpdate. |
void |
testExecuteQueryWithMoreThanOneDynamicResultSet_callable()
Tests that CallableStatement.executeQuery() fails
when multiple result sets are returned. |
void |
testExecuteQueryWithMoreThanOneDynamicResultSet_prepared()
Tests that PreparedStatement.executeQuery() fails
when multiple result sets are returned. |
void |
testExecuteQueryWithMoreThanOneDynamicResultSet()
Tests that Statement.executeQuery() fails when
multiple result sets are returned. |
void |
testExecuteQueryWithNoDynamicResultSets_callable()
Tests that CallableStatement.executeQuery() fails
when no result sets are returned. |
void |
testExecuteQueryWithNoDynamicResultSets_prepared()
Tests that PreparedStatement.executeQuery() fails
when no result sets are returned. |
void |
testExecuteQueryWithNoDynamicResultSets()
Tests that Statement.executeQuery() fails when no
result sets are returned. |
void |
testExecuteQueryWithOneDynamicResultSet_callable()
Tests that CallableStatement.executeQuery()
succeeds when one result set is returned from a stored
procedure. |
void |
testExecuteQueryWithOneDynamicResultSet_prepared()
Tests that PreparedStatement.executeQuery()
succeeds when one result set is returned from a stored
procedure. |
void |
testExecuteQueryWithOneDynamicResultSet()
Tests that Statement.executeQuery() succeeds when
one result set is returned from a stored procedure. |
void |
testExecuteUpdateWithNoDynamicResultSets_callable()
Tests that CallableStatement.executeUpdate()
succeeds when no result sets are returned. |
void |
testExecuteUpdateWithNoDynamicResultSets_prepared()
Tests that PreparedStatement.executeUpdate()
succeeds when no result sets are returned. |
void |
testExecuteUpdateWithNoDynamicResultSets()
Tests that Statement.executeUpdate() succeeds when
no result sets are returned. |
void |
testExecuteUpdateWithOneDynamicResultSet_callable()
Tests that CallableStatement.executeUpdate() fails
when a result set is returned from a stored procedure. |
void |
testExecuteUpdateWithOneDynamicResultSet_prepared()
Tests that PreparedStatement.executeUpdate() fails
when a result set is returned from a stored procedure. |
void |
testExecuteUpdateWithOneDynamicResultSet()
Tests that Statement.executeUpdate() fails when a
result set is returned from a stored procedure. |
void |
testGetMoreResults()
Test various combinations of getMoreResults |
void |
testRollbackStoredProcWhenExecuteQueryReturnsNothing_prepared()
Tests that the effects of executing a stored procedure with executeQuery() are correctly rolled back when the
query fails because the number of returned result sets is zero. |
void |
testRollbackStoredProcWhenExecuteQueryReturnsNothing()
Tests that the effects of executing a stored procedure with executeQuery() are correctly rolled back when the
query fails because the number of returned result sets is zero. |
void |
testRollbackStoredProcWhenExecuteQueryReturnsTooMuch_prepared()
Tests that the effects of executing a stored procedure with executeQuery() are correctly rolled back when the
query fails because the number of returned result sets is more
than one. |
void |
testRollbackStoredProcWhenExecuteQueryReturnsTooMuch()
Tests that the effects of executing a stored procedure with executeQuery() are correctly rolled back when the
query fails because the number of returned result sets is more
than one. |
void |
testRollbackStoredProcWhenExecuteUpdateReturnsResults_prepared()
Tests that the effects of executing a stored procedure with executeUpdate() are correctly rolled back when the
query fails because the stored procedure returned a result set. |
void |
testRollbackStoredProcWhenExecuteUpdateReturnsResults()
Tests that the effects of executing a stored procedure with executeUpdate() are correctly rolled back when the
query fails because the stored procedure returned a result set. |
void |
testRollbackStoredProcWithExecuteQuery()
Tests that the effects of executing a stored procedure with executeQuery() are correctly rolled back when
Connection.rollback() is called. |
void |
testRollbackStoredProcWithExecuteUpdate()
Tests that the effects of executing a stored procedure with executeUpdate() are correctly rolled back when
Connection.rollback() is called. |
| 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, 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 |
| Field Detail |
|---|
private static final java.lang.String[] PROCEDURES
private static final java.lang.String[][] TABLES
| Constructor Detail |
|---|
public ProcedureTest(java.lang.String name)
ProcedureTest instance.
name - name of the test| Method Detail |
|---|
public void testExecuteQueryWithNoDynamicResultSets()
throws java.sql.SQLException
Statement.executeQuery() fails when no
result sets are returned.
java.sql.SQLException - if a database error occurs
public void testExecuteQueryWithOneDynamicResultSet()
throws java.sql.SQLException
Statement.executeQuery() succeeds when
one result set is returned from a stored procedure.
java.sql.SQLException - if a database error occurs
public void testExecuteQueryWithMoreThanOneDynamicResultSet()
throws java.sql.SQLException
Statement.executeQuery() fails when
multiple result sets are returned.
java.sql.SQLException - if a database error occurs
public void testExecuteUpdateWithNoDynamicResultSets()
throws java.sql.SQLException
Statement.executeUpdate() succeeds when
no result sets are returned.
Currently, this test fails with JCC.
java.sql.SQLException - if a database error occurs
public void testExecuteUpdateWithOneDynamicResultSet()
throws java.sql.SQLException
Statement.executeUpdate() fails when a
result set is returned from a stored procedure.
java.sql.SQLException - if a database error occurs
public void testExecuteQueryWithNoDynamicResultSets_prepared()
throws java.sql.SQLException
PreparedStatement.executeQuery() fails
when no result sets are returned.
java.sql.SQLException - if a database error occurs
public void testExecuteQueryWithOneDynamicResultSet_prepared()
throws java.sql.SQLException
PreparedStatement.executeQuery()
succeeds when one result set is returned from a stored
procedure.
java.sql.SQLException - if a database error occurs
public void testExecuteQueryWithMoreThanOneDynamicResultSet_prepared()
throws java.sql.SQLException
PreparedStatement.executeQuery() fails
when multiple result sets are returned.
java.sql.SQLException - if a database error occurs
public void testExecuteUpdateWithNoDynamicResultSets_prepared()
throws java.sql.SQLException
PreparedStatement.executeUpdate()
succeeds when no result sets are returned.
Currently, this test fails with JCC.
java.sql.SQLException - if a database error occurs
public void testExecuteUpdateWithOneDynamicResultSet_prepared()
throws java.sql.SQLException
PreparedStatement.executeUpdate() fails
when a result set is returned from a stored procedure.
Currently, this test fails with
JCC. However, the corresponding tests for
Statement and CallableStatement
succeed. Strange...
java.sql.SQLException - if a database error occurs
public void testExecuteQueryWithNoDynamicResultSets_callable()
throws java.sql.SQLException
CallableStatement.executeQuery() fails
when no result sets are returned.
java.sql.SQLException - if a database error occurs
public void testExecuteQueryWithOneDynamicResultSet_callable()
throws java.sql.SQLException
CallableStatement.executeQuery()
succeeds when one result set is returned from a stored
procedure.
java.sql.SQLException - if a database error occurs
public void testExecuteQueryWithMoreThanOneDynamicResultSet_callable()
throws java.sql.SQLException
CallableStatement.executeQuery() fails
when multiple result sets are returned.
java.sql.SQLException - if a database error occurs
public void testExecuteUpdateWithNoDynamicResultSets_callable()
throws java.sql.SQLException
CallableStatement.executeUpdate()
succeeds when no result sets are returned.
Currently, this test fails with JCC.
java.sql.SQLException - if a database error occurs
public void testExecuteUpdateWithOneDynamicResultSet_callable()
throws java.sql.SQLException
CallableStatement.executeUpdate() fails
when a result set is returned from a stored procedure.
java.sql.SQLException - if a database error occurs
public void testRollbackStoredProcWithExecuteQuery()
throws java.sql.SQLException
executeQuery() are correctly rolled back when
Connection.rollback() is called.
java.sql.SQLException - if a database error occurs
public void testRollbackStoredProcWithExecuteUpdate()
throws java.sql.SQLException
executeUpdate() are correctly rolled back when
Connection.rollback() is called.
java.sql.SQLException - if a database error occurs
public void testRollbackStoredProcWhenExecuteQueryReturnsNothing()
throws java.sql.SQLException
executeQuery() are correctly rolled back when the
query fails because the number of returned result sets is zero.
This test case fails with JCC.
java.sql.SQLException - if a database error occurs
public void testRollbackStoredProcWhenExecuteQueryReturnsTooMuch()
throws java.sql.SQLException
executeQuery() are correctly rolled back when the
query fails because the number of returned result sets is more
than one.
This test case fails with JCC.
java.sql.SQLException - if a database error occurs
public void testRollbackStoredProcWhenExecuteUpdateReturnsResults()
throws java.sql.SQLException
executeUpdate() are correctly rolled back when the
query fails because the stored procedure returned a result set.
This test case fails with JCC.
java.sql.SQLException - if a database error occurs
public void testRollbackStoredProcWhenExecuteQueryReturnsNothing_prepared()
throws java.sql.SQLException
executeQuery() are correctly rolled back when the
query fails because the number of returned result sets is zero.
This test case fails with JCC.
java.sql.SQLException - if a database error occurs
public void testRollbackStoredProcWhenExecuteQueryReturnsTooMuch_prepared()
throws java.sql.SQLException
executeQuery() are correctly rolled back when the
query fails because the number of returned result sets is more
than one.
This test case fails with JCC.
java.sql.SQLException - if a database error occurs
public void testRollbackStoredProcWhenExecuteUpdateReturnsResults_prepared()
throws java.sql.SQLException
executeUpdate() are correctly rolled back when the
query fails because the stored procedure returned a result set.
This test case fails with JCC.
java.sql.SQLException - if a database error occurs
public void testClosedDynamicResultSetsFromExecuteQuery()
throws java.sql.SQLException
executeQuery().
java.sql.SQLException - if a database error occurs
public void testClosedDynamicResultSetsFromExecuteUpdate()
throws java.sql.SQLException
executeUpdate().
java.sql.SQLException - if a database error occurs
public void testDynamicResultSetsFromOtherConnectionWithExecuteQuery()
throws java.sql.SQLException
executeQuery.
java.sql.SQLException - if a database error occurs
public void testDynamicResultSetsFromOtherConnectionWithExecuteUpdate()
throws java.sql.SQLException
executeUpdate.
java.sql.SQLException - if a database error occursprivate void assertNoResultSetFromExecuteQuery(java.sql.SQLException sqle)
executeQuery() returning no result set.
sqle - a SQLException valueprivate void assertMultipleResultsFromExecuteQuery(java.sql.SQLException sqle)
executeQuery() returning multiple result sets.
sqle - a SQLException valueprivate void assertResultsFromExecuteUpdate(java.sql.SQLException sqle)
executeUpdate() returning result sets.
sqle - a SQLException valuepublic static junit.framework.Test suite()
private static junit.framework.Test baseSuite(java.lang.String name)
TestSetup
instance which sets up and tears down the test environment.
public void setUp()
throws java.sql.SQLException
setUp in class junit.framework.TestCasejava.sql.SQLException - if a database error occurs
public static void retrieveDynamicResults(int number,
java.sql.ResultSet[] rs1,
java.sql.ResultSet[] rs2,
java.sql.ResultSet[] rs3,
java.sql.ResultSet[] rs4)
throws java.sql.SQLException
ResultSets.
number - the number of ResultSets to returnrs1 - first ResultSetrs2 - second ResultSetrs3 - third ResultSetrs4 - fourth ResultSet
java.sql.SQLException - if a database error occurs
public static void retrieveClosedResult(java.sql.ResultSet[] closed)
throws java.sql.SQLException
closed - holder for the closed result set
java.sql.SQLException - if a database error occurs
public static void retrieveExternalResult(java.lang.String dbName,
java.lang.String user,
java.lang.String password,
java.sql.ResultSet[] external)
throws java.sql.SQLException
external - result set from another connection
java.sql.SQLException - if a database error occurs
public static void procWithSideEffects(int returnResults,
java.sql.ResultSet[] rs1,
java.sql.ResultSet[] rs2)
throws java.sql.SQLException
returnResults - if one, return one result set; if greater
than one, return two result sets; otherwise, return no result
setrs1 - first result set to returnrs2 - second result set to return
java.sql.SQLException - if a database error occurs
public static void nestedDynamicResultSets(java.lang.String procedureText,
java.sql.ResultSet[] rs1,
java.sql.ResultSet[] rs2,
java.sql.ResultSet[] rs3,
java.sql.ResultSet[] rs4,
java.sql.ResultSet[] rs5,
java.sql.ResultSet[] rs6)
throws java.sql.SQLException
java.sql.SQLException
public void testGetMoreResults()
throws java.sql.SQLException
java.sql.SQLException
private void checkExecuteClosesResults(java.sql.CallableStatement cs,
java.sql.ResultSet[] allRS)
throws java.sql.SQLException
cs - allRS -
java.sql.SQLException
private void checkCSCloseClosesResults(java.sql.CallableStatement cs,
java.sql.ResultSet[] allRS)
throws java.sql.SQLException
cs - allRS -
java.sql.SQLException
private void mixedGetMoreResults(java.sql.CallableStatement cs,
java.sql.ResultSet[] allRS)
throws java.sql.SQLException
java.sql.SQLException
private void keepCurrentGetMoreResults(java.sql.CallableStatement cs,
java.sql.ResultSet[] allRS)
throws java.sql.SQLException
cs - allRS -
java.sql.SQLException
private void closeCurrentGetMoreResults(java.sql.CallableStatement cs,
java.sql.ResultSet[] allRS)
throws java.sql.SQLException
java.sql.SQLException
private void defaultGetMoreResults(java.sql.CallableStatement cs,
java.sql.ResultSet[] allRS)
throws java.sql.SQLException
cs - allRS -
java.sql.SQLException
|
Built on Thu 2009-11-26 18:42:53-0800, from revision 884739 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||