public class Changes10_9 extends UpgradeChange
Modifier and Type | Class and Description |
---|---|
private class |
Changes10_9.CharRange |
(package private) class |
Changes10_9.Goal |
private class |
Changes10_9.SingleChar |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
INVALID_PROVIDER_CHANGE |
private Changes10_9.Goal[] |
pattern
Regexp pattern to match the file name of a jar file stored in the
database (version >= 10.9).
|
private static java.lang.String[] |
SUPPORT_FILES_SOURCE |
private static java.lang.String |
UPGRADE_REQUIRED |
private static java.lang.String[][] |
USERS
Information about users for the test of builtin authentication with
configurable hash algorithm.
|
oldVersion, PH_CREATE, PH_HARD_UPGRADE, PH_POST_HARD_UPGRADE, PH_POST_SOFT_UPGRADE, PH_SOFT_UPGRADE, phase, PHASES, SQLSTATE_NEED_UPGRADE
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
Changes10_9(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
private void |
assertFileNameShape(java.lang.String fName)
assert that fName has the expected shape of a jar file
in the database (version >= 10.9).
|
private void |
createSchema(java.lang.String name) |
private java.lang.String |
getDatabaseProperty(java.sql.Statement s,
java.lang.String key) |
private java.lang.String |
getNewFunctionID(java.sql.Statement s) |
private void |
initPattern()
Initialize a pattern corresponding to:
<Derby uuid string>[.]jar[.]G[0-9]+
where:
<Derby uuid string> has the form
hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh
where h id a lower case hex digit.
|
private void |
installJar(java.lang.String resource,
java.lang.String jarName) |
private boolean |
matches(java.lang.String fName,
Changes10_9.Goal[] pattern)
Poor man's regexp matcher: can match patterns of type below, where
start "^" and end "$" is implied: must match whole string.
|
private void |
popAuthenticationAlgorithm(java.sql.Statement s,
java.lang.String defaultDigestAlgorithm) |
private java.lang.String |
pushAuthenticationAlgorithm(java.sql.Statement s) |
private void |
removeJar(java.lang.String jarName) |
private void |
replaceJar(java.lang.String resource,
java.lang.String jarName) |
private void |
setDatabaseProperty(java.sql.Statement s,
java.lang.String key,
java.lang.String value) |
private void |
setDBClasspath(java.lang.String cp) |
private void |
setPasswords(java.sql.CallableStatement cs)
Set the passwords for all users specified in
USERS . |
static junit.framework.Test |
suite(int phase)
Return the suite of tests to test the changes made in 10.7.
|
void |
test_5493()
Test the changes introduced to fix correctness problems with sequences.
|
void |
testBuiltinAuthenticationWithConfigurableHash()
Make sure builtin authentication doesn't use a hash scheme that's not
supported by the old version until the database has been hard upgraded.
|
void |
testDisposableStatisticsExplicit()
Verifies the behavior of the update statistics code when faced with
"disposable statistics entries".
|
void |
testDropOrphanedStatistics()
Verifies that an orphaned statistics entry can be dropped by running the
SYSCS_DROP_STATISTICS system procedure. |
void |
testDropStatisticsProc()
Make sure that the drop statistics procedure only appears after
hard-upgrade.
|
void |
testJarStorage()
For 10.9 and later storage of jar files changed.
|
void |
testNativeAuthentication()
Make sure that the catalogs and procedures for NATIVE authentication
only appear after hard-upgrade.
|
void |
testNativeLocalAuthentication()
Make sure that NATIVE LOCAL authentication can't be turned on
before hard-upgrade.
|
private void |
tryCall() |
private void |
verifyCanConnect(javax.sql.DataSource ds)
Verify that all users specified in
USERS can connect to the
database. |
private void |
verifyNewLocations(int noOfObjects) |
private void |
verifyPasswords(java.sql.Connection c)
Verify that all passwords for the users in
USERS are stored
as expected. |
private void |
vetNativeProcs(java.sql.Statement s,
boolean shouldExist) |
private void |
vetProcs(java.sql.Statement s,
java.lang.String procCall,
boolean shouldExist) |
private void |
vetSYSUSERS(java.sql.Statement s,
boolean shouldExist) |
getOldFixPack, getOldMajor, getOldMinor, getOldPoint, getOldVersion, getOldVersionString, getPhase, getPhaseString, oldAtLeast, oldIs, oldIs, oldLessThan
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, initializeConnection, 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, runTest, setName, setUp, toString
private static final java.lang.String UPGRADE_REQUIRED
private static final java.lang.String INVALID_PROVIDER_CHANGE
private static final java.lang.String[] SUPPORT_FILES_SOURCE
private static final java.lang.String[][] USERS
private Changes10_9.Goal[] pattern
public static junit.framework.Test suite(int phase)
phase
- an integer that indicates the current phase in
the upgrade test.public void testDropStatisticsProc() throws java.lang.Exception
java.lang.Exception
public void testNativeAuthentication() throws java.lang.Exception
java.lang.Exception
private void vetProcs(java.sql.Statement s, java.lang.String procCall, boolean shouldExist) throws java.lang.Exception
java.lang.Exception
private void vetSYSUSERS(java.sql.Statement s, boolean shouldExist) throws java.lang.Exception
java.lang.Exception
private void vetNativeProcs(java.sql.Statement s, boolean shouldExist) throws java.lang.Exception
java.lang.Exception
private java.lang.String pushAuthenticationAlgorithm(java.sql.Statement s) throws java.lang.Exception
java.lang.Exception
private void popAuthenticationAlgorithm(java.sql.Statement s, java.lang.String defaultDigestAlgorithm) throws java.lang.Exception
java.lang.Exception
private void setDatabaseProperty(java.sql.Statement s, java.lang.String key, java.lang.String value) throws java.lang.Exception
java.lang.Exception
private java.lang.String getDatabaseProperty(java.sql.Statement s, java.lang.String key) throws java.lang.Exception
java.lang.Exception
public void testNativeLocalAuthentication() throws java.lang.Exception
java.lang.Exception
public void testBuiltinAuthenticationWithConfigurableHash() throws java.sql.SQLException
java.sql.SQLException
private void setPasswords(java.sql.CallableStatement cs) throws java.sql.SQLException
USERS
.cs
- a callable statement that sets database propertiesjava.sql.SQLException
private void verifyPasswords(java.sql.Connection c) throws java.sql.SQLException
USERS
are stored
as expected. Raise an assert failure on mismatch.c
- a connection to the databasejava.sql.SQLException
private void verifyCanConnect(javax.sql.DataSource ds) throws java.sql.SQLException
USERS
can connect to the
database.ds
- a data source for connecting to the databasejava.sql.SQLException
- if one of the users cannot connect to the databasepublic void testJarStorage() throws java.lang.Exception
java.lang.Exception
private void createSchema(java.lang.String name) throws java.sql.SQLException
java.sql.SQLException
private void installJar(java.lang.String resource, java.lang.String jarName) throws java.sql.SQLException, java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
private void replaceJar(java.lang.String resource, java.lang.String jarName) throws java.sql.SQLException, java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
private void removeJar(java.lang.String jarName) throws java.sql.SQLException
java.sql.SQLException
private void setDBClasspath(java.lang.String cp) throws java.sql.SQLException
java.sql.SQLException
private void tryCall() throws java.sql.SQLException
java.sql.SQLException
private void verifyNewLocations(int noOfObjects) throws java.sql.SQLException
java.sql.SQLException
private void initPattern()
private void assertFileNameShape(java.lang.String fName)
private boolean matches(java.lang.String fName, Changes10_9.Goal[] pattern)
public void test_5493() throws java.lang.Exception
java.lang.Exception
private java.lang.String getNewFunctionID(java.sql.Statement s) throws java.lang.Exception
java.lang.Exception
public void testDropOrphanedStatistics() throws java.sql.SQLException
SYSCS_DROP_STATISTICS
system procedure.
Relevant JIRAs:
DERBY-5702(Creating a foreign key constraint does not automatically create a statistics row if foreign key constraint will share a backing index created for a primay key) is causing a problem for us to test the hanging statistics row with 10.4 and prior releases. Following test relies on having hanging statistics rows which should have been dropped when the constraint owing it was dropped. The test then goes ahead and uses the new drop statisitcs procedure to drop the hanging statistics rows. But because of DERBY-5702, when a constraint is added which will reuse an existing backing index, no statistics row is created for that constraint unless a user were to say use an update statistics stored procedure to create the statistics for that constraint. And later when that constraint is dropped, we will find that because of DERBY-5681, the statistics row never gets dropped. But update statistics stored procedure was not introduced up until 10.5 and because of that, we can't really test for hanging index created through constraints sharing the same backing index prior to 10.5
java.sql.SQLException
public void testDisposableStatisticsExplicit() throws java.sql.SQLException
A disposable statistics entry is a row in SYS.SYSSTATISTICS that has been orphaned (see DERBY-5681) or it is on longer needed by the Derby optimizer (due to internal changes/improvements).
This test expects different things based on the phase:
java.sql.SQLException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.