From f54607b257927f7717ad350d884a14af41edf743 Mon Sep 17 00:00:00 2001 From: Tim Harper Date: Wed, 2 Apr 2014 17:46:52 -0600 Subject: [PATCH] make tests pass when run in other time zones --- .../com/github/tminglei/slickpg/PgDateSupportJodaTest.scala | 2 ++ .../scala/com/github/tminglei/slickpg/PgDate2SupportTest.scala | 2 ++ .../scala/com/github/tminglei/slickpg/PgDateSupportTest.scala | 2 ++ 3 files changed, 6 insertions(+) diff --git a/addons/joda-time/src/test/scala/com/github/tminglei/slickpg/PgDateSupportJodaTest.scala b/addons/joda-time/src/test/scala/com/github/tminglei/slickpg/PgDateSupportJodaTest.scala index 5bb9ddcb..7c78f157 100644 --- a/addons/joda-time/src/test/scala/com/github/tminglei/slickpg/PgDateSupportJodaTest.scala +++ b/addons/joda-time/src/test/scala/com/github/tminglei/slickpg/PgDateSupportJodaTest.scala @@ -3,6 +3,7 @@ package com.github.tminglei.slickpg import org.joda.time.{Period, LocalDateTime, LocalTime, LocalDate, DateTime} import org.junit.{After, Before, Test} import org.junit.Assert._ +import scala.slick.jdbc.StaticQuery class PgDateSupportJodaTest { import MyPostgresDriver.simple._ @@ -42,6 +43,7 @@ class PgDateSupportJodaTest { @Test def testDatetimeFunctions(): Unit = { db withSession { implicit session: Session => + (StaticQuery.u + "SET TIMEZONE TO '+8';").execute Datetimes forceInsertAll (testRec1, testRec2, testRec3) // datetime - '+'/'-' diff --git a/addons/threeten/src/test/scala/com/github/tminglei/slickpg/PgDate2SupportTest.scala b/addons/threeten/src/test/scala/com/github/tminglei/slickpg/PgDate2SupportTest.scala index d2159845..f28e8ef4 100644 --- a/addons/threeten/src/test/scala/com/github/tminglei/slickpg/PgDate2SupportTest.scala +++ b/addons/threeten/src/test/scala/com/github/tminglei/slickpg/PgDate2SupportTest.scala @@ -3,6 +3,7 @@ package com.github.tminglei.slickpg import org.junit._ import org.junit.Assert._ import org.threeten.bp.{Duration, LocalDateTime, LocalTime, LocalDate, ZonedDateTime} +import scala.slick.jdbc.StaticQuery class PgDate2SupportTest { import MyPostgresDriver.simple._ @@ -42,6 +43,7 @@ class PgDate2SupportTest { @Test def testDatetimeFunctions(): Unit = { db withSession { implicit session: Session => + (StaticQuery.u + "SET TIMEZONE TO '+8';").execute Datetimes forceInsertAll (testRec1, testRec2, testRec3) // datetime - '+'/'-' diff --git a/src/test/scala/com/github/tminglei/slickpg/PgDateSupportTest.scala b/src/test/scala/com/github/tminglei/slickpg/PgDateSupportTest.scala index 6f65e6fd..1c293039 100644 --- a/src/test/scala/com/github/tminglei/slickpg/PgDateSupportTest.scala +++ b/src/test/scala/com/github/tminglei/slickpg/PgDateSupportTest.scala @@ -7,6 +7,7 @@ import java.util.Calendar import java.text.SimpleDateFormat import javax.xml.bind.DatatypeConverter import com.github.tminglei.slickpg.date.PgDateJavaTypes +import scala.slick.jdbc.StaticQuery class gDateSupportTest { import MyPostgresDriver.simple._ @@ -55,6 +56,7 @@ class gDateSupportTest { @Test def testDatetimeFunctions(): Unit = { db withSession { implicit session: Session => + (StaticQuery.u + "SET TIMEZONE TO '+8';").execute Datetimes forceInsertAll (testRec1, testRec2, testRec3) // datetime - '+'/'-'