public final class BLOBTest extends BaseJDBCTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
BLOBTest(java.lang.String name)
Constructor
|
Modifier and Type | Method and Description |
---|---|
private void |
actionTypesCompareMainToAction(int actionCount) |
static java.lang.Object |
getRandomValue(java.util.Random r,
int jdbcType,
int precision) |
private static byte[] |
randomBinary(java.util.Random r,
int len) |
static void |
setRandomValue(java.util.Random r,
java.sql.PreparedStatement ps,
int column,
int jdbcType,
int precision) |
void |
setUp()
The setup creates a Connection to the database.
|
static junit.framework.Test |
suite()
The suite decorates the tests of this class with
a setup which creates and populates the data model.
|
void |
testBlobCastInValuesClause()
Tests that a stream value in a values clause can be cast to a BLOB.
|
void |
testDerby1511()
Regression test case for DERBY-1511.
|
void |
testDerby2992_Repro()
Checks that Derby fails with an exception when a transaction using
READ_UNCOMMITTED obtains a stream from a BLOB (reads one byte) and at
the same time another connection deletes the BLOB.
|
void |
testDerby4477_2349_Repro()
Tests that a lob can be safely occur multiple times in a SQL select in
a trigger context.
|
void |
testDerby4477_3645_3646_Repro()
Tests that a lob can be safely occur multiple times in a SQL select.
|
void |
testUpdateBlobFromForwardOnlyResultSetUsingPositionedUpdates()
Tests updating a Blob from a forward only resultset, using
methods.
|
void |
testUpdateBlobFromForwardOnlyResultSetUsingResultSetMethods()
Tests updating a Blob from a forward only resultset, using
result set update methods.
|
void |
testUpdateBlobFromForwardOnlyResultSetWithProjectUsingPositionedUpdates()
Tests updating a Blob from a forward only resultset, produced by
a select query with projection.
|
void |
testUpdateBlobFromForwardOnlyResultSetWithProjectUsingResultSetMethods()
Tests updating a Blob from a forward only resultset, produced by
a select query with projection.
|
void |
testUpdateBlobFromScrollableResultSetUsingPositionedUpdates()
Tests updating a Blob from a scollable resultset, using
positioned updates.
|
void |
testUpdateBlobFromScrollableResultSetUsingResultSetMethods()
Tests updating a Blob from a scollable resultset, using
result set update methods.
|
void |
testUpdateBlobFromScrollableResultSetWithProjectUsingPositionedUpdates()
Tests updating a Blob from a scollable resultset, produced by
a select query with projection.
|
void |
testUpdateBlobFromScrollableResultSetWithProjectUsingResultSetMethods()
Tests updating a Blob from a scollable resultset produced by a
select query with projection.
|
private void |
testUpdateBlobWithPositionedUpdate(java.sql.ResultSet rs,
int newVal,
int newSize)
Tests updating the Blob using positioned updates
|
private void |
testUpdateBlobWithResultSetMethods(java.sql.ResultSet rs,
int newVal,
int newSize)
Tests updating the Blob using result set update methods.
|
private void |
verifyBlob(int expectedVal,
int expectedSize,
java.sql.Blob blob)
Verifies that the blob is consistent
|
private void |
verifyNewValueInTable(int newVal,
int newSize)
Verifies that the table has row with column val=newVal
and that it its data and size columns are consistent.
|
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
public BLOBTest(java.lang.String name)
name
- name of test case (method).public void testUpdateBlobFromScrollableResultSetUsingResultSetMethods() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
- causes test to fail with errorjava.io.IOException
- causes test to fail with errorpublic void testUpdateBlobFromForwardOnlyResultSetUsingResultSetMethods() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
- causes test to fail with errorjava.io.IOException
- causes test to fail with errorpublic void testUpdateBlobFromScrollableResultSetUsingPositionedUpdates() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
- causes test to fail with errorjava.io.IOException
- causes test to fail with errorpublic void testUpdateBlobFromForwardOnlyResultSetUsingPositionedUpdates() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
- causes test to fail with errorjava.io.IOException
- causes test to fail with errorpublic void testUpdateBlobFromScrollableResultSetWithProjectUsingResultSetMethods() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
- causes test to fail with errorjava.io.IOException
- causes test to fail with errorpublic void testUpdateBlobFromForwardOnlyResultSetWithProjectUsingResultSetMethods() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
- causes test to fail with errorjava.io.IOException
- causes test to fail with errorpublic void testUpdateBlobFromScrollableResultSetWithProjectUsingPositionedUpdates() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
- causes test to fail with errorjava.io.IOException
- causes test to fail with errorpublic void testUpdateBlobFromForwardOnlyResultSetWithProjectUsingPositionedUpdates() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
- causes test to fail with errorjava.io.IOException
- causes test to fail with errorprivate void testUpdateBlobWithResultSetMethods(java.sql.ResultSet rs, int newVal, int newSize) throws java.sql.SQLException, java.io.IOException
rs
- result set, currently positioned on row to be updatednewVal
- new value in val column and blob datanewSize
- new size of Blobjava.sql.SQLException
- causes test to fail with errorjava.io.IOException
- causes test to fail with errorprivate void testUpdateBlobWithPositionedUpdate(java.sql.ResultSet rs, int newVal, int newSize) throws java.sql.SQLException, java.io.IOException
rs
- result set, currently positioned on row to be updatednewVal
- new value in val column and blob datanewSize
- new size of Blobjava.sql.SQLException
- causes test to fail with errorjava.io.IOException
- causes test to fail with errorpublic void testBlobCastInValuesClause() throws java.io.IOException, java.sql.SQLException
See DERBY-4102 (test case resulted in a ClassCastException earlier).
java.io.IOException
- if something goes wrongjava.sql.SQLException
- if something goes wrongpublic void testDerby4477_3645_3646_Repro() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
BlobMemTest.testDerby4477_3645_3646_Repro_lowmem()
,
ClobMemTest.testDerby4477_3645_3646_Repro_lowmem_clob()
public void testDerby4477_2349_Repro() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public void testDerby2992_Repro() throws java.io.IOException, java.sql.SQLException
Earlier only parts of the BLOB was returned, without errors. It was impossible to tell for the user that only parts of the value was retrieved.
See DERBY-2992.
java.io.IOException
java.sql.SQLException
public static void setRandomValue(java.util.Random r, java.sql.PreparedStatement ps, int column, int jdbcType, int precision) throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public static java.lang.Object getRandomValue(java.util.Random r, int jdbcType, int precision) throws java.io.IOException
java.io.IOException
private static byte[] randomBinary(java.util.Random r, int len)
private void actionTypesCompareMainToAction(int actionCount) throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public void testDerby1511() throws java.lang.Exception
java.lang.Exception
private void verifyNewValueInTable(int newVal, int newSize) throws java.io.IOException, java.sql.SQLException
newVal
- value expected to be found in the val column of a rownewSize
- expected size of size column and size of blobjava.sql.SQLException
- causes test to fail with errorjava.io.IOException
- causes test to fail with errorprivate void verifyBlob(int expectedVal, int expectedSize, java.sql.Blob blob) throws java.io.IOException, java.sql.SQLException
expectedVal
- the InputStream for the Blob should return this value
for every byteexpectedSize
- the BLOB should have this sizeblob
- the BLOB to checkjava.sql.SQLException
- causes test to fail with errorjava.io.IOException
- causes test to fail with errorpublic static junit.framework.Test suite()
public final void setUp() throws java.lang.Exception
setUp
in class junit.framework.TestCase
java.lang.Exception
- any exception will cause test to fail with error.Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.