You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by jo...@apache.org on 2020/01/01 13:09:26 UTC

[incubator-dolphinscheduler] branch dev updated: Fix bug in #1634 , replace the current datetime with a fixed time (#1665)

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

journey pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new f311c96  Fix bug in #1634 ,replace the current datetime with a fixed time (#1665)
f311c96 is described below

commit f311c966ab2f7cfcbea8cb8983689ddbdacab7b7
Author: zhukai <bo...@qq.com>
AuthorDate: Wed Jan 1 21:09:19 2020 +0800

    Fix bug in #1634 ,replace the current datetime with a fixed time (#1665)
---
 .../apache/dolphinscheduler/server/utils/ParamUtilsTest.java | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/ParamUtilsTest.java b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/ParamUtilsTest.java
index b91bff7..60a5259 100644
--- a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/ParamUtilsTest.java
+++ b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/utils/ParamUtilsTest.java
@@ -27,6 +27,7 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
@@ -84,8 +85,13 @@ public class ParamUtilsTest {
         //The expected value when globalParams is null but localParams is not null
         String expected1 = "{\"local_param\":{\"direct\":\"IN\",\"prop\":\"local_param\",\"type\":\"VARCHAR\",\"value\":\"20191229\"}}";
 
+        //Define expected date , the month is 0-base
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(2019,11,30);
+        Date date = calendar.getTime();
+
         //Invoke convert
-        Map<String, Property> paramsMap = ParamUtils.convert(globalParams, globalParamsMap, localParams, CommandType.START_PROCESS, new Date());
+        Map<String, Property> paramsMap = ParamUtils.convert(globalParams, globalParamsMap, localParams, CommandType.START_PROCESS, date);
         String result = JSON.toJSONString(paramsMap);
         assertEquals(expected, result);
 
@@ -97,12 +103,12 @@ public class ParamUtilsTest {
         }
 
         //Invoke convert with null globalParams
-        Map<String, Property> paramsMap1 = ParamUtils.convert(null, globalParamsMap, localParams, CommandType.START_PROCESS, new Date());
+        Map<String, Property> paramsMap1 = ParamUtils.convert(null, globalParamsMap, localParams, CommandType.START_PROCESS, date);
         String result1 = JSON.toJSONString(paramsMap1);
         assertEquals(expected1, result1);
 
         //Null check, invoke convert with null globalParams and null localParams
-        Map<String, Property> paramsMap2 = ParamUtils.convert(null, globalParamsMap, null, CommandType.START_PROCESS, new Date());
+        Map<String, Property> paramsMap2 = ParamUtils.convert(null, globalParamsMap, null, CommandType.START_PROCESS, date);
         assertNull(paramsMap2);
     }