final class PhaseChanger extends BaseTestSetup
Modifier and Type | Field and Description |
---|---|
private java.lang.ClassLoader |
loader |
private int |
phase |
private java.lang.ClassLoader |
previousLoader |
private boolean |
trace |
private java.lang.String |
upgradeAttributes |
private int[] |
version |
Constructor and Description |
---|
PhaseChanger(junit.framework.Test test,
int phase,
java.lang.ClassLoader loader,
int[] version,
boolean useCreateOnUpgrade) |
Modifier and Type | Method and Description |
---|---|
private void |
clearDerby23ThreadLocals(java.lang.Object contextService)
Clear some fields in ContextService to allow the engine to be garbage
collected.
|
private void |
clearDerby4895ThreadLocal()
Clear a static ThreadLocal field in TableDescriptor so that the engine
classes can be garbage collected when they are no longer used.
|
private static void |
clearField(java.lang.Class cls,
java.lang.String name,
java.lang.Object instance)
Clear a field that is possibly private or final.
|
private void |
deregisterDriver()
Make sure the JDBC driver in the class loader associated with this
version is deregistered.
|
private java.lang.Object |
getDerby23ContextService()
Get a handle to the ContextService in the old engine if the version
is affected by DERBY-23.
|
protected void |
setUp()
Set the phase and boot the database, creating it
or upgrading it as required.
|
protected void |
tearDown()
Shutdown the database engine and reset the class loader.
|
run
basicRun, countTestCases, getTest, toString
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, fail, fail, failNotEquals, failNotSame, failSame, format
private final int phase
private final int[] version
private java.lang.ClassLoader loader
private java.lang.ClassLoader previousLoader
private boolean trace
private java.lang.String upgradeAttributes
public PhaseChanger(junit.framework.Test test, int phase, java.lang.ClassLoader loader, int[] version, boolean useCreateOnUpgrade)
protected void setUp() throws java.sql.SQLException
setUp
in class junit.extensions.TestSetup
java.sql.SQLException
protected void tearDown() throws java.lang.Exception
tearDown
in class junit.extensions.TestSetup
java.sql.SQLException
- if the engine couldn't be stoppedjava.lang.Exception
private void deregisterDriver() throws java.lang.Exception
java.lang.Exception
private void clearDerby4895ThreadLocal() throws java.lang.Exception
java.lang.Exception
private static void clearField(java.lang.Class cls, java.lang.String name, java.lang.Object instance) throws java.lang.Exception
cls
- the class in which the field livesname
- the name of the field to clearinstance
- the instance whose field should be cleared,
or null if the field is staticjava.lang.Exception
private java.lang.Object getDerby23ContextService() throws java.lang.Exception
java.lang.Exception
private void clearDerby23ThreadLocals(java.lang.Object contextService) throws java.lang.Exception
contextService
- the context service for an engine that has been
shut down, or null if this version of the engine doesn't suffer from
DERBY-23java.lang.Exception
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.