|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.derbyTesting.junit.BaseTestCase
org.apache.derbyTesting.junit.BaseJDBCTestCase
org.apache.derbyTesting.functionTests.tests.lang.CastingTest
public class CastingTest
| Nested Class Summary | |
|---|---|
static class |
CastingTest.TypedColumn
|
| Field Summary | |
|---|---|
static boolean |
_
|
static int |
BIGINT_OFFSET
|
static int |
BLOB_OFFSET
|
static int |
CHAR_FOR_BIT_OFFSET
|
static int |
CHAR_OFFSET
|
static int |
CLOB_OFFSET
|
static int |
DATE_OFFSET
|
static int |
DECIMAL_OFFSET
|
static int |
DOUBLE_OFFSET
|
private static java.lang.String[][] |
explicitCastValues
|
private static CastingTest.TypedColumn[] |
ILLEGAL_BOOLEAN_CASTS
|
static java.lang.String |
ILLEGAL_CAST_EXCEPTION_SQLSTATE
|
static int |
INTEGER_OFFSET
|
static int[] |
jdbcTypes
|
static java.lang.String |
LANG_FORMAT_EXCEPTION_SQLSTATE
|
static java.lang.String |
LANG_NOT_COMPARABLE_SQLSTATE
|
static java.lang.String |
LANG_NOT_STORABLE_SQLSTATE
|
private static CastingTest.TypedColumn[] |
LEGAL_BOOLEAN_CASTS
|
static int |
LONGVARCHAR_FOR_BIT_OFFSET
|
static int |
LONGVARCHAR_OFFSET
|
static java.lang.String |
METHOD_NOT_FOUND_SQLSTATE
|
static int |
NULL_DATA_OFFSET
|
static java.lang.String |
NULL_VALUE
|
static int |
REAL_OFFSET
|
static int |
SMALLINT_OFFSET
|
static java.lang.String[][] |
SQLData
|
static int |
SQLTYPE_ARRAY_SIZE
|
static boolean[][] |
T_146
Table 146 - Supported explicit casts between Built-in DataTypes This table has THE FOR BIT DATA TYPES broken out into separate columns for clarity and testing |
static boolean[][] |
T_147a
Table 147 describes Data Type Compatibility for Assignments The table 147a covers the assignments as they do differ somewhat from comparisons which can be found in 147b |
static boolean[][] |
T_147b
|
static int |
TIME_OFFSET
|
static int |
TIMESTAMP_OFFSET
|
static int |
VALID_DATA_OFFSET
|
static java.lang.String |
VALID_DATE_STRING
|
static java.lang.String |
VALID_TIME_STRING
|
static java.lang.String |
VALID_TIMESTAMP_STRING
|
static int |
VARCHAR_FOR_BIT_OFFSET
|
static int |
VARCHAR_OFFSET
|
static boolean |
X
|
| Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase |
|---|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE |
| Constructor Summary | |
|---|---|
CastingTest(java.lang.String name)
|
|
| Method Summary | |
|---|---|
private void |
assertAllTypesCovered()
|
private void |
assertBooleanResults(java.lang.String queryText,
boolean expectedValue,
int expectedRowCount)
|
private void |
assertNoBoolean()
|
private void |
assertScalarResult(java.lang.String queryText,
int expectedValue)
|
private java.sql.PreparedStatement |
chattyPrepare(java.lang.String text)
Prepare a statement and report its sql text. |
private static void |
checkSupportedAssignment(int sourceType,
int targetType)
|
private static void |
checkSupportedCast(int sourceType,
int targetType)
|
private static void |
checkSupportedComparison(int sourceType,
int targetType)
|
private void |
expectError(java.lang.String sqlState,
java.lang.String query)
Assert that the statement text, when compiled, raises an exception |
private static java.lang.String |
formatString(java.lang.String str)
|
private static java.lang.String |
getCompatibleString(int sourceType,
int targetType,
int dataOffset)
|
private static java.lang.String |
getShortTypeName(int type)
Truncates (*) from typename |
private static java.lang.String |
getTableName(int type)
Build a unique table name from the type |
private void |
goodStatement(java.lang.String ddl)
Run good DDL. |
private static boolean |
isBinaryType(int typeOffset)
|
private static boolean |
isCastException(java.sql.SQLException se)
|
private static boolean |
isCharacterType(int typeOffset)
|
private static boolean |
isClob(int typeOffset)
|
private static boolean |
isDateTimeTimestamp(int typeOffset)
|
private static boolean |
isLob(int typeOffset)
|
private static boolean |
isLongType(int typeOffset)
|
private static boolean |
isMethodNotFoundException(java.sql.SQLException se)
|
private static boolean |
isNotComparableException(java.sql.SQLException se)
|
private static boolean |
isNotStorableException(java.sql.SQLException se)
|
private static boolean |
isSupportedAssignment(int sourceType,
int targetType)
|
private static boolean |
isSupportedCast(int sourceType,
int targetType)
|
private static boolean |
isSupportedComparison(int sourceType,
int targetType)
|
private java.lang.String |
makeCastedColumnList(java.lang.String columnName,
CastingTest.TypedColumn[] targetTypes)
|
private java.lang.String |
makeColumnList(CastingTest.TypedColumn[] columns)
|
private java.lang.String |
makeRepeatedColumnList(java.lang.String columnName,
int N)
|
private void |
makeTableForCasts(java.lang.String tableName,
CastingTest.TypedColumn[] columns)
|
protected void |
setUp()
|
private static boolean |
sqlStateMatches(java.sql.SQLException se,
java.lang.String expectedValue)
|
static junit.framework.Test |
suite()
Testing server-side behaviour so run in embedded only. |
protected void |
tearDown()
Tear down this fixture, sub-classes should call super.tearDown(). |
void |
test_derby887()
Verify that DERBY-887 is fixed. |
void |
test_illegalBooleanCasts()
Verify that the illegal boolean casts work as expected. |
void |
test_legalBooleanCasts()
Verify that the legal boolean casts work as expected. |
void |
testAssignments()
|
void |
testComparisons()
|
void |
testExplicitCasts()
|
| 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, 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 |
|---|
public static java.lang.String VALID_DATE_STRING
public static java.lang.String VALID_TIME_STRING
public static java.lang.String VALID_TIMESTAMP_STRING
public static java.lang.String NULL_VALUE
public static java.lang.String ILLEGAL_CAST_EXCEPTION_SQLSTATE
public static java.lang.String LANG_NOT_STORABLE_SQLSTATE
public static java.lang.String LANG_NOT_COMPARABLE_SQLSTATE
public static java.lang.String METHOD_NOT_FOUND_SQLSTATE
public static java.lang.String LANG_FORMAT_EXCEPTION_SQLSTATE
public static int SQLTYPE_ARRAY_SIZE
public static int SMALLINT_OFFSET
public static int INTEGER_OFFSET
public static int BIGINT_OFFSET
public static int DECIMAL_OFFSET
public static int REAL_OFFSET
public static int DOUBLE_OFFSET
public static int CHAR_OFFSET
public static int VARCHAR_OFFSET
public static int LONGVARCHAR_OFFSET
public static int CHAR_FOR_BIT_OFFSET
public static int VARCHAR_FOR_BIT_OFFSET
public static int LONGVARCHAR_FOR_BIT_OFFSET
public static int CLOB_OFFSET
public static int DATE_OFFSET
public static int TIME_OFFSET
public static int TIMESTAMP_OFFSET
public static int BLOB_OFFSET
public static int[] jdbcTypes
public static int NULL_DATA_OFFSET
public static int VALID_DATA_OFFSET
public static java.lang.String[][] SQLData
public static final boolean _
public static final boolean X
public static final boolean[][] T_146
public static final boolean[][] T_147a
public static final boolean[][] T_147b
private static final java.lang.String[][] explicitCastValues
private static final CastingTest.TypedColumn[] LEGAL_BOOLEAN_CASTS
private static final CastingTest.TypedColumn[] ILLEGAL_BOOLEAN_CASTS
| Constructor Detail |
|---|
public CastingTest(java.lang.String name)
| Method Detail |
|---|
protected void setUp()
throws java.sql.SQLException
setUp in class junit.framework.TestCasejava.sql.SQLException
public void testAssignments()
throws java.sql.SQLException
java.sql.SQLException
public void testExplicitCasts()
throws java.sql.SQLException
java.sql.SQLException
public void testComparisons()
throws java.sql.SQLException
java.sql.SQLException
public void test_derby887()
throws java.lang.Exception
java.lang.Exception
public void test_legalBooleanCasts()
throws java.lang.Exception
Verify that the legal boolean casts work as expected. This test helps verify that DERBY-887 is fixed. Verifies the following:
The following can't be tested until the BOOLEAN type is re-enabled:
java.lang.Exception
private void makeTableForCasts(java.lang.String tableName,
CastingTest.TypedColumn[] columns)
throws java.lang.Exception
java.lang.Exceptionprivate java.lang.String makeColumnList(CastingTest.TypedColumn[] columns)
private java.lang.String makeCastedColumnList(java.lang.String columnName,
CastingTest.TypedColumn[] targetTypes)
private java.lang.String makeRepeatedColumnList(java.lang.String columnName,
int N)
private void assertBooleanResults(java.lang.String queryText,
boolean expectedValue,
int expectedRowCount)
throws java.lang.Exception
java.lang.Exception
private void assertScalarResult(java.lang.String queryText,
int expectedValue)
throws java.lang.Exception
java.lang.Exception
private void assertNoBoolean()
throws java.lang.Exception
java.lang.Exception
private void assertAllTypesCovered()
throws java.lang.Exception
java.lang.Exception
public void test_illegalBooleanCasts()
throws java.lang.Exception
Verify that the illegal boolean casts work as expected. This test helps verify that DERBY-887 is fixed. Verifies the following:
The following can't be tested until the BOOLEAN type is re-enabled:
java.lang.Exception
protected void tearDown()
throws java.sql.SQLException,
java.lang.Exception
BaseJDBCTestCase
tearDown in class BaseJDBCTestCasejava.sql.SQLException
java.lang.Exceptionprivate static java.lang.String getTableName(int type)
type - table offset
private static java.lang.String getShortTypeName(int type)
type - -
Type offset
private static java.lang.String getCompatibleString(int sourceType,
int targetType,
int dataOffset)
private static boolean isSupportedCast(int sourceType,
int targetType)
private static boolean isSupportedAssignment(int sourceType,
int targetType)
private static boolean isSupportedComparison(int sourceType,
int targetType)
private static boolean isCastException(java.sql.SQLException se)
private static boolean isMethodNotFoundException(java.sql.SQLException se)
private static boolean sqlStateMatches(java.sql.SQLException se,
java.lang.String expectedValue)
private static boolean isNotStorableException(java.sql.SQLException se)
private static boolean isNotComparableException(java.sql.SQLException se)
private static void checkSupportedCast(int sourceType,
int targetType)
private static void checkSupportedAssignment(int sourceType,
int targetType)
private static void checkSupportedComparison(int sourceType,
int targetType)
private static boolean isLongType(int typeOffset)
private static boolean isCharacterType(int typeOffset)
private static boolean isBinaryType(int typeOffset)
private static boolean isDateTimeTimestamp(int typeOffset)
private static boolean isClob(int typeOffset)
private static boolean isLob(int typeOffset)
private static java.lang.String formatString(java.lang.String str)
private void goodStatement(java.lang.String ddl)
throws java.sql.SQLException
java.sql.SQLException
private void expectError(java.lang.String sqlState,
java.lang.String query)
private java.sql.PreparedStatement chattyPrepare(java.lang.String text)
throws java.sql.SQLException
java.sql.SQLExceptionpublic static junit.framework.Test suite()
|
Built on Sat 2009-11-28 18:44:18-0800, from revision 885187 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||