Package org.h2.test.unit
Class TestFile
- java.lang.Object
-
- org.h2.test.TestBase
-
- org.h2.test.unit.TestFile
-
- All Implemented Interfaces:
DataHandler
public class TestFile extends org.h2.test.TestBase implements DataHandler
Tests the in-memory file store.
-
-
Constructor Summary
Constructors Constructor Description TestFile()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckPowerOff()Check if the simulated power failure occurred.voidcheckWritingAllowed()Check if writing is allowed.CompareModegetCompareMode()Return compare mode.java.lang.StringgetDatabasePath()Get the database path.SmallLRUCache<java.lang.String,java.lang.String[]>getLobFileListCache()Get the lob file list cache if it is used.LobStorageInterfacegetLobStorage()Get the lob storage mechanism to use.java.lang.ObjectgetLobSyncObject()Get the synchronization object for lob operations.intgetMaxLengthInplaceLob()Get the maximum length of in-place large objectTempFileDeletergetTempFileDeleter()Get the temp file deleter mechanism.static voidmain(java.lang.String... a)Run just this test.FileStoreopenFile(java.lang.String name, java.lang.String mode, boolean mustExist)Open a file at the given location.intreadLob(long lobId, byte[] hmac, long offset, byte[] buff, int off, int length)Read from a lob.voidtest()This method will be called by the test framework.-
Methods 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, isEnabled, logError, logErrorMessage, println, printTime, printTimeMemory, readString, runTest, setPowerOffCount, testFromMain, throwException, trace, trace, traceMemory
-
-
-
-
Method Detail
-
main
public static void main(java.lang.String... a) throws java.lang.ExceptionRun just this test.- Parameters:
a- ignored- Throws:
java.lang.Exception
-
test
public void test() throws java.lang.ExceptionDescription copied from class:org.h2.test.TestBaseThis method will be called by the test framework.- Specified by:
testin classorg.h2.test.TestBase- Throws:
java.lang.Exception- if an exception in the test occurs
-
checkPowerOff
public void checkPowerOff()
Description copied from interface:DataHandlerCheck if the simulated power failure occurred. This call will decrement the countdown.- Specified by:
checkPowerOffin interfaceDataHandler
-
checkWritingAllowed
public void checkWritingAllowed()
Description copied from interface:DataHandlerCheck if writing is allowed.- Specified by:
checkWritingAllowedin interfaceDataHandler
-
getDatabasePath
public java.lang.String getDatabasePath()
Description copied from interface:DataHandlerGet the database path.- Specified by:
getDatabasePathin interfaceDataHandler- Returns:
- the database path
-
getLobSyncObject
public java.lang.Object getLobSyncObject()
Description copied from interface:DataHandlerGet the synchronization object for lob operations.- Specified by:
getLobSyncObjectin interfaceDataHandler- Returns:
- the synchronization object
-
getMaxLengthInplaceLob
public int getMaxLengthInplaceLob()
Description copied from interface:DataHandlerGet the maximum length of in-place large object- Specified by:
getMaxLengthInplaceLobin interfaceDataHandler- Returns:
- the maximum size
-
openFile
public FileStore openFile(java.lang.String name, java.lang.String mode, boolean mustExist)
Description copied from interface:DataHandlerOpen a file at the given location.- Specified by:
openFilein interfaceDataHandler- Parameters:
name- the file namemode- the modemustExist- whether the file must already exist- Returns:
- the file
-
getLobFileListCache
public SmallLRUCache<java.lang.String,java.lang.String[]> getLobFileListCache()
Description copied from interface:DataHandlerGet the lob file list cache if it is used.- Specified by:
getLobFileListCachein interfaceDataHandler- Returns:
- the cache or null
-
getTempFileDeleter
public TempFileDeleter getTempFileDeleter()
Description copied from interface:DataHandlerGet the temp file deleter mechanism.- Specified by:
getTempFileDeleterin interfaceDataHandler- Returns:
- the temp file deleter
-
getLobStorage
public LobStorageInterface getLobStorage()
Description copied from interface:DataHandlerGet the lob storage mechanism to use.- Specified by:
getLobStoragein interfaceDataHandler- Returns:
- the lob storage mechanism
-
readLob
public int readLob(long lobId, byte[] hmac, long offset, byte[] buff, int off, int length)Description copied from interface:DataHandlerRead from a lob.- Specified by:
readLobin interfaceDataHandler- Parameters:
lobId- the lob idhmac- the message authentication codeoffset- the offset within the lobbuff- the target bufferoff- the offset within the target bufferlength- the number of bytes to read- Returns:
- the number of bytes read
-
getCompareMode
public CompareMode getCompareMode()
Description copied from interface:DataHandlerReturn compare mode.- Specified by:
getCompareModein interfaceDataHandler- Returns:
- Compare mode.
-
-