nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ijokaruma...@apache.org
Subject nifi git commit: NIFI-5890 Added a unit test that proves that 1.9 fixes a bug in the date conversion behavior in 1.8.
Date Wed, 12 Dec 2018 02:08:44 GMT
Repository: nifi
Updated Branches:
  refs/heads/master 1a937b651 -> 13a7f1686


NIFI-5890 Added a unit test that proves that 1.9 fixes a bug in the date conversion behavior
in 1.8.

This closes #3214.

Signed-off-by: Koji Kawamura <ijokarumawak@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/13a7f168
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/13a7f168
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/13a7f168

Branch: refs/heads/master
Commit: 13a7f168604f20da3c837ce3bf91a3472a9708f1
Parents: 1a937b6
Author: Mike Thomsen <mikerthomsen@gmail.com>
Authored: Tue Dec 11 11:18:52 2018 -0500
Committer: Koji Kawamura <ijokarumawak@apache.org>
Committed: Wed Dec 12 11:08:18 2018 +0900

----------------------------------------------------------------------
 .../nifi/serialization/record/TestDataTypeUtils.java | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/13a7f168/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestDataTypeUtils.java
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestDataTypeUtils.java
b/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestDataTypeUtils.java
index 5f15fc2..45b65b4 100644
--- a/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestDataTypeUtils.java
+++ b/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestDataTypeUtils.java
@@ -54,6 +54,21 @@ public class TestDataTypeUtils {
         assertEquals("Times didn't match", ts.getTime(), sDate.getTime());
     }
 
+    /*
+     * This was a bug in NiFi 1.8 where converting from a Timestamp to a Date with the record
path API
+     * would throw an exception.
+     */
+    @Test
+    public void testTimestampToDate() {
+        java.util.Date date = new java.util.Date();
+        Timestamp ts = DataTypeUtils.toTimestamp(date, null, null);
+        assertNotNull(ts);
+
+        java.sql.Date output = DataTypeUtils.toDate(ts, null, null);
+        assertNotNull(output);
+        assertEquals("Timestamps didn't match", output.getTime(), ts.getTime());
+    }
+
     @Test
     public void testConvertRecordMapToJavaMap() {
         assertNull(DataTypeUtils.convertRecordMapToJavaMap(null, null));


Mime
View raw message