[Feature-4417]fix code style (#5395)
* fix code style * fix ut * remove unused ut * remove unused ut Co-authored-by: baoliang <baoliang@analysys.com.cn>
This commit is contained in:
parent
2a44cb9de6
commit
86dcddb32b
|
|
@ -17,9 +17,8 @@
|
|||
|
||||
package org.apache.dolphinscheduler.common.utils;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* java.lang.String utils class
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class LoggerUtilsTest {
|
|||
|
||||
String taskId = LoggerUtils.buildTaskId(LoggerUtils.TASK_LOGGER_INFO_PREFIX, 798L,1,4084, 15210);
|
||||
|
||||
Assert.assertEquals(" - [taskAppId=TASK-79-4084-15210]", taskId);
|
||||
Assert.assertEquals(" - [taskAppId=TASK-798_1-4084-15210]", taskId);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
package org.apache.dolphinscheduler.common.utils;
|
||||
|
||||
import org.apache.dolphinscheduler.common.model.TaskNode;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
|
@ -28,8 +24,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
public class VarPoolUtilsTest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(VarPoolUtilsTest.class);
|
||||
|
|
@ -54,108 +48,4 @@ public class VarPoolUtilsTest {
|
|||
logger.info(rawScript);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetTaskNodeLocalParams() throws Exception {
|
||||
String taskJson = "{\"id\":\"tasks-66199\",\"name\":\"file-shell\",\"desc\":null,\"type\":\"SHELL\","
|
||||
+ "\"runFlag\":\"NORMAL\",\"loc\":null,\"maxRetryTimes\":0,\"retryInterval\":1,\""
|
||||
+ "params\":{\"rawScript\":\"sh n-1/n-1-1/run.sh\",\""
|
||||
+ "localParams\":[{\"prop\":\"k1\",\"direct\":\"IN\",\"type\":\"VARCHAR\",\"value\":\"v1\"},{\"prop\":\"k2\",\"direct\":\"IN\",\"type\":\"VARCHAR\",\"value\":\"v2\"},"
|
||||
+ "{\"prop\":\"k3\",\"direct\":\"IN\",\"type\":\"VARCHAR\",\"value\":\"v3\"}],\""
|
||||
+ "resourceList\":[{\"id\":\"dolphinschedule-code\",\"res\":\"n-1/n-1-1/dolphinscheduler-api-server.log\"},"
|
||||
+ "{\"id\":\"mr-code\",\"res\":\"n-1/n-1-1/hadoop-mapreduce-examples-2.7.4.jar\"},"
|
||||
+ "{\"id\":\"run\",\"res\":\"n-1/n-1-1/run.sh\"}]},\"preTasks\":[],\"extras\":null,\"depList\":[],\""
|
||||
+ "dependence\":{},\"conditionResult\":{\"successNode\":[\"\"],\"failedNode\":[\"\"]},\"taskInstancePriority\":\"MEDIUM\",\""
|
||||
+ "workerGroup\":\"default\",\"workerGroupId\":null,\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false},\"delayTime\":0}";
|
||||
|
||||
String changeTaskJson = "{"
|
||||
+ " \"id\":\"tasks-66199\","
|
||||
+ " \"code\":null,"
|
||||
+ " \"version\":0,"
|
||||
+ " \"name\":\"file-shell\","
|
||||
+ " \"desc\":null,"
|
||||
+ " \"type\":\"SHELL\","
|
||||
+ " \"runFlag\":\"NORMAL\","
|
||||
+ " \"loc\":null,"
|
||||
+ " \"maxRetryTimes\":0,"
|
||||
+ " \"retryInterval\":1,"
|
||||
+ " \"params\":{"
|
||||
+ " \"rawScript\":\"sh n-1/n-1-1/run.sh\","
|
||||
+ " \"localParams\":["
|
||||
+ " {"
|
||||
+ " \"prop\":\"k1\","
|
||||
+ " \"direct\":\"IN\","
|
||||
+ " \"type\":\"VARCHAR\","
|
||||
+ " \"value\":\"k1-value-change\""
|
||||
+ " },"
|
||||
+ " {"
|
||||
+ " \"prop\":\"k2\","
|
||||
+ " \"direct\":\"IN\","
|
||||
+ " \"type\":\"VARCHAR\","
|
||||
+ " \"value\":\"k2-value-change\""
|
||||
+ " },"
|
||||
+ " {"
|
||||
+ " \"prop\":\"k3\","
|
||||
+ " \"direct\":\"IN\","
|
||||
+ " \"type\":\"VARCHAR\","
|
||||
+ " \"value\":\"v3\""
|
||||
+ " }"
|
||||
+ " ],"
|
||||
+ " \"resourceList\":["
|
||||
+ " {"
|
||||
+ " \"id\":\"dolphinschedule-code\","
|
||||
+ " \"res\":\"n-1/n-1-1/dolphinscheduler-api-server.log\""
|
||||
+ " },"
|
||||
+ " {"
|
||||
+ " \"id\":\"mr-code\","
|
||||
+ " \"res\":\"n-1/n-1-1/hadoop-mapreduce-examples-2.7.4.jar\""
|
||||
+ " },"
|
||||
+ " {"
|
||||
+ " \"id\":\"run\","
|
||||
+ " \"res\":\"n-1/n-1-1/run.sh\""
|
||||
+ " }"
|
||||
+ " ]"
|
||||
+ " },"
|
||||
+ " \"preTasks\":["
|
||||
+ ""
|
||||
+ " ],"
|
||||
+ " \"preTaskNodeList\":null,"
|
||||
+ " \"extras\":null,"
|
||||
+ " \"depList\":["
|
||||
+ ""
|
||||
+ " ],"
|
||||
+ " \"dependence\":{"
|
||||
+ ""
|
||||
+ " },"
|
||||
+ " \"conditionResult\":{"
|
||||
+ " \"successNode\":["
|
||||
+ " \"\""
|
||||
+ " ],"
|
||||
+ " \"failedNode\":["
|
||||
+ " \"\""
|
||||
+ " ]"
|
||||
+ " },"
|
||||
+ " \"taskInstancePriority\":\"MEDIUM\","
|
||||
+ " \"workerGroup\":\"default\","
|
||||
+ " \"workerGroupId\":null,"
|
||||
+ " \"timeout\":{"
|
||||
+ " \"strategy\":\"\","
|
||||
+ " \"interval\":null,"
|
||||
+ " \"enable\":false"
|
||||
+ " },"
|
||||
+ " \"delayTime\":0"
|
||||
+ "}";
|
||||
|
||||
ObjectNode jsonNodes = JSONUtils.parseObject(changeTaskJson);
|
||||
Map<String, Object> propToValue = new HashMap<String, Object>();
|
||||
propToValue.put("k1", "k1-value-change");
|
||||
propToValue.put("k2", "k2-value-change");
|
||||
|
||||
TaskNode taskNode = JSONUtils.parseObject(taskJson, TaskNode.class);
|
||||
|
||||
VarPoolUtils.setTaskNodeLocalParams(taskNode, propToValue);
|
||||
|
||||
Assert.assertEquals(JSONUtils.toJsonString(jsonNodes), JSONUtils.toJsonString(taskNode).trim());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue