net.sourceforge.jtds.jdbc
Class TimestampTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bynet.sourceforge.jtds.jdbc.TestBase
              extended bynet.sourceforge.jtds.jdbc.DatabaseTestCase
                  extended bynet.sourceforge.jtds.jdbc.TimestampTest
All Implemented Interfaces:
junit.framework.Test

public class TimestampTest
extends DatabaseTestCase

test getting timestamps from the database.

Version:
$Id: TimestampTest.java,v 1.32.2.5 2009-08-20 19:44:04 ickzon Exp $
Author:
Alin Sinpalean

Field Summary
 
Fields inherited from class net.sourceforge.jtds.jdbc.DatabaseTestCase
 
Fields inherited from class net.sourceforge.jtds.jdbc.TestBase
con, props
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
TimestampTest(java.lang.String name)
           
 
Method Summary
(package private)  java.lang.Object[][] getDatatypes()
           
 long getTimeInMs(java.sql.ResultSet rs)
          Java 1.3 Timestamp.getDate() does not add the nano seconds to the millisecond value returned.
static void main(java.lang.String[] args)
           
 void test1899Date()
          Test for bug [1234531] Dates before 01/01/1900 broken due to DateTime value markers.
 void testBigint0000()
           
 void testBlob0021()
           
 void testBug638()
          Test for bug #638, preparedStatement.setTimestamp sets seconds to 0.
 void testConnection0038()
           
 void testConnection0039()
           
 void testDateEscaping()
          Test for bug #541, data type mismatch when using date/time/timestamp JDBC escapes.
 void testDateRange()
           Regression test for bug #632, valid DATE values range from 0001-01-01 to 9999-12-31.
 void testDateTimeConversion()
          Test conversion between DATETIME, DATE and TIME.
 void testDateTimeDegeneration()
          Test for bug [2508201], date field is changed by 3 milliseconds.
 void testDatetimeRounding1()
          Test for bug [994916] datetime decoding in TdsData.java
 void testDatetimeRounding10()
          Test for bug [994916] datetime decoding in TdsData.java
 void testDatetimeRounding2()
          Test for bug [994916] datetime decoding in TdsData.java
 void testDatetimeRounding3()
          Test for bug [994916] datetime decoding in TdsData.java
 void testDatetimeRounding4()
          Test for bug [994916] datetime decoding in TdsData.java
 void testDatetimeRounding5()
          Test for bug [994916] datetime decoding in TdsData.java
 void testDatetimeRounding6()
          Test for bug [994916] datetime decoding in TdsData.java
 void testDatetimeRounding7()
          Test for bug [994916] datetime decoding in TdsData.java
 void testDatetimeRounding8()
          Test for bug [994916] datetime decoding in TdsData.java
 void testDatetimeRounding9()
          Test for bug [994916] datetime decoding in TdsData.java
 void testDayOfWeek()
          Test for bug [1226210] {fn dayofweek()} depends on the language.
 void testDecimalConversion0058()
           
 void testEmptyResults0011()
           
 void testEmptyResults0012()
           
 void testEmptyResults0013()
           
 void testEra()
          Test for bugs [2181003]/[2349058], an attempt to set a BC date invalidates driver state/DateTime allows invalid dates through.
 void testErrors0036()
           
 void testEscape(java.lang.String sql, java.lang.String expected)
           
 void testEscapes0006()
           
 void testForBrowse0014()
           
 void testGetBoolean0025()
           
 void testGetString()
          Test for bug [1235845] getTimestamp() returns illegal value after getString().
 void testMetaData0046()
           
 void testMissingParameter0016()
           
 void testMultipleResults0015()
           
 void testNestedStatements0022()
           
 void testNestedStatements0026()
          SAfe Tests whether cursor-based statements still work ok when nested.
 void testOutputParams()
           
 void testPreparedStatement0007()
           
 void testPreparedStatement0008()
           
 void testPreparedStatement0009()
           
 void testPreparedStatement0040()
           
 void testPreparedStatement0041()
           
 void testPreparedStatement0042()
           
 void testPreparedTimestampEscaping()
          Test for bug #541, data type mismatch when using date/time/timestamp JDBC escapes.
 void testPrimaryKeyFloat0023()
           
 void testPrimaryKeyReal0024()
           
 void testResultSet0043()
           
 void testResultSet0044()
           
 void testResultSet0045()
           
 void testStatements0020()
           
 void testTimeEscaping()
          Test for bug #541, data type mismatch when using date/time/timestamp JDBC escapes.
 void testTimestampEscaping()
          Test for bug #541, data type mismatch when using date/time/timestamp JDBC escapes.
 void testTimestampRange()
          Test for bug [1040475] Possible bug when converting to and from datetime.
 void testTimestamps0001()
           
 void testTimestamps0004()
           
 void testTimestamps0037()
           
 void testTimestamps0047()
           
 void testTimestamps0048()
           
 void testTimestampTimeZone()
          Test for bug [1036059] getTimestamp with Calendar applies tzone offset wrong way.
 void testTransactions0010()
           
 void testWriteDate()
          Test that java.sql.Date objects are inserted and retrieved correctly (ie no time component).
 
Methods inherited from class net.sourceforge.jtds.jdbc.DatabaseTestCase
compareBytes, getLongString, getLongString, getType, getTypemap
 
Methods inherited from class net.sourceforge.jtds.jdbc.TestBase
compareInputStreams, compareReaders, connect, dropDatabase, dropFunction, dropProcedure, dropTable, dropTrigger, dropType, dropView, dump, dump, dumpAll, dumpKeys, dumpRow, dumpRow, getConnection, getConnection, makeObjects, makeTestTables, setUp, tearDown
 
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, 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
 

Constructor Detail

TimestampTest

public TimestampTest(java.lang.String name)
Method Detail

testBug638

public void testBug638()
                throws java.lang.Exception
Test for bug #638, preparedStatement.setTimestamp sets seconds to 0.

Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)

testDateRange

public void testDateRange()
                   throws java.lang.Exception

Regression test for bug #632, valid DATE values range from 0001-01-01 to 9999-12-31.

Throws:
java.lang.Exception

testBigint0000

public void testBigint0000()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testTimestamps0001

public void testTimestamps0001()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testTimestamps0004

public void testTimestamps0004()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testEscape

public void testEscape(java.lang.String sql,
                       java.lang.String expected)
                throws java.lang.Exception
Throws:
java.lang.Exception

testEscapes0006

public void testEscapes0006()
                     throws java.lang.Exception
Throws:
java.lang.Exception

testPreparedStatement0007

public void testPreparedStatement0007()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testPreparedStatement0008

public void testPreparedStatement0008()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testPreparedStatement0009

public void testPreparedStatement0009()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testTransactions0010

public void testTransactions0010()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testEmptyResults0011

public void testEmptyResults0011()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testEmptyResults0012

public void testEmptyResults0012()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testEmptyResults0013

public void testEmptyResults0013()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testForBrowse0014

public void testForBrowse0014()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testMultipleResults0015

public void testMultipleResults0015()
                             throws java.lang.Exception
Throws:
java.lang.Exception

testMissingParameter0016

public void testMissingParameter0016()
                              throws java.lang.Exception
Throws:
java.lang.Exception

getDatatypes

java.lang.Object[][] getDatatypes()

testOutputParams

public void testOutputParams()
                      throws java.lang.Exception
Throws:
java.lang.Exception

testStatements0020

public void testStatements0020()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testBlob0021

public void testBlob0021()
                  throws java.lang.Exception
Throws:
java.lang.Exception

testNestedStatements0022

public void testNestedStatements0022()
                              throws java.lang.Exception
Throws:
java.lang.Exception

testPrimaryKeyFloat0023

public void testPrimaryKeyFloat0023()
                             throws java.lang.Exception
Throws:
java.lang.Exception

testPrimaryKeyReal0024

public void testPrimaryKeyReal0024()
                            throws java.lang.Exception
Throws:
java.lang.Exception

testGetBoolean0025

public void testGetBoolean0025()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testNestedStatements0026

public void testNestedStatements0026()
                              throws java.lang.Exception
SAfe Tests whether cursor-based statements still work ok when nested. Similar to testNestedStatements0022, which tests the same with plain (non-cursor-based) statements (and unfortunately fails).

Throws:
java.lang.Exception - if an Exception occurs (very relevant, huh?)

testErrors0036

public void testErrors0036()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testTimestamps0037

public void testTimestamps0037()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testConnection0038

public void testConnection0038()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testConnection0039

public void testConnection0039()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testPreparedStatement0040

public void testPreparedStatement0040()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testPreparedStatement0041

public void testPreparedStatement0041()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testPreparedStatement0042

public void testPreparedStatement0042()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testResultSet0043

public void testResultSet0043()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testResultSet0044

public void testResultSet0044()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testResultSet0045

public void testResultSet0045()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testMetaData0046

public void testMetaData0046()
                      throws java.lang.Exception
Throws:
java.lang.Exception

testTimestamps0047

public void testTimestamps0047()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testTimestamps0048

public void testTimestamps0048()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testDecimalConversion0058

public void testDecimalConversion0058()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testDatetimeRounding1

public void testDatetimeRounding1()
                           throws java.lang.Exception
Test for bug [994916] datetime decoding in TdsData.java

Throws:
java.lang.Exception

testDatetimeRounding2

public void testDatetimeRounding2()
                           throws java.lang.Exception
Test for bug [994916] datetime decoding in TdsData.java

Throws:
java.lang.Exception

testDatetimeRounding3

public void testDatetimeRounding3()
                           throws java.lang.Exception
Test for bug [994916] datetime decoding in TdsData.java

Throws:
java.lang.Exception

testDatetimeRounding4

public void testDatetimeRounding4()
                           throws java.lang.Exception
Test for bug [994916] datetime decoding in TdsData.java

Throws:
java.lang.Exception

testDatetimeRounding5

public void testDatetimeRounding5()
                           throws java.lang.Exception
Test for bug [994916] datetime decoding in TdsData.java

Throws:
java.lang.Exception

testDatetimeRounding6

public void testDatetimeRounding6()
                           throws java.lang.Exception
Test for bug [994916] datetime decoding in TdsData.java

Throws:
java.lang.Exception

testDatetimeRounding7

public void testDatetimeRounding7()
                           throws java.lang.Exception
Test for bug [994916] datetime decoding in TdsData.java

Throws:
java.lang.Exception

testDatetimeRounding8

public void testDatetimeRounding8()
                           throws java.lang.Exception
Test for bug [994916] datetime decoding in TdsData.java

Throws:
java.lang.Exception

testDatetimeRounding9

public void testDatetimeRounding9()
                           throws java.lang.Exception
Test for bug [994916] datetime decoding in TdsData.java

Throws:
java.lang.Exception

testDatetimeRounding10

public void testDatetimeRounding10()
                            throws java.lang.Exception
Test for bug [994916] datetime decoding in TdsData.java

Throws:
java.lang.Exception

testTimestampTimeZone

public void testTimestampTimeZone()
                           throws java.sql.SQLException
Test for bug [1036059] getTimestamp with Calendar applies tzone offset wrong way.

Throws:
java.sql.SQLException

testTimestampRange

public void testTimestampRange()
                        throws java.sql.SQLException
Test for bug [1040475] Possible bug when converting to and from datetime.

jTDS seems to accept dates outside the range accepted by SQL Server (i.e. 1753-9999).

Throws:
java.sql.SQLException

testWriteDate

public void testWriteDate()
                   throws java.sql.SQLException
Test that java.sql.Date objects are inserted and retrieved correctly (ie no time component).

Throws:
java.sql.SQLException

testDayOfWeek

public void testDayOfWeek()
                   throws java.lang.Exception
Test for bug [1226210] {fn dayofweek()} depends on the language.

Throws:
java.lang.Exception

testGetString

public void testGetString()
                   throws java.sql.SQLException
Test for bug [1235845] getTimestamp() returns illegal value after getString().

Throws:
java.sql.SQLException

test1899Date

public void test1899Date()
                  throws java.lang.Exception
Test for bug [1234531] Dates before 01/01/1900 broken due to DateTime value markers.

Throws:
java.lang.Exception

getTimeInMs

public long getTimeInMs(java.sql.ResultSet rs)
                 throws java.sql.SQLException
Java 1.3 Timestamp.getDate() does not add the nano seconds to the millisecond value returned. This causes the timestamp tests to fail. If running under java 1.3 we add the nanos ourselves.

Parameters:
rs - the result set returning the Timstamp value in column 1
Returns:
the millisecond date value as a long.
Throws:
java.sql.SQLException

testDateTimeDegeneration

public void testDateTimeDegeneration()
                              throws java.lang.Exception
Test for bug [2508201], date field is changed by 3 milliseconds. Note: This test will be skipped for data types not supported by the server the test is run against (e.g. only DATETIME will be tested on SQL server).

Throws:
java.lang.Exception

testDateTimeConversion

public void testDateTimeConversion()
                            throws java.lang.Exception
Test conversion between DATETIME, DATE and TIME.

Throws:
java.lang.Exception

testDateEscaping

public void testDateEscaping()
                      throws java.sql.SQLException
Test for bug #541, data type mismatch when using date/time/timestamp JDBC escapes.

Throws:
java.sql.SQLException

testTimeEscaping

public void testTimeEscaping()
                      throws java.sql.SQLException
Test for bug #541, data type mismatch when using date/time/timestamp JDBC escapes.

Throws:
java.sql.SQLException

testTimestampEscaping

public void testTimestampEscaping()
                           throws java.sql.SQLException
Test for bug #541, data type mismatch when using date/time/timestamp JDBC escapes.

Throws:
java.sql.SQLException

testPreparedTimestampEscaping

public void testPreparedTimestampEscaping()
                                   throws java.sql.SQLException
Test for bug #541, data type mismatch when using date/time/timestamp JDBC escapes.

Throws:
java.sql.SQLException

testEra

public void testEra()
             throws java.sql.SQLException
Test for bugs [2181003]/[2349058], an attempt to set a BC date invalidates driver state/DateTime allows invalid dates through.

Throws:
java.sql.SQLException


Generated on October 27 2012