public class MissingPermissionsTest extends BaseJDBCTestCase
| Modifier and Type | Class and Description |
|---|---|
private class |
MissingPermissionsTest.SystemThreadRun |
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
AUTH_MSG |
private static boolean |
inSubProcess
Used for running #testModifyThreadGroup
|
private int |
KIND_EXPECT_ERROR_MSG_ABSENT |
private int |
KIND_EXPECT_ERROR_MSG_PRESENT |
private static java.lang.String |
OK_POLICY |
private static java.lang.String |
OK_POLICY_R |
private static java.lang.String |
OK_POLICY_T |
private static java.lang.String |
POLICY_MINUS_FILEPERMISSION |
private static java.lang.String |
POLICY_MINUS_FILEPERMISSION_R |
private static java.lang.String |
POLICY_MINUS_FILEPERMISSION_T |
private static java.lang.String |
POLICY_MINUS_PROPERTYPERMISSION |
private static java.lang.String |
POLICY_MINUS_PROPERTYPERMISSION_T |
private static java.lang.String |
resourcePrefix |
private static java.lang.String |
SYSTEM_HOME |
private static java.lang.String |
testPrefix |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE| Constructor and Description |
|---|
MissingPermissionsTest(java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
private static java.io.BufferedReader |
getReader(java.lang.String file) |
private java.lang.String |
makeMessage(java.lang.String property)
Make a regex that matches a warning for missing property permission.
|
private static junit.framework.Test |
makeTest(java.lang.String fixture,
java.lang.String policy) |
static junit.framework.Test |
suite() |
void |
testMissingFilePermission()
This test is run with a policy that lacks permission for derby.jar to
create a db directory for derby.
|
void |
testMissingPropertiesPermission()
This test is run with a policy that lacks permission to read properties
for derby.jar.
|
void |
testModifyThreadGroup() |
void |
testPresentPropertiesPermission()
This test is run with a policy that does not lack permission to read
properties for derby.jar.
|
private void |
verifyMessagesInDerbyLog(int kind) |
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, usingEmbeddedalarm, 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, isJava8, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit, vmAtLeastassertEquals, 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, toStringprivate static final java.lang.String AUTH_MSG
private static final java.lang.String SYSTEM_HOME
private static final java.lang.String resourcePrefix
private static final java.lang.String testPrefix
private static final java.lang.String OK_POLICY
private static final java.lang.String OK_POLICY_T
private static final java.lang.String OK_POLICY_R
private static final java.lang.String POLICY_MINUS_PROPERTYPERMISSION
private static final java.lang.String POLICY_MINUS_PROPERTYPERMISSION_T
private static final java.lang.String POLICY_MINUS_FILEPERMISSION
private static final java.lang.String POLICY_MINUS_FILEPERMISSION_T
private static final java.lang.String POLICY_MINUS_FILEPERMISSION_R
private final int KIND_EXPECT_ERROR_MSG_PRESENT
private final int KIND_EXPECT_ERROR_MSG_ABSENT
private static boolean inSubProcess
private static junit.framework.Test makeTest(java.lang.String fixture,
java.lang.String policy)
public static junit.framework.Test suite()
public void testPresentPropertiesPermission()
throws java.sql.SQLException,
java.io.IOException,
java.security.PrivilegedActionException
java.sql.SQLExceptionjava.io.IOExceptionjava.security.PrivilegedActionExceptionpublic void testMissingPropertiesPermission()
throws java.sql.SQLException,
java.io.IOException,
java.security.PrivilegedActionException
java.sql.SQLExceptionjava.io.IOExceptionjava.security.PrivilegedActionExceptionpublic void testMissingFilePermission()
throws java.sql.SQLException,
java.io.IOException,
java.security.PrivilegedActionException,
java.lang.ClassNotFoundException,
java.lang.InterruptedException
FileMonitor#PBinitialize
when it gets a SecurityException following attempt to do "home.mkdir(s)".
Note that the policy used with this text fixture also doubles as the
one used by the subprocess to demonstrate the lack of permission.java.sql.SQLExceptionjava.io.IOExceptionjava.security.PrivilegedActionExceptionjava.lang.ClassNotFoundExceptionjava.lang.InterruptedExceptionprivate java.lang.String makeMessage(java.lang.String property)
property - the property for which read permission is missingprivate void verifyMessagesInDerbyLog(int kind)
throws java.io.FileNotFoundException,
java.io.IOException,
java.security.PrivilegedActionException
java.io.FileNotFoundExceptionjava.io.IOExceptionjava.security.PrivilegedActionExceptionprivate static java.io.BufferedReader getReader(java.lang.String file)
throws java.security.PrivilegedActionException
java.security.PrivilegedActionExceptionpublic void testModifyThreadGroup()
throws java.lang.Throwable
java.lang.ThrowableApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.