public class DaylightSavingTest extends BaseJDBCTestCase
java.sql.Date
, java.sql.Time
and java.sql.Timestamp
across DST changes.DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
DaylightSavingTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
private static java.sql.Timestamp |
dateToTimestamp(java.sql.Date date,
java.util.Calendar cal)
Convert a date value to a timestamp.
|
private static java.sql.Time |
stripDate(java.util.Date time,
java.util.Calendar cal)
Strip away the date component from a
java.util.Date and return
it as a java.sql.Time , so that it can be compared with a time
value returned by Derby. |
private static java.sql.Date |
stripTime(java.util.Date date,
java.util.Calendar cal)
Strip away the time component from a
java.util.Date and return
it as a java.sql.Date , so that it can be compared with a date
value returned by Derby. |
static junit.framework.Test |
suite() |
void |
testConversionToGMTAroundDSTChange()
Regression test case for DERBY-4582.
|
private static java.sql.Timestamp |
timeToTimestamp(java.sql.Time time,
java.util.Calendar cal)
Convert a time value to a timestamp.
|
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, initializeConnection, 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
public static junit.framework.Test suite()
public void testConversionToGMTAroundDSTChange() throws java.sql.SQLException
java.sql.SQLException
private static java.sql.Time stripDate(java.util.Date time, java.util.Calendar cal)
java.util.Date
and return
it as a java.sql.Time
, so that it can be compared with a time
value returned by Derby. Derby will set the date component of the time
value to 1970-01-01, so let's do the same here.time
- the time value whose date component to strip awaycal
- the calendar used to store the time in the database originallytime
in the calendar cal
, but with the date component
normalized to 1970-01-01private static java.sql.Date stripTime(java.util.Date date, java.util.Calendar cal)
java.util.Date
and return
it as a java.sql.Date
, so that it can be compared with a date
value returned by Derby. Derby will set the time component of the date
value to 00:00:00.0, so let's do the same here.date
- the date whose time component to strip awaycal
- the calendar used to store the date in the database originallydate
in the
calendar cal
, but with the time component normalized to
00:00:00.0private static java.sql.Timestamp timeToTimestamp(java.sql.Time time, java.util.Calendar cal)
time
- the time value to convertcal
- the calendar in which the conversion should be performedprivate static java.sql.Timestamp dateToTimestamp(java.sql.Date date, java.util.Calendar cal)
date
- the date value to convertcal
- the calendar in which the conversion should be performedApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.