public class SequenceGeneratorTest extends GeneratedColumnsHelper
Test sequence generators. See DERBY-712.
Modifier and Type | Class and Description |
---|---|
static class |
SequenceGeneratorTest.BadAllocator |
static class |
SequenceGeneratorTest.LegalAllocator |
static class |
SequenceGeneratorTest.T_SequenceUpdater
Machine for testing sequence generators standalone.
|
Modifier and Type | Field and Description |
---|---|
private static boolean |
_fullDebug |
private static java.lang.String |
ALICE |
private static long |
ALLOCATION_COUNT |
private static java.lang.String |
DUPLICATE_SEQUENCE |
private static java.lang.String[] |
LEGAL_USERS |
private static java.lang.String |
MISSING_ALLOCATOR |
private static java.lang.String |
RUTH |
private static java.lang.String |
TEST_DBO |
private static int |
TWEAKED_ALLOCATION_COUNT |
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 |
---|
SequenceGeneratorTest(java.lang.String name)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
private void |
assertLongEquals(java.lang.Long left,
java.lang.Long right) |
private void |
assertNextValue(java.sql.Connection conn,
java.lang.String schema,
java.lang.String sequenceName,
int expectedValue) |
private long |
getCurrentValue(java.sql.Connection conn,
java.lang.String schemaName,
java.lang.String sequenceName)
Get the current value from a sequence
|
private long |
getCurrentValue(java.lang.String schemaName,
java.lang.String sequenceName)
Get the current value from a sequence
|
private int |
getScalarInteger(java.sql.PreparedStatement ps)
Get a scalar integer result from a query
|
private long |
getScalarLong(java.sql.PreparedStatement ps)
Get a scalar long result from a query
|
void |
postCrashActions() |
void |
preCrashActions() |
static junit.framework.Test |
suite()
Construct top level suite in this JUnit test
|
void |
test_01_basic()
Test basic incrementing and pre-allocating of sequence values on disk.
|
void |
test_02_boundary()
Test boundary conditions in sequence generators.
|
void |
test_03_nonCycling()
Test non cycling sequence generators.
|
void |
test_04_reboot()
Test that when you reboot the database, you pick up the sequence
number on disk, not the last version in memory.
|
void |
test_05_concurrency()
Test that multiple transactions can access the same sequence generator
and not block.
|
void |
test_06_bigStepSize()
Test big step sizes.
|
void |
test_07_dropSequence()
Test that cache flushing doesn't prevent us from dropping
a sequence generator.
|
void |
test_08_userWrittenAllocators()
Test user-written range allocators.
|
void |
test_09_defaultRangeSize()
Test overriding the default length of sequence/identity ranges.
|
void |
test_10_5398()
Test that sequence values are not leaked during an orderly system shutdown.
|
void |
test_11_5493_correctness()
Test that sequence values don't repeat via transaction trickery.
|
void |
test_12_5493_function()
Verify the syscs_peek_at_sequence function introduced by DERBY-5493.
|
void |
test_13_5494()
Verify that system crash does not rollback changes to SYSSEQUENCES.CURRENTVALUE.
|
void |
test_14_6553()
Verify that we don't get an internal error when creating a sequence-invoking trigger.
|
private void |
vetBigStep(long maxValue,
long minValue) |
private void |
vetBoundaries(long maxValue,
long minValue) |
private void |
vetBoundaries(long maxValue,
long minValue,
long stepSize) |
private void |
vetBoundaries(long maxValue,
long minValue,
long stepSize,
long firstValue,
long restartValue) |
private void |
vetBump(SGVetter vetter,
SequenceGeneratorTest.T_SequenceUpdater updater) |
private void |
vetBumping(java.sql.Connection conn,
java.lang.String schemaName,
java.lang.String sequenceName,
int expectedValue,
long expectedValueOnDisk) |
private void |
vetBumping(long firstValue,
boolean canCycle,
long stepSize,
long maxValue,
long minValue,
long restartValue,
long bumps) |
private void |
vetBumping(SequenceGeneratorTest.T_SequenceUpdater updater,
long expectedValue,
long expectedValueOnDisk) |
private void |
vetLowerBoundary(long maxValue,
long minValue,
long stepSize) |
private void |
vetNonCycling(long maxValue,
long minValue) |
private void |
vetNonCycling(long maxValue,
long minValue,
long stepSize) |
private void |
vetUpperBoundary(long maxValue,
long minValue,
long stepSize) |
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 long ALLOCATION_COUNT
private static final int TWEAKED_ALLOCATION_COUNT
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[] LEGAL_USERS
private static final java.lang.String MISSING_ALLOCATOR
private static final java.lang.String DUPLICATE_SEQUENCE
private static boolean _fullDebug
public SequenceGeneratorTest(java.lang.String name)
public static junit.framework.Test suite()
public void test_01_basic() throws java.lang.Exception
Test basic incrementing and pre-allocating of sequence values on disk.
java.lang.Exception
private void vetBumping(java.sql.Connection conn, java.lang.String schemaName, java.lang.String sequenceName, int expectedValue, long expectedValueOnDisk) throws java.lang.Exception
java.lang.Exception
public void test_02_boundary() throws java.lang.Exception
Test boundary conditions in sequence generators.
java.lang.Exception
private void vetBoundaries(long maxValue, long minValue) throws java.lang.Exception
java.lang.Exception
private void vetBoundaries(long maxValue, long minValue, long stepSize) throws java.lang.Exception
java.lang.Exception
private void vetUpperBoundary(long maxValue, long minValue, long stepSize) throws java.lang.Exception
java.lang.Exception
private void vetLowerBoundary(long maxValue, long minValue, long stepSize) throws java.lang.Exception
java.lang.Exception
private void vetBoundaries(long maxValue, long minValue, long stepSize, long firstValue, long restartValue) throws java.lang.Exception
java.lang.Exception
private void vetBumping(long firstValue, boolean canCycle, long stepSize, long maxValue, long minValue, long restartValue, long bumps) throws java.lang.Exception
java.lang.Exception
private void vetBump(SGVetter vetter, SequenceGeneratorTest.T_SequenceUpdater updater) throws java.lang.Exception
java.lang.Exception
private void assertLongEquals(java.lang.Long left, java.lang.Long right)
private void vetBumping(SequenceGeneratorTest.T_SequenceUpdater updater, long expectedValue, long expectedValueOnDisk) throws java.lang.Exception
java.lang.Exception
public void test_03_nonCycling() throws java.lang.Exception
Test non cycling sequence generators.
java.lang.Exception
private void vetNonCycling(long maxValue, long minValue) throws java.lang.Exception
java.lang.Exception
private void vetNonCycling(long maxValue, long minValue, long stepSize) throws java.lang.Exception
java.lang.Exception
public void test_04_reboot() throws java.lang.Exception
Test that when you reboot the database, you pick up the sequence number on disk, not the last version in memory.
java.lang.Exception
public void test_05_concurrency() throws java.lang.Exception
Test that multiple transactions can access the same sequence generator and not block.
java.lang.Exception
public void test_06_bigStepSize() throws java.lang.Exception
Test big step sizes.
java.lang.Exception
private void vetBigStep(long maxValue, long minValue) throws java.lang.Exception
java.lang.Exception
public void test_07_dropSequence() throws java.lang.Exception
Test that cache flushing doesn't prevent us from dropping a sequence generator.
java.lang.Exception
public void test_08_userWrittenAllocators() throws java.lang.Exception
Test user-written range allocators.
java.lang.Exception
public void test_09_defaultRangeSize() throws java.lang.Exception
Test overriding the default length of sequence/identity ranges.
java.lang.Exception
public void test_10_5398() throws java.lang.Exception
Test that sequence values are not leaked during an orderly system shutdown. See DERBY-5398.
java.lang.Exception
public void test_11_5493_correctness() throws java.lang.Exception
Test that sequence values don't repeat via transaction trickery. See DERBY-5493.
java.lang.Exception
public void test_12_5493_function() throws java.lang.Exception
Verify the syscs_peek_at_sequence function introduced by DERBY-5493.
java.lang.Exception
public void test_13_5494() throws java.lang.Exception
Verify that system crash does not rollback changes to SYSSEQUENCES.CURRENTVALUE. See DERBY-5494.
java.lang.Exception
public void preCrashActions() throws java.lang.Exception
java.lang.Exception
public void postCrashActions() throws java.lang.Exception
java.lang.Exception
private void assertNextValue(java.sql.Connection conn, java.lang.String schema, java.lang.String sequenceName, int expectedValue) throws java.lang.Exception
java.lang.Exception
public void test_14_6553() throws java.lang.Exception
Verify that we don't get an internal error when creating a sequence-invoking trigger. See DERBY-6553.
java.lang.Exception
private long getCurrentValue(java.lang.String schemaName, java.lang.String sequenceName) throws java.lang.Exception
java.lang.Exception
private long getCurrentValue(java.sql.Connection conn, java.lang.String schemaName, java.lang.String sequenceName) throws java.lang.Exception
java.lang.Exception
private int getScalarInteger(java.sql.PreparedStatement ps) throws java.lang.Exception
java.lang.Exception
private long getScalarLong(java.sql.PreparedStatement ps) throws java.lang.Exception
java.lang.Exception
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.