You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by km...@apache.org on 2008/07/01 18:48:36 UTC
svn commit: r673136 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests:
master/DerbyNet/ master/DerbyNetClient/ suites/ tests/lang/
Author: kmarsden
Date: Tue Jul 1 09:48:36 2008
New Revision: 673136
URL: http://svn.apache.org/viewvc?rev=673136&view=rev
Log:
DERBY-3724 convert big.sql to JUnit
contributed by Junjie Peng
Added:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BigDataTest.java (with props)
Removed:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/big.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/big.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/big.sql
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/big_derby.properties
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude?rev=673136&r1=673135&r2=673136&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude Tue Jul 1 09:48:36 2008
@@ -13,7 +13,6 @@
# derbynet/sysinfo_withproperties.java - needs other properties
# following fail for various reasons, many related to not being able to connect:
# lang/optimizerOverrides.sql
-# lang/big.sql
# lang/wisconsin.java
# jdbcapi/derbyStress.java
# jdbcapi/maxfieldsize.java
@@ -29,7 +28,6 @@
derbynet/sysinfo_withproperties.java
stress/stress.multi
lang/optimizerOverrides.sql
-lang/big.sql
lang/wisconsin.java
jdbcapi/derbyStress.java
jdbcapi/maxfieldsize.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude?rev=673136&r1=673135&r2=673136&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude Tue Jul 1 09:48:36 2008
@@ -11,7 +11,6 @@
# derbynet/sysinfo.java - fails because not access to java.class.path
# derbynet/sysinfo_withproperties.java - fails because not access to java.class.path
# lang/optimizerOverrides.sql - fails...
-# lang/big.sql - checks depend on dir structure
# lang/wisconsin.java - checks depend on dir structure
# jdbcapi/maxfieldsize.java - fails...??? (but not when run by itself)
#
@@ -25,6 +24,5 @@
derbynet/sysinfo.java
derbynet/sysinfo_withproperties.java
lang/optimizerOverrides.sql
-lang/big.sql
lang/wisconsin.java
stress/stress.multi
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall?rev=673136&r1=673135&r2=673136&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall Tue Jul 1 09:48:36 2008
@@ -10,7 +10,6 @@
derbynet/timeslice.java
jdbcapi/metadataMultiConn.java
lang/optimizerOverrides.sql
-lang/big.sql
lang/holdCursorIJ.sql
lang/wisconsin.java
lang/ShutdownDatabase.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall?rev=673136&r1=673135&r2=673136&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall Tue Jul 1 09:48:36 2008
@@ -5,7 +5,6 @@
derbynet/runtimeinfo.java
derbynet/timeslice.java
jdbcapi/metadataMultiConn.java
-lang/big.sql
lang/holdCursorIJ.sql
store/holdCursorExternalSortJDBC30.sql
store/holdCursorJDBC30.sql
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BigDataTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BigDataTest.java?rev=673136&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BigDataTest.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BigDataTest.java Tue Jul 1 09:48:36 2008
@@ -0,0 +1,538 @@
+/**
+ * Derby - Class org.apache.derbyTesting.functionTests.tests.lang.BigDataTest
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.derbyTesting.functionTests.tests.lang;
+
+import java.sql.Clob;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.derbyTesting.functionTests.util.Formatters;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * A test case for big.sql.
+ */
+public class BigDataTest extends BaseJDBCTestCase {
+ private static final String BIG_TABLE_NAME = "big";
+
+ /**
+ * Constructor.
+ *
+ * @param name
+ * @throws SQLException
+ */
+ public BigDataTest(String name) throws SQLException {
+ super(name);
+ }
+
+ /**
+ * Get a String to select all records from the table defined.
+ *
+ * @param tableName
+ * The table to fetch records from.
+ * @return "select * from " + tableName.
+ */
+ public static String getSelectSql(String tableName) {
+ return "select * from " + tableName;
+ }
+
+ /**
+ * 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));"
+ *
+ * @param tableName
+ * @param lengths
+ * @param 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 SQLException
+ */
+ private void createTable(String tableName, int[] lengths, boolean[] useClob)
+ throws SQLException {
+ StringBuffer sqlSb = new StringBuffer();
+ sqlSb.append("create table ");
+ sqlSb.append(tableName);
+ sqlSb.append(" (");
+ for (int i = 0; i < lengths.length - 1; i++) {
+ sqlSb.append("c" + (i + 1) + (useClob[i] ? " clob(" : " varchar(")
+ + lengths[i] + "),");
+ }
+ sqlSb.append("c" + lengths.length
+ + (useClob[lengths.length - 1] ? " clob(" : " varchar(")
+ + lengths[lengths.length - 1] + ")");
+ sqlSb.append(")");
+ String sql = sqlSb.toString();
+
+ createTable(sql);
+ }
+
+ /**
+ * Create a new table with defined sql sentence.
+ *
+ * @param sql
+ * a sql sentence a create a table, which should use BIG_TABLE_NAME as new
+ * table's name.
+ * @throws SQLException
+ */
+ private void createTable(String sql) throws SQLException {
+ Statement ps = createStatement();
+ ps.executeUpdate(sql);
+ ps.close();
+ }
+
+ /**
+ * Generate String array according to String array and int array defined. i.e. calling
+ * getStringArray({"a", "b",}, {3, 4}) returns {"aaa", "bbbb",}.
+ *
+ * @param sa
+ * the sort string array to use.
+ * @param timesArray
+ * stores repeated times of String constructed by elements in sa.
+ * @return A String array, whose elements is constructed by elements in sa, and each
+ * element repeated times defined by ia.
+ */
+ private String[] getStringArray(String[] sa, int[] timesArray) {
+ String[] result = new String[sa.length];
+ for (int i = 0; i < sa.length; i++) {
+ result[i] = new String(Formatters.repeatChar(sa[i], timesArray[i]));
+ }
+
+ return result;
+ }
+
+ /**
+ * 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",}.
+ *
+ * @param sa
+ * the sort string array to use.
+ * @param timesArray
+ * stores repeated times of String constructed by elements in sa.
+ * @return 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.
+ */
+ private String[][] getRowsWithOnlyOneColumn(String[] sa, int[] timesArray) {
+ String[][] result = new String[sa.length][1];
+ for (int i = 0; i < sa.length; i++) {
+ result[i][0] = new String(Formatters.repeatChar(sa[i], timesArray[i]));
+ }
+
+ return result;
+ }
+
+ /**
+ * Insert one row into a table named by tableName, with defined table, and String
+ * array and int array to construct params.
+ *
+ * @param tableName
+ * can not be null.
+ * @param sa
+ * the string array to use.
+ * @param timesArray
+ * stores repeated times of String constructed by elements in sa.
+ * @throws SQLException
+ */
+ private void insertOneRow(String tableName, String[] sa, int[] timesArray)
+ throws SQLException {
+ String[] params = getStringArray(sa, timesArray);
+ insertOneRow(tableName, params);
+ }
+
+ /**
+ * Insert a row into a table named by tableName, with defined table and params.
+ *
+ * @param tableName
+ * can not be null.
+ * @param columns
+ * can not be null, and has a length bigger than 0.
+ * @throws SQLException
+ * if SQLException occurs.
+ */
+ private void insertOneRow(String tableName, String[] columns) throws SQLException {
+ StringBuffer sqlSb = new StringBuffer();
+ sqlSb.append("insert into ");
+ sqlSb.append(tableName);
+ sqlSb.append(" values (");
+ for (int i = 0; i < columns.length - 1; i++)
+ sqlSb.append("?, ");
+ sqlSb.append("?)");
+ String sql = sqlSb.toString();
+
+ PreparedStatement ps = prepareStatement(sql);
+ for (int i = 1; i <= columns.length; i++)
+ ps.setString(i, columns[i - 1]);
+ ps.executeUpdate();
+ ps.close();
+ }
+
+ /**
+ * Insert multiple rows into one table.
+ *
+ * @param tableName
+ * the table will receive new rows.
+ * @param rows
+ * new rows for the table. Each row has only one column.
+ * @throws SQLException
+ */
+ private void insertMultipleRows(String tableName, String[][] rows)
+ throws SQLException {
+ for (int i = 0; i < rows.length; i++) {
+ String[] row = rows[i];
+ insertOneRow(tableName, row);
+ }
+ }
+
+ /**
+ * Valid content in defined table.
+ *
+ * @param exected
+ * 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.
+ * @param tableName
+ * whose content will be compared.
+ * @throws SQLException
+ * means invalid.
+ */
+ private void validTable(String[][] expected, String tableName) throws SQLException {
+ String sql = getSelectSql(tableName);
+ Statement st = createStatement();
+ ResultSet rs = st.executeQuery(sql);
+ JDBC.assertFullResultSet(rs, expected);
+ st.close();
+ }
+
+ /**
+ * Valid the current row record of passed ResultSet.
+ *
+ * @param exected
+ * the values expected, it has the same order with the table.
+ * @param useClob
+ * for each element of useColb, true means the column is Clob, false means
+ * varchar.
+ * @param rs
+ * whose current row will be compared.
+ * @throws SQLException
+ * means invalid.
+ */
+ private void validSingleRow(String[] exected, boolean[] useClob, ResultSet rs)
+ throws SQLException {
+ for (int i = 0; i < exected.length; i++) {
+ String real;
+ if (useClob[i]) {
+ Clob c = rs.getClob(i + 1);
+ real = c.getSubString(1, (int) c.length());
+ } else {
+ real = rs.getString(i + 1);
+ }
+
+ assertEquals("Compare column " + (i + 1), exected[i], real);
+ }
+ }
+
+ public void tearDown() throws SQLException {
+ dropTable(BIG_TABLE_NAME);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("BigDataTest");
+ suite.addTest(TestConfiguration.defaultSuite(BigDataTest.class));
+ return suite;
+ }
+
+ /**
+ * Mix clob and varchar in the table. The commented part in big.sql has been revived
+ * without DRDAProtocolException thrown.
+ *
+ * @throws SQLException
+ */
+ public void testMixture() throws SQLException {
+ int[] ia = { 32672, 32672, 32672, 32672, };
+ boolean[] useClob = { true, false, false, true, };
+ createTable(BIG_TABLE_NAME, ia, useClob);
+
+ String[] sa = { "a", "b", "c", "d", };
+ insertOneRow(BIG_TABLE_NAME, sa, ia);
+
+ String[] row = getStringArray(sa, ia);
+ String[][] expected = { row, };
+ validTable(expected, BIG_TABLE_NAME);
+
+ insertOneRow(BIG_TABLE_NAME, sa, ia);
+ insertOneRow(BIG_TABLE_NAME, sa, ia);
+
+ expected = new String[][] { row, row, row, };
+ validTable(expected, BIG_TABLE_NAME);
+
+ String sql1 = getSelectSql(BIG_TABLE_NAME);
+ Statement st = createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
+ ResultSet.CONCUR_READ_ONLY);
+ ResultSet rs = st.executeQuery(sql1);
+ assertEquals("Before operation, row No. is 0.", 0, rs.getRow());
+ rs.first();
+ assertEquals("After calling first(), row No. is 1.", 1, rs.getRow());
+ validSingleRow(row, useClob, rs);
+ rs.next();
+ assertEquals("After calling next(), row No. is 2.", 2, rs.getRow());
+ validSingleRow(row, useClob, rs);
+ rs.previous();
+ assertEquals("After calling previous(), row No. is 1.", 1, rs.getRow());
+ validSingleRow(row, useClob, rs);
+ rs.last();
+ assertEquals("After calling last(), row No. is 3.", 3, rs.getRow());
+ validSingleRow(row, useClob, rs);
+ rs.close();
+
+ st.close();
+ }
+
+ /**
+ * let's try scrolling.
+ *
+ * @throws SQLException
+ */
+ public void testScrolling() throws SQLException {
+ int[] lens = { 10000, 10000, 10000, 10000, };
+ boolean[] useClob = { false, false, false, false, };
+ createTable(BIG_TABLE_NAME, lens, useClob);
+
+ String[] sa1 = { "a", "b", "c", "d", };
+ insertOneRow(BIG_TABLE_NAME, sa1, lens);
+ String[] sa2 = new String[] { "e", "f", "g", "h", };
+ insertOneRow(BIG_TABLE_NAME, sa2, lens);
+ String[] sa3 = new String[] { "i", "j", "k", "l", };
+ insertOneRow(BIG_TABLE_NAME, sa3, lens);
+ String[] sa4 = new String[] { "m", "n", "o", "p", };
+ insertOneRow(BIG_TABLE_NAME, sa4, lens);
+
+ String[] row1 = getStringArray(sa1, lens);
+ String[] row2 = getStringArray(sa2, lens);
+ String[] row3 = getStringArray(sa3, lens);
+ String[] row4 = getStringArray(sa4, lens);
+ String[][] expected = { row1, row2, row3, row4, };
+ validTable(expected, BIG_TABLE_NAME);
+
+ String sql = getSelectSql(BIG_TABLE_NAME);
+ Statement st = createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
+ ResultSet.CONCUR_READ_ONLY);
+ ResultSet rs = st.executeQuery(sql);
+
+ rs.first();
+ validSingleRow(row1, useClob, rs);
+ rs.next();
+ validSingleRow(row2, useClob, rs);
+ rs.previous();
+ validSingleRow(row1, useClob, rs);
+ rs.last();
+ validSingleRow(row4, useClob, rs);
+ rs.close();
+
+ rs = st.executeQuery(sql);
+ rs.last();
+ validSingleRow(row4, useClob, rs);
+ rs.close();
+
+ st.close();
+ }
+
+ /**
+ * try a column which is > 32767
+ *
+ * @throws SQLException
+ */
+ public void testBigColumn() throws SQLException {
+ int[] ia = { 40000, };
+ boolean[] useClob = { true, };
+ createTable(BIG_TABLE_NAME, ia, useClob);
+
+ String[] sa = { "a", };
+ insertOneRow(BIG_TABLE_NAME, sa, ia);
+
+ String[][] expected = { getStringArray(sa, ia), };
+ validTable(expected, BIG_TABLE_NAME);
+ }
+
+ /**
+ * try several columns > 32767.
+ *
+ * @throws SQLException
+ */
+ public void testSeveralBigColumns() throws SQLException {
+ int[] ia = { 40000, 40000, 40000, };
+ boolean[] useClob = { true, true, true, };
+ createTable(BIG_TABLE_NAME, ia, useClob);
+
+ String[] sa = { "a", "b", "c", };
+ insertOneRow(BIG_TABLE_NAME, sa, ia);
+
+ String[] sa1 = new String[] { "d", "e", "f", };
+ insertOneRow(BIG_TABLE_NAME, sa1, ia);
+
+ String[][] expected = { getStringArray(sa, ia), getStringArray(sa1, ia), };
+ validTable(expected, BIG_TABLE_NAME);
+ }
+
+ /**
+ * create table with row greater than 32K.
+ *
+ * @throws SQLException
+ */
+ public void testBigRow() throws SQLException {
+ int[] ia = { 10000, 10000, 10000, 10000, };
+ boolean[] useClob = { false, false, false, false, };
+ createTable(BIG_TABLE_NAME, ia, useClob);
+
+ String[] sa = { "a", "b", "c", "d", };
+ insertOneRow(BIG_TABLE_NAME, sa, ia);
+
+ String[][] expected = { getStringArray(sa, ia), };
+ validTable(expected, BIG_TABLE_NAME);
+
+ String[] sa1 = new String[] { "e", "f", "g", "h", };
+ insertOneRow(BIG_TABLE_NAME, sa1, ia);
+
+ expected = new String[][] { expected[0], getStringArray(sa1, ia), };
+ validTable(expected, BIG_TABLE_NAME);
+ }
+
+ /**
+ * the overhead for DSS on QRYDTA is 15 bytes let's try a row which is exactly 32767
+ * (default client query block size).
+ *
+ * @throws SQLException
+ */
+ public void testDefaultQueryBlock() throws SQLException {
+ int[] lens = { 30000, 2752, };
+ boolean[] useClob = { false, false, };
+ createTable(BIG_TABLE_NAME, lens, useClob);
+
+ String[] sa = { "a", "b", };
+ insertOneRow(BIG_TABLE_NAME, sa, lens);
+
+ String[][] expected = { getStringArray(sa, lens), };
+ validTable(expected, BIG_TABLE_NAME);
+ }
+
+ /**
+ * Various tests for JIRA-614: handling of rows which span QRYDTA blocks. What happens
+ * when the SplitQRYDTA has to span 3+ blocks.
+ *
+ * @throws SQLException
+ */
+ public void testSpanQRYDTABlocks() throws SQLException {
+ int[] lens = { 32672, 32672, 32672, 32672, };
+ boolean[] useClob = { false, false, false, false, };
+ createTable(BIG_TABLE_NAME, lens, useClob);
+
+ String[] sa = { "a", "b", "c", "d", };
+ insertOneRow(BIG_TABLE_NAME, sa, lens);
+
+ String[] row = getStringArray(sa, lens);
+ String[][] expected = { row, };
+ validTable(expected, BIG_TABLE_NAME);
+
+ insertOneRow(BIG_TABLE_NAME, sa, lens);
+ insertOneRow(BIG_TABLE_NAME, sa, lens);
+
+ expected = new String[][] { row, row, row, };
+ validTable(expected, BIG_TABLE_NAME);
+
+ String sql1 = getSelectSql(BIG_TABLE_NAME);
+ Statement st = createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
+ ResultSet.CONCUR_READ_ONLY);
+ ResultSet rs = st.executeQuery(sql1);
+ assertEquals("Before operation, row No. is 0.", 0, rs.getRow());
+ rs.first();
+ assertEquals("After calling first(), row No. is 1.", 1, rs.getRow());
+ validSingleRow(row, useClob, rs);
+ rs.next();
+ assertEquals("After calling next(), row No. is 2.", 2, rs.getRow());
+ validSingleRow(row, useClob, rs);
+ rs.previous();
+ assertEquals("After calling previous(), row No. is 1.", 1, rs.getRow());
+ validSingleRow(row, useClob, rs);
+ rs.last();
+ assertEquals("After calling last(), row No. is 3.", 3, rs.getRow());
+ validSingleRow(row, useClob, rs);
+ rs.close();
+ st.close();
+ }
+
+ /**
+ * What happens when the row + the ending SQLCARD is too big.
+ *
+ * @throws SQLException
+ */
+ public void testTooBigSQLCARD() throws SQLException {
+ int[] lens = { 30000, 2750, };
+ boolean[] useClob = { false, false, };
+ createTable(BIG_TABLE_NAME, lens, useClob);
+
+ String[] sa = { "a", "b", };
+ insertOneRow(BIG_TABLE_NAME, sa, lens);
+
+ String[][] expected = { getStringArray(sa, lens), };
+ validTable(expected, BIG_TABLE_NAME);
+ }
+
+ /**
+ * 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 SQLException
+ */
+ public void testLongVarchar() throws SQLException {
+ String sql = "create table " + BIG_TABLE_NAME + "(lvc long varchar )";
+ createTable(sql);
+
+ String[] sa = { "a", "a", "a", "a", "a", };
+ int[] timesArray = { 1000, 2000, 3000, 32000, 32700, };
+ String[][] rows = getRowsWithOnlyOneColumn(sa, timesArray);
+
+ insertMultipleRows(BIG_TABLE_NAME, rows);
+ validTable(rows, BIG_TABLE_NAME);
+ }
+
+ /**
+ * Test a table just has only one column typed varchar. This is a Test case commented
+ * in big.sql, but revived partly now.
+ *
+ * @throws SQLException
+ */
+ public void testVarchar() throws SQLException {
+ String sql = "create table " + BIG_TABLE_NAME + "(vc varchar(32672))";
+ createTable(sql);
+
+ String[] sa = { "a", "a", "a", "a", "a", };
+ int[] timesArray = { 1000, 2000, 3000, 32000, 32672, };
+ String[][] rows = getRowsWithOnlyOneColumn(sa, timesArray);
+
+ insertMultipleRows(BIG_TABLE_NAME, rows);
+ validTable(rows, BIG_TABLE_NAME);
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BigDataTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=673136&r1=673135&r2=673136&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java Tue Jul 1 09:48:36 2008
@@ -165,6 +165,8 @@
// Test uses DriverManager to connect to database in jar.
suite.addTest(DBInJarTest.suite());
}
+
+ suite.addTest(BigDataTest.suite());
return suite;
}