public class LobLimitsTest extends BaseJDBCTestCase
Modifier and Type | Field and Description |
---|---|
(package private) static int |
_100MB |
(package private) static int |
_2GB |
(package private) static long |
_4GB |
(package private) static int |
BIG_LOB_SZ |
(package private) static int |
BIGGEST_LOB_SZ |
(package private) static java.lang.String |
CHARDATAFILE |
(package private) static java.lang.String |
DATAFILE |
(package private) static int |
MORE_DATA_THAN_COL_WIDTH |
(package private) static int |
NUM_TRAILING_SPACES |
(package private) static boolean |
trace |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
LobLimitsTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
(package private) static junit.framework.Test |
baseSuite(int biggestSize,
int bigSize)
Create an instance of the
LobLimitsTest suite. |
private static void |
compareBlobToFile(java.io.InputStream lobstream,
java.lang.String filename) |
private static void |
compareClobToFile(java.io.Reader lobstream,
java.lang.String filename,
int length) |
private void |
deleteAndTruncateTable(java.lang.String table,
int expectedRows) |
private void |
insertBlob_SetBinaryStream(java.lang.String testId,
java.sql.PreparedStatement ps,
int bloblen,
int start,
int rows,
int streamLength)
insert blob
|
private void |
insertBlob_SetBlob(java.lang.String testId,
java.sql.PreparedStatement ps,
java.sql.Blob blob,
long bloblen,
int start,
int rows,
int expectedRows)
insert blob, using a setBlob api.
|
private void |
insertBlob2(java.lang.String testId,
java.sql.PreparedStatement ps,
int bloblen,
int start,
int rows,
int streamLength,
java.lang.String file)
insert blob into BLOBTBL2
|
private void |
insertClob_SetCharacterStream(java.lang.String testId,
java.sql.PreparedStatement ps,
int cloblen,
int start,
int rows,
int streamLength)
insert clob
|
private void |
insertClob_SetClob(java.lang.String testId,
java.sql.PreparedStatement ps,
java.sql.Clob clob,
long cloblen,
int start,
int rows,
int expectedRows)
insert clob, using a setClob api.
|
private void |
insertClob2(java.lang.String testId,
java.sql.PreparedStatement ps,
int cloblen,
int start,
int rows,
int streamLength,
java.lang.String file)
insert clob into CLOBTBL2
|
private void |
negativeSpaceTruncationTest(java.lang.String msg) |
private void |
selectBlob(java.lang.String testId,
java.sql.PreparedStatement ps,
int bloblen,
int id,
int expectedRows)
select from blob table (BLOBTBL)
|
private void |
selectBlob2(java.lang.String testId,
java.sql.PreparedStatement ps,
int bloblen,
int id,
int expectedRows,
java.lang.String file)
select from blob table (BLOBTBL2)
|
private void |
selectClob(java.lang.String testId,
java.sql.PreparedStatement ps,
int cloblen,
int id,
int expectedRows)
select from clob table
|
private void |
selectClob2(java.lang.String testId,
java.sql.PreparedStatement ps,
int cloblen,
int id,
int expectedRows,
java.lang.String file)
select from clob table (CLOBTBL2)
|
private void |
selectInsertBlob(java.lang.String testId,
java.sql.PreparedStatement ps,
java.sql.PreparedStatement ins,
int bloblen,
int id,
int insertId)
Basically this test will do an insert using setBlob api - select row from
blobtbl and then insert a row in blobtbl and verify updated data in
blobtbl
|
private void |
selectUpdateBlob(java.lang.String testId,
java.sql.PreparedStatement ps,
int bloblen,
int id,
int updateId)
Basically this test will do an update using setBlob api - select row from
blobtbl and then update a row in blobtbl and verify updated data in
blobtbl
|
private void |
selectUpdateBlob2(java.lang.String testId,
java.sql.PreparedStatement ps,
java.sql.PreparedStatement sel,
int bloblen,
int id,
int updateId,
java.lang.String file)
Basically this test will do an update using setBinaryStream api and
verifies the updated data. select row from blobtbl2 and then update a row
in blobtbl and verify updated data in blobtbl
|
private void |
selectUpdateClob(java.lang.String testId,
java.sql.PreparedStatement ps,
int cloblen,
int id,
int updateId) |
private void |
selectUpdateClob2(java.lang.String testId,
java.sql.PreparedStatement ps,
java.sql.PreparedStatement sel,
int cloblen,
int id,
int updateId,
java.lang.String file) |
static void |
setBIG_LOB_SZ(int bIGLOBSZ) |
static void |
setBIGGEST_LOB_SZ(int bIGGESTLOBSZ) |
static void |
setMORE_DATA_THAN_COL_WIDTH(int mOREDATATHANCOLWIDTH) |
(package private) static void |
setupTables(java.sql.Statement s,
int biggestlobsz,
int biglobsz)
Setup the schema and the blob sizes for the test.
|
static junit.framework.Test |
suite() |
void |
test_01_Blob()
tests specific for blobs
|
void |
test_02_BlobNegative() |
void |
test_03_Clob1()
tests using clobs
|
void |
test_04_Clob2() |
void |
test_05_ClobNegative() |
void |
test_06_shutdownDB() |
private void |
updateClob2(java.lang.String testId,
java.sql.PreparedStatement sel,
int cloblen,
int id,
int updateRowId,
int updateIdVal,
java.lang.String file) |
private static void |
verifyTest(int affectedRows,
int expectedRows,
java.lang.String test) |
private static void |
writeToFile(java.lang.String file,
java.io.Reader r) |
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, setUp, toString
static boolean trace
static final int _2GB
static final int _100MB
static final long _4GB
static final int NUM_TRAILING_SPACES
static int BIGGEST_LOB_SZ
static int BIG_LOB_SZ
static int MORE_DATA_THAN_COL_WIDTH
static final java.lang.String DATAFILE
static final java.lang.String CHARDATAFILE
public static void setBIGGEST_LOB_SZ(int bIGGESTLOBSZ)
public static void setBIG_LOB_SZ(int bIGLOBSZ)
public static void setMORE_DATA_THAN_COL_WIDTH(int mOREDATATHANCOLWIDTH)
static void setupTables(java.sql.Statement s, int biggestlobsz, int biglobsz) throws java.sql.SQLException
s
- biggestlobsz
- biglobsz
- java.sql.SQLException
public static junit.framework.Test suite()
static junit.framework.Test baseSuite(int biggestSize, int bigSize)
LobLimitsTest
suite.biggestSize
- the size of the biggest LOB to testbigSize
- the size of a typical big LOB to testpublic void test_01_Blob() throws java.lang.Exception
java.lang.Exception
public void test_02_BlobNegative() throws java.sql.SQLException
java.sql.SQLException
public void test_03_Clob1() throws java.lang.Exception
java.lang.Exception
public void test_04_Clob2() throws java.lang.Exception
java.lang.Exception
public void test_05_ClobNegative() throws java.lang.Exception
java.lang.Exception
public void test_06_shutdownDB() throws java.lang.Exception
java.lang.Exception
private void negativeSpaceTruncationTest(java.lang.String msg) throws java.lang.Exception
java.lang.Exception
private void insertBlob_SetBinaryStream(java.lang.String testId, java.sql.PreparedStatement ps, int bloblen, int start, int rows, int streamLength) throws java.sql.SQLException
bloblen
- length of blob to insertstart
- start id value for insertrows
- insert rows number of rowsstreamLength
- stream length passed to setBinaryStream(,,length)java.sql.SQLException
private void insertBlob_SetBlob(java.lang.String testId, java.sql.PreparedStatement ps, java.sql.Blob blob, long bloblen, int start, int rows, int expectedRows) throws java.sql.SQLException
bloblen
- length of blob to insertblob
- blob to insertstart
- start id value for insertrows
- insert rows number of rowsexpectedRows
- rows expected to be insertedjava.sql.SQLException
private void selectBlob(java.lang.String testId, java.sql.PreparedStatement ps, int bloblen, int id, int expectedRows) throws java.sql.SQLException
bloblen
- select expects to retrieve a blob of this lengthid
- id of the row to retrieveexpectedRows
- number of rows expected to match idjava.sql.SQLException
private void insertBlob2(java.lang.String testId, java.sql.PreparedStatement ps, int bloblen, int start, int rows, int streamLength, java.lang.String file) throws java.lang.Exception
bloblen
- length of blob to insertstart
- id value for insertrows
- insert rows number of rowsstreamLength
- stream length passed to setBinaryStream(,,length)file
- filename to match retrieved data againstjava.lang.Exception
private void selectBlob2(java.lang.String testId, java.sql.PreparedStatement ps, int bloblen, int id, int expectedRows, java.lang.String file) throws java.lang.Exception
bloblen
- select expects to retrieve a blob of this lengthid
- id of the row to retrieveexpectedRows
- number of rows expected to match idfile
- name of the file,against which the retrieved data is comparedjava.lang.Exception
private void selectUpdateBlob(java.lang.String testId, java.sql.PreparedStatement ps, int bloblen, int id, int updateId) throws java.lang.Exception
ps
- select statement from which blob is retrievedbloblen
- updating value is of length bloblenid
- id of the row retrieved, for the updateupdateId
- id of the row that is updatedjava.lang.Exception
private void selectInsertBlob(java.lang.String testId, java.sql.PreparedStatement ps, java.sql.PreparedStatement ins, int bloblen, int id, int insertId) throws java.lang.Exception
ps
- select statement from which blob is retrievedbloblen
- updating value is of length bloblenid
- id of the row retrieved, for the updateinsertId
- id of the row that is insertedjava.lang.Exception
private void selectUpdateBlob2(java.lang.String testId, java.sql.PreparedStatement ps, java.sql.PreparedStatement sel, int bloblen, int id, int updateId, java.lang.String file) throws java.lang.Exception
bloblen
- updating value is of length bloblenid
- id of the row retrieved, for the updateupdateId
- id of the row that is updatedfile
- name of the file,against which the updated data is comparedjava.lang.Exception
private static void compareBlobToFile(java.io.InputStream lobstream, java.lang.String filename) throws java.lang.Exception
java.lang.Exception
private void deleteAndTruncateTable(java.lang.String table, int expectedRows) throws java.sql.SQLException
java.sql.SQLException
private void insertClob_SetCharacterStream(java.lang.String testId, java.sql.PreparedStatement ps, int cloblen, int start, int rows, int streamLength) throws java.sql.SQLException
cloblen
- length of clob to insertstart
- id value for insertrows
- insert rows number of rowsstreamLength
- stream length passed to
setCharacterStream(...,length)java.sql.SQLException
private void insertClob_SetClob(java.lang.String testId, java.sql.PreparedStatement ps, java.sql.Clob clob, long cloblen, int start, int rows, int expectedRows) throws java.sql.SQLException
cloblen
- length of clob to insertclob
- clob to insertstart
- start id value for insertrows
- insert rows number of rowsexpectedRows
- rows expected to be insertedjava.sql.SQLException
private void selectClob(java.lang.String testId, java.sql.PreparedStatement ps, int cloblen, int id, int expectedRows) throws java.sql.SQLException
cloblen
- select expects to retrieve a clob of this lengthid
- id of the row to retrieveexpectedRows
- number of rows expected to match idjava.sql.SQLException
private void insertClob2(java.lang.String testId, java.sql.PreparedStatement ps, int cloblen, int start, int rows, int streamLength, java.lang.String file) throws java.lang.Exception
cloblen
- length of clob to insertstart
- id value for insertrows
- insert rows number of rowsstreamLength
- stream length passed to
setCharacterStream(pos,reader,streamLength)file
- name of the file that has data to be insertedjava.lang.Exception
private void selectClob2(java.lang.String testId, java.sql.PreparedStatement ps, int cloblen, int id, int expectedRows, java.lang.String file) throws java.lang.Exception
cloblen
- select expects to retrieve a clob of this lengthid
- id of the row to retrieveexpectedRows
- number of rows expected to match idfile
- filename to compare the retrieved data againstjava.lang.Exception
private void selectUpdateClob(java.lang.String testId, java.sql.PreparedStatement ps, int cloblen, int id, int updateId) throws java.lang.Exception
java.lang.Exception
private void selectUpdateClob2(java.lang.String testId, java.sql.PreparedStatement ps, java.sql.PreparedStatement sel, int cloblen, int id, int updateId, java.lang.String file) throws java.lang.Exception
java.lang.Exception
private void updateClob2(java.lang.String testId, java.sql.PreparedStatement sel, int cloblen, int id, int updateRowId, int updateIdVal, java.lang.String file) throws java.lang.Exception
java.lang.Exception
private static void compareClobToFile(java.io.Reader lobstream, java.lang.String filename, int length) throws java.lang.Exception
java.lang.Exception
private static void verifyTest(int affectedRows, int expectedRows, java.lang.String test)
private static void writeToFile(java.lang.String file, java.io.Reader r) throws java.io.IOException
java.io.IOException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.