From b77dddfeefa87be2027c5ddac29350f946b9e629 Mon Sep 17 00:00:00 2001 From: "gabry.wu" Date: Sun, 9 Feb 2020 17:56:55 +0800 Subject: [PATCH] Adapting partial code(file name start with B) to the sonar cloud rules (#1915) * Adapting partial code(file name start with B) to the sonar cloud rules * add @Ignore to BaseTaskQueueTest class --- .../dolphinscheduler/api/controller/BaseController.java | 9 +++------ .../common/utils/placeholder/BusinessTimeUtils.java | 4 +++- .../dolphinscheduler/common/queue/BaseTaskQueueTest.java | 8 ++++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java index 46432569e1..c434398679 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java @@ -157,8 +157,7 @@ public class BaseController { * @return success result code */ public Result success(String msg, Object list) { - Result result = getResult(msg, list); - return result; + return getResult(msg, list); } /** @@ -168,8 +167,7 @@ public class BaseController { * @return success result code */ public Result success(Object list) { - Result result = getResult(Status.SUCCESS.getMsg(), list); - return result; + return getResult(Status.SUCCESS.getMsg(), list); } /** @@ -181,8 +179,7 @@ public class BaseController { * @return success result code */ public Result success(String msg, Map object) { - Result result = getResult(msg, object); - return result; + return getResult(msg, object); } /** diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/BusinessTimeUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/BusinessTimeUtils.java index d6b4e34ce3..23db4b626b 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/BusinessTimeUtils.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/placeholder/BusinessTimeUtils.java @@ -33,7 +33,9 @@ import static org.apache.commons.lang.time.DateUtils.addDays; * business time utils */ public class BusinessTimeUtils { - + private BusinessTimeUtils() { + throw new IllegalStateException("BusinessTimeUtils class"); + } /** * get business time in parameters by different command types * diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/queue/BaseTaskQueueTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/queue/BaseTaskQueueTest.java index 0bd4266bb7..433e4fa30f 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/queue/BaseTaskQueueTest.java +++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/queue/BaseTaskQueueTest.java @@ -17,12 +17,12 @@ package org.apache.dolphinscheduler.common.queue; import org.apache.dolphinscheduler.common.zk.ZKServer; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.*; /** * base task queue test for only start zk server once */ +@Ignore public class BaseTaskQueueTest { protected static ITaskQueue tasksQueue = null; @@ -40,4 +40,8 @@ public class BaseTaskQueueTest { tasksQueue.delete(); ZKServer.stop(); } + @Test + public void tasksQueueNotNull(){ + Assert.assertNotNull(tasksQueue); + } }