org.apache.derbyTesting.functionTests.tests.lang
Class BigDataTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.derbyTesting.junit.BaseTestCase
              extended by org.apache.derbyTesting.junit.BaseJDBCTestCase
                  extended by org.apache.derbyTesting.functionTests.tests.lang.BigDataTest
All Implemented Interfaces:
junit.framework.Test

public class BigDataTest
extends BaseJDBCTestCase

A test case for big.sql.


Field Summary
private static java.lang.String BIG_TABLE_NAME
           
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
BigDataTest(java.lang.String name)
          Constructor.
 
Method Summary
private  void createTable(java.lang.String sql)
          Create a new table with defined sql sentence.
private  void createTable(java.lang.String tableName, int[] lengths, boolean[] useClob)
          Create table by the name defined, and each column of the table has the type of varchar or clob, which is determined by the element in useClob.
private  java.lang.String[][] getRowsWithOnlyOneColumn(java.lang.String[] sa, int[] timesArray)
          Generate String array with two dimensions according to String array and int array defined. i.e. calling getStringArray({"a", "b",}, {3, 4}) returns {"aaa", "bbbb",}.
static java.lang.String getSelectSql(java.lang.String tableName)
          Get a String to select all records from the table defined.
private  java.lang.String[] getStringArray(java.lang.String[] sa, int[] timesArray)
          Generate String array according to String array and int array defined. i.e. calling getStringArray({"a", "b",}, {3, 4}) returns {"aaa", "bbbb",}.
private  void insertMultipleRows(java.lang.String tableName, java.lang.String[][] rows)
          Insert multiple rows into one table.
private  void insertOneRow(java.lang.String tableName, java.lang.String[] columns)
          Insert a row into a table named by tableName, with defined table and params.
private  void insertOneRow(java.lang.String tableName, java.lang.String[] sa, int[] timesArray)
          Insert one row into a table named by tableName, with defined table, and String array and int array to construct params.
static junit.framework.Test suite()
           
 void tearDown()
          Tear down this fixture, sub-classes should call super.tearDown().
 void testBigColumn()
          try a column which is > 32767
 void testBigRow()
          create table with row greater than 32K.
 void testDefaultQueryBlock()
          the overhead for DSS on QRYDTA is 15 bytes let's try a row which is exactly 32767 (default client query block size).
 void testLongVarchar()
          Test a table just has only one column typed long varchar.
 void testMixture()
          Mix clob and varchar in the table.
 void testScrolling()
          let's try scrolling.
 void testSeveralBigColumns()
          try several columns > 32767.
 void testSpanQRYDTABlocks()
          Various tests for JIRA-614: handling of rows which span QRYDTA blocks.
 void testTooBigSQLCARD()
          What happens when the row + the ending SQLCARD is too big.
 void testVarchar()
          Test a table just has only one column typed varchar.
private  void validSingleRow(java.lang.String[] exected, boolean[] useClob, java.sql.ResultSet rs)
          Valid the current row record of passed ResultSet.
private  void validTable(java.lang.String[][] expected, java.lang.String tableName)
          Valid content in defined table.
 
Methods inherited from class org.apache.derbyTesting.junit.BaseJDBCTestCase
assertCallError, assertCheckTable, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertGetIntError, assertNextError, assertPreparedStatementError, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertTableRowCount, assertUpdateCount, assertUpdateCount, checkAllConsistency, checkEstimatedRowCount, commit, createStatement, createStatement, createStatement, dropTable, dropTable, getConnection, getDatabaseProperty, getLastSQLException, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runScript, runScript, runSQLCommands, setAutoCommit, usingDB2Client, usingDerbyNetClient, usingEmbedded
 
Methods inherited from class org.apache.derbyTesting.junit.BaseTestCase
alarm, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertSecurityManager, assertThrowableEquals, execJavaCmd, fail, getFailureFolder, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeSystemProperty, runBare, setSystemProperty, traceit
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, setUp, toString
 
Methods inherited from class junit.framework.Assert
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, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BIG_TABLE_NAME

private static final java.lang.String BIG_TABLE_NAME
See Also:
Constant Field Values
Constructor Detail

BigDataTest

public BigDataTest(java.lang.String name)
            throws java.sql.SQLException
Constructor.

Parameters:
name -
Throws:
java.sql.SQLException
Method Detail

getSelectSql

public static java.lang.String getSelectSql(java.lang.String tableName)
Get a String to select all records from the table defined.

Parameters:
tableName - The table to fetch records from.
Returns:
"select * from " + tableName.

createTable

private void createTable(java.lang.String tableName,
                         int[] lengths,
                         boolean[] useClob)
                  throws java.sql.SQLException
Create table by the name defined, and each column of the table has the type of varchar or clob, which is determined by the element in useClob. At the same time, each column is as big as identified by lengths. i.e. to call createTable(conn, "big", {1000, 1000, }, {true, false,}) equals calling the sql sentence "create table big(c1 clob(1000), c2 varchar(1000));"

Parameters:
tableName -
lengths -
useClob - for element of useClob, if true, use clob as an element for a column; false, use varchar as an element for a column.
Throws:
java.sql.SQLException

createTable

private void createTable(java.lang.String sql)
                  throws java.sql.SQLException
Create a new table with defined sql sentence.

Parameters:
sql - a sql sentence a create a table, which should use BIG_TABLE_NAME as new table's name.
Throws:
java.sql.SQLException

getStringArray

private java.lang.String[] getStringArray(java.lang.String[] sa,
                                          int[] timesArray)
Generate String array according to String array and int array defined. i.e. calling getStringArray({"a", "b",}, {3, 4}) returns {"aaa", "bbbb",}.

Parameters:
sa - the sort string array to use.
timesArray - stores repeated times of String constructed by elements in sa.
Returns:
A String array, whose elements is constructed by elements in sa, and each element repeated times defined by ia.

getRowsWithOnlyOneColumn

private java.lang.String[][] getRowsWithOnlyOneColumn(java.lang.String[] sa,
                                                      int[] timesArray)
Generate String array with two dimensions according to String array and int array defined. i.e. calling getStringArray({"a", "b",}, {3, 4}) returns {"aaa", "bbbb",}.

Parameters:
sa - the sort string array to use.
timesArray - stores repeated times of String constructed by elements in sa.
Returns:
A String array with two dimensions, whose elements is constructed by elements in sa, and each element repeated times defined by ia, for each row, it has only one column.

insertOneRow

private void insertOneRow(java.lang.String tableName,
                          java.lang.String[] sa,
                          int[] timesArray)
                   throws java.sql.SQLException
Insert one row into a table named by tableName, with defined table, and String array and int array to construct params.

Parameters:
tableName - can not be null.
sa - the string array to use.
timesArray - stores repeated times of String constructed by elements in sa.
Throws:
java.sql.SQLException

insertOneRow

private void insertOneRow(java.lang.String tableName,
                          java.lang.String[] columns)
                   throws java.sql.SQLException
Insert a row into a table named by tableName, with defined table and params.

Parameters:
tableName - can not be null.
columns - can not be null, and has a length bigger than 0.
Throws:
java.sql.SQLException - if SQLException occurs.

insertMultipleRows

private void insertMultipleRows(java.lang.String tableName,
                                java.lang.String[][] rows)
                         throws java.sql.SQLException
Insert multiple rows into one table.

Parameters:
tableName - the table will receive new rows.
rows - new rows for the table. Each row has only one column.
Throws:
java.sql.SQLException

validTable

private void validTable(java.lang.String[][] expected,
                        java.lang.String tableName)
                 throws java.sql.SQLException
Valid content in defined table.

Parameters:
expected - the values expected, it has the same order with the table. i.e.expected[0] means the expected values for the first row in rs.
tableName - whose content will be compared.
Throws:
java.sql.SQLException - means invalid.

validSingleRow

private void validSingleRow(java.lang.String[] exected,
                            boolean[] useClob,
                            java.sql.ResultSet rs)
                     throws java.sql.SQLException
Valid the current row record of passed ResultSet.

Parameters:
exected - the values expected, it has the same order with the table.
useClob - for each element of useColb, true means the column is Clob, false means varchar.
rs - whose current row will be compared.
Throws:
java.sql.SQLException - means invalid.

tearDown

public void tearDown()
              throws java.sql.SQLException
Description copied from class: BaseJDBCTestCase
Tear down this fixture, sub-classes should call super.tearDown(). This cleanups & closes the connection if it is open and any statement objects returned through the utility methods.

Overrides:
tearDown in class BaseJDBCTestCase
Throws:
java.sql.SQLException

suite

public static junit.framework.Test suite()

testMixture

public void testMixture()
                 throws java.sql.SQLException
Mix clob and varchar in the table. The commented part in big.sql has been revived without DRDAProtocolException thrown.

Throws:
java.sql.SQLException

testScrolling

public void testScrolling()
                   throws java.sql.SQLException
let's try scrolling.

Throws:
java.sql.SQLException

testBigColumn

public void testBigColumn()
                   throws java.sql.SQLException
try a column which is > 32767

Throws:
java.sql.SQLException

testSeveralBigColumns

public void testSeveralBigColumns()
                           throws java.sql.SQLException
try several columns > 32767.

Throws:
java.sql.SQLException

testBigRow

public void testBigRow()
                throws java.sql.SQLException
create table with row greater than 32K.

Throws:
java.sql.SQLException

testDefaultQueryBlock

public void testDefaultQueryBlock()
                           throws java.sql.SQLException
the overhead for DSS on QRYDTA is 15 bytes let's try a row which is exactly 32767 (default client query block size).

Throws:
java.sql.SQLException

testSpanQRYDTABlocks

public void testSpanQRYDTABlocks()
                          throws java.sql.SQLException
Various tests for JIRA-614: handling of rows which span QRYDTA blocks. What happens when the SplitQRYDTA has to span 3+ blocks.

Throws:
java.sql.SQLException

testTooBigSQLCARD

public void testTooBigSQLCARD()
                       throws java.sql.SQLException
What happens when the row + the ending SQLCARD is too big.

Throws:
java.sql.SQLException

testLongVarchar

public void testLongVarchar()
                     throws java.sql.SQLException
Test a table just has only one column typed long varchar. This is a Test case commented in big.sql, but revived partly now. When inserting a big row, a SQLException is thrown with the prompt that 33000 is a invalid length.

Throws:
java.sql.SQLException

testVarchar

public void testVarchar()
                 throws java.sql.SQLException
Test a table just has only one column typed varchar. This is a Test case commented in big.sql, but revived partly now.

Throws:
java.sql.SQLException

Built on Sat 2009-11-28 18:44:18-0800, from revision 885187

Apache Derby V10.6 Internals - Copyright © 2004,2008 The Apache Software Foundation. All Rights Reserved.