public class LobStreamsTest extends BaseJDBCTestCase
Modifier and Type | Field and Description |
---|---|
(package private) int[] |
streamSize |
private java.lang.String |
unicodeTestString |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
LobStreamsTest(java.lang.String name)
Creates a new instance of LobStreamsTest
|
Modifier and Type | Method and Description |
---|---|
private boolean |
compareClobReader2CharArray(char[] cArray,
java.io.Reader charReader) |
private boolean |
compareLob2File(java.io.InputStream fStream,
java.io.InputStream lStream) |
private int |
readBytesFromStream(byte[] b,
java.io.InputStream is) |
void |
setUp()
Set up the connection to the database.
|
static junit.framework.Test |
suite()
Run with DerbyNetClient only.
|
void |
testBlobWrite1Param()
Tests the BlobOutputStream.write(int b) method
|
void |
testBlobWrite3Param()
Tests the BlobOutputStream.write(byte b[], int off, int len) method
|
void |
testClobAsciiWrite1Param()
Tests the ClobOutputStream.write(int b) method
|
void |
testClobAsciiWrite3Param()
Tests the ClobOutputStream.write(byte b[], int off, int len) method
|
void |
testClobCharacterWrite1Char()
Tests the ClobWriter.write(int c) method
|
void |
testClobCharacterWrite1ParamString()
Tests the ClobWriter.write(String str) method
|
void |
testClobCharacterWrite3ParamChar()
Tests the ClobWriter.write(char cbuf[], int off, int len) method
|
void |
testClobCharacterWrite3ParamString()
Tests the ClobWriter.write(String str, int off, int len) method
|
void |
testGettingBlobTwice()
Originally tested that the usage pattern
rs.getBlob().method()
didn't cause the underlying source stream to be closed too early. |
void |
testGettingClobTwice()
Tests that accessing the same Clob multiple times on a row results in
an exception being thrown.
|
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, getName, run, run, runTest, setName, toString
int[] streamSize
private final java.lang.String unicodeTestString
public LobStreamsTest(java.lang.String name)
public void setUp() throws java.lang.Exception
setUp
in class junit.framework.TestCase
java.lang.Exception
public void testGettingBlobTwice() throws java.lang.Exception
rs.getBlob().method()
didn't cause the underlying source stream to be closed too early. This
behavior was forbidden, the test now checks that an exception is thrown.
Test description: Select from a BLOB column, access the BLOB using the pattern rs.getBlob(1).blobMethod() (note that we do not keep a reference to the Blob-object), provoke/invoke GC and finalization, and finally try to access the same BLOB again (through a different/another call to rs.getBlob(1)).
Note that the BLOB must be of a certain size (i.e. multiple pages), such that it is stored/accessed as a stream in store.
See DERBY-3844 and DERBY-4440.
java.lang.Exception
- if something goes wrongpublic void testGettingClobTwice() throws java.sql.SQLException
java.lang.Exception
- if something goes wrongjava.sql.SQLException
public void testBlobWrite3Param() throws java.lang.Exception
java.lang.Exception
public void testBlobWrite1Param() throws java.lang.Exception
java.lang.Exception
public void testClobAsciiWrite1Param() throws java.lang.Exception
java.lang.Exception
public void testClobAsciiWrite3Param() throws java.lang.Exception
java.lang.Exception
public void testClobCharacterWrite3ParamChar() throws java.lang.Exception
java.lang.Exception
public void testClobCharacterWrite3ParamString() throws java.lang.Exception
java.lang.Exception
public void testClobCharacterWrite1ParamString() throws java.lang.Exception
java.lang.Exception
public void testClobCharacterWrite1Char() throws java.lang.Exception
java.lang.Exception
public static junit.framework.Test suite()
private int readBytesFromStream(byte[] b, java.io.InputStream is) throws java.io.IOException
java.io.IOException
private boolean compareLob2File(java.io.InputStream fStream, java.io.InputStream lStream) throws java.lang.Exception
java.lang.Exception
private boolean compareClobReader2CharArray(char[] cArray, java.io.Reader charReader) throws java.lang.Exception
java.lang.Exception
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.