You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2017/08/21 09:49:15 UTC
[6/7] cayenne git commit: CAY-2352 Clean up build scripts and code to
support Java 8 fix tests for MySQL
CAY-2352 Clean up build scripts and code to support Java 8
fix tests for MySQL
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/790f1987
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/790f1987
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/790f1987
Branch: refs/heads/master
Commit: 790f1987cf358b49f20d12d0afb7d44eb9f20b36
Parents: 93fb331
Author: Nikita Timofeev <st...@gmail.com>
Authored: Mon Aug 21 11:57:29 2017 +0300
Committer: Nikita Timofeev <st...@gmail.com>
Committed: Mon Aug 21 11:57:29 2017 +0300
----------------------------------------------------------------------
.../java/org/apache/cayenne/access/types/Java8TimeIT.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/790f1987/cayenne-server/src/test/java/org/apache/cayenne/access/types/Java8TimeIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/types/Java8TimeIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/types/Java8TimeIT.java
index 1f3d393..df98c8a 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/types/Java8TimeIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/types/Java8TimeIT.java
@@ -36,6 +36,7 @@ import java.sql.SQLException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
+import java.time.temporal.ChronoField;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -103,7 +104,9 @@ public class Java8TimeIT extends ServerCase {
@Test
public void testJava8LocalDateTime() {
LocalDateTimeTestEntity localDateTimeTestEntity = context.newObject(LocalDateTimeTestEntity.class);
- LocalDateTime localDateTime = LocalDateTime.now();
+ // round up seconds fraction
+ // reason: on MySQL field should be defined as TIMESTAMP(fractionSecondsPrecision) to support it
+ LocalDateTime localDateTime = LocalDateTime.now().with(ChronoField.NANO_OF_SECOND, 0);
localDateTimeTestEntity.setTimestamp(localDateTime);
context.commitChanges();
@@ -118,7 +121,9 @@ public class Java8TimeIT extends ServerCase {
@Test
public void columnSelectWithJava8Type() {
- LocalDateTime localDateTime = LocalDateTime.now();
+ // round up seconds fraction
+ // reason: on MySQL field should be defined as TIMESTAMP(fractionSecondsPrecision) to support it
+ LocalDateTime localDateTime = LocalDateTime.now().with(ChronoField.NANO_OF_SECOND, 0);
LocalDateTimeTestEntity localDateTimeTestEntity = context.newObject(LocalDateTimeTestEntity.class);
localDateTimeTestEntity.setTimestamp(localDateTime);