|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase org.eigenbase.test.DiffTestCase net.sf.farrago.test.ResultSetTestCase net.sf.farrago.test.FarragoJdbcTest
public class FarragoJdbcTest
FarragoJdbcTest tests specifics of the Farrago implementation of the JDBC API. See also unitsql/jdbc/*.sql.
TODO: test:
Nested Class Summary | |
---|---|
class |
FarragoJdbcTest.FarragoJdbcTester
|
static interface |
FarragoJdbcTest.JdbcTester
|
protected static class |
FarragoJdbcTest.TestJavaType
Defines a Java type. |
private static class |
FarragoJdbcTest.TestSqlApproxType
Defines class for testing approximate sql type |
private static class |
FarragoJdbcTest.TestSqlDecimalType
Defines class for testing decimal sql type |
private static class |
FarragoJdbcTest.TestSqlIntegralType
Defines class for testing integral sql type |
private static class |
FarragoJdbcTest.TestSqlType
Defines a SQL type, and a corresponding column in the datatypes table, and some operations particular to each type. |
Field Summary | |
---|---|
private static BigDecimal |
bigDecimalValue
|
private static int |
BIGINT
|
private static Long |
bigIntObj
|
private static int |
BINARY
|
private static int |
BOOLEAN
|
private static Boolean |
boolObj
|
private static boolean |
boolValue
|
private static byte[] |
bytes
|
private static int |
CHAR
|
private static String |
charObj
|
private static String[] |
columnNames
|
protected static String |
columnStr
|
protected static String |
columnTypeStr
|
protected Connection |
connection
JDBC connection to Farrago database. |
private static Date |
date
|
private static int |
DATE
|
private static Date |
dateNoTime
|
private static String |
dateStr
|
private static int |
DECIMAL
|
private static int |
DECIMAL73
|
private static BigDecimal |
decimal73Obj
|
private static BigDecimal |
decimalObj
|
private static int |
DOUBLE
|
private static Double |
doubleObj
|
private static double |
doubleValue1
|
private static double |
doubleValue2
|
private static int |
FLOAT
|
private static Float |
floatObj
|
private static float |
floatValue1
|
private static float |
floatValue2
|
private static int |
INTEGER
|
private static Integer |
integerObj
|
private static byte |
maxByte
|
private static double |
maxDouble
|
private static float |
maxFloat
|
private static int |
maxInt
|
private static long |
maxLong
|
private static short |
maxShort
|
private static byte |
minByte
|
private static double |
minDouble
|
private static float |
minFloat
|
private static int |
minInt
|
private static long |
minLong
|
private static short |
minShort
|
protected static String |
paramStr
|
protected PreparedStatement |
preparedStmt
PreparedStatement for processing queries. |
private static int |
REAL
|
protected static boolean |
schemaExists
|
private static int |
SMALLINT
|
private static Short |
smallIntObj
|
protected Statement |
stmt
Statement for processing queries. |
private static String |
stringValue
|
private static Calendar |
sydneyCal
A point of time in Sydney, Australia. |
private FarragoJdbcTest.JdbcTester |
tester
Tester to use |
private static Time |
time
|
private static int |
TIME
|
private static Time |
timeNoDate
|
private static Timestamp |
timestamp
|
private static int |
TIMESTAMP
|
private static Timestamp |
timestampNoPrec
|
private static String |
timestampStr
|
private static String |
timeStr
|
private static int |
TINYINT
|
private static Byte |
tinyIntObj
|
private static boolean |
todo
|
protected static Logger |
tracer
Logger to use for test tracing. |
protected Object[] |
values
|
private static int |
VARBINARY
|
private static int |
VARCHAR
|
private static String |
varcharObj
|
Fields inherited from class net.sf.farrago.test.ResultSetTestCase |
---|
resultSet |
Fields inherited from class org.eigenbase.test.DiffTestCase |
---|
logFile, logOutputStream, refFile |
Constructor Summary | |
---|---|
FarragoJdbcTest(String testName)
Creates a new FarragoJdbcTest object. |
Method Summary | |
---|---|
protected static void |
assertContains(String expected,
String actual)
Asserts that a given string contains a given substring. |
static void |
assertEquals(String message,
Object expected,
Object actual)
Overrides Assert.assertEquals(String,Object,Object) to handle
byte arrays correctly. |
static void |
assertExceptionMatches(Throwable e,
String expectedPattern)
|
private void |
assertTimestampBecomes(String expected)
|
protected boolean |
checkCancelException(SQLException ex)
|
void |
checkPreparedStmtDataTypes(String query)
|
protected void |
checkResults(FarragoJdbcTest.TestJavaType javaType)
|
protected int |
checkResults(ResultSet resultSet,
FarragoJdbcTest.TestJavaType javaType)
|
private void |
checkSet(FarragoJdbcTest.TestJavaType javaType,
FarragoJdbcTest.TestSqlType[] types,
Object value)
|
private void |
checkSet(FarragoJdbcTest.TestJavaType javaType,
FarragoJdbcTest.TestSqlType sqlType,
Object value)
|
private void |
checkSetBigDecimal()
|
private void |
checkSetBooleanFalse()
|
private void |
checkSetByteMax()
|
private void |
checkSetByteMin()
|
private void |
checkSetBytes()
|
private void |
checkSetDate()
|
private void |
checkSetDoubleMax()
|
private void |
checkSetDoubleMin()
|
private void |
checkSetFloat()
|
private void |
checkSetFloatMax()
|
private void |
checkSetFloatMin()
|
private void |
checkSetIntMax()
|
private void |
checkSetIntMin()
|
private void |
checkSetInvalidIndex(int column)
|
private void |
checkSetLongMax()
|
private void |
checkSetLongMin()
|
private void |
checkSetNull()
|
private void |
checkSetObject()
|
private void |
checkSetShortMax()
|
private void |
checkSetShortMin()
|
private void |
checkSetString()
|
private void |
checkSetTime()
|
private void |
checkSetTimestamp()
|
private boolean |
checkThrowable(String error,
String expectedPattern,
Throwable throwable)
|
private void |
doEmpInsert(String name,
int i)
|
private void |
executeAndCancel(String sql,
int waitMillis)
|
protected FarragoJdbcTest.JdbcTester |
getTester(String name)
|
protected File |
getTestlogRoot()
|
void |
insertDataTypes()
|
private static Calendar |
makeCalendar(String tz,
int year,
int month,
int date,
int hour,
int minute,
int second,
int millis)
Creates a calendar. |
private void |
prepareAndCancel(String sql,
int waitMillis)
|
protected void |
queryCancel(boolean synchronous,
String executorType)
|
protected void |
queryCancel(int waitMillis,
String executorType,
boolean subquery)
|
protected void |
quietlyDropSchema(String schemaName)
|
private void |
repeatQuery(boolean flushCache)
|
protected void |
setUp()
|
private void |
setValidateOnPrepare(boolean currSetting,
boolean newSetting)
|
static Test |
suite()
|
protected void |
tearDown()
|
void |
testCachedQuery()
Tests re-execution of an unprepared query. |
void |
testChar()
Tests char and varchar Data Type in JDBC. |
void |
testCheckParametersSet()
|
void |
testCreateView()
|
void |
testCreateViewNegative()
Tests that a DDL statement fails because we have not specified a target schema. |
void |
testDataTypes()
|
void |
testDateTimeSql()
Tests sql Date/Time to java.sql Date/Time translations. |
void |
testDdlNoValidateOnPrepare()
Verifies that DDL statements are not validated at prepare time, but at execution time |
void |
testDdlValidateOnPrepare()
Verifies that DDL statements are validated at prepare time, not just execution time. |
void |
testDynamicParameter()
Tests valid usage of a dynamic parameter and retrieval of associated metadata. |
void |
testDynamicParameterExecuteImmediate()
Tests invalid attempt to execute a statement with a dynamic parameter without preparation. |
void |
testDynamicParameterInUpdate()
Tests metadata for dynamic parameter in an UPDATE statement. |
void |
testEarlyCancel()
|
void |
testFennelQueryAsynchronousCancel()
|
void |
testFennelQuerySynchronousCancel()
|
void |
testFoo()
|
void |
testInteger()
Tests integer Data Type in JDBC. |
void |
testInvalidDynamicParameter()
Tests invalid usage of a dynamic parameter. |
void |
testJavaQueryAsynchronousCancel()
|
void |
testJavaQueryAsynchronousCancelRepeated()
|
void |
testJavaQuerySynchronousCancel()
|
void |
testMaxRows()
Tests Statement.setMaxRows(int) . |
void |
testMultipleDynamicParameters1()
Tests valid usage of multiple dynamic parameters. |
void |
testMultipleDynamicParameters2()
Tests valid usage of multiple dynamic parameters, including the fix for FRG-72. |
void |
testOrphans()
Tests orphan statement and resultset cleanup. |
void |
testPlannerCancel()
|
void |
testPreparedMetaData()
Tests retrieval of ResultSetMetaData without actually executing query. |
void |
testPreparedQuery()
Tests re-execution of a prepared query. |
void |
testPreparedStmtDataTypes()
|
void |
testSetTimestamp()
Tests inserting timestamp values via a dynamic parameter with and without a calendar object. |
void |
testSubqueryCancel()
|
void |
testTimeout()
Tests setQueryTimeout. |
void |
testUdxAsynchronousCancel()
|
void |
testUdxSynchronousCancel()
|
void |
testUncachedQuery()
Tests re-execution of an unprepared query with statement caching disabled. |
private String |
toString(Object o)
|
protected String |
toStringThreadInfo(Thread thread)
Returns string representation of thread info. |
private boolean |
tryExecuteQuery(PreparedStatement stmt)
attempts executeQuery on a PreparedStatement. |
private boolean |
tryExecuteQuery(Statement stmt,
String sql)
attempts executeQuery on a plain Statement. |
private boolean |
tryResultSet(ResultSet rset)
attempts to use a ResultSet. |
protected void |
udxCancel(boolean synchronous)
|
protected void |
udxCancel(int waitMillis)
|
Methods inherited from class net.sf.farrago.test.ResultSetTestCase |
---|
compareResultList, compareResultLists, compareResultSet, compareResultSetWithDelta, compareResultSetWithPattern, getResultSetCount |
Methods inherited from class org.eigenbase.test.DiffTestCase |
---|
addDiffMask, addIgnorePattern, diffFile, diffLines, diffTestLog, fileContents, openTestLog, openTestLogOutputStream, setGC, setRefFileDiffMasks, setVerbose |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, 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, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final Logger tracer
private static final byte minByte
private static final byte maxByte
private static final short minShort
private static final short maxShort
private static final int minInt
private static final int maxInt
private static final long minLong
private static final long maxLong
private static final float minFloat
private static final float maxFloat
private static final float floatValue1
private static final float floatValue2
private static final double minDouble
private static final double maxDouble
private static final double doubleValue1
private static final double doubleValue2
private static final boolean boolValue
private static final BigDecimal bigDecimalValue
private static final String stringValue
private static final byte[] bytes
private static final Calendar sydneyCal
private static final Time time
private static final Date date
private static final Timestamp timestamp
private static final String dateStr
private static final String timeStr
private static final String timestampStr
private static final Time timeNoDate
private static final Date dateNoTime
private static final Timestamp timestampNoPrec
private static final Byte tinyIntObj
private static final Short smallIntObj
private static final Integer integerObj
private static final Long bigIntObj
private static final Float floatObj
private static final Double doubleObj
private static final Boolean boolObj
private static final BigDecimal decimalObj
private static final BigDecimal decimal73Obj
private static final String charObj
private static final String varcharObj
private static final int TINYINT
private static final int SMALLINT
private static final int INTEGER
private static final int BIGINT
private static final int REAL
private static final int FLOAT
private static final int DOUBLE
private static final int BOOLEAN
private static final int CHAR
private static final int VARCHAR
private static final int BINARY
private static final int VARBINARY
private static final int TIME
private static final int DATE
private static final int TIMESTAMP
private static final int DECIMAL
private static final int DECIMAL73
protected static boolean schemaExists
private static final String[] columnNames
protected static String columnTypeStr
protected static String columnStr
protected static String paramStr
private static final boolean todo
protected Object[] values
private FarragoJdbcTest.JdbcTester tester
protected Connection connection
protected PreparedStatement preparedStmt
protected Statement stmt
Constructor Detail |
---|
public FarragoJdbcTest(String testName) throws Exception
Exception
Method Detail |
---|
protected FarragoJdbcTest.JdbcTester getTester(String name) throws Exception
Exception
protected File getTestlogRoot() throws Exception
getTestlogRoot
in class DiffTestCase
Exception
public static Test suite()
private static Calendar makeCalendar(String tz, int year, int month, int date, int hour, int minute, int second, int millis)
public void testJavaQuerySynchronousCancel() throws Exception
Exception
public void testJavaQueryAsynchronousCancel() throws Exception
Exception
public void testJavaQueryAsynchronousCancelRepeated() throws Exception
Exception
public void testFennelQuerySynchronousCancel() throws Exception
Exception
public void testFennelQueryAsynchronousCancel() throws Exception
Exception
public void testUdxSynchronousCancel() throws Exception
Exception
public void testUdxAsynchronousCancel() throws Exception
Exception
public void testSubqueryCancel() throws Exception
Exception
public void testPlannerCancel() throws Exception
Exception
public void testEarlyCancel() throws Exception
Exception
protected void queryCancel(boolean synchronous, String executorType) throws Exception
Exception
protected void queryCancel(int waitMillis, String executorType, boolean subquery) throws Exception
Exception
protected void udxCancel(boolean synchronous) throws Exception
Exception
protected void udxCancel(int waitMillis) throws Exception
Exception
protected boolean checkCancelException(SQLException ex)
private void executeAndCancel(String sql, int waitMillis) throws SQLException
SQLException
private void prepareAndCancel(String sql, int waitMillis) throws SQLException
SQLException
public void testCheckParametersSet() throws Exception
Exception
public void testPreparedStmtDataTypes() throws Exception
Exception
public void checkPreparedStmtDataTypes(String query) throws Exception
Exception
protected void tearDown() throws Exception
tearDown
in class DiffTestCase
Exception
protected void setUp() throws Exception
setUp
in class DiffTestCase
Exception
private void checkSetObject() throws SQLException
SQLException
private void checkSetTimestamp() throws Exception
Exception
private void checkSetTime() throws Exception
Exception
private void checkSetDate() throws Exception
Exception
private void checkSetBytes() throws Exception
Exception
private void checkSetBigDecimal() throws Exception
Exception
private void checkSetBooleanFalse() throws Exception
Exception
private void checkSetDoubleMax() throws Exception
Exception
private void checkSetDoubleMin() throws Exception
Exception
private void checkSetFloatMax() throws Exception
Exception
private void checkSetFloat() throws Exception
Exception
private void checkSetFloatMin() throws Exception
Exception
private void checkSetLongMax() throws Exception
Exception
private void checkSetLongMin() throws Exception
Exception
private void checkSetIntMax() throws Exception
Exception
private void checkSetIntMin() throws Exception
Exception
private void checkSetShortMax() throws Exception
Exception
private void checkSetShortMin() throws Exception
Exception
private void checkSetByteMax() throws Exception
Exception
private void checkSetByteMin() throws Exception
Exception
private void checkSetNull() throws Exception
Exception
private void checkSetString() throws Exception
Exception
protected int checkResults(ResultSet resultSet, FarragoJdbcTest.TestJavaType javaType) throws SQLException
SQLException
protected void checkResults(FarragoJdbcTest.TestJavaType javaType) throws SQLException
SQLException
public static void assertEquals(String message, Object expected, Object actual)
Assert.assertEquals(String,Object,Object)
to handle
byte arrays correctly.
private String toString(Object o)
protected String toStringThreadInfo(Thread thread)
private void checkSet(FarragoJdbcTest.TestJavaType javaType, FarragoJdbcTest.TestSqlType[] types, Object value) throws Exception
Exception
private boolean checkThrowable(String error, String expectedPattern, Throwable throwable)
private void checkSet(FarragoJdbcTest.TestJavaType javaType, FarragoJdbcTest.TestSqlType sqlType, Object value) throws Exception
Exception
private void checkSetInvalidIndex(int column) throws Exception
Exception
public void insertDataTypes() throws Exception
Exception
public void testDataTypes() throws Exception
Exception
public void testDateTimeSql() throws Exception
Exception
public void testTimeout() throws Exception
Exception
- .public void testOrphans() throws Exception
Exception
public void testChar() throws Exception
Exception
- .public static void assertExceptionMatches(Throwable e, String expectedPattern)
private void doEmpInsert(String name, int i) throws SQLException
SQLException
public void testInteger() throws Exception
Exception
- .public void testPreparedQuery() throws Exception
Exception
- .public void testCachedQuery() throws Exception
Exception
- .public void testUncachedQuery() throws Exception
Exception
- .private void repeatQuery(boolean flushCache) throws Exception
Exception
public void testPreparedMetaData() throws Exception
Exception
public void testDdlValidateOnPrepare()
public void testDdlNoValidateOnPrepare()
private void setValidateOnPrepare(boolean currSetting, boolean newSetting)
public void testDynamicParameter() throws Exception
Exception
public void testMultipleDynamicParameters1() throws Exception
Exception
public void testMultipleDynamicParameters2() throws Exception
Exception
public void testDynamicParameterInUpdate() throws Exception
Exception
public void testInvalidDynamicParameter() throws Exception
Exception
public void testDynamicParameterExecuteImmediate() throws Exception
Exception
public void testMaxRows() throws Exception
Statement.setMaxRows(int)
.
Exception
protected void quietlyDropSchema(String schemaName)
public void testFoo() throws SQLException
SQLException
public void testCreateView() throws SQLException
SQLException
public void testCreateViewNegative() throws SQLException
SQLException
protected static void assertContains(String expected, String actual)
AssertionFailedError
if not.
expected
- Expected substringactual
- Stringprivate boolean tryExecuteQuery(Statement stmt, String sql)
private boolean tryExecuteQuery(PreparedStatement stmt)
private boolean tryResultSet(ResultSet rset)
public void testSetTimestamp() throws SQLException
SQLException
PreparedStatement.setTimestamp(int, java.sql.Timestamp)
,
PreparedStatement.setTimestamp(int, java.sql.Timestamp,
java.util.Calendar)
private void assertTimestampBecomes(String expected) throws SQLException
SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |