diff --git a/src/test/com/cloudera/sqoop/TestColumnTypes.java b/src/test/com/cloudera/sqoop/TestColumnTypes.java index 40205592..8397a371 100644 --- a/src/test/com/cloudera/sqoop/TestColumnTypes.java +++ b/src/test/com/cloudera/sqoop/TestColumnTypes.java @@ -72,11 +72,6 @@ protected boolean supportsBlob() { return false; } - @Override - protected String getVarBinaryDbOutput(String asInserted) { - return asInserted.toLowerCase(); - } - @Override protected String getVarBinarySeqOutput(String asInserted) { return toLowerHexString(asInserted); diff --git a/src/test/com/cloudera/sqoop/TestMultiCols.java b/src/test/com/cloudera/sqoop/TestMultiCols.java index 37c23675..e165cfe2 100644 --- a/src/test/com/cloudera/sqoop/TestMultiCols.java +++ b/src/test/com/cloudera/sqoop/TestMultiCols.java @@ -47,21 +47,14 @@ public class TestMultiCols extends ImportJobTestCase { * @param importColumns The list of columns to import */ private void verifyTypes(String [] types , String [] insertVals, - String [] validateVals, String validateLine) { - verifyTypes(types, insertVals, validateVals, validateLine, null); + String validateLine) { + verifyTypes(types, insertVals, validateLine, null); } private void verifyTypes(String [] types , String [] insertVals, - String [] validateVals, String validateLine, String [] importColumns) { + String validateLine, String [] importColumns) { createTableWithColTypes(types, insertVals); - - int i = 0; - for (String val : validateVals) { - verifyReadback(++i, val); - LOG.debug("Verified column " + i + " as value: " + val); - } - verifyImport(validateLine, importColumns); LOG.debug("Verified input line as " + validateLine + " -- ok!"); } @@ -69,109 +62,97 @@ private void verifyTypes(String [] types , String [] insertVals, public void testThreeStrings() { String [] types = { "VARCHAR(32)", "VARCHAR(32)", "VARCHAR(32)" }; String [] insertVals = { "'foo'", "'bar'", "'baz'" }; - String [] validateVals = { "foo", "bar", "baz" }; String validateLine = "foo,bar,baz"; - verifyTypes(types, insertVals, validateVals, validateLine); + verifyTypes(types, insertVals, validateLine); } public void testStringsWithNull1() { String [] types = { "VARCHAR(32)", "VARCHAR(32)", "VARCHAR(32)" }; String [] insertVals = { "'foo'", "null", "'baz'" }; - String [] validateVals = { "foo", null, "baz" }; String validateLine = "foo,null,baz"; - verifyTypes(types, insertVals, validateVals, validateLine); + verifyTypes(types, insertVals, validateLine); } public void testStringsWithNull2() { String [] types = { "VARCHAR(32)", "VARCHAR(32)", "VARCHAR(32)" }; String [] insertVals = { "null", "'foo'", "'baz'" }; - String [] validateVals = { null, "foo", "baz" }; String validateLine = "null,foo,baz"; - verifyTypes(types, insertVals, validateVals, validateLine); + verifyTypes(types, insertVals, validateLine); } public void testStringsWithNull3() { String [] types = { "VARCHAR(32)", "VARCHAR(32)", "VARCHAR(32)" }; String [] insertVals = { "'foo'", "'baz'", "null"}; - String [] validateVals = { "foo", "baz", null }; String validateLine = "foo,baz,null"; - verifyTypes(types, insertVals, validateVals, validateLine); + verifyTypes(types, insertVals, validateLine); } public void testThreeInts() { String [] types = { "INTEGER", "INTEGER", "INTEGER" }; String [] insertVals = { "1", "2", "3" }; - String [] validateVals = { "1", "2", "3" }; String validateLine = "1,2,3"; - verifyTypes(types, insertVals, validateVals, validateLine); + verifyTypes(types, insertVals, validateLine); } public void testIntsWithNulls() { String [] types = { "INTEGER", "INTEGER", "INTEGER" }; String [] insertVals = { "1", "null", "3" }; - String [] validateVals = { "1", null, "3" }; String validateLine = "1,null,3"; - verifyTypes(types, insertVals, validateVals, validateLine); + verifyTypes(types, insertVals, validateLine); } public void testMixed1() { String [] types = { "INTEGER", "VARCHAR(32)", "DATE" }; String [] insertVals = { "1", "'meep'", "'2009-12-31'" }; - String [] validateVals = { "1", "meep", "2009-12-31" }; String validateLine = "1,meep,2009-12-31"; - verifyTypes(types, insertVals, validateVals, validateLine); + verifyTypes(types, insertVals, validateLine); } public void testMixed2() { String [] types = { "INTEGER", "VARCHAR(32)", "DATE" }; String [] insertVals = { "null", "'meep'", "'2009-12-31'" }; - String [] validateVals = { null, "meep", "2009-12-31" }; String validateLine = "null,meep,2009-12-31"; - verifyTypes(types, insertVals, validateVals, validateLine); + verifyTypes(types, insertVals, validateLine); } public void testMixed3() { String [] types = { "INTEGER", "VARCHAR(32)", "DATE" }; String [] insertVals = { "1", "'meep'", "null" }; - String [] validateVals = { "1", "meep", null }; String validateLine = "1,meep,null"; - verifyTypes(types, insertVals, validateVals, validateLine); + verifyTypes(types, insertVals, validateLine); } public void testMixed4() { String [] types = { "NUMERIC", "INTEGER", "NUMERIC" }; String [] insertVals = { "-42", "17", "33333333333333333333333.1714" }; - String [] validateVals = { "-42", "17", "33333333333333333333333.1714" }; String validateLine = "-42,17,33333333333333333333333.1714"; - verifyTypes(types, insertVals, validateVals, validateLine); + verifyTypes(types, insertVals, validateLine); } public void testMixed5() { String [] types = { "NUMERIC", "INTEGER", "NUMERIC" }; String [] insertVals = { "null", "17", "33333333333333333333333.0" }; - String [] validateVals = { null, "17", "33333333333333333333333.0" }; String validateLine = "null,17,33333333333333333333333.0"; - verifyTypes(types, insertVals, validateVals, validateLine); + verifyTypes(types, insertVals, validateLine); } public void testMixed6() { String [] types = { "NUMERIC", "INTEGER", "NUMERIC" }; String [] insertVals = { "33333333333333333333333", "17", "-42"}; - String [] validateVals = { "33333333333333333333333", "17", "-42" }; String validateLine = "33333333333333333333333,17,-42"; - verifyTypes(types, insertVals, validateVals, validateLine); + verifyTypes(types, insertVals, validateLine); } ////////////////////////////////////////////////////////////////////////// @@ -182,34 +163,31 @@ public void testMixed6() { public void testSkipFirstCol() { String [] types = { "NUMERIC", "INTEGER", "NUMERIC" }; String [] insertVals = { "33333333333333333333333", "17", "-42"}; - String [] validateVals = { "33333333333333333333333", "17", "-42" }; String validateLine = "17,-42"; String [] loadCols = {"DATA_COL1", "DATA_COL2"}; - verifyTypes(types, insertVals, validateVals, validateLine, loadCols); + verifyTypes(types, insertVals, validateLine, loadCols); } public void testSkipSecondCol() { String [] types = { "NUMERIC", "INTEGER", "NUMERIC" }; String [] insertVals = { "33333333333333333333333", "17", "-42"}; - String [] validateVals = { "33333333333333333333333", "17", "-42" }; String validateLine = "33333333333333333333333,-42"; String [] loadCols = {"DATA_COL0", "DATA_COL2"}; - verifyTypes(types, insertVals, validateVals, validateLine, loadCols); + verifyTypes(types, insertVals, validateLine, loadCols); } public void testSkipThirdCol() { String [] types = { "NUMERIC", "INTEGER", "NUMERIC" }; String [] insertVals = { "33333333333333333333333", "17", "-42"}; - String [] validateVals = { "33333333333333333333333", "17", "-42" }; String validateLine = "33333333333333333333333,17"; String [] loadCols = {"DATA_COL0", "DATA_COL1"}; - verifyTypes(types, insertVals, validateVals, validateLine, loadCols); + verifyTypes(types, insertVals, validateLine, loadCols); } /** @@ -223,11 +201,10 @@ public void testSkipThirdCol() { public void testSingleColumnsArg() throws IOException { String [] types = { "VARCHAR(32)", "VARCHAR(32)", "VARCHAR(32)" }; String [] insertVals = { "'foo'", "'bar'", "'baz'" }; - String [] validateVals = { "foo", "bar", "baz" }; String validateLine = "foo,bar,baz"; String [] loadCols = {"DATA_COL0,DATA_COL1,DATA_COL2"}; - verifyTypes(types, insertVals, validateVals, validateLine, loadCols); + verifyTypes(types, insertVals, validateLine, loadCols); } /** @@ -241,10 +218,9 @@ public void testSingleColumnsArg() throws IOException { public void testColumnsWithSpaces() throws IOException { String [] types = { "VARCHAR(32)", "VARCHAR(32)", "VARCHAR(32)" }; String [] insertVals = { "'foo'", "'bar'", "'baz'" }; - String [] validateVals = { "foo", "bar", "baz" }; String validateLine = "foo,bar,baz"; String [] loadCols = {"DATA_COL0, DATA_COL1, DATA_COL2"}; - verifyTypes(types, insertVals, validateVals, validateLine, loadCols); + verifyTypes(types, insertVals, validateLine, loadCols); } } diff --git a/src/test/com/cloudera/sqoop/manager/MySQLCompatTest.java b/src/test/com/cloudera/sqoop/manager/MySQLCompatTest.java index fbe4783b..675b6b84 100644 --- a/src/test/com/cloudera/sqoop/manager/MySQLCompatTest.java +++ b/src/test/com/cloudera/sqoop/manager/MySQLCompatTest.java @@ -98,48 +98,23 @@ protected String getBlobType() { return "MEDIUMBLOB"; } - @Override - protected String getTrueBoolDbOutput() { - return "1"; - } - - @Override - protected String getFalseBoolDbOutput() { - return "0"; - } - - @Override - protected String getRealDbOutput(String realAsInserted) { - return realAsInserted; - } - @Override protected String getRealSeqOutput(String realAsInserted) { return withDecimalZero(realAsInserted); } - @Override - protected String getFloatDbOutput(String floatAsInserted) { - return floatAsInserted; - } - @Override protected String getFloatSeqOutput(String floatAsInserted) { return withDecimalZero(floatAsInserted); } - @Override - protected String getDoubleDbOutput(String doubleAsInserted) { - return doubleAsInserted; - } - @Override protected String getDoubleSeqOutput(String doubleAsInserted) { return withDecimalZero(doubleAsInserted); } @Override - protected String getTimestampDbOutput(String tsAsInserted) { + protected String getTimestampSeqOutput(String tsAsInserted) { // We trim timestamps to exactly one tenth of a second. if ("null".equals(tsAsInserted)) { return tsAsInserted; @@ -154,12 +129,7 @@ protected String getTimestampDbOutput(String tsAsInserted) { } @Override - protected String getTimestampSeqOutput(String tsAsInserted) { - return getTimestampDbOutput(tsAsInserted); - } - - @Override - protected String getNumericDbOutput(String numAsInserted) { + protected String getNumericSeqOutput(String numAsInserted) { // We always pad to exactly the number of digits in // getNumericDecPartDigits(). @@ -188,13 +158,13 @@ protected String getNumericDbOutput(String numAsInserted) { } @Override - protected String getDecimalDbOutput(String numAsInserted) { - return getNumericDbOutput(numAsInserted); + protected String getDecimalSeqOutput(String numAsInserted) { + return getNumericSeqOutput(numAsInserted); } @Test public void testYear() { - verifyType("YEAR", "2012", "2012-01-01", "2012"); + verifyType("YEAR", "2012", "2012"); } } diff --git a/src/test/com/cloudera/sqoop/manager/OracleCompatTest.java b/src/test/com/cloudera/sqoop/manager/OracleCompatTest.java index 153459ef..309a960d 100644 --- a/src/test/com/cloudera/sqoop/manager/OracleCompatTest.java +++ b/src/test/com/cloudera/sqoop/manager/OracleCompatTest.java @@ -29,8 +29,6 @@ import com.cloudera.sqoop.SqoopOptions; import com.cloudera.sqoop.testutil.ManagerCompatTestCase; -import junit.framework.AssertionFailedError; - /** * Test the basic Oracle connection manager with the various column types. */ @@ -135,51 +133,26 @@ protected String getTimestampInsertStr(String tsStr) { } @Override - protected String getDateDbOutput(String asInserted) { + protected String getDateSeqOutput(String asInserted) { // DATE is actually a TIMESTAMP in Oracle; add a time component. return asInserted + " 00:00:00.0"; } - @Override - protected String getDateSeqOutput(String asInserted) { - return getDateDbOutput(asInserted); - } - - @Override - protected String getFixedCharDbOut(int fieldWidth, String asInserted) { - return padString(fieldWidth, asInserted); - } - @Override protected String getFixedCharSeqOut(int fieldWidth, String asInserted) { return padString(fieldWidth, asInserted); } - @Override - protected String getRealDbOutput(String realAsInserted) { - return realAsInserted; - } - @Override protected String getRealSeqOutput(String realAsInserted) { return realAsInserted; } - @Override - protected String getFloatDbOutput(String floatAsInserted) { - return floatAsInserted; - } - @Override protected String getFloatSeqOutput(String floatAsInserted) { return floatAsInserted; } - @Override - protected String getDoubleDbOutput(String doubleAsInserted) { - return doubleAsInserted; - } - @Override protected String getDoubleSeqOutput(String doubleAsInserted) { return doubleAsInserted; @@ -219,84 +192,34 @@ public void testEmptyStringCol() { "Oracle treats empty strings as null (non-ANSI compliant). Skipping."); } - // Date and timestamp output values seem to be formatted in multiple - // different ways depending on which Oracle JDBC driver subversion is used. - // We override the test to control the expected output. We actually accept - // one of multiple different output results -- if it fails one output - // format, we check the other. Success on either is success for the whole - // test. Because of this, we can't just use a single getTimestampDbOutput() - // method. - @Override public void testTimestamp1() { - try { - // Older ojdbc6_g jars succeed with this format. - verifyType(getTimestampType(), - getTimestampInsertStr("'2009-04-24 18:24:00'"), - "2009-4-24 18:24:0. 0", - "2009-04-24 18:24:00.0"); - } catch (AssertionFailedError afe) { - // Try the test again with a different timestamp format. - verifyType(getTimestampType(), - getTimestampInsertStr("'2009-04-24 18:24:00'"), - "2009-04-24 18:24:00", - "2009-04-24 18:24:00.0"); - } + verifyType(getTimestampType(), + getTimestampInsertStr("'2009-04-24 18:24:00'"), + "2009-04-24 18:24:00.0"); } @Override public void testTimestamp2() { - try { - LOG.debug("Beginning testTimestamp2"); - verifyType(getTimestampType(), - getTimestampInsertStr("'2009-04-24 18:24:00.0002'"), - "2009-4-24 18:24:0. 200000", - "2009-04-24 18:24:00.0002"); - } catch (AssertionFailedError afe) { - // Try again with the newer version of the timestamp format. - // The in-db format (third argument) looks weird to me, like it's losing - // precision. But the final argument (the to-string version of what we - // extract) is correct, which is what is most important. - verifyType(getTimestampType(), - getTimestampInsertStr("'2009-04-24 18:24:00.0002'"), - "2009-04-24 18:24:00.2", - "2009-04-24 18:24:00.0002"); - } finally { - LOG.debug("End testTimestamp2"); - } + verifyType(getTimestampType(), + getTimestampInsertStr("'2009-04-24 18:24:00.0002'"), + "2009-04-24 18:24:00.0002"); } @Override public void testDate1() { - try { - verifyType("DATE", getDateInsertStr("'2009-01-12'"), - "2009-01-12 00:00:00.0", - getDateSeqOutput("2009-01-12")); - } catch (AssertionFailedError afe) { - // If the above format doesn't work, it might be a newer ojdbc jar, - // which does not append the ".0" on the end. - verifyType("DATE", getDateInsertStr("'2009-01-12'"), - "2009-01-12 00:00:00", - getDateSeqOutput("2009-01-12")); - } + verifyType("DATE", getDateInsertStr("'2009-01-12'"), + getDateSeqOutput("2009-01-12")); } @Override public void testDate2() { - try { - verifyType("DATE", getDateInsertStr("'2009-04-24'"), - "2009-04-24 00:00:00.0", - getDateSeqOutput("2009-04-24")); - } catch (AssertionFailedError afe) { - verifyType("DATE", getDateInsertStr("'2009-04-24'"), - "2009-04-24 00:00:00", - getDateSeqOutput("2009-04-24")); - } + verifyType("DATE", getDateInsertStr("'2009-04-24'"), + getDateSeqOutput("2009-04-24")); } public void testRawVal() { - verifyType("RAW(8)", "'12ABCD'", "12ABCD", - getVarBinarySeqOutput("12ABCD"), true); + verifyType("RAW(8)", "'12ABCD'", getVarBinarySeqOutput("12ABCD"), true); } } diff --git a/src/test/com/cloudera/sqoop/testutil/BaseSqoopTestCase.java b/src/test/com/cloudera/sqoop/testutil/BaseSqoopTestCase.java index 4be43db7..f9370c4a 100644 --- a/src/test/com/cloudera/sqoop/testutil/BaseSqoopTestCase.java +++ b/src/test/com/cloudera/sqoop/testutil/BaseSqoopTestCase.java @@ -416,44 +416,6 @@ protected void removeTableDir() { } } - /** - * Verify that the single-column single-row result can be read back from the - * db. - */ - protected void verifyReadback(int colNum, String expectedVal) { - ResultSet results = null; - try { - results = getManager().readTable(getTableName(), getColNames()); - assertNotNull("Null results from readTable()!", results); - assertTrue("Expected at least one row returned", results.next()); - String resultVal = results.getString(colNum); - LOG.info("Verifying readback from " + getTableName() - + ": got value [" + resultVal + "]"); - LOG.info("Expected value is: [" + expectedVal + "]"); - if (null != expectedVal) { - assertNotNull("Expected non-null result value", resultVal); - } - - assertEquals("Error reading inserted value back from db", expectedVal, - resultVal); - assertFalse("Expected at most one row returned", results.next()); - } catch (SQLException sqlE) { - fail("Got SQLException: " + StringUtils.stringifyException(sqlE)); - } finally { - if (null != results) { - try { - results.close(); - } catch (SQLException sqlE) { - fail("Got SQLException in resultset.close(): " - + StringUtils.stringifyException(sqlE)); - } - } - - // Free internal resources after the readTable. - getManager().release(); - } - } - /** * Create a new string array with 'moreEntries' appended to the 'entries' * array. diff --git a/src/test/com/cloudera/sqoop/testutil/ManagerCompatTestCase.java b/src/test/com/cloudera/sqoop/testutil/ManagerCompatTestCase.java index 07eb7d2b..ecbaa835 100644 --- a/src/test/com/cloudera/sqoop/testutil/ManagerCompatTestCase.java +++ b/src/test/com/cloudera/sqoop/testutil/ManagerCompatTestCase.java @@ -274,22 +274,12 @@ protected String getFalseBoolLiteralSqlInput() { return "false"; } - /** @return How a BOOLEAN column with value TRUE is communicated over JDBC */ - protected String getTrueBoolDbOutput() { - return "true"; - } - /** @return How a BOOLEAN column with value TRUE is represented in a seq-file * import. */ protected String getTrueBoolSeqOutput() { return "true"; } - /** @return How a BOOLEAN column with value FALSE is communicated over JDBC */ - protected String getFalseBoolDbOutput() { - return "false"; - } - /** @return How a BOOLEAN column with value FALSE is represented in a seq-file * import. */ protected String getFalseBoolSeqOutput() { @@ -317,59 +307,28 @@ protected String withDecimalZero(String floatingPointStr) { } } - /** - * A real value inserted as '40' may be returned as '40', '40.', or '40.0', - * etc. Given a string that defines how a real value is inserted, determine - * how it is returned. - * - * @param realAsInserted the string we used in the SQL INSERT statement - * @return how the string version of this as returned by the database is - * represented. - */ - protected String getRealDbOutput(String realAsInserted) { - return withDecimalZero(realAsInserted); - } - /** * @return how a given real value is represented in an imported sequence * file */ protected String getRealSeqOutput(String realAsInserted) { - return getRealDbOutput(realAsInserted); + return withDecimalZero(realAsInserted); } /** - * A float value inserted as '40' may be returned as '40', '40.', or '40.0', - * etc. Given a string that defines how a float value is inserted, determine - * how it is returned. - * - * @param floatAsInserted the string we used in the SQL INSERT statement - * @return how the string version of this as returned by the database is - * represented. + * @return how a given float value is represented in an imported sequence + * file */ - protected String getFloatDbOutput(String floatAsInserted) { + protected String getFloatSeqOutput(String floatAsInserted) { return withDecimalZero(floatAsInserted); } - protected String getFloatSeqOutput(String floatAsInserted) { - return getFloatDbOutput(floatAsInserted); - } - /** - * A double value inserted as '40' may be returned as '40', '40.', or '40.0', - * etc. Given a string that defines how a double value is inserted, determine - * how it is returned. - * - * @param doubleAsInserted the string we used in the SQL INSERT statement - * @return how the string version of this as returned by the database is - * represented. + * @return how a given double value is represented in an imported sequence + * file */ - protected String getDoubleDbOutput(String doubleAsInserted) { - return withDecimalZero(doubleAsInserted); - } - protected String getDoubleSeqOutput(String doubleAsInserted) { - return getDoubleDbOutput(doubleAsInserted); + return withDecimalZero(doubleAsInserted); } /** @@ -402,43 +361,10 @@ protected String getTimestampInsertStr(String insertStr) { return insertStr; } - protected String getDateDbOutput(String dateAsInserted) { - return dateAsInserted; - } - protected String getDateSeqOutput(String dateAsInserted) { return dateAsInserted; } - /** - * Convert an input timestamp to the string representation of the timestamp - * returned by a database select query. - * - * @param tsAsInserted the input timestamp - * @return the string version of this as returned by the database is - * represented. - */ - protected String getTimestampDbOutput(String tsAsInserted) { - if ("null".equals(tsAsInserted)) { - return tsAsInserted; - } - - int dotPos = tsAsInserted.indexOf("."); - if (-1 == dotPos) { - // No dot in the original string; expand to 9 places. - return tsAsInserted + ".000000000"; - } else { - // Default with a dot is to pad the nanoseconds column to 9 places. - int numZerosNeeded = tsAsInserted.length() - dotPos; - String zeros = ""; - for (int i = 0; i < numZerosNeeded; i++) { - zeros = zeros + "0"; - } - - return tsAsInserted + zeros; - } - } - /** * Convert an input timestamp to the string representation of the timestamp * returned by a sequencefile-based import. @@ -463,30 +389,18 @@ protected String getTimestampSeqOutput(String tsAsInserted) { } } - protected String getNumericDbOutput(String numAsInserted) { - return numAsInserted; - } - protected String getNumericSeqOutput(String numAsInserted) { - return getNumericDbOutput(numAsInserted); - } - - protected String getDecimalDbOutput(String numAsInserted) { return numAsInserted; } protected String getDecimalSeqOutput(String numAsInserted) { - return getDecimalDbOutput(numAsInserted); + return numAsInserted; } /** - * @return how a CHAR(fieldWidth) field is returned by the database - * for a given input. + * @return how a CHAR(fieldWidth) field is represented in an imported + * sequence file */ - protected String getFixedCharDbOut(int fieldWidth, String asInserted) { - return asInserted; - } - protected String getFixedCharSeqOut(int fieldWidth, String asInserted) { return asInserted; } @@ -523,14 +437,6 @@ protected String getBlobSeqOutput(String asInserted) { return new BytesWritable(getBlobDbOutput(asInserted)).toString(); } - /** - * @return A String declaring how an inserted VARBINARY will be - * returned to us via the database. - */ - protected String getVarBinaryDbOutput(String asInserted) { - return asInserted; - } - /** * @return A String declaring how an inserted VARBINARY will be * returned to us via the sequencefile. @@ -572,49 +478,31 @@ protected String toLowerHexString(String str) { * Do a full verification test on the singleton value of a given type. * @param colType The SQL type to instantiate the column. * @param insertVal The SQL text to insert a value into the database. - * @param returnVal The string representation of the value as extracted - * from the db. - */ - protected void verifyType(String colType, String insertVal, - String returnVal) { - verifyType(colType, insertVal, returnVal, returnVal); - } - - /** - * Do a full verification test on the singleton value of a given type. - * @param colType The SQL type to instantiate the column. - * @param insertVal The SQL text to insert a value into the database. - * @param returnVal The string representation of the value as extracted from - * the db. * @param seqFileVal The string representation of the value as extracted * through the DBInputFormat, serialized, and injected into a * SequenceFile and put through toString(). This may be slightly * different than what ResultSet.getString() returns, which is used * by returnVal. */ - protected void verifyType(String colType, String insertVal, String returnVal, + protected void verifyType(String colType, String insertVal, String seqFileVal) { - verifyType(colType, insertVal, returnVal, seqFileVal, false); + verifyType(colType, insertVal, seqFileVal, false); } - protected void verifyType(String colType, String insertVal, String returnVal, - String seqFileVal, boolean useIntPrimaryKey) { + protected void verifyType(String colType, String insertVal, String seqFileVal, + boolean useIntPrimaryKey) { - int readBackCol; String readbackPrepend = ""; if (useIntPrimaryKey) { String [] types = { "INTEGER", colType }; String [] vals = { "0", insertVal }; createTableWithColTypes(types, vals); - readBackCol = 2; readbackPrepend = "0,"; // verifyImport will verify the entire row. } else { createTableForColType(colType, insertVal); - readBackCol = 1; } - verifyReadback(readBackCol, returnVal); verifyImport(readbackPrepend + seqFileVal, null); } @@ -629,7 +517,6 @@ public void testStringCol1() { @Test public void testStringCol2() { verifyType("CHAR(32)", STRING_VAL_IN, - getFixedCharDbOut(32, STRING_VAL_OUT), getFixedCharSeqOut(32, STRING_VAL_OUT)); } @@ -661,7 +548,7 @@ public void testBoolean() { return; } verifyType("BOOLEAN", getTrueBoolNumericSqlInput(), - getTrueBoolDbOutput(), getTrueBoolSeqOutput()); + getTrueBoolSeqOutput()); } @Test @@ -672,7 +559,7 @@ public void testBoolean2() { return; } verifyType("BOOLEAN", getFalseBoolNumericSqlInput(), - getFalseBoolDbOutput(), getFalseBoolSeqOutput()); + getFalseBoolSeqOutput()); } @Test @@ -682,7 +569,7 @@ public void testBoolean3() { skipped = true; return; } - verifyType("BOOLEAN", getFalseBoolLiteralSqlInput(), getFalseBoolDbOutput(), + verifyType("BOOLEAN", getFalseBoolLiteralSqlInput(), getFalseBoolSeqOutput()); } @@ -729,50 +616,43 @@ public void testBigInt1() { @Test public void testReal1() { - verifyType("REAL", "256", getRealDbOutput("256"), getRealSeqOutput("256")); + verifyType("REAL", "256", getRealSeqOutput("256")); } @Test public void testReal2() { - verifyType("REAL", "256.45", getRealDbOutput("256.45"), - getRealSeqOutput("256.45")); + verifyType("REAL", "256.45", getRealSeqOutput("256.45")); } @Test public void testFloat1() { - verifyType("FLOAT", "256", getFloatDbOutput("256"), - getFloatSeqOutput("256")); + verifyType("FLOAT", "256", getFloatSeqOutput("256")); } @Test public void testFloat2() { - verifyType("FLOAT", "256.5", getFloatDbOutput("256.5"), - getFloatSeqOutput("256.5")); + verifyType("FLOAT", "256.5", getFloatSeqOutput("256.5")); } @Test public void testDouble1() { - verifyType(getDoubleType(), "-256", getDoubleDbOutput("-256"), - getDoubleSeqOutput("-256")); + verifyType(getDoubleType(), "-256", getDoubleSeqOutput("-256")); } @Test public void testDouble2() { - verifyType(getDoubleType(), "256.45", getDoubleDbOutput("256.45"), - getDoubleSeqOutput("256.45")); + verifyType(getDoubleType(), "256.45", getDoubleSeqOutput("256.45")); } @Test public void testDate1() { verifyType("DATE", getDateInsertStr("'2009-01-12'"), - getDateDbOutput("2009-01-12"), getDateSeqOutput("2009-01-12")); } @Test public void testDate2() { verifyType("DATE", getDateInsertStr("'2009-04-24'"), - getDateDbOutput("2009-04-24"), getDateSeqOutput("2009-04-24")); } @@ -820,7 +700,6 @@ public void testTime4() { public void testTimestamp1() { verifyType(getTimestampType(), getTimestampInsertStr("'2009-04-24 18:24:00'"), - getTimestampDbOutput("2009-04-24 18:24:00"), getTimestampSeqOutput("2009-04-24 18:24:00")); } @@ -830,7 +709,6 @@ public void testTimestamp2() { log.debug("Beginning testTimestamp2"); verifyType(getTimestampType(), getTimestampInsertStr("'2009-04-24 18:24:00.0002'"), - getTimestampDbOutput("2009-04-24 18:24:00.0002"), getTimestampSeqOutput("2009-04-24 18:24:00.0002")); } finally { log.debug("End testTimestamp2"); @@ -850,21 +728,18 @@ public void testTimestamp3() { @Test public void testNumeric1() { verifyType(getNumericType(), "1", - getNumericDbOutput("1"), getNumericSeqOutput("1")); } @Test public void testNumeric2() { verifyType(getNumericType(), "-10", - getNumericDbOutput("-10"), getNumericSeqOutput("-10")); } @Test public void testNumeric3() { verifyType(getNumericType(), "3.14159", - getNumericDbOutput("3.14159"), getNumericSeqOutput("3.14159")); } @@ -872,7 +747,6 @@ public void testNumeric3() { public void testNumeric4() { verifyType(getNumericType(), "3000000000000000000.14159", - getNumericDbOutput("3000000000000000000.14159"), getNumericSeqOutput("3000000000000000000.14159")); } @@ -880,7 +754,6 @@ public void testNumeric4() { public void testNumeric5() { verifyType(getNumericType(), "99999999999999999999.14159", - getNumericDbOutput("99999999999999999999.14159"), getNumericSeqOutput("99999999999999999999.14159")); } @@ -889,28 +762,24 @@ public void testNumeric5() { public void testNumeric6() { verifyType(getNumericType(), "-99999999999999999999.14159", - getNumericDbOutput("-99999999999999999999.14159"), getNumericSeqOutput("-99999999999999999999.14159")); } @Test public void testDecimal1() { verifyType(getDecimalType(), "1", - getDecimalDbOutput("1"), getDecimalSeqOutput("1")); } @Test public void testDecimal2() { verifyType(getDecimalType(), "-10", - getDecimalDbOutput("-10"), getDecimalSeqOutput("-10")); } @Test public void testDecimal3() { verifyType(getDecimalType(), "3.14159", - getDecimalDbOutput("3.14159"), getDecimalSeqOutput("3.14159")); } @@ -918,7 +787,6 @@ public void testDecimal3() { public void testDecimal4() { verifyType(getDecimalType(), "3000000000000000000.14159", - getDecimalDbOutput("3000000000000000000.14159"), getDecimalSeqOutput("3000000000000000000.14159")); } @@ -926,7 +794,6 @@ public void testDecimal4() { public void testDecimal5() { verifyType(getDecimalType(), "99999999999999999999.14159", - getDecimalDbOutput("99999999999999999999.14159"), getDecimalSeqOutput("99999999999999999999.14159")); } @@ -934,7 +801,6 @@ public void testDecimal5() { public void testDecimal6() { verifyType(getDecimalType(), "-99999999999999999999.14159", - getDecimalDbOutput("-99999999999999999999.14159"), getDecimalSeqOutput("-99999999999999999999.14159")); } @@ -958,7 +824,6 @@ protected void verifyClob(String insertVal, String returnVal, String [] checkCol = { "DATA_COL0", "DATA_COL1" }; createTableWithColTypes(types, vals); - verifyReadback(2, returnVal); verifyImport("1," + seqFileVal, checkCol); } @@ -1042,7 +907,6 @@ public void testVarBinary() { } verifyType(getVarBinaryType(), "'F00FABCD'", - getVarBinaryDbOutput("F00FABCD"), getVarBinarySeqOutput("F00FABCD"), true); } }