Package org.h2.test.db
Class TestListener
java.lang.Object
org.h2.test.TestBase
org.h2.test.TestDb
org.h2.test.db.TestListener
- All Implemented Interfaces:
EventListener,DatabaseEventListener
Tests the DatabaseEventListener.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.h2.test.TestDb
org.h2.test.TestDb.ChildNested classes/interfaces inherited from class org.h2.test.TestBase
org.h2.test.TestBase.VoidCallable -
Field Summary
Fields inherited from class org.h2.test.TestBase
BASE_TEST_DIR, config, start, uniqueIdFields inherited from interface org.h2.api.DatabaseEventListener
STATE_BACKUP_FILE, STATE_CREATE_INDEX, STATE_RECONNECTED, STATE_RECOVER, STATE_SCAN_FILE, STATE_STATEMENT_END, STATE_STATEMENT_PROGRESS, STATE_STATEMENT_START -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is called before the database is closed normally.voidexceptionThrown(SQLException e, String sql) This method is called if an exception occurred.voidThis method is called just after creating the object.booleanstatic voidRun just this test.voidopened()This method is called after the database has been opened.voidsetProgress(int state, String name, long current, long max) This method is called for long running events, such as recovering, scanning a file or building an index.voidtest()This method will be called by the test framework.Methods inherited from class org.h2.test.TestDb
buildChild, deleteDb, deleteDb, getConnection, getConnection, getURLMethods inherited from class org.h2.test.TestBase
assertContains, assertEmpty, assertEqualDatabases, assertEqualReaders, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualStreams, assertFalse, assertFalse, assertKnownException, assertKnownException, assertNotContaining, assertNotNull, assertNotNull, assertNull, assertResult, assertResultRowCount, assertResultSetMeta, assertResultSetOrdered, assertResultSetOrdered, assertSame, assertSingleValue, assertSmaller, assertStartsWith, assertThrows, assertThrows, assertThrows, assertThrows, assertThrows, assertThrows, assertThrows, assertThrows, assertTrue, assertTrue, checkErrorCode, crash, createCaller, createFailingStream, eatMemory, execute, execute, fail, fail, freeMemory, getBaseDir, getClassPath, getFilePassword, getJVM, getMemoryUsed, getMemoryUsedBytes, getPassword, getPassword, getPowerOffCount, getSize, getTestDir, getTestName, getUser, init, init, logError, logErrorMessage, println, printTime, printTimeMemory, readString, runTest, setPowerOffCount, testFromMain, throwException, trace, trace, traceMemory
-
Constructor Details
-
TestListener
public TestListener()
-
-
Method Details
-
main
Run just this test.- Parameters:
a- ignored- Throws:
Exception
-
isEnabled
public boolean isEnabled()- Overrides:
isEnabledin classorg.h2.test.TestBase- Returns:
- whether this test is enabled in the current configuration
-
test
Description copied from class:org.h2.test.TestBaseThis method will be called by the test framework.- Specified by:
testin classorg.h2.test.TestBase- Throws:
SQLException
-
exceptionThrown
Description copied from interface:DatabaseEventListenerThis method is called if an exception occurred.- Specified by:
exceptionThrownin interfaceDatabaseEventListener- Parameters:
e- the exceptionsql- the SQL statement
-
setProgress
Description copied from interface:DatabaseEventListenerThis method is called for long running events, such as recovering, scanning a file or building an index.More states might be added in future versions, therefore implementations should silently ignore states that they don't understand.
- Specified by:
setProgressin interfaceDatabaseEventListener- Parameters:
state- the statename- the object namecurrent- the current positionmax- the highest possible value or 0 if unknown
-
closingDatabase
public void closingDatabase()Description copied from interface:DatabaseEventListenerThis method is called before the database is closed normally. It is safe to connect to the database and execute statements at this point, however the connection must be closed before the method returns.- Specified by:
closingDatabasein interfaceDatabaseEventListener
-
init
Description copied from interface:DatabaseEventListenerThis method is called just after creating the object. This is done when opening the database if the listener is specified in the database URL, but may be later if the listener is set at runtime with the SET SQL statement.- Specified by:
initin interfaceDatabaseEventListener- Parameters:
url- - the database URL
-
opened
public void opened()Description copied from interface:DatabaseEventListenerThis method is called after the database has been opened. It is safe to connect to the database and execute statements at this point.- Specified by:
openedin interfaceDatabaseEventListener
-