public class BasicInMemoryDbTest extends BaseJDBCTestCase
Modifier and Type | Field and Description |
---|---|
private static MemoryDbManager |
dbm
Helper for dealing with memory databases.
|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
BasicInMemoryDbTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getString(int length,
CharAlphabet alphabet)
Generates a string.
|
private void |
loadDriver()
Helper method to make sure the driver is loaded.
|
static junit.framework.Test |
suite() |
void |
tearDown()
Closes all opened statements and connections that are known, and also
deletes all known in-memory databases.
|
void |
testBootSameDbDifferentSubSubProtocol()
Verify that booting two databases with the same name but with different
subsubprotocols doesn't result in two connections to the same database.
|
void |
testCreateBackupBootRestore()
Performs a cycle to test that the in-memory db is compatible with the
deafult directory protocol.
|
void |
testDelete()
Test deletion of an in-memory database:
- create database
- delete database
- try to connection to database, should fail
- recreate and delete again
|
void |
testDeleteWhenInUse()
Deletes the database when in use by a different connection.
|
void |
testEnginehutdown()
Makes sure shutting down the Derby engine with an in-memory database
already booted works.
|
void |
testFunctionalityPresent()
Tries to connect to a non-existing database with the in-memory protocol,
expecting an error saying the database doesn't exist.
|
void |
testShutdown()
Makes sure shutting down an in-memory database works.
|
void |
testShutdownWhenInUse()
Shuts down the database when in use by a different connection.
|
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, 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 MemoryDbManager dbm
public void tearDown() throws java.lang.Exception
tearDown
in class BaseJDBCTestCase
java.lang.Exception
- if something goes wrongprivate void loadDriver() throws java.sql.SQLException
java.sql.SQLException
public void testFunctionalityPresent()
public void testCreateBackupBootRestore() throws java.io.IOException, java.sql.SQLException
java.io.IOException
- if something goes wrongjava.sql.SQLException
- if something goes wrongpublic void testShutdown() throws java.sql.SQLException
java.sql.SQLException
- if something goes wrongpublic void testEnginehutdown() throws java.sql.SQLException
Related to DERBY-4093
java.sql.SQLException
- if something goes wrongpublic void testBootSameDbDifferentSubSubProtocol() throws java.sql.SQLException
java.sql.SQLException
- if something goes wrongpublic void testDelete() throws java.sql.SQLException
java.sql.SQLException
- if something else goes wrongpublic void testDeleteWhenInUse() throws java.io.IOException, java.sql.SQLException
The expected outcome is that the first connection will be closed when the second one deletes the database.
java.io.IOException
- if something goes wrongjava.sql.SQLException
- if something goes wrongpublic void testShutdownWhenInUse() throws java.io.IOException, java.sql.SQLException
The expected outcome is that the first connection will be closed when the second one shuts down the database.
java.io.IOException
- if something goes wrongjava.sql.SQLException
- if something goes wrongpublic static junit.framework.Test suite()
public static java.lang.String getString(int length, CharAlphabet alphabet) throws java.io.IOException
length
- length of the stringalphabet
- the alphabet to use for the contentjava.io.IOException
- if reading from the source stream failsApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.