public class StreamingColumnTest extends BaseJDBCTestCase
Modifier and Type | Field and Description |
---|---|
private static int |
CLOB |
static int |
DB2_LONGVARCHAR_MAXWIDTH |
static int |
DB2_VARCHAR_MAXWIDTH |
(package private) static long[] |
fileLength |
(package private) static java.lang.String[] |
fileName |
private static int |
LONGVARCHAR |
private static int |
VARCHAR |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
StreamingColumnTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
protected static junit.framework.Test |
baseSuite(java.lang.String name) |
private static void |
compareCharArray(java.io.Reader stream,
char[] compare,
int length)
compare char data
|
private java.lang.String |
getLongString(int key,
java.lang.String tableName) |
private static void |
insertDataUsingAsciiStream(java.sql.PreparedStatement ps,
int intValue,
java.lang.String fileName,
int maxValueAllowed,
int test)
Method used by testStream12, testStream13, testStream14 to insert data
from a file using an ASCII stream
|
private static void |
insertDataUsingCharacterStream(java.sql.PreparedStatement ps,
int intValue,
java.lang.String fileName,
int maxValueAllowed,
int test)
Method used by testStream12, testStream13, testStream14 to insert data
from a file using a character stream
|
private static void |
insertDataUsingConcat(java.sql.Statement stmt,
int intValue,
int maxValueAllowed,
boolean blankPadding,
int tblType,
java.lang.String tableName)
blankPadding true means excess trailing blanks false means excess
trailing non-blank characters
|
private static void |
insertDataUsingStringOrObject(java.sql.PreparedStatement ps,
int intValue,
int maxValueAllowed,
boolean blankPadding,
boolean testUsingString,
int test) |
private int |
insertLongString(int key,
java.lang.String data,
boolean binaryColumn,
java.lang.String tableName) |
(package private) static java.lang.String |
pad(java.lang.String base,
long length) |
private static int |
streamInLongCol(java.sql.PreparedStatement ps,
java.lang.Object data) |
private int |
streamInStringCol(java.sql.PreparedStatement ps,
java.lang.String data,
boolean binaryColumn) |
private void |
streamTest2(long length,
java.lang.String tableName)
Insert strings padded with various lengths and verify their existence.
|
private void |
streamTest3(long length,
java.lang.String tableName)
Similar to streamTest2 apart from the insertion of file data as ascii
streams.
|
private void |
streamTest5(long length,
java.lang.String tableName)
If length > 32700 insert to a BLOB field.
|
private void |
streamTest8(int stream1_len,
int stream2_len,
java.lang.String tableName)
Method called by testStream8_10_2500 and testStream8_2500_10
|
private void |
streamTest9(int stream1_len,
int stream2_len,
java.lang.String tableName)
Metjod called by testStream9_10_2500 and testStream9_2500_10
|
private static void |
streamTestDataVerification(java.sql.ResultSet rs,
int maxValueAllowed) |
static junit.framework.Test |
suite()
Runs the test fixtures in embedded and client.
|
void |
testDerby500_verifyVarcharStreams()
Test that DERBY500 fix did not change the behavior for varchar, char,
long varchar types when stream api is used.
|
void |
testDerby500()
Streams are not re-used.
|
void |
testStream1()
Test inserting data into long varchar columns from FileInputStreams, and
retrieving them back as InputStreams.
|
void |
testStream10()
table with multiple indexes, indexes share columns table has more than 4
rows, insert stream into table compress table and verify that each index
is valid .
|
void |
testStream11()
Test the passing of negative values for stream lengths to various
setXXXStream methods.
|
void |
testStream12()
Test truncation from files with trailing blanks and non-blanks.
|
void |
testStream13()
Test truncation from files to long varchar.
|
void |
testStream14()
Test truncation behavior for clobs Test is similar to streamTest12 except
that this test tests for clob column
|
void |
testStream2_10000()
test column size 10000 bytes.
|
void |
testStream2_1500()
test column size 1500 bytes.
|
void |
testStream2_5000()
test column size 5000 bytes.Run streamTest2 with padding length 5000
|
void |
testStream3_0()
Run streamTest3 with padding length 0
|
void |
testStream3_10000()
Run streamTest3 with padding length 10000
|
void |
testStream3_1500()
Run streamTest3 with padding length 1500
|
void |
testStream3_5000()
Run streamTest3 with padding length 5000
|
void |
testStream4()
Insert data from streams to a BLOB field.
|
void |
testStream5_0()
Run streamTest5 with padding length 0.
|
void |
testStream5_1500()
Run streamTest5 with padding length 1500.
|
void |
testStream5_5000()
Run streamTest5 with padding length 5000.
|
void |
testStream6()
Test getting a ByteArrayInputStream from data and inserting.
|
void |
testStream7()
Test insertion of a long string to a long varchar field in a table
created with pagesize 1024.
|
void |
testStream8_10_2500()
long row test of insert/backout case, using setAsciiStream().
|
void |
testStream8_2500_10()
long row test of insert/backout case, using setAsciiStream().
|
void |
testStream9_10_2500()
long row test of insert/backout case, using setBinaryStream().
|
void |
testStream9_2500_10()
long row test of insert/backout case, using setBinaryStream().
|
private int |
updateLongString(int oldkey,
int newkey,
java.lang.String tableName) |
private void |
verifyDerby500Test(java.sql.PreparedStatement ps,
byte[] buf,
char[] cbuf,
int startId,
int endId,
boolean binaryType)
verify the data in the derby500Test
|
private void |
verifyExistence(int key,
java.lang.String base,
long length,
java.lang.String tableName) |
private void |
verifyLength(int a,
int columnSize,
long[] fileLength) |
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
public static final int DB2_LONGVARCHAR_MAXWIDTH
public static final int DB2_VARCHAR_MAXWIDTH
static java.lang.String[] fileName
static long[] fileLength
private static final int LONGVARCHAR
private static final int CLOB
private static final int VARCHAR
public void testStream1() throws java.lang.Exception
java.lang.Exception
- If an unexpected error occurs.public void testStream2_1500() throws java.lang.Exception
java.lang.Exception
public void testStream2_5000() throws java.lang.Exception
java.lang.Exception
public void testStream2_10000() throws java.lang.Exception
java.lang.Exception
private void streamTest2(long length, java.lang.String tableName) throws java.lang.Exception
length
- How long the string should be padded.tableName
- The table to enter the strings.java.lang.Exception
- If any unexpected errors occur.public void testStream3_0() throws java.lang.Exception
java.lang.Exception
public void testStream3_1500() throws java.lang.Exception
java.lang.Exception
public void testStream3_5000() throws java.lang.Exception
java.lang.Exception
public void testStream3_10000() throws java.lang.Exception
java.lang.Exception
private void streamTest3(long length, java.lang.String tableName) throws java.lang.Exception
length
- tableName
- java.lang.Exception
public void testStream4() throws java.lang.Exception
java.lang.Exception
public void testStream5_0() throws java.lang.Exception
java.lang.Exception
public void testStream5_1500() throws java.lang.Exception
java.lang.Exception
public void testStream5_5000() throws java.lang.Exception
java.lang.Exception
private void streamTest5(long length, java.lang.String tableName) throws java.lang.Exception
length
- Padding lengthtableName
- Name of tablejava.lang.Exception
public void testStream6() throws java.lang.Exception
java.lang.Exception
public void testStream7() throws java.lang.Exception
java.lang.Exception
public void testStream8_10_2500() throws java.lang.Exception
The heap tries to make rows all fit on one page if possible. So it first asks raw store to try inserting without overflowing rows or columns. If that doesn't work it then asks raw store for a mostly empty page and tries to insert it there with overflow, If that doesn't work then an empty page is picked.
If parameters are 10,2500 - then the second row inserted will have the 1st column fit, but the second not fit which caused track #2240.
java.lang.Exception
public void testStream8_2500_10() throws java.lang.Exception
The heap tries to make rows all fit on one page if possible. So it first asks raw store to try inserting without overflowing rows or columns. If that doesn't work it then asks raw store for a mostly empty page and tries to insert it there with overflow, If that doesn't work then an empty page is picked.
If parameters are 10,2500 - then the second row inserted will have the 1st column fit, but the second not fit which caused track #2240.
StandardException
- Standard exception policy.java.lang.Exception
private void streamTest8(int stream1_len, int stream2_len, java.lang.String tableName) throws java.lang.Exception
stream1_len
- Length of the 1st streamstream2_len
- Length of the 2nd streamtableName
- Name of tablejava.lang.Exception
public void testStream9_10_2500() throws java.lang.Exception
The heap tries to make rows all fit on one page if possible. So it first asks raw store to try inserting without overflowing rows or columns. If that doesn't work it then asks raw store for a mostly empty page and tries to insert it there with overflow, If that doesn't work then an empty page is picked.
If input parameters are 10,2500 - then the second row inserted will have the 1st column fit, but the second not fit which caused track #2240.
StandardException
- Standard exception policy.java.lang.Exception
public void testStream9_2500_10() throws java.lang.Exception
The heap tries to make rows all fit on one page if possible. So it first asks raw store to try inserting without overflowing rows or columns. If that doesn't work it then asks raw store for a mostly empty page and tries to insert it there with overflow, If that doesn't work then an empty page is picked.
If input parameters are 10,2500 - then the second row inserted will have the 1st column fit, but the second not fit which caused track #2240.
StandardException
- Standard exception policy.java.lang.Exception
private void streamTest9(int stream1_len, int stream2_len, java.lang.String tableName) throws java.sql.SQLException
stream1_len
- Length of 1st streamstream2_len
- Length of 2nd streamtableName
- name of tablejava.sql.SQLException
public void testStream10() throws java.lang.Exception
java.lang.Exception
public void testStream11() throws java.lang.Exception
java.lang.Exception
public void testStream12() throws java.lang.Exception
java.lang.Exception
public void testStream13() throws java.lang.Exception
java.lang.Exception
public void testStream14() throws java.lang.Exception
java.lang.Exception
public void testDerby500() throws java.lang.Exception
java.lang.Exception
public void testDerby500_verifyVarcharStreams() throws java.lang.Exception
java.lang.Exception
private void verifyDerby500Test(java.sql.PreparedStatement ps, byte[] buf, char[] cbuf, int startId, int endId, boolean binaryType) throws java.lang.Exception
ps
- select preparedstatementbuf
- byte array to compare the blob datacbuf
- char array to compare the clob datastartId
- start id of the row to check data forendId
- end id of the row to check data forbinaryType
- flag to indicate if the second column in resultset is a binary
type or not. true for binary typejava.lang.Exception
private static void compareCharArray(java.io.Reader stream, char[] compare, int length) throws java.lang.Exception
stream
- data from stream to comparecompare
- base data to compare againstlength
- compare length number of chars.java.lang.Exception
private static void streamTestDataVerification(java.sql.ResultSet rs, int maxValueAllowed) throws java.lang.Exception
java.lang.Exception
private static void insertDataUsingConcat(java.sql.Statement stmt, int intValue, int maxValueAllowed, boolean blankPadding, int tblType, java.lang.String tableName) throws java.lang.Exception
tblType
- table type, depending on the table type, the corresponding
table is used. for varchar - testVarChar , for long varchar -
testVarChars,java.lang.Exception
private static void insertDataUsingStringOrObject(java.sql.PreparedStatement ps, int intValue, int maxValueAllowed, boolean blankPadding, boolean testUsingString, int test) throws java.lang.Exception
java.lang.Exception
private static void insertDataUsingCharacterStream(java.sql.PreparedStatement ps, int intValue, java.lang.String fileName, int maxValueAllowed, int test) throws java.lang.Exception
java.lang.Exception
private static void insertDataUsingAsciiStream(java.sql.PreparedStatement ps, int intValue, java.lang.String fileName, int maxValueAllowed, int test) throws java.lang.Exception
java.lang.Exception
private void verifyLength(int a, int columnSize, long[] fileLength)
private void verifyExistence(int key, java.lang.String base, long length, java.lang.String tableName) throws java.lang.Exception
java.lang.Exception
private java.lang.String getLongString(int key, java.lang.String tableName) throws java.lang.Exception
java.lang.Exception
static java.lang.String pad(java.lang.String base, long length)
private int insertLongString(int key, java.lang.String data, boolean binaryColumn, java.lang.String tableName) throws java.lang.Exception
java.lang.Exception
private int updateLongString(int oldkey, int newkey, java.lang.String tableName) throws java.lang.Exception
java.lang.Exception
private int streamInStringCol(java.sql.PreparedStatement ps, java.lang.String data, boolean binaryColumn) throws java.lang.Exception
java.lang.Exception
private static int streamInLongCol(java.sql.PreparedStatement ps, java.lang.Object data) throws java.lang.Exception
ps
- PreparedStatementdata
- Data to be padded and insertedjava.lang.Exception
public static junit.framework.Test suite()
protected static junit.framework.Test baseSuite(java.lang.String name)
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.