public class DboPowersTest extends BaseJDBCTestCase
Modifier and Type | Field and Description |
---|---|
private int |
_authLevel |
private java.lang.String |
_dbo |
private java.lang.String |
_dboPassword |
private static int |
AUTHENTICATION |
(package private) static java.lang.String[] |
cryptoTests
Enumerates the cryptographic tests.
|
private static boolean |
DECRYPT |
private static boolean |
ENCRYPT |
private static int |
NOAUTHENTICATION |
(package private) static java.lang.String |
pwSuffix |
private static java.lang.String[] |
secLevelNames |
private static int |
SQLAUTHORIZATION |
(package private) static java.lang.String[][] |
users
Users used by both dboShutdownSuite and dboCryptoSuite
|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
DboPowersTest(java.lang.String name,
int authLevel)
Create a new instance of DboPowersTest (for shutdown test)
|
DboPowersTest(java.lang.String name,
int authLevel,
java.lang.String dbo,
java.lang.String dboPassword)
Creates a new instance of DboPowersTest for cryptographic operations
and hard upgrade tests.
|
Modifier and Type | Method and Description |
---|---|
private void |
bringDbDown()
Shut down database, as db owner (not testing that power here)
|
private void |
bringDbUp(java.lang.String bootPassword)
Boots database back up after cryptographic operation using current user,
should succeed.
|
private static junit.framework.Test |
dboCryptoSuite(java.lang.String framework)
Constructs suite of tests for cryptographic actions, that is database
encryption, re-encryption, and decryption.
|
private static junit.framework.Test |
dboHardUpgradeSuite(java.lang.String framework)
Construct suite of tests for hard upgrade database action
NOTE: there is no real upgrade going on here since the
database is created with the same version, but the checking
is performed nonetheless, which is what we are testing
here.
|
private static junit.framework.Test |
dboShutdownSuite(java.lang.String framework)
Construct suite of tests for shutdown database action
|
private void |
derby3038(java.sql.Connection con)
Make and call a stored procedure which opens a nested
connection to expose DERBY-3038.
|
static void |
derby3038Proc() |
private void |
doEncrypt(java.lang.String bootPassword)
Encrypt database, as owner (not testing encryption power here)
|
static junit.framework.Test |
suite()
Construct top level suite in this JUnit test
|
void |
testDecrypt()
Tests that only the DBO can decrypt a database.
|
void |
testEncrypt()
Test database encryption for an already created
database.
|
void |
testHardUpgrade()
Test database upgrade power enforcement
|
void |
testReEncrypt()
Test database re-encryption for an already encrypted
database.
|
void |
testShutDown()
Test database shutdown power enforcement
|
private void |
vetAttempt(java.lang.String user,
java.sql.SQLException e,
java.lang.String state,
java.lang.String operation)
Decide if the result of trying operation yields expected result.
|
private void |
vetCryptoAttempt(boolean encrypt,
java.lang.String user,
java.sql.SQLException e)
Decides if the result of trying to (re-)encrypt or decrypt the database
is compliant with the semantics introduced by DERBY-2264.
|
private void |
vetHardUpgradeAttempt(java.lang.String user,
java.sql.SQLException e)
Decide if the result of trying to hard upgrade the database is
compliant with the semantics introduced by DERBY-2264.
|
private void |
vetShutdownException(java.lang.String user,
java.sql.SQLException e)
Decide if the result of trying to shut down the database is
compliant with the semantics introduced by DERBY-2264.
|
private static junit.framework.Test |
wrapCryptoUserTests(int autLev)
Wraps the encryption fixtures in decorators to run with data
base owner and one other valid user.
|
private static junit.framework.Test |
wrapHardUpgradeUserTests(int autLev)
Wraps the shutdown fixture in decorators to run with data
base owner and one other valid user.
|
private static junit.framework.Test |
wrapShutdownUserTests(int autLev)
Wraps the shutdown fixture in decorators to run with data
base owner and one other valid user.
|
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 final int _authLevel
private final java.lang.String _dbo
private final java.lang.String _dboPassword
private static final int NOAUTHENTICATION
private static final int AUTHENTICATION
private static final int SQLAUTHORIZATION
private static final java.lang.String[] secLevelNames
private static final boolean ENCRYPT
private static final boolean DECRYPT
static final java.lang.String[][] users
static final java.lang.String pwSuffix
static final java.lang.String[] cryptoTests
public DboPowersTest(java.lang.String name, int authLevel)
name
- Fixture nameauthLevel
- authentication level with which test is runpublic DboPowersTest(java.lang.String name, int authLevel, java.lang.String dbo, java.lang.String dboPassword)
The database owner credentials is needed to always be able to perform the restricted operations (when they are not under test, but used as part of a test fixture for another operation).
name
- Fixture nameauthLevel
- authentication level with which test is rundbo
- Database ownerdboPassword
- Database owner's passwordpublic static junit.framework.Test suite()
private static junit.framework.Test dboShutdownSuite(java.lang.String framework)
framework
- Derby framework nameprivate static junit.framework.Test wrapShutdownUserTests(int autLev)
autLev
- security context to usepublic void testShutDown() throws java.sql.SQLException
java.sql.SQLException
private void vetShutdownException(java.lang.String user, java.sql.SQLException e)
private static junit.framework.Test dboCryptoSuite(java.lang.String framework)
framework
- Derby framework nameprivate static junit.framework.Test wrapCryptoUserTests(int autLev)
autLev
- security context to usepublic void testEncrypt() throws java.sql.SQLException
java.sql.SQLException
public void testReEncrypt() throws java.sql.SQLException
java.sql.SQLException
public void testDecrypt() throws java.sql.SQLException
java.sql.SQLException
private void doEncrypt(java.lang.String bootPassword) throws java.sql.SQLException
bootPassword
- java.sql.SQLException
private void bringDbDown()
private void bringDbUp(java.lang.String bootPassword) throws java.sql.SQLException
bootPassword
- boot using this bootPassword, may be null
java.sql.SQLException
private void vetCryptoAttempt(boolean encrypt, java.lang.String user, java.sql.SQLException e)
encrypt
- whether we are (re-)encrypting or decryptinguser
- The db user under which we tried to encrypte
- Exception caught during attempt, if anyprivate static junit.framework.Test dboHardUpgradeSuite(java.lang.String framework)
framework
- Derby framework nameprivate static junit.framework.Test wrapHardUpgradeUserTests(int autLev)
autLev
- security context to usepublic void testHardUpgrade() throws java.sql.SQLException
java.sql.SQLException
private void vetHardUpgradeAttempt(java.lang.String user, java.sql.SQLException e)
user
- The db user under which we tried to upgradee
- Exception caught during attempt, if anyprivate void vetAttempt(java.lang.String user, java.sql.SQLException e, java.lang.String state, java.lang.String operation)
user
- The db user under which we tried to upgradee
- Exception caught during attempted operation, if anystate
- The expected SQL state if this operation fails due to
insufficient poweroperation
- string describing the operation attemptedprivate void derby3038(java.sql.Connection con) throws java.sql.SQLException
java.sql.SQLException
public static void derby3038Proc() throws java.sql.SQLException
java.sql.SQLException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.