public class TimestampArithTest extends BaseJDBCTestCase
Modifier and Type | Class and Description |
---|---|
private static class |
TimestampArithTest.OneAddTest |
private static class |
TimestampArithTest.OneDiffTest |
private static class |
TimestampArithTest.OneStringAddTest |
private static class |
TimestampArithTest.OneStringDiffTest |
private static class |
TimestampArithTest.OneTest
Abstract class that factors out all the common code for the timestamps tests.
|
Modifier and Type | Field and Description |
---|---|
private static TimestampArithTest.OneAddTest[] |
addBetweenDateAndTsTests
date + timestamp
|
private static TimestampArithTest.OneStringAddTest[] |
addBetweenStringTests |
private static TimestampArithTest.OneAddTest[] |
addBetweenTsTests
timestamp + timestamp
|
private static int |
DAY_INTERVAL |
private static TimestampArithTest.OneDiffTest[] |
diffBetweenDateAndTsTests
date - timestamp
|
private static TimestampArithTest.OneStringDiffTest[] |
diffBetweenStringTests |
private static TimestampArithTest.OneDiffTest[] |
diffBetweenTsAndDateTests
timestamp - date
|
private static TimestampArithTest.OneDiffTest[] |
diffBetweenTsTests
timestamp - timestamp
|
private static int |
FRAC_SECOND_INTERVAL |
private static int |
HOUR_INTERVAL |
private static java.lang.String[] |
intervalJdbcNames |
private static java.lang.String[][] |
invalid |
private static int |
MINUTE_INTERVAL |
private static int |
MONTH_INTERVAL |
private static TimestampArithTest.OneTest[] |
overflowTests
check overflow conditions
|
private static int |
QUARTER_INTERVAL |
private static int |
SECOND_INTERVAL |
private static java.sql.Statement |
stmt |
private static java.sql.PreparedStatement[] |
tsAddPS |
private static java.sql.PreparedStatement[] |
tsDiffPS |
private static int |
WEEK_INTERVAL |
private static int |
YEAR_INTERVAL |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
TimestampArithTest(java.lang.String name)
Basic constructor.
|
Modifier and Type | Method and Description |
---|---|
private static void |
closeAll(java.sql.Statement[] statements)
Close all statements in an array.
|
private static java.lang.String |
composeSqlStr(java.lang.String fn,
int interval,
java.lang.String parm1,
java.lang.String parm2) |
private static java.lang.String |
dateTimeToLiteral(java.lang.Object ts) |
private static java.sql.Date |
dt(java.lang.String s) |
private static void |
expectException(java.sql.PreparedStatement ps,
java.lang.Object obj1,
java.lang.Object obj2,
java.lang.String expectedSQLState,
java.lang.String label) |
private static void |
expectNullResult(java.sql.PreparedStatement ps) |
protected void |
initializeConnection(java.sql.Connection conn)
Allow a sub-class to initialize a connection to provide
consistent connection state for its tests.
|
private static void |
setDateTime(java.sql.PreparedStatement ps,
int parameterIdx,
java.util.Date dateTime) |
static junit.framework.Test |
suite() |
void |
testAddBetweenDateAndTimestamps() |
void |
testAddBetweenString() |
void |
testAddBetweenTimestamp() |
void |
testDiffBetweenDateAndTimestamp() |
void |
testDiffBetweenString() |
void |
testDiffBetweenTimestamp() |
void |
testDiffBetweenTimestampAndDate() |
void |
testInvalidArgTypes() |
void |
testInvalidLengths() |
void |
testNullInputs()
Tests null inputs, each position, each type.
|
void |
testOverflow() |
private static java.sql.Timestamp |
ts(java.lang.String s) |
assertCallError, assertCheckTable, assertCommitError, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertResults, assertResults, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, chattyPrepare, chattyPrepareCall, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, dumpRs, dumpRs, emptyStatementCache, executeQuery, expectCompilationError, expectCompilationError, expectExecutionError, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, goodStatement, goodUpdate, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbedded
alarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSameNullness, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit, vmAtLeast
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, setUp, toString
private static final int FRAC_SECOND_INTERVAL
private static final int SECOND_INTERVAL
private static final int MINUTE_INTERVAL
private static final int HOUR_INTERVAL
private static final int DAY_INTERVAL
private static final int WEEK_INTERVAL
private static final int MONTH_INTERVAL
private static final int QUARTER_INTERVAL
private static final int YEAR_INTERVAL
private static final TimestampArithTest.OneDiffTest[] diffBetweenTsTests
private static final TimestampArithTest.OneDiffTest[] diffBetweenTsAndDateTests
private static final TimestampArithTest.OneDiffTest[] diffBetweenDateAndTsTests
private static final TimestampArithTest.OneAddTest[] addBetweenTsTests
private static final TimestampArithTest.OneAddTest[] addBetweenDateAndTsTests
private static final TimestampArithTest.OneStringDiffTest[] diffBetweenStringTests
private static final TimestampArithTest.OneStringAddTest[] addBetweenStringTests
private static final TimestampArithTest.OneTest[] overflowTests
private static final java.lang.String[][] invalid
private static final java.lang.String[] intervalJdbcNames
private static java.sql.Statement stmt
private static java.sql.PreparedStatement[] tsAddPS
private static java.sql.PreparedStatement[] tsDiffPS
public TimestampArithTest(java.lang.String name)
protected void initializeConnection(java.sql.Connection conn) throws java.sql.SQLException
BaseJDBCTestCase
initializeConnection
in class BaseJDBCTestCase
conn
- Connection to be intializedjava.sql.SQLException
- Error setting the initial state.public static junit.framework.Test suite()
private static void closeAll(java.sql.Statement[] statements) throws java.sql.SQLException
java.sql.SQLException
public void testDiffBetweenTimestamp() throws java.sql.SQLException
java.sql.SQLException
public void testDiffBetweenTimestampAndDate() throws java.sql.SQLException
java.sql.SQLException
public void testDiffBetweenDateAndTimestamp() throws java.sql.SQLException
java.sql.SQLException
public void testAddBetweenTimestamp() throws java.sql.SQLException
java.sql.SQLException
public void testAddBetweenDateAndTimestamps() throws java.sql.SQLException
java.sql.SQLException
public void testDiffBetweenString() throws java.sql.SQLException
java.sql.SQLException
public void testAddBetweenString() throws java.sql.SQLException
java.sql.SQLException
public void testOverflow() throws java.sql.SQLException
java.sql.SQLException
public void testNullInputs() throws java.sql.SQLException
java.sql.SQLException
public void testInvalidLengths() throws java.sql.SQLException
java.sql.SQLException
public void testInvalidArgTypes() throws java.sql.SQLException
java.sql.SQLException
private static void expectException(java.sql.PreparedStatement ps, java.lang.Object obj1, java.lang.Object obj2, java.lang.String expectedSQLState, java.lang.String label)
private static void expectNullResult(java.sql.PreparedStatement ps) throws java.sql.SQLException
java.sql.SQLException
private static java.lang.String dateTimeToLiteral(java.lang.Object ts)
private static java.lang.String composeSqlStr(java.lang.String fn, int interval, java.lang.String parm1, java.lang.String parm2)
private static void setDateTime(java.sql.PreparedStatement ps, int parameterIdx, java.util.Date dateTime) throws java.sql.SQLException
java.sql.SQLException
private static java.sql.Timestamp ts(java.lang.String s)
private static java.sql.Date dt(java.lang.String s)
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.