You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by as...@apache.org on 2019/03/28 09:42:52 UTC

[oozie] branch master updated: OOZIE-3443 Migrate from joda time to java.time (matijhs via asalamon74)

This is an automated email from the ASF dual-hosted git repository.

asalamon74 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/oozie.git


The following commit(s) were added to refs/heads/master by this push:
     new cf49384  OOZIE-3443 Migrate from joda time to java.time (matijhs via asalamon74)
cf49384 is described below

commit cf4938496e10ee85258cbbec607533a3e025c1cc
Author: Andras Salamon <as...@apache.org>
AuthorDate: Thu Mar 28 10:42:24 2019 +0100

    OOZIE-3443 Migrate from joda time to java.time (matijhs via asalamon74)
---
 core/pom.xml                                            |  6 ------
 .../command/wf/TestWorkflowActionRetryInfoXCommand.java | 14 +++++++++-----
 pom.xml                                                 | 17 +++++++++++------
 release-log.txt                                         |  1 +
 sharelib/hcatalog/pom.xml                               |  6 ++++++
 sharelib/hive/pom.xml                                   |  6 ++++++
 sharelib/hive2/pom.xml                                  |  6 ++++++
 sharelib/pig/pom.xml                                    | 11 ++++++-----
 sharelib/spark/pom.xml                                  |  6 ++++++
 9 files changed, 51 insertions(+), 22 deletions(-)

diff --git a/core/pom.xml b/core/pom.xml
index eeb43cf..0d6bf7b 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -466,12 +466,6 @@
         </dependency>
 
         <dependency>
-            <groupId>joda-time</groupId>
-            <artifactId>joda-time</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
             <scope>compile</scope>
diff --git a/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowActionRetryInfoXCommand.java b/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowActionRetryInfoXCommand.java
index 8418b9f..a12335f 100644
--- a/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowActionRetryInfoXCommand.java
+++ b/core/src/test/java/org/apache/oozie/command/wf/TestWorkflowActionRetryInfoXCommand.java
@@ -22,6 +22,9 @@ import java.io.File;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.oozie.ForTestingActionExecutor;
 import org.apache.oozie.WorkflowActionBean;
@@ -38,7 +41,6 @@ import org.apache.oozie.service.SchemaService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.test.XDataTestCase;
 import org.apache.oozie.util.XConfiguration;
-import org.joda.time.Interval;
 
 public class TestWorkflowActionRetryInfoXCommand extends XDataTestCase {
     private Services services;
@@ -188,8 +190,7 @@ public class TestWorkflowActionRetryInfoXCommand extends XDataTestCase {
                 final Date secondRetry1EndTime = JsonUtils.parseDateRfc822(retries1List.get(1).get(
                         JsonTags.WORKFLOW_ACTION_END_TIME));
                 assertTrue("action end time should be within ten seconds of second retry end time",
-                        new Interval(secondRetry1EndTime.getTime(), secondRetry1EndTime.getTime() + 10_000)
-                                .contains(action1EndTime.getTime()));
+                        endTimeIsWithinExpectedTime(action1EndTime.toInstant(), secondRetry1EndTime.toInstant().plusSeconds(10)));
             }
         }
 
@@ -202,8 +203,7 @@ public class TestWorkflowActionRetryInfoXCommand extends XDataTestCase {
                 final Date secondRetry2EndTime = JsonUtils.parseDateRfc822(retries2List.get(1).get(
                         JsonTags.WORKFLOW_ACTION_END_TIME));
                 assertTrue("action end time should be within ten seconds of second retry end time",
-                        new Interval(secondRetry2EndTime.getTime(), secondRetry2EndTime.getTime() + 10_000)
-                                .contains(action2EndTime.getTime()));
+                        endTimeIsWithinExpectedTime(action2EndTime.toInstant(), secondRetry2EndTime.toInstant().plusSeconds(10)));
             }
         }
     }
@@ -215,4 +215,8 @@ public class TestWorkflowActionRetryInfoXCommand extends XDataTestCase {
         WorkflowActionRetryInfoXCommand command = new WorkflowActionRetryInfoXCommand(action.getId());
         return command.call();
     }
+
+    private boolean endTimeIsWithinExpectedTime(Instant endTime, Instant expectedTime) {
+        return ChronoUnit.MILLIS.between(endTime, expectedTime) >= 0;
+    }
 }
diff --git a/pom.xml b/pom.xml
index 3385129..a1a1f54 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,6 +104,7 @@
          <spark.scala.binary.version>2.10</spark.scala.binary.version>
          <sqoop.classifier>hadoop200</sqoop.classifier>
          <tez.version>0.8.4</tez.version>
+         <joda.time.version>2.9.9</joda.time.version>
 
          <jetty.version>9.3.20.v20170531</jetty.version>
          <apache.jsp.version>8.0.33</apache.jsp.version>
@@ -246,6 +247,12 @@
                  <groupId>org.apache.oozie</groupId>
                 <artifactId>oozie-sharelib-hcatalog</artifactId>
                 <version>${project.version}</version>
+                <exclusions>
+                    <exclusion>
+                            <groupId>joda-time</groupId>
+                            <artifactId>joda-time</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
             <dependency>
                  <groupId>org.apache.oozie</groupId>
@@ -525,6 +532,10 @@
                         <groupId>org.apache.hive</groupId>
                         <artifactId>hive-cli</artifactId>
                     </exclusion>
+                    <exclusion>
+                        <groupId>joda-time</groupId>
+                        <artifactId>joda-time</artifactId>
+                    </exclusion>
                 </exclusions>
             </dependency>
 
@@ -1610,12 +1621,6 @@
             </dependency>
 
             <dependency>
-                <groupId>joda-time</groupId>
-                <artifactId>joda-time</artifactId>
-                <version>2.9.9</version>
-            </dependency>
-
-            <dependency>
                 <groupId>com.google.code.gson</groupId>
                 <artifactId>gson</artifactId>
                 <version>2.7</version>
diff --git a/release-log.txt b/release-log.txt
index 4d776df..448cf9c 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 5.2.0 release (trunk - unreleased)
 
+OOZIE-3443 Migrate from joda time to java.time (matijhs via asalamon74)
 OOZIE-3448 Cleanup of oozie-server copy dependency (nobigo via asalamon74)
 OOZIE-3446 Migrate from commons-lang 2.x to commons-lang 3.x (nobigo via asalamon74)
 OOZIE-3312 Add support for HSTS (kmarton via asalamon74)
diff --git a/sharelib/hcatalog/pom.xml b/sharelib/hcatalog/pom.xml
index 70ebd69..5726488 100644
--- a/sharelib/hcatalog/pom.xml
+++ b/sharelib/hcatalog/pom.xml
@@ -39,6 +39,12 @@
 
     <dependencies>
         <dependency>
+            <groupId>joda-time</groupId>
+            <artifactId>joda-time</artifactId>
+            <version>${joda.time.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.hive.hcatalog</groupId>
             <artifactId>hive-webhcat-java-client</artifactId>
             <scope>compile</scope>
diff --git a/sharelib/hive/pom.xml b/sharelib/hive/pom.xml
index 4102d1f..829df03 100644
--- a/sharelib/hive/pom.xml
+++ b/sharelib/hive/pom.xml
@@ -39,6 +39,12 @@
 
     <dependencies>
         <dependency>
+            <groupId>joda-time</groupId>
+            <artifactId>joda-time</artifactId>
+            <version>${joda.time.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.hive</groupId>
             <artifactId>hive-cli</artifactId>
             <scope>compile</scope>
diff --git a/sharelib/hive2/pom.xml b/sharelib/hive2/pom.xml
index 0ce0c67..743b6e9 100644
--- a/sharelib/hive2/pom.xml
+++ b/sharelib/hive2/pom.xml
@@ -39,6 +39,12 @@
 
     <dependencies>
         <dependency>
+            <groupId>joda-time</groupId>
+            <artifactId>joda-time</artifactId>
+            <version>${joda.time.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.hive</groupId>
             <artifactId>hive-cli</artifactId>
             <scope>compile</scope>
diff --git a/sharelib/pig/pom.xml b/sharelib/pig/pom.xml
index e953b22..4793dd0 100644
--- a/sharelib/pig/pom.xml
+++ b/sharelib/pig/pom.xml
@@ -39,6 +39,12 @@
 
     <dependencies>
         <dependency>
+            <groupId>joda-time</groupId>
+            <artifactId>joda-time</artifactId>
+            <version>${joda.time.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.pig</groupId>
             <artifactId>pig</artifactId>
             <classifier>${pig.classifier}</classifier>
@@ -113,11 +119,6 @@
             <scope>compile</scope>
         </dependency>
         <dependency>
-            <groupId>joda-time</groupId>
-            <artifactId>joda-time</artifactId>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.hive.hcatalog</groupId>
             <artifactId>hive-hcatalog-pig-adapter</artifactId>
             <version>${hive.version}</version>
diff --git a/sharelib/spark/pom.xml b/sharelib/spark/pom.xml
index 9eec4bf..4dd249a 100644
--- a/sharelib/spark/pom.xml
+++ b/sharelib/spark/pom.xml
@@ -39,6 +39,12 @@
 
     <dependencies>
         <dependency>
+            <groupId>joda-time</groupId>
+            <artifactId>joda-time</artifactId>
+            <version>${joda.time.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
             <version>${spark.guava.version}</version>