|
|
@ -71,11 +71,13 @@ import org.apache.dolphinscheduler.dao.repository.TaskDefinitionDao; |
|
|
|
import org.apache.dolphinscheduler.dao.repository.TaskDefinitionLogDao; |
|
|
|
import org.apache.dolphinscheduler.dao.repository.TaskDefinitionLogDao; |
|
|
|
import org.apache.dolphinscheduler.dao.repository.TaskInstanceDao; |
|
|
|
import org.apache.dolphinscheduler.dao.repository.TaskInstanceDao; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.TaskPluginManager; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.TaskPluginManager; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.Direct; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.DataType; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.DataType; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.DqTaskState; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.DqTaskState; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.ExecuteSqlType; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.ExecuteSqlType; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.InputType; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.InputType; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.OptionSourceType; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.OptionSourceType; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.model.Property; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo; |
|
|
|
import org.apache.dolphinscheduler.service.cron.CronUtilsTest; |
|
|
|
import org.apache.dolphinscheduler.service.cron.CronUtilsTest; |
|
|
|
import org.apache.dolphinscheduler.service.exceptions.CronParseException; |
|
|
|
import org.apache.dolphinscheduler.service.exceptions.CronParseException; |
|
|
@ -89,6 +91,7 @@ import java.util.Collections; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Assertions; |
|
|
|
import org.junit.jupiter.api.Assertions; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
@ -612,6 +615,32 @@ public class ProcessServiceTest { |
|
|
|
return list; |
|
|
|
return list; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSetGlobalParamIfCommanded() { |
|
|
|
|
|
|
|
ProcessDefinition processDefinition = new ProcessDefinition(); |
|
|
|
|
|
|
|
String globalParams = |
|
|
|
|
|
|
|
"[{\"prop\":\"global_param\",\"value\":\"4\",\"direct\":\"IN\",\"type\":\"VARCHAR\"},{\"prop\":\"O_ERRCODE\",\"value\":\"\",\"direct\":\"OUT\",\"type\":\"VARCHAR\"}]"; |
|
|
|
|
|
|
|
processDefinition.setGlobalParams(globalParams); |
|
|
|
|
|
|
|
Map<String, String> globalParamMap = processDefinition.getGlobalParamMap(); |
|
|
|
|
|
|
|
Assertions.assertTrue(globalParamMap.size() == 2); |
|
|
|
|
|
|
|
Assertions.assertTrue(processDefinition.getGlobalParamList().size() == 2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, String> startParams = new HashMap<>(); |
|
|
|
|
|
|
|
String expectValue = "6"; |
|
|
|
|
|
|
|
startParams.put("global_param", expectValue); |
|
|
|
|
|
|
|
HashMap<String, String> commandParams = new HashMap<>(); |
|
|
|
|
|
|
|
commandParams.put(CMD_PARAM_START_PARAMS, JSONUtils.toJsonString(startParams)); |
|
|
|
|
|
|
|
Map<String, Property> mockStartParams = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mockStartParams.put("global_param", new Property("global_param", Direct.IN, |
|
|
|
|
|
|
|
org.apache.dolphinscheduler.plugin.task.api.enums.DataType.VARCHAR, startParams.get("global_param"))); |
|
|
|
|
|
|
|
when(curingGlobalParamsService.parseWorkflowStartParam(commandParams)).thenReturn(mockStartParams); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
processService.setGlobalParamIfCommanded(processDefinition, commandParams); |
|
|
|
|
|
|
|
Assertions.assertTrue(globalParamMap.get("global_param").equals(expectValue)); |
|
|
|
|
|
|
|
Assertions.assertTrue(globalParamMap.containsKey("O_ERRCODE")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testSaveTaskDefine() { |
|
|
|
public void testSaveTaskDefine() { |
|
|
|
User operator = new User(); |
|
|
|
User operator = new User(); |
|
|
|