public abstract class InternalClobTest extends BaseJDBCTestCase
InternalClob
interface.
The tests are split into two categories; read-only and modifying tests. The latter should only be run if @{link InternalClob#isWritable} is true.
Implementation notes: To implement a test by subclassing, a few things must be done. First of all, many of the tests require that the number of bytes per character is fixed. The following variables must be initialized by the subclass:
Modifier and Type | Class and Description |
---|---|
(package private) static class |
InternalClobTest.FakeStoreStream
A fake store stream passed in to StoreStreamClob.
|
Modifier and Type | Field and Description |
---|---|
(package private) static int |
BUFFER_SIZE
Buffer used for reading/skipping from streams.
|
protected long |
bytesPerChar |
protected long |
headerLength |
protected org.apache.derby.impl.jdbc.InternalClob |
iClob
The InternalClob used by the tests, the concrete implementation is
chosen by the subclasses.
|
protected long |
initialByteLength |
protected long |
initialCharLength |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
InternalClobTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
protected static junit.framework.Test |
addModifyingTests(java.lang.Class<? extends junit.framework.TestCase> theClass) |
void |
modTestInsertString_append_small() |
void |
modTestInsertString_replace_and_append_small()
Replaces the last part of the Clob and then adds a little more, all in
one operation.
|
void |
modTestInsertString_replace_small()
Replaces a piece of the Clob.
|
static long |
readFromStream(java.io.Reader in,
long characterCount)
Attemps to read the specified number of characters from the stream.
|
protected static java.lang.String |
subString(org.apache.derby.impl.jdbc.InternalClob clob,
long pos,
int count)
Extracts a substring from the Clob.
|
void |
tearDown()
Tear down this fixture, sub-classes should call
super.tearDown().
|
void |
testGetCharLength() |
void |
testGetCharLengthAfterRelease() |
void |
testGetRawByteStreamAfterRelease() |
void |
testGetReaderAfterEndPos() |
void |
testGetReaderAfterRelease() |
void |
testGetReaderAtEndPos() |
void |
testGetReaderAtSecondPos() |
void |
testGetReaderAtStartPos() |
void |
testGetWriterAfterRelease() |
void |
testInsertStringAfterRelease() |
void |
testReleaseAfterRelase() |
void |
testSanity()
This test just ensures the initial variables are set in a sane way.
|
void |
testTruncateAfterRelease() |
static long |
transferData(java.io.Reader src,
java.io.Writer dest,
long charsToCopy)
Transfers data from the source to the destination.
|
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
static final int BUFFER_SIZE
protected org.apache.derby.impl.jdbc.InternalClob iClob
protected long initialByteLength
protected long initialCharLength
protected long bytesPerChar
protected long headerLength
public void tearDown() throws java.lang.Exception
BaseJDBCTestCase
tearDown
in class BaseJDBCTestCase
java.lang.Exception
protected static junit.framework.Test addModifyingTests(java.lang.Class<? extends junit.framework.TestCase> theClass) throws java.lang.Exception
java.lang.Exception
public void testSanity()
public void testGetCharLengthAfterRelease() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testGetRawByteStreamAfterRelease() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testGetReaderAfterRelease() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testReleaseAfterRelase() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testGetWriterAfterRelease() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testInsertStringAfterRelease() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testTruncateAfterRelease() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testGetCharLength() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testGetReaderAtStartPos() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testGetReaderAtSecondPos() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testGetReaderAtEndPos() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testGetReaderAfterEndPos() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void modTestInsertString_append_small() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void modTestInsertString_replace_small() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void modTestInsertString_replace_and_append_small() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
protected static java.lang.String subString(org.apache.derby.impl.jdbc.InternalClob clob, long pos, int count) throws java.io.IOException, java.sql.SQLException
clob
- the clob to extract frompos
- the starting position in the Clobcount
- the number of characters to extract. Note that the actual
number of characters extracted might be smaller if there are not
enough characters in the Clob.count
characters long.java.io.IOException
java.sql.SQLException
public static long transferData(java.io.Reader src, java.io.Writer dest, long charsToCopy) throws java.io.IOException
java.io.IOException
public static final long readFromStream(java.io.Reader in, long characterCount) throws java.io.IOException
java.io.IOException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.