|
|||||||||
| 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.DboPowersTest
public class DboPowersTest
This JUnit tests enforcement of dbo (=database owner) powers, cf. DERBY-2264. The tests are run in the cross product (cardinality 10) of contexts: {client/server, embedded} x {no authentication, authentication and authentication/sqlAuthorization} x {data base owner, other user } One could consider removing the client/server suites to speed up this test as it does not add much value given the nature of the changes.
| Field Summary | |
|---|---|
private int |
_authLevel
|
private java.lang.String |
_dbo
|
private java.lang.String |
_dboPassword
|
private static int |
AUTHENTICATION
|
(package private) static java.lang.String[] |
encryptionTests
Enumerates the encryption tests |
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 dboEncryptionSuite |
| Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase |
|---|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE |
| Constructor Summary | |
|---|---|
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)
Create a new instance of DboPowersTest (for encryption and hard upgrade tests). |
|
| Method Summary | |
|---|---|
private void |
bringDbDown()
Shut down database, as db owner (not testing that power here) |
private void |
bringDbUp(java.lang.String bootPassword)
Boot database back up after encryption using current user, should succeed |
private static junit.framework.Test |
dboEncryptionSuite(java.lang.String framework)
Construct suite of tests for database encryption action |
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 |
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 |
vetEncryptionAttempt(java.lang.String user,
java.sql.SQLException e)
Decide if the result of trying to (re)encrypt 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 |
wrapEncryptionUserTests(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. |
| 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, setUp, 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 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
static final java.lang.String[][] users
static final java.lang.String pwSuffix
static final java.lang.String[] encryptionTests
| Constructor Detail |
|---|
public DboPowersTest(java.lang.String name,
int authLevel)
name - Fixture nameauthLevel - authentication level with which test is run
public DboPowersTest(java.lang.String name,
int authLevel,
java.lang.String dbo,
java.lang.String dboPassword)
name - Fixture nameauthLevel - authentication level with which test is rundbo - Database ownerdboPassword - Database owner's password| Method Detail |
|---|
public static junit.framework.Test suite()
private static junit.framework.Test dboShutdownSuite(java.lang.String framework)
framework - Derby framework name
private static junit.framework.Test wrapShutdownUserTests(int autLev)
autLev - security context to use
public 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 dboEncryptionSuite(java.lang.String framework)
framework - Derby framework name
private static junit.framework.Test wrapEncryptionUserTests(int autLev)
autLev - security context to use
public void testEncrypt()
throws java.sql.SQLException
java.sql.SQLException
public void testReEncrypt()
throws java.sql.SQLException
java.sql.SQLException
private void doEncrypt(java.lang.String bootPassword)
throws java.sql.SQLException
bootPassword -
java.sql.SQLExceptionprivate void bringDbDown()
private void bringDbUp(java.lang.String bootPassword)
throws java.sql.SQLException
bootPassword - Boot using this bootPassword
java.sql.SQLException
private void vetEncryptionAttempt(java.lang.String user,
java.sql.SQLException e)
user - 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 name
private static junit.framework.Test wrapHardUpgradeUserTests(int autLev)
autLev - security context to use
public 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 any
private 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 attempted
private void derby3038(java.sql.Connection con)
throws java.sql.SQLException
java.sql.SQLException
public static void derby3038Proc()
throws java.sql.SQLException
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 | ||||||||