public class LuceneSupportPermsTest extends GeneratedColumnsHelper
Test permissions on objects created by the optional Lucene support tool.
Modifier and Type | Class and Description |
---|---|
static class |
LuceneSupportPermsTest.CD |
static class |
LuceneSupportPermsTest.ConstantIndexDescriptor |
static class |
LuceneSupportPermsTest.ConstantQueryParser |
static class |
LuceneSupportPermsTest.FieldNameIndexDescriptor |
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.String[] |
_fieldNames |
private static java.lang.String |
ALICE |
private static java.lang.String |
AUTH_NO_ACCESS_NOT_OWNER |
private static java.lang.String |
BAD_COLUMN_NAME |
private static java.lang.String |
BAD_DIRECTORY |
private static java.lang.String |
BAD_FIELD_NAME |
private static java.lang.String |
CONSTANT_QUERY_PARSER |
private static java.lang.String |
COUNTRY |
private static java.lang.String |
DB_NAME |
private static java.lang.String |
DBO_ONLY |
private static java.lang.String |
DEFAULT_INDEX_DESCRIPTOR |
private static java.lang.String |
DOUBLE_LOAD_ILLEGAL |
private static java.lang.String |
DOUBLE_UNLOAD_ILLEGAL |
private static java.lang.String |
DROP_POEMS_INDEX |
private static java.lang.String |
DROP_PRIMARY_KEY |
private static java.lang.String |
DUPLICATE_FIELD_NAME |
private static java.lang.String |
FRANK |
private static java.lang.String |
FUNCTION_EXISTS |
private static java.lang.String |
ILLEGAL_NULL_ARG |
private static java.lang.String |
INCOMPATIBLE_ENCRYPTION |
private static java.lang.String |
INDEX_POEMS |
private static java.lang.String |
LANGUAGE |
private static java.lang.String[] |
LEGAL_USERS |
private static java.lang.String |
LOAD_TOOL |
private static java.lang.String |
LUCENE_VERSION |
private static java.lang.String |
LUCENE_VERSION_PROPERTY |
private static long |
MILLIS_IN_DAY |
private static long |
MILLIS_IN_HOUR |
private static java.lang.String |
NO_DDL_PRIV |
private static java.lang.String |
NO_PRIMARY_KEY |
private static java.lang.String |
NONEXISTENT_INDEX |
private static java.lang.String |
NONEXISTENT_TABLE_FUNCTION |
private static java.lang.String |
NOT_INDEXABLE |
private static java.lang.String |
NULL_PRIMITIVE_ARG |
private static java.lang.String |
POLICY_FILE |
private static java.lang.String |
RUTH |
private static java.lang.String |
TEST_DBO |
private static java.lang.String |
UNLOAD_TOOL |
private static java.lang.String |
UPDATE_POEMS_INDEX |
BAD_BEFORE_TRIGGER, BAD_CAST, BAD_FOREIGN_KEY_ACTION, CANT_CONTAIN_NULLS, CANT_MODIFY_IDENTITY, CANT_OVERRIDE_GENERATION_CLAUSE, CANT_REFERENCE_GENERATED_COLUMN, CASCADED_COLUMN_DROP_WARNING, COLUMN_OUT_OF_SCOPE, CONSTRAINT_DROPPED_WARNING, CONSTRAINT_VIOLATION, DUPLICATE_CLAUSE, FORBIDDEN_DROP_TRIGGER, FORBIDDEN_ORDERING_OPERATION, FOREIGN_KEY_VIOLATION, GRANT_REVOKE_NOT_ALLOWED, ILLEGAL_ADD_DEFAULT, ILLEGAL_AGG, ILLEGAL_AGGREGATE, ILLEGAL_COMPARISON, ILLEGAL_DUPLICATE, ILLEGAL_RENAME, ILLEGAL_STORAGE, ILLEGAL_UDT_CLASS, JAVA_EXCEPTION, LACK_COLUMN_PRIV, LACK_EXECUTE_PRIV, LACK_TABLE_PRIV, LACK_USAGE_PRIV, LANG_INVALID_USE_OF_DEFAULT, LEXICAL_ERROR, LOCK_TIMEOUT, MISSING_OBJECT, NEED_EXPLICIT_DATATYPE, NO_GENERIC_PERMISSION, NO_SELECT_OR_UPDATE_PERMISSION, NO_TABLE_PERMISSION, NON_EMPTY_SCHEMA, NONEXISTENT_OBJECT, NOT_IMPLEMENTED, NOT_NULL_NEEDS_DATATYPE, NOT_NULL_VIOLATION, OBJECT_DOES_NOT_EXIST, OPERATION_FORBIDDEN, REDUNDANT_CLAUSE, ROUTINE_CANT_ISSUE_SQL, ROUTINE_DEPENDS_ON_TYPE, STRING_TRUNCATION, SYNTAX_ERROR, TABLE_DEPENDS_ON_TYPE, TOO_MUCH_CONTENTION, TRIGGER_DROPPED_WARNING, UNSTABLE_RESULTS, VIEW_DEPENDENCY
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
LuceneSupportPermsTest(java.lang.String name)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
clobberFile(java.io.File file)
Really delete a file
|
static org.apache.derby.optional.api.LuceneIndexDescriptor |
constantStringIndexDescriptor()
Alternative QueryParser maker, which forces the text to be a constant string
|
private void |
createLocaleFunction(java.sql.Connection conn) |
private void |
createPoemsTable(java.sql.Connection conn,
int jdbcType) |
private void |
createPoemView(java.sql.Connection conn) |
private void |
createSchema(java.sql.Connection ruthConnection,
int jdbcType) |
private boolean |
deleteFile(java.io.File file)
Delete a file.
|
private void |
dropSchema(java.sql.Connection ruthConnection) |
static java.lang.String |
getDatabaseLocale()
Get the database locale
|
private java.lang.String |
getType(int jdbcType) |
private void |
grantPermission(java.sql.Connection conn,
java.lang.String permission,
java.lang.String grantee) |
private boolean |
isDirectory(java.io.File file)
Return true if the file is a directory
|
private java.io.File[] |
listFiles(java.io.File file)
List files
|
(package private) static void |
loadTestTable(java.sql.Connection conn) |
static byte[] |
makeAllBytes(int initialValue)
Make a byte array with all possible byte values in it
|
static byte[] |
makeBytes(int initialValue)
Make a byte array starting with the given byte
|
static org.apache.derby.optional.api.LuceneIndexDescriptor |
makeFieldNameIndexDescriptor() |
private java.lang.String |
makeStringKey(int key) |
private void |
revokePermission(java.sql.Connection conn,
java.lang.String permission,
java.lang.String grantee) |
static void |
setFieldNames(java.lang.String... fieldNames) |
private void |
setNextPoemID(java.sql.PreparedStatement ps,
int jdbcType,
int intPoemID) |
static junit.framework.Test |
suite()
Construct top level suite in this JUnit test
|
void |
test_001_basicNoGrant()
Test baseline permissions where no grants are made.
|
void |
test_002_userGrant()
Test that a user can grant access to her indexes.
|
void |
test_003_loading()
Test that only the DBO can (un)load the tool and the tool
can't be (un)loaded twice.
|
void |
test_004_datatypes()
Test all datatypes as key types.
|
void |
test_005_deleteDirectory()
Test error messages when a lucene directory has been deleted.
|
void |
test_006_changeAnalyzer()
Test that you can change the Analyzer.
|
void |
test_007_indexViews()
Test that you can index views and index tables with alternative column lists.
|
void |
test_008_columnNames()
Test that you can't create an index involving a column with the same name
as one of the system-supplied column names (documentID and score).
|
void |
test_009_searchArgs()
Test changes to the arguments to the searching table function.
|
void |
test_010_encryption()
Test that encryption and the Lucene plugin are incompatible.
|
void |
test_011_fieldNames()
Test restrictions on field names.
|
void |
test_6596_null_args()
Test that nulls are not allowed as the values of certain arguments.
|
void |
test_6602()
Test that nulls are allowed in keys.
|
void |
test_6730()
Test identifier casing for keys and text columns.
|
static java.lang.String |
toString(byte[] value) |
(package private) static void |
unloadTestTable(java.sql.Connection conn) |
private void |
vet_004(java.sql.Connection ruthConnection,
int jdbcType) |
private void |
vet6602(java.sql.Connection conn,
LuceneSupportPermsTest.CD cd) |
private void |
vet6730(java.sql.Connection conn) |
private void |
vetPermission_002(Permission permission,
java.sql.Connection ruthConnection,
java.sql.Connection aliceConnection,
java.lang.String statement,
java.lang.String[][] expectedResults) |
assertColumnTypes, assertDeterministic, expectExecutionWarning, expectExecutionWarnings, expectInsertRowError, expectNoWarning, expectUpdateRowError, fill, verifyRestrictedDrop, verifyRevokePrivilege
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 LUCENE_VERSION_PROPERTY
private static java.lang.String LUCENE_VERSION
private static final java.lang.String DB_NAME
private static final java.lang.String TEST_DBO
private static final java.lang.String RUTH
private static final java.lang.String ALICE
private static final java.lang.String FRANK
private static final java.lang.String[] LEGAL_USERS
private static final java.lang.String AUTH_NO_ACCESS_NOT_OWNER
private static final java.lang.String DBO_ONLY
private static final java.lang.String FUNCTION_EXISTS
private static final java.lang.String NOT_INDEXABLE
private static final java.lang.String NO_PRIMARY_KEY
private static final java.lang.String NONEXISTENT_INDEX
private static final java.lang.String NO_DDL_PRIV
private static final java.lang.String DOUBLE_LOAD_ILLEGAL
private static final java.lang.String DOUBLE_UNLOAD_ILLEGAL
private static final java.lang.String BAD_DIRECTORY
private static final java.lang.String BAD_COLUMN_NAME
private static final java.lang.String NONEXISTENT_TABLE_FUNCTION
private static final java.lang.String INCOMPATIBLE_ENCRYPTION
private static final java.lang.String ILLEGAL_NULL_ARG
private static final java.lang.String BAD_FIELD_NAME
private static final java.lang.String DUPLICATE_FIELD_NAME
private static final java.lang.String NULL_PRIMITIVE_ARG
private static final java.lang.String POLICY_FILE
private static final java.lang.String LOAD_TOOL
private static final java.lang.String UNLOAD_TOOL
private static final java.lang.String INDEX_POEMS
private static final java.lang.String UPDATE_POEMS_INDEX
private static final java.lang.String DROP_POEMS_INDEX
private static final java.lang.String DROP_PRIMARY_KEY
private static final long MILLIS_IN_HOUR
private static final long MILLIS_IN_DAY
private static final java.lang.String LANGUAGE
private static final java.lang.String COUNTRY
private static final java.lang.String DEFAULT_INDEX_DESCRIPTOR
private static final java.lang.String CONSTANT_QUERY_PARSER
static java.lang.String[] _fieldNames
public LuceneSupportPermsTest(java.lang.String name)
public static junit.framework.Test suite()
public void test_001_basicNoGrant() throws java.lang.Exception
Test baseline permissions where no grants are made.
java.lang.Exception
public void test_002_userGrant() throws java.lang.Exception
Test that a user can grant access to her indexes.
java.lang.Exception
private void vetPermission_002(Permission permission, java.sql.Connection ruthConnection, java.sql.Connection aliceConnection, java.lang.String statement, java.lang.String[][] expectedResults) throws java.lang.Exception
java.lang.Exception
private void grantPermission(java.sql.Connection conn, java.lang.String permission, java.lang.String grantee) throws java.lang.Exception
java.lang.Exception
private void revokePermission(java.sql.Connection conn, java.lang.String permission, java.lang.String grantee) throws java.lang.Exception
java.lang.Exception
public void test_003_loading() throws java.lang.Exception
Test that only the DBO can (un)load the tool and the tool can't be (un)loaded twice.
java.lang.Exception
public void test_004_datatypes() throws java.lang.Exception
Test all datatypes as key types.
java.lang.Exception
private void vet_004(java.sql.Connection ruthConnection, int jdbcType) throws java.lang.Exception
java.lang.Exception
public void test_005_deleteDirectory() throws java.lang.Exception
Test error messages when a lucene directory has been deleted.
java.lang.Exception
public void test_006_changeAnalyzer() throws java.lang.Exception
Test that you can change the Analyzer.
java.lang.Exception
public void test_007_indexViews() throws java.lang.Exception
Test that you can index views and index tables with alternative column lists.
java.lang.Exception
public void test_008_columnNames() throws java.lang.Exception
Test that you can't create an index involving a column with the same name as one of the system-supplied column names (documentID and score).
java.lang.Exception
public void test_009_searchArgs() throws java.lang.Exception
Test changes to the arguments to the searching table function.
java.lang.Exception
static void loadTestTable(java.sql.Connection conn) throws java.lang.Exception
java.lang.Exception
static void unloadTestTable(java.sql.Connection conn) throws java.lang.Exception
java.lang.Exception
public void test_010_encryption() throws java.lang.Exception
Test that encryption and the Lucene plugin are incompatible.
java.lang.Exception
public void test_011_fieldNames() throws java.lang.Exception
Test restrictions on field names.
java.lang.Exception
public void test_6602() throws java.lang.Exception
Test that nulls are allowed in keys. See DERBY-6602.
java.lang.Exception
private void vet6602(java.sql.Connection conn, LuceneSupportPermsTest.CD cd) throws java.lang.Exception
java.lang.Exception
public void test_6596_null_args() throws java.lang.Exception
Test that nulls are not allowed as the values of certain arguments. See DERBY-6596.
java.lang.Exception
public void test_6730() throws java.lang.Exception
Test identifier casing for keys and text columns. See DERBY-6730.
java.lang.Exception
private void vet6730(java.sql.Connection conn) throws java.lang.Exception
java.lang.Exception
private void createSchema(java.sql.Connection ruthConnection, int jdbcType) throws java.lang.Exception
java.lang.Exception
private void createPoemsTable(java.sql.Connection conn, int jdbcType) throws java.lang.Exception
java.lang.Exception
private void createPoemView(java.sql.Connection conn) throws java.lang.Exception
java.lang.Exception
private void createLocaleFunction(java.sql.Connection conn) throws java.lang.Exception
java.lang.Exception
private java.lang.String getType(int jdbcType) throws java.lang.Exception
java.lang.Exception
private void setNextPoemID(java.sql.PreparedStatement ps, int jdbcType, int intPoemID) throws java.lang.Exception
java.lang.Exception
private java.lang.String makeStringKey(int key)
private void dropSchema(java.sql.Connection ruthConnection) throws java.lang.Exception
java.lang.Exception
public static java.lang.String getDatabaseLocale() throws java.sql.SQLException
java.sql.SQLException
public static java.lang.String toString(byte[] value)
public static byte[] makeAllBytes(int initialValue)
public static byte[] makeBytes(int initialValue)
public static org.apache.derby.optional.api.LuceneIndexDescriptor constantStringIndexDescriptor()
private boolean deleteFile(java.io.File file) throws java.io.IOException, java.security.PrivilegedActionException
java.io.IOException
java.security.PrivilegedActionException
private boolean isDirectory(java.io.File file) throws java.io.IOException, java.security.PrivilegedActionException
java.io.IOException
java.security.PrivilegedActionException
private boolean clobberFile(java.io.File file) throws java.io.IOException, java.security.PrivilegedActionException
java.io.IOException
java.security.PrivilegedActionException
private java.io.File[] listFiles(java.io.File file) throws java.io.IOException, java.security.PrivilegedActionException
java.io.IOException
java.security.PrivilegedActionException
public static void setFieldNames(java.lang.String... fieldNames)
public static org.apache.derby.optional.api.LuceneIndexDescriptor makeFieldNameIndexDescriptor()
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.