public class SURQueryMixTest extends SURBaseTest
Modifier and Type | Field and Description |
---|---|
private boolean |
checkRowDeleted |
private boolean |
checkRowUpdated |
private java.lang.String |
cursorName |
private boolean |
positioned |
private static java.lang.String[] |
projectConditions |
private java.lang.String |
query |
private static java.lang.String[] |
selectConditions |
CURSOR_NOT_POSITIONED_ON_INSERT_ROW, CURSOR_NOT_UPDATABLE_SQL_STATE, CURSOR_OPERATION_CONFLICT, FOR_UPDATE_NOT_PERMITTED_SQL_STATE, INVALID_CURSOR_STATE_NO_CURRENT_ROW, LOCK_TIMEOUT_EXPRESSION_SQL_STATE, LOCK_TIMEOUT_SQL_STATE, QUERY_NOT_QUALIFIED_FOR_UPDATABLE_RESULTSET, recordCount, RESULTSET_NOT_UPDATABLE_SQL_STATE
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
SURQueryMixTest(java.lang.String model,
java.lang.String query,
java.lang.String cursorName,
boolean positioned)
Constructor
|
Modifier and Type | Method and Description |
---|---|
private static junit.framework.Test |
baseSuite(java.lang.String name)
The suite contains all testcases in this class running on different data models
|
private java.util.List |
createRandomSample(java.util.Map<java.lang.Integer,java.lang.String> rows,
int k)
Create a random sample of rows
|
private java.util.Map<java.lang.Integer,java.lang.String> |
createRowMap(java.sql.ResultSet rs)
Creates a Map of the values in the ResultSet.
|
private static BaseTestSuite |
createTestCases(java.lang.String modelName) |
private void |
deleteRandomSampleOfNRecords(java.sql.ResultSet rs,
java.util.Map<java.lang.Integer,java.lang.String> rows,
java.util.Set<java.lang.Integer> deletedRows,
int k)
Delete a random sample of n records in the resultset
|
private java.lang.String |
getRowString(java.sql.ResultSet rs)
Get a concatenation of the values of the
current Row in the ResultSet
|
void |
runTest()
Test SUR properties of the query
|
static junit.framework.Test |
suite()
Run in client and embedded.
|
private void |
testNavigation(java.sql.ResultSet rs,
java.util.Map rows,
java.util.Set updatedRows,
java.util.Set deletedRows)
Tests navigation in ResultSet.
|
private void |
updatePositioned(java.sql.ResultSet rs,
java.sql.ResultSetMetaData meta)
Updates the current row in the ResultSet using updateRow()
|
private void |
updateRandomSampleOfNRecords(java.sql.ResultSet rs,
java.util.Map<java.lang.Integer,java.lang.String> rows,
java.util.Set<java.lang.Integer> updatedRows,
int k)
Update a random sample of n records in the resultset
|
private void |
updateRow(java.sql.ResultSet rs,
java.sql.ResultSetMetaData meta)
Updates the current row in the ResultSet using updateRow()
|
assertFailOnUpdate, assertWarning, initializeConnection, scrollBackward, scrollBackwardAndUpdate, scrollBackwardAndUpdatePositioned, scrollForward, scrollForwardAndUpdate, scrollForwardAndUpdatePositioned, updateTuple, updateTuplePositioned, verifyTuple
assertCallError, assertCheckTable, assertCommitError, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertResults, assertResults, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, chattyPrepare, chattyPrepareCall, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, dumpRs, dumpRs, emptyStatementCache, executeQuery, expectCompilationError, expectCompilationError, expectExecutionError, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, goodStatement, goodUpdate, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbedded
alarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSameNullness, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit, vmAtLeast
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, setName, setUp, toString
private final java.lang.String query
private final java.lang.String cursorName
private final boolean positioned
private boolean checkRowUpdated
private boolean checkRowDeleted
private static final java.lang.String[] selectConditions
private static final java.lang.String[] projectConditions
public SURQueryMixTest(java.lang.String model, java.lang.String query, java.lang.String cursorName, boolean positioned)
model
- name of data model for this TestCasequery
- to use for producing the resultsetcursorName
- name of cursorpositioned
- flag to determine if the Test should use positioned
updates/deletes instead of updateRow() and deleteRow()public void runTest() throws java.sql.SQLException
runTest
in class junit.framework.TestCase
java.sql.SQLException
private java.util.Map<java.lang.Integer,java.lang.String> createRowMap(java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
private java.util.List createRandomSample(java.util.Map<java.lang.Integer,java.lang.String> rows, int k)
rows
- Map to create sample fromk
- number of rows in the sampleprivate void deleteRandomSampleOfNRecords(java.sql.ResultSet rs, java.util.Map<java.lang.Integer,java.lang.String> rows, java.util.Set<java.lang.Integer> deletedRows, int k) throws java.sql.SQLException
rs
- result set to be updatedrows
- map of rows, will also be updateddeletedRows
- set of rows being deleted (position in RS)k
- number of records to be deletedjava.sql.SQLException
private void updateRandomSampleOfNRecords(java.sql.ResultSet rs, java.util.Map<java.lang.Integer,java.lang.String> rows, java.util.Set<java.lang.Integer> updatedRows, int k) throws java.sql.SQLException
rs
- result set to be updatedrows
- map of rows, will also be updatedupdatedRows
- set of being updated (position in RS)k
- number of records to be updatedjava.sql.SQLException
private void updateRow(java.sql.ResultSet rs, java.sql.ResultSetMetaData meta) throws java.sql.SQLException
rs
- ResultSet to be updatedmeta
- meta for the ResultSetjava.sql.SQLException
private void updatePositioned(java.sql.ResultSet rs, java.sql.ResultSetMetaData meta) throws java.sql.SQLException
rs
- ResultSet to be updatedmeta
- meta for the ResultSetjava.sql.SQLException
private void testNavigation(java.sql.ResultSet rs, java.util.Map rows, java.util.Set updatedRows, java.util.Set deletedRows) throws java.sql.SQLException
rs
- ResultSet to test navigation of.
Needs to be scrollablerows
- a sample of the rows which are in the ResultSet. Maps
position to a concatenation of the string valuesupdatedRows
- a integer set of which rows that have been
updated. Used to test rowUpdated()deletedRows
- a integer set of which rows that have been
deleted. Used to test rowDeleted()java.sql.SQLException
private java.lang.String getRowString(java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
private static BaseTestSuite createTestCases(java.lang.String modelName)
public static junit.framework.Test suite()
private static junit.framework.Test baseSuite(java.lang.String name)
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.