public class RoutinesDefinersRightsTest extends BaseJDBCTestCase
Modifier and Type | Field and Description |
---|---|
private static int |
BOSS |
private static int[] |
categories |
private static int |
FOOTSOLDIER |
private static int |
MIDDLEMANAGER |
private static java.lang.String |
MULTIPLE_ELEMENTS |
private static java.lang.String |
NOCOLUMNPERMISSION |
private static java.lang.String |
NOEXECUTEPERMISSION |
private static java.lang.String |
pwSuffix |
private static java.lang.String[] |
users |
private static double[] |
wages |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
RoutinesDefinersRightsTest(java.lang.String name)
Create a new instance of RoutinesDefinersRightsTest.
|
Modifier and Type | Method and Description |
---|---|
static double |
lookupDilbertWage() |
static double |
lookupWageFootSoldier(int employee) |
private static junit.framework.Test |
makeSuite()
Construct suite of tests
|
static java.sql.ResultSet |
selectFootSoldiers() |
static void |
spTestBuiltins() |
static junit.framework.Test |
suite()
Construct top level suite in this JUnit test
|
void |
testBuiltins() |
void |
testDefinersRights() |
void |
testInvokersRights() |
static void |
updateWage()
Test that PHB can actually update using
ResultSet.insertRow ,
ResultSet.updateRow and ResultSet.deleteRow . |
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 pwSuffix
private static final java.lang.String NOEXECUTEPERMISSION
private static final java.lang.String NOCOLUMNPERMISSION
private static final java.lang.String MULTIPLE_ELEMENTS
private static final int BOSS
private static final int MIDDLEMANAGER
private static final int FOOTSOLDIER
private static final java.lang.String[] users
private static final double[] wages
private static final int[] categories
public RoutinesDefinersRightsTest(java.lang.String name)
name
- Fixture namepublic static junit.framework.Test suite()
private static junit.framework.Test makeSuite()
public void testDefinersRights() throws java.sql.SQLException
java.sql.SQLException
public void testBuiltins() throws java.sql.SQLException
java.sql.SQLException
public void testInvokersRights() throws java.sql.SQLException
java.sql.SQLException
public static double lookupWageFootSoldier(int employee) throws java.sql.SQLException
java.sql.SQLException
public static void updateWage() throws java.sql.SQLException
ResultSet.insertRow
,
ResultSet.updateRow
and ResultSet.deleteRow
.
Aside: This test is somewhat artificial here, since the middle manager
would not be allowed to do this, presumably; just added here to test
this functionality (which was initially broken by the first patch for
DERBY-4551).
The problem was that the nested statement contexts used for SQL
substatements generated for these ResultSet operations were not
correctly set up, so the effective user id would not be the DEFINER
(DBO), and authorization would fail. Cf DERBY-4551 and DERBY-3327
for more detail.java.sql.SQLException
public static java.sql.ResultSet selectFootSoldiers() throws java.sql.SQLException
java.sql.SQLException
public static double lookupDilbertWage() throws java.sql.SQLException
java.sql.SQLException
public static void spTestBuiltins() throws java.sql.SQLException
java.sql.SQLException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.