db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r939231 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DaylightSavingTest.java
Date Thu, 29 Apr 2010 08:44:14 GMT
Author: kahatlen
Date: Thu Apr 29 08:44:14 2010
New Revision: 939231

URL: http://svn.apache.org/viewvc?rev=939231&view=rev
Log:
DERBY-4582: Timestamps inserted with GMT calendar are 1 hour later
when subsequently read with GMT calendar (Server Mode Only)

Fixed test failure on small devices because the Foundation Profile 1.1
API doesn't include getYear(), getMonth(), etc, in java.util.Date. Use
java.util.Calendar to access those fields instead.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DaylightSavingTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DaylightSavingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DaylightSavingTest.java?rev=939231&r1=939230&r2=939231&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DaylightSavingTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DaylightSavingTest.java
Thu Apr 29 08:44:14 2010
@@ -177,18 +177,22 @@ public class DaylightSavingTest extends 
             Timestamp ts2 = rs.getTimestamp(1, cal);
             cal.clear();
             cal.setTime(ts2);
+            localCal.clear();
+            localCal.setTime(ts1);
             assertEquals("TS.YEAR",
-                    ts1.getYear() + 1900, cal.get(Calendar.YEAR));
+                    localCal.get(Calendar.YEAR), cal.get(Calendar.YEAR));
             assertEquals("TS.MONTH",
-                    ts1.getMonth(), cal.get(Calendar.MONTH));
+                    localCal.get(Calendar.MONTH), cal.get(Calendar.MONTH));
             assertEquals("TS.DATE",
-                    ts1.getDate(), cal.get(Calendar.DAY_OF_MONTH));
+                    localCal.get(Calendar.DAY_OF_MONTH),
+                    cal.get(Calendar.DAY_OF_MONTH));
             assertEquals("TS.HOURS",
-                    ts1.getHours(), cal.get(Calendar.HOUR_OF_DAY));
+                    localCal.get(Calendar.HOUR_OF_DAY),
+                    cal.get(Calendar.HOUR_OF_DAY));
             assertEquals("TS.MINUTES",
-                    ts1.getMinutes(), cal.get(Calendar.MINUTE));
+                    localCal.get(Calendar.MINUTE), cal.get(Calendar.MINUTE));
             assertEquals("TS.SECONDS",
-                    ts1.getSeconds(), cal.get(Calendar.SECOND));
+                    localCal.get(Calendar.SECOND), cal.get(Calendar.SECOND));
             assertEquals("TS.NANOS",
                     ts1.getNanos(), ts2.getNanos());
 
@@ -199,12 +203,15 @@ public class DaylightSavingTest extends 
             Time t2 = rs.getTime(2, cal);
             cal.clear();
             cal.setTime(t2);
+            localCal.clear();
+            localCal.setTime(t1);
             assertEquals("T.HOURS",
-                    t1.getHours(), cal.get(Calendar.HOUR_OF_DAY));
+                    localCal.get(Calendar.HOUR_OF_DAY),
+                    cal.get(Calendar.HOUR_OF_DAY));
             assertEquals("T.MINUTES",
-                    t1.getMinutes(), cal.get(Calendar.MINUTE));
+                    localCal.get(Calendar.MINUTE), cal.get(Calendar.MINUTE));
             assertEquals("T.SECONDS",
-                    t1.getSeconds(), cal.get(Calendar.SECOND));
+                    localCal.get(Calendar.SECOND), cal.get(Calendar.SECOND));
 
             Date d1 = dates[i];
             rs.updateDate(3, d1);
@@ -213,12 +220,15 @@ public class DaylightSavingTest extends 
             Date d2 = rs.getDate(3, cal);
             cal.clear();
             cal.setTime(d2);
+            localCal.clear();
+            localCal.setTime(d1);
             assertEquals("D.YEAR",
-                    d1.getYear() + 1900, cal.get(Calendar.YEAR));
+                    localCal.get(Calendar.YEAR), cal.get(Calendar.YEAR));
             assertEquals("D.MONTH",
-                    d1.getMonth(), cal.get(Calendar.MONTH));
+                    localCal.get(Calendar.MONTH), cal.get(Calendar.MONTH));
             assertEquals("D.DATE",
-                    d1.getDate(), cal.get(Calendar.DAY_OF_MONTH));
+                    localCal.get(Calendar.DAY_OF_MONTH),
+                    cal.get(Calendar.DAY_OF_MONTH));
 
             rs.updateRow();
         }



Mime
View raw message