public class AutoloadTest extends BaseJDBCTestCase
Modifier and Type | Field and Description |
---|---|
private java.lang.Class<?> |
spawnedTestClass |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Modifier | Constructor and Description |
---|---|
private |
AutoloadTest(java.lang.Class<?> wrapper)
Create a test case that runs this test in a separate JVM.
|
|
AutoloadTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
private static junit.framework.Test |
baseAutoLoadSuite(java.lang.String which)
Return the ordered set of tests when autoloading is enabled.
|
private void |
explicitLoad(boolean instanceOnly) |
(package private) static junit.framework.Test |
fullAutoloadSuite()
Generate the full suite of autoload tests.
|
private boolean |
fullEngineAutoBoot() |
private java.lang.String |
getAutoloadedDriverName() |
private java.lang.String |
getClientDriverName() |
java.lang.String |
getName()
Get the name of the test case.
|
private boolean |
getRegisteredDrivers(java.lang.String driver) |
private boolean |
hasDerbyThreadGroup()
Return true if a ThreadGroup exists that has a name
starting with 'derby.'.
|
private boolean |
isEmbeddedDriverRegistered()
Return true if there appears to be a Derby embedded
driver registered with the DriverManager.
|
void |
noloadTestNodriverLoaded()
Simple test when auto-loading is not expected.
|
void |
spawnProcess()
Run
AutoloadTest in a separate JVM. |
static junit.framework.Test |
suite()
Only run a test if the driver will be auto-loaded.
|
void |
testAssertShutdownOK() |
void |
testAutoloadDriverUnregister()
Test DERBY-2905:Shutting down embedded Derby does remove all code,
the AutoloadDriver is deregistered from DriverManager.
|
void |
testAutoNetworkServerBoot()
Test that the auto-load of the network server is as expected.
|
void |
testEmbeddedNotStarted()
Test indirect artifacts through public apis that
the embedded engine has not been started.
|
void |
testEmbeddedStarted()
Check the test(s) we use to determine if the embedded driver
is not up indicate the opposite once the driver has been
fully booted.
|
void |
testExplicitLoad()
Test an explicit load of the driver works as well
even though the drivers were loaded automatically.
|
void |
testExplicitReload()
Test that an explicit reload of the driver works,
typically after a shutdown.
|
void |
testRegisteredDriver() |
void |
testShutdownDeRegister()
Test that after a shutdown that no Derby embedded driver
is left registered in the DriverManager.
|
void |
testSuccessfulConnect()
Test we can connect successfully to a database.
|
void |
testUnsuccessfulConnect()
Test the error code on an unsuccessful connect
to ensure it is not one returned by DriverManager.
|
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, run, run, runTest, setName, setUp, toString
public AutoloadTest(java.lang.String name)
private AutoloadTest(java.lang.Class<?> wrapper)
wrapper
- a test class that decorates AutoloadTest
with the
desired configurationpublic java.lang.String getName()
getName
in class junit.framework.TestCase
public static junit.framework.Test suite()
private static junit.framework.Test baseAutoLoadSuite(java.lang.String which)
which
- embedded or clientstatic junit.framework.Test fullAutoloadSuite()
Generate the full suite of autoload tests. Each test will be started in its own JVM so that we know that the driver hasn't been loaded accidentally by another test.
The test suite runs AutoloadTest
in the following
configurations:
public void spawnProcess() throws java.lang.Exception
AutoloadTest
in a separate JVM.java.lang.Exception
- something went wrongpublic void testAutoloadDriverUnregister() throws java.lang.Exception
java.lang.Exception
private java.lang.String getAutoloadedDriverName()
private java.lang.String getClientDriverName()
public void testRegisteredDriver() throws java.sql.SQLException
java.sql.SQLException
public void testShutdownDeRegister() throws java.sql.SQLException
java.sql.SQLException
- failureprivate boolean isEmbeddedDriverRegistered()
public void testSuccessfulConnect() throws java.sql.SQLException
java.sql.SQLException
- test errorpublic void testUnsuccessfulConnect() throws java.sql.SQLException
java.sql.SQLException
- test errorpublic void testExplicitLoad() throws java.lang.Exception
java.lang.Exception
public void testExplicitReload() throws java.lang.Exception
java.lang.Exception
private void explicitLoad(boolean instanceOnly) throws java.lang.Exception
java.lang.Exception
public void noloadTestNodriverLoaded()
public void testAutoNetworkServerBoot() throws java.lang.Exception
derby.drda.startNetworkServer=false or not set
network server should not auto boot.
derby.drda.startNetworkServer=true
If jdbc.drivers contains the name of the embedded driver
then the server must be booted.
Otherwise even if auto-loading the embedded driver due to JDBC 4
auto-loading the network server must not boot. This is because
the auto-loaded driver for JDBC 4 is a proxy driver that registers
a driver but does not boot the complete embedded engine.
java.lang.Exception
private boolean fullEngineAutoBoot()
true
if a full auto-boot of the engine is expected
due to jdbc.drivers containing the name of the embedded driver.public void testEmbeddedNotStarted()
public void testEmbeddedStarted()
private boolean getRegisteredDrivers(java.lang.String driver)
public void testAssertShutdownOK() throws java.sql.SQLException
java.sql.SQLException
private boolean hasDerbyThreadGroup()
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.