|
|
@ -17,65 +17,18 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.apache.dolphinscheduler.service.process; |
|
|
|
package org.apache.dolphinscheduler.service.process; |
|
|
|
|
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING; |
|
|
|
import com.fasterxml.jackson.databind.JsonNode; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_START_PARAMS; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE; |
|
|
|
|
|
|
|
import static org.mockito.ArgumentMatchers.any; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
|
import org.apache.dolphinscheduler.common.enums.CommandType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.*; |
|
|
|
import org.apache.dolphinscheduler.common.enums.Flag; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.enums.TaskGroupQueueStatus; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.enums.UserType; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.enums.WarningType; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.graph.DAG; |
|
|
|
import org.apache.dolphinscheduler.common.graph.DAG; |
|
|
|
import org.apache.dolphinscheduler.common.model.TaskNodeRelation; |
|
|
|
import org.apache.dolphinscheduler.common.model.TaskNodeRelation; |
|
|
|
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; |
|
|
|
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; |
|
|
|
import org.apache.dolphinscheduler.common.utils.DateUtils; |
|
|
|
import org.apache.dolphinscheduler.common.utils.DateUtils; |
|
|
|
import org.apache.dolphinscheduler.common.utils.JSONUtils; |
|
|
|
import org.apache.dolphinscheduler.common.utils.JSONUtils; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.Command; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.*; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.DqExecuteResult; |
|
|
|
import org.apache.dolphinscheduler.dao.mapper.*; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.DqRule; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.DqRuleExecuteSql; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.DqRuleInputEntry; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessInstance; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessInstanceMap; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.Resource; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.TaskGroupQueue; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.TaskInstance; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.User; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.CommandMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.DqComparisonTypeMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.DqExecuteResultMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.DqRuleExecuteSqlMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.DqRuleInputEntryMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.DqRuleMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ErrorCommandMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationLogMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ResourceMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.TaskGroupMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.TaskGroupQueueMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.mapper.UserMapper; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.dao.repository.ProcessInstanceDao; |
|
|
|
import org.apache.dolphinscheduler.dao.repository.ProcessInstanceDao; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.DqTaskState; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.*; |
|
|
|
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.OptionSourceType; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.ValueType; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.model.DateInterval; |
|
|
|
import org.apache.dolphinscheduler.plugin.task.api.model.DateInterval; |
|
|
|
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; |
|
|
@ -85,39 +38,31 @@ import org.apache.dolphinscheduler.service.expand.CuringParamsService; |
|
|
|
import org.apache.dolphinscheduler.service.model.TaskNode; |
|
|
|
import org.apache.dolphinscheduler.service.model.TaskNode; |
|
|
|
import org.apache.dolphinscheduler.service.task.TaskPluginManager; |
|
|
|
import org.apache.dolphinscheduler.service.task.TaskPluginManager; |
|
|
|
import org.apache.dolphinscheduler.spi.params.base.FormType; |
|
|
|
import org.apache.dolphinscheduler.spi.params.base.FormType; |
|
|
|
|
|
|
|
import org.junit.jupiter.api.Assertions; |
|
|
|
import java.util.ArrayList; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import java.util.Collections; |
|
|
|
import org.junit.jupiter.api.extension.ExtendWith; |
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.junit.Assert; |
|
|
|
|
|
|
|
import org.junit.Rule; |
|
|
|
|
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
import org.junit.rules.ExpectedException; |
|
|
|
|
|
|
|
import org.junit.runner.RunWith; |
|
|
|
|
|
|
|
import org.mockito.InjectMocks; |
|
|
|
import org.mockito.InjectMocks; |
|
|
|
import org.mockito.Mock; |
|
|
|
import org.mockito.Mock; |
|
|
|
import org.mockito.Mockito; |
|
|
|
import org.mockito.Mockito; |
|
|
|
import org.mockito.junit.MockitoJUnitRunner; |
|
|
|
import org.mockito.junit.jupiter.MockitoExtension; |
|
|
|
|
|
|
|
import org.mockito.junit.jupiter.MockitoSettings; |
|
|
|
|
|
|
|
import org.mockito.quality.Strictness; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.Constants.*; |
|
|
|
|
|
|
|
import static org.mockito.ArgumentMatchers.any; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* process service test |
|
|
|
* process service test |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@RunWith(MockitoJUnitRunner.Silent.class) |
|
|
|
@ExtendWith(MockitoExtension.class) |
|
|
|
|
|
|
|
@MockitoSettings(strictness = Strictness.LENIENT) |
|
|
|
public class ProcessServiceTest { |
|
|
|
public class ProcessServiceTest { |
|
|
|
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(CronUtilsTest.class); |
|
|
|
private static final Logger logger = LoggerFactory.getLogger(CronUtilsTest.class); |
|
|
|
|
|
|
|
|
|
|
|
@Rule |
|
|
|
|
|
|
|
public final ExpectedException exception = ExpectedException.none(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@InjectMocks |
|
|
|
@InjectMocks |
|
|
|
private ProcessServiceImpl processService; |
|
|
|
private ProcessServiceImpl processService; |
|
|
|
@Mock |
|
|
|
@Mock |
|
|
@ -203,19 +148,19 @@ public class ProcessServiceTest { |
|
|
|
Mockito.when(processDefineMapper.queryByDefineId(100)).thenReturn(processDefinition); |
|
|
|
Mockito.when(processDefineMapper.queryByDefineId(100)).thenReturn(processDefinition); |
|
|
|
Mockito.when(processDefineMapper.queryByCode(10L)).thenReturn(processDefinition); |
|
|
|
Mockito.when(processDefineMapper.queryByCode(10L)).thenReturn(processDefinition); |
|
|
|
command = processService.createSubProcessCommand(parentInstance, childInstance, instanceMap, task); |
|
|
|
command = processService.createSubProcessCommand(parentInstance, childInstance, instanceMap, task); |
|
|
|
Assert.assertEquals(CommandType.START_PROCESS, command.getCommandType()); |
|
|
|
Assertions.assertEquals(CommandType.START_PROCESS, command.getCommandType()); |
|
|
|
|
|
|
|
|
|
|
|
// father history: start,start failure; child null == command type: start
|
|
|
|
// father history: start,start failure; child null == command type: start
|
|
|
|
parentInstance.setCommandType(CommandType.START_FAILURE_TASK_PROCESS); |
|
|
|
parentInstance.setCommandType(CommandType.START_FAILURE_TASK_PROCESS); |
|
|
|
parentInstance.setHistoryCmd("START_PROCESS,START_FAILURE_TASK_PROCESS"); |
|
|
|
parentInstance.setHistoryCmd("START_PROCESS,START_FAILURE_TASK_PROCESS"); |
|
|
|
command = processService.createSubProcessCommand(parentInstance, childInstance, instanceMap, task); |
|
|
|
command = processService.createSubProcessCommand(parentInstance, childInstance, instanceMap, task); |
|
|
|
Assert.assertEquals(CommandType.START_PROCESS, command.getCommandType()); |
|
|
|
Assertions.assertEquals(CommandType.START_PROCESS, command.getCommandType()); |
|
|
|
|
|
|
|
|
|
|
|
// father history: scheduler,start failure; child null == command type: scheduler
|
|
|
|
// father history: scheduler,start failure; child null == command type: scheduler
|
|
|
|
parentInstance.setCommandType(CommandType.START_FAILURE_TASK_PROCESS); |
|
|
|
parentInstance.setCommandType(CommandType.START_FAILURE_TASK_PROCESS); |
|
|
|
parentInstance.setHistoryCmd("SCHEDULER,START_FAILURE_TASK_PROCESS"); |
|
|
|
parentInstance.setHistoryCmd("SCHEDULER,START_FAILURE_TASK_PROCESS"); |
|
|
|
command = processService.createSubProcessCommand(parentInstance, childInstance, instanceMap, task); |
|
|
|
command = processService.createSubProcessCommand(parentInstance, childInstance, instanceMap, task); |
|
|
|
Assert.assertEquals(CommandType.SCHEDULER, command.getCommandType()); |
|
|
|
Assertions.assertEquals(CommandType.SCHEDULER, command.getCommandType()); |
|
|
|
|
|
|
|
|
|
|
|
// father history: complement,start failure; child null == command type: complement
|
|
|
|
// father history: complement,start failure; child null == command type: complement
|
|
|
|
|
|
|
|
|
|
|
@ -228,20 +173,20 @@ public class ProcessServiceTest { |
|
|
|
complementMap.put(Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE, endString); |
|
|
|
complementMap.put(Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE, endString); |
|
|
|
parentInstance.setCommandParam(JSONUtils.toJsonString(complementMap)); |
|
|
|
parentInstance.setCommandParam(JSONUtils.toJsonString(complementMap)); |
|
|
|
command = processService.createSubProcessCommand(parentInstance, childInstance, instanceMap, task); |
|
|
|
command = processService.createSubProcessCommand(parentInstance, childInstance, instanceMap, task); |
|
|
|
Assert.assertEquals(CommandType.COMPLEMENT_DATA, command.getCommandType()); |
|
|
|
Assertions.assertEquals(CommandType.COMPLEMENT_DATA, command.getCommandType()); |
|
|
|
|
|
|
|
|
|
|
|
JsonNode complementDate = JSONUtils.parseObject(command.getCommandParam()); |
|
|
|
JsonNode complementDate = JSONUtils.parseObject(command.getCommandParam()); |
|
|
|
Date start = DateUtils.stringToDate(complementDate.get(Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE).asText()); |
|
|
|
Date start = DateUtils.stringToDate(complementDate.get(Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE).asText()); |
|
|
|
Date end = DateUtils.stringToDate(complementDate.get(Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE).asText()); |
|
|
|
Date end = DateUtils.stringToDate(complementDate.get(Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE).asText()); |
|
|
|
Assert.assertEquals(startString, DateUtils.dateToString(start)); |
|
|
|
Assertions.assertEquals(startString, DateUtils.dateToString(start)); |
|
|
|
Assert.assertEquals(endString, DateUtils.dateToString(end)); |
|
|
|
Assertions.assertEquals(endString, DateUtils.dateToString(end)); |
|
|
|
|
|
|
|
|
|
|
|
// father history: start,failure,start failure; child not null == command type: start failure
|
|
|
|
// father history: start,failure,start failure; child not null == command type: start failure
|
|
|
|
childInstance = new ProcessInstance(); |
|
|
|
childInstance = new ProcessInstance(); |
|
|
|
parentInstance.setCommandType(CommandType.START_FAILURE_TASK_PROCESS); |
|
|
|
parentInstance.setCommandType(CommandType.START_FAILURE_TASK_PROCESS); |
|
|
|
parentInstance.setHistoryCmd("START_PROCESS,START_FAILURE_TASK_PROCESS"); |
|
|
|
parentInstance.setHistoryCmd("START_PROCESS,START_FAILURE_TASK_PROCESS"); |
|
|
|
command = processService.createSubProcessCommand(parentInstance, childInstance, instanceMap, task); |
|
|
|
command = processService.createSubProcessCommand(parentInstance, childInstance, instanceMap, task); |
|
|
|
Assert.assertEquals(CommandType.START_FAILURE_TASK_PROCESS, command.getCommandType()); |
|
|
|
Assertions.assertEquals(CommandType.START_FAILURE_TASK_PROCESS, command.getCommandType()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -254,16 +199,16 @@ public class ProcessServiceTest { |
|
|
|
command.setCommandParam("{\"" + CMD_PARAM_RECOVER_PROCESS_ID_STRING + "\":\"111\"}"); |
|
|
|
command.setCommandParam("{\"" + CMD_PARAM_RECOVER_PROCESS_ID_STRING + "\":\"111\"}"); |
|
|
|
commands.add(command); |
|
|
|
commands.add(command); |
|
|
|
Mockito.when(commandMapper.selectList(null)).thenReturn(commands); |
|
|
|
Mockito.when(commandMapper.selectList(null)).thenReturn(commands); |
|
|
|
Assert.assertFalse(processService.verifyIsNeedCreateCommand(command)); |
|
|
|
Assertions.assertFalse(processService.verifyIsNeedCreateCommand(command)); |
|
|
|
|
|
|
|
|
|
|
|
Command command1 = new Command(); |
|
|
|
Command command1 = new Command(); |
|
|
|
command1.setCommandType(CommandType.REPEAT_RUNNING); |
|
|
|
command1.setCommandType(CommandType.REPEAT_RUNNING); |
|
|
|
command1.setCommandParam("{\"" + CMD_PARAM_RECOVER_PROCESS_ID_STRING + "\":\"222\"}"); |
|
|
|
command1.setCommandParam("{\"" + CMD_PARAM_RECOVER_PROCESS_ID_STRING + "\":\"222\"}"); |
|
|
|
Assert.assertTrue(processService.verifyIsNeedCreateCommand(command1)); |
|
|
|
Assertions.assertTrue(processService.verifyIsNeedCreateCommand(command1)); |
|
|
|
|
|
|
|
|
|
|
|
Command command2 = new Command(); |
|
|
|
Command command2 = new Command(); |
|
|
|
command2.setCommandType(CommandType.PAUSE); |
|
|
|
command2.setCommandType(CommandType.PAUSE); |
|
|
|
Assert.assertTrue(processService.verifyIsNeedCreateCommand(command2)); |
|
|
|
Assertions.assertTrue(processService.verifyIsNeedCreateCommand(command2)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -308,10 +253,10 @@ public class ProcessServiceTest { |
|
|
|
+ CMD_PARAM_SUB_PROCESS_DEFINE_CODE |
|
|
|
+ CMD_PARAM_SUB_PROCESS_DEFINE_CODE |
|
|
|
+ "\":\"222\"}"); |
|
|
|
+ "\":\"222\"}"); |
|
|
|
try { |
|
|
|
try { |
|
|
|
Assert.assertNull(processService.handleCommand(host, command)); |
|
|
|
Assertions.assertNull(processService.handleCommand(host, command)); |
|
|
|
} catch (IllegalArgumentException illegalArgumentException) { |
|
|
|
} catch (IllegalArgumentException illegalArgumentException) { |
|
|
|
// assert throw illegalArgumentException here since the definition is null
|
|
|
|
// assert throw illegalArgumentException here since the definition is null
|
|
|
|
Assert.assertTrue(true); |
|
|
|
Assertions.assertTrue(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int definitionVersion = 1; |
|
|
|
int definitionVersion = 1; |
|
|
@ -349,7 +294,7 @@ public class ProcessServiceTest { |
|
|
|
Mockito.when(processDefineLogMapper.queryByDefinitionCodeAndVersion(processInstance.getProcessDefinitionCode(), |
|
|
|
Mockito.when(processDefineLogMapper.queryByDefinitionCodeAndVersion(processInstance.getProcessDefinitionCode(), |
|
|
|
processInstance.getProcessDefinitionVersion())).thenReturn(new ProcessDefinitionLog(processDefinition)); |
|
|
|
processInstance.getProcessDefinitionVersion())).thenReturn(new ProcessDefinitionLog(processDefinition)); |
|
|
|
Mockito.when(processInstanceMapper.queryDetailById(222)).thenReturn(processInstance); |
|
|
|
Mockito.when(processInstanceMapper.queryDetailById(222)).thenReturn(processInstance); |
|
|
|
Assert.assertNotNull(processService.handleCommand(host, command1)); |
|
|
|
Assertions.assertNotNull(processService.handleCommand(host, command1)); |
|
|
|
|
|
|
|
|
|
|
|
Command command2 = new Command(); |
|
|
|
Command command2 = new Command(); |
|
|
|
command2.setId(2); |
|
|
|
command2.setId(2); |
|
|
@ -359,7 +304,7 @@ public class ProcessServiceTest { |
|
|
|
command2.setCommandType(CommandType.RECOVER_SUSPENDED_PROCESS); |
|
|
|
command2.setCommandType(CommandType.RECOVER_SUSPENDED_PROCESS); |
|
|
|
command2.setProcessInstanceId(processInstanceId); |
|
|
|
command2.setProcessInstanceId(processInstanceId); |
|
|
|
Mockito.when(commandMapper.deleteById(2)).thenReturn(1); |
|
|
|
Mockito.when(commandMapper.deleteById(2)).thenReturn(1); |
|
|
|
Assert.assertNotNull(processService.handleCommand(host, command2)); |
|
|
|
Assertions.assertNotNull(processService.handleCommand(host, command2)); |
|
|
|
|
|
|
|
|
|
|
|
Command command3 = new Command(); |
|
|
|
Command command3 = new Command(); |
|
|
|
command3.setId(3); |
|
|
|
command3.setId(3); |
|
|
@ -369,7 +314,7 @@ public class ProcessServiceTest { |
|
|
|
command3.setCommandParam("{\"WaitingThreadInstanceId\":222}"); |
|
|
|
command3.setCommandParam("{\"WaitingThreadInstanceId\":222}"); |
|
|
|
command3.setCommandType(CommandType.START_FAILURE_TASK_PROCESS); |
|
|
|
command3.setCommandType(CommandType.START_FAILURE_TASK_PROCESS); |
|
|
|
Mockito.when(commandMapper.deleteById(3)).thenReturn(1); |
|
|
|
Mockito.when(commandMapper.deleteById(3)).thenReturn(1); |
|
|
|
Assert.assertNotNull(processService.handleCommand(host, command3)); |
|
|
|
Assertions.assertNotNull(processService.handleCommand(host, command3)); |
|
|
|
|
|
|
|
|
|
|
|
Command command4 = new Command(); |
|
|
|
Command command4 = new Command(); |
|
|
|
command4.setId(4); |
|
|
|
command4.setId(4); |
|
|
@ -379,7 +324,7 @@ public class ProcessServiceTest { |
|
|
|
command4.setCommandType(CommandType.REPEAT_RUNNING); |
|
|
|
command4.setCommandType(CommandType.REPEAT_RUNNING); |
|
|
|
command4.setProcessInstanceId(processInstanceId); |
|
|
|
command4.setProcessInstanceId(processInstanceId); |
|
|
|
Mockito.when(commandMapper.deleteById(4)).thenReturn(1); |
|
|
|
Mockito.when(commandMapper.deleteById(4)).thenReturn(1); |
|
|
|
Assert.assertNotNull(processService.handleCommand(host, command4)); |
|
|
|
Assertions.assertNotNull(processService.handleCommand(host, command4)); |
|
|
|
|
|
|
|
|
|
|
|
Command command5 = new Command(); |
|
|
|
Command command5 = new Command(); |
|
|
|
command5.setId(5); |
|
|
|
command5.setId(5); |
|
|
@ -399,7 +344,7 @@ public class ProcessServiceTest { |
|
|
|
CommandType.START_PROCESS, |
|
|
|
CommandType.START_PROCESS, |
|
|
|
processInstance.getScheduleTime(), null)).thenReturn("\"testStartParam1\""); |
|
|
|
processInstance.getScheduleTime(), null)).thenReturn("\"testStartParam1\""); |
|
|
|
ProcessInstance processInstance1 = processService.handleCommand(host, command5); |
|
|
|
ProcessInstance processInstance1 = processService.handleCommand(host, command5); |
|
|
|
Assert.assertTrue(processInstance1.getGlobalParams().contains("\"testStartParam1\"")); |
|
|
|
Assertions.assertTrue(processInstance1.getGlobalParams().contains("\"testStartParam1\"")); |
|
|
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition1 = new ProcessDefinition(); |
|
|
|
ProcessDefinition processDefinition1 = new ProcessDefinition(); |
|
|
|
processDefinition1.setId(123); |
|
|
|
processDefinition1.setId(123); |
|
|
@ -423,7 +368,7 @@ public class ProcessServiceTest { |
|
|
|
Mockito.when(processInstanceMapper.queryDetailById(223)).thenReturn(processInstance2); |
|
|
|
Mockito.when(processInstanceMapper.queryDetailById(223)).thenReturn(processInstance2); |
|
|
|
Mockito.when(processDefineMapper.queryByCode(11L)).thenReturn(processDefinition1); |
|
|
|
Mockito.when(processDefineMapper.queryByCode(11L)).thenReturn(processDefinition1); |
|
|
|
Mockito.when(commandMapper.deleteById(1)).thenReturn(1); |
|
|
|
Mockito.when(commandMapper.deleteById(1)).thenReturn(1); |
|
|
|
Assert.assertNotNull(processService.handleCommand(host, command1)); |
|
|
|
Assertions.assertNotNull(processService.handleCommand(host, command1)); |
|
|
|
|
|
|
|
|
|
|
|
Command command6 = new Command(); |
|
|
|
Command command6 = new Command(); |
|
|
|
command6.setId(6); |
|
|
|
command6.setId(6); |
|
|
@ -436,7 +381,7 @@ public class ProcessServiceTest { |
|
|
|
Mockito.when(processInstanceMapper.updateNextProcessIdById(223, 222)).thenReturn(true); |
|
|
|
Mockito.when(processInstanceMapper.updateNextProcessIdById(223, 222)).thenReturn(true); |
|
|
|
Mockito.when(commandMapper.deleteById(6)).thenReturn(1); |
|
|
|
Mockito.when(commandMapper.deleteById(6)).thenReturn(1); |
|
|
|
ProcessInstance processInstance6 = processService.handleCommand(host, command6); |
|
|
|
ProcessInstance processInstance6 = processService.handleCommand(host, command6); |
|
|
|
Assert.assertTrue(processInstance6 != null); |
|
|
|
Assertions.assertNotNull(processInstance6); |
|
|
|
|
|
|
|
|
|
|
|
processDefinition1.setExecutionType(ProcessExecutionTypeEnum.SERIAL_DISCARD); |
|
|
|
processDefinition1.setExecutionType(ProcessExecutionTypeEnum.SERIAL_DISCARD); |
|
|
|
Mockito.when(processDefineMapper.queryByCode(11L)).thenReturn(processDefinition1); |
|
|
|
Mockito.when(processDefineMapper.queryByCode(11L)).thenReturn(processDefinition1); |
|
|
@ -456,7 +401,7 @@ public class ProcessServiceTest { |
|
|
|
Mockito.when(processInstanceMapper.queryByProcessDefineCodeAndProcessDefinitionVersionAndStatusAndNextId(11L, 1, |
|
|
|
Mockito.when(processInstanceMapper.queryByProcessDefineCodeAndProcessDefinitionVersionAndStatusAndNextId(11L, 1, |
|
|
|
org.apache.dolphinscheduler.service.utils.Constants.RUNNING_PROCESS_STATE, 224)).thenReturn(null); |
|
|
|
org.apache.dolphinscheduler.service.utils.Constants.RUNNING_PROCESS_STATE, 224)).thenReturn(null); |
|
|
|
ProcessInstance processInstance8 = processService.handleCommand(host, command7); |
|
|
|
ProcessInstance processInstance8 = processService.handleCommand(host, command7); |
|
|
|
Assert.assertTrue(processInstance8 != null); |
|
|
|
Assertions.assertNotNull(processInstance8); |
|
|
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition2 = new ProcessDefinition(); |
|
|
|
ProcessDefinition processDefinition2 = new ProcessDefinition(); |
|
|
|
processDefinition2.setId(123); |
|
|
|
processDefinition2.setId(123); |
|
|
@ -481,10 +426,10 @@ public class ProcessServiceTest { |
|
|
|
Mockito.when(processInstanceMapper.updateById(processInstance)).thenReturn(1); |
|
|
|
Mockito.when(processInstanceMapper.updateById(processInstance)).thenReturn(1); |
|
|
|
Mockito.when(commandMapper.deleteById(9)).thenReturn(1); |
|
|
|
Mockito.when(commandMapper.deleteById(9)).thenReturn(1); |
|
|
|
ProcessInstance processInstance10 = processService.handleCommand(host, command9); |
|
|
|
ProcessInstance processInstance10 = processService.handleCommand(host, command9); |
|
|
|
Assert.assertTrue(processInstance10 != null); |
|
|
|
Assertions.assertNotNull(processInstance10); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = ServiceException.class) |
|
|
|
@Test |
|
|
|
public void testDeleteNotExistCommand() throws CronParseException, CodeGenerateUtils.CodeGenerateException { |
|
|
|
public void testDeleteNotExistCommand() throws CronParseException, CodeGenerateUtils.CodeGenerateException { |
|
|
|
String host = "127.0.0.1"; |
|
|
|
String host = "127.0.0.1"; |
|
|
|
int definitionVersion = 1; |
|
|
|
int definitionVersion = 1; |
|
|
@ -522,8 +467,10 @@ public class ProcessServiceTest { |
|
|
|
processInstance.getProcessDefinitionVersion())).thenReturn(new ProcessDefinitionLog(processDefinition)); |
|
|
|
processInstance.getProcessDefinitionVersion())).thenReturn(new ProcessDefinitionLog(processDefinition)); |
|
|
|
Mockito.when(processInstanceMapper.queryDetailById(222)).thenReturn(processInstance); |
|
|
|
Mockito.when(processInstanceMapper.queryDetailById(222)).thenReturn(processInstance); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assertions.assertThrows(ServiceException.class, () -> { |
|
|
|
// will throw exception when command id is 0 and delete fail
|
|
|
|
// will throw exception when command id is 0 and delete fail
|
|
|
|
processService.handleCommand(host, command1); |
|
|
|
processService.handleCommand(host, command1); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -531,7 +478,7 @@ public class ProcessServiceTest { |
|
|
|
User user = new User(); |
|
|
|
User user = new User(); |
|
|
|
user.setId(123); |
|
|
|
user.setId(123); |
|
|
|
Mockito.when(userMapper.selectById(123)).thenReturn(user); |
|
|
|
Mockito.when(userMapper.selectById(123)).thenReturn(user); |
|
|
|
Assert.assertEquals(user, processService.getUserById(123)); |
|
|
|
Assertions.assertEquals(user, processService.getUserById(123)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -540,7 +487,7 @@ public class ProcessServiceTest { |
|
|
|
taskInstance.setId(333); |
|
|
|
taskInstance.setId(333); |
|
|
|
taskInstance.setProcessInstanceId(222); |
|
|
|
taskInstance.setProcessInstanceId(222); |
|
|
|
Mockito.when(processService.findProcessInstanceById(taskInstance.getProcessInstanceId())).thenReturn(null); |
|
|
|
Mockito.when(processService.findProcessInstanceById(taskInstance.getProcessInstanceId())).thenReturn(null); |
|
|
|
Assert.assertEquals("", processService.formatTaskAppId(taskInstance)); |
|
|
|
Assertions.assertEquals("", processService.formatTaskAppId(taskInstance)); |
|
|
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition = new ProcessDefinition(); |
|
|
|
ProcessDefinition processDefinition = new ProcessDefinition(); |
|
|
|
processDefinition.setId(111); |
|
|
|
processDefinition.setId(111); |
|
|
@ -550,7 +497,7 @@ public class ProcessServiceTest { |
|
|
|
processInstance.setProcessDefinitionCode(1L); |
|
|
|
processInstance.setProcessDefinitionCode(1L); |
|
|
|
Mockito.when(processService.findProcessInstanceById(taskInstance.getProcessInstanceId())) |
|
|
|
Mockito.when(processService.findProcessInstanceById(taskInstance.getProcessInstanceId())) |
|
|
|
.thenReturn(processInstance); |
|
|
|
.thenReturn(processInstance); |
|
|
|
Assert.assertEquals("", processService.formatTaskAppId(taskInstance)); |
|
|
|
Assertions.assertEquals("", processService.formatTaskAppId(taskInstance)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -584,7 +531,7 @@ public class ProcessServiceTest { |
|
|
|
List<Long> ids = new ArrayList<>(); |
|
|
|
List<Long> ids = new ArrayList<>(); |
|
|
|
processService.recurseFindSubProcess(parentProcessDefineCode, ids); |
|
|
|
processService.recurseFindSubProcess(parentProcessDefineCode, ids); |
|
|
|
|
|
|
|
|
|
|
|
Assert.assertEquals(0, ids.size()); |
|
|
|
Assertions.assertEquals(0, ids.size()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -599,25 +546,25 @@ public class ProcessServiceTest { |
|
|
|
ProcessDefinitionLog processDefinitionLog = new ProcessDefinitionLog(); |
|
|
|
ProcessDefinitionLog processDefinitionLog = new ProcessDefinitionLog(); |
|
|
|
processDefinitionLog.setCode(1L); |
|
|
|
processDefinitionLog.setCode(1L); |
|
|
|
processDefinitionLog.setVersion(2); |
|
|
|
processDefinitionLog.setVersion(2); |
|
|
|
Assert.assertEquals(0, processService.switchVersion(processDefinition, processDefinitionLog)); |
|
|
|
Assertions.assertEquals(0, processService.switchVersion(processDefinition, processDefinitionLog)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void getDqRule() { |
|
|
|
public void getDqRule() { |
|
|
|
Mockito.when(dqRuleMapper.selectById(1)).thenReturn(new DqRule()); |
|
|
|
Mockito.when(dqRuleMapper.selectById(1)).thenReturn(new DqRule()); |
|
|
|
Assert.assertNotNull(processService.getDqRule(1)); |
|
|
|
Assertions.assertNotNull(processService.getDqRule(1)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void getRuleInputEntry() { |
|
|
|
public void getRuleInputEntry() { |
|
|
|
Mockito.when(dqRuleInputEntryMapper.getRuleInputEntryList(1)).thenReturn(getRuleInputEntryList()); |
|
|
|
Mockito.when(dqRuleInputEntryMapper.getRuleInputEntryList(1)).thenReturn(getRuleInputEntryList()); |
|
|
|
Assert.assertNotNull(processService.getRuleInputEntry(1)); |
|
|
|
Assertions.assertNotNull(processService.getRuleInputEntry(1)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void getDqExecuteSql() { |
|
|
|
public void getDqExecuteSql() { |
|
|
|
Mockito.when(dqRuleExecuteSqlMapper.getExecuteSqlList(1)).thenReturn(getRuleExecuteSqlList()); |
|
|
|
Mockito.when(dqRuleExecuteSqlMapper.getExecuteSqlList(1)).thenReturn(getRuleExecuteSqlList()); |
|
|
|
Assert.assertNotNull(processService.getDqExecuteSql(1)); |
|
|
|
Assertions.assertNotNull(processService.getDqExecuteSql(1)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<DqRuleInputEntry> getRuleInputEntryList() { |
|
|
|
private List<DqRuleInputEntry> getRuleInputEntryList() { |
|
|
@ -733,7 +680,7 @@ public class ProcessServiceTest { |
|
|
|
Mockito.when(taskDefinitionMapper.queryByCodeList(Collections.singletonList(taskDefinition.getCode()))) |
|
|
|
Mockito.when(taskDefinitionMapper.queryByCodeList(Collections.singletonList(taskDefinition.getCode()))) |
|
|
|
.thenReturn(Collections.singletonList(taskDefinition)); |
|
|
|
.thenReturn(Collections.singletonList(taskDefinition)); |
|
|
|
int result = processService.saveTaskDefine(operator, projectCode, taskDefinitionLogs, Boolean.TRUE); |
|
|
|
int result = processService.saveTaskDefine(operator, projectCode, taskDefinitionLogs, Boolean.TRUE); |
|
|
|
Assert.assertEquals(0, result); |
|
|
|
Assertions.assertEquals(0, result); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -787,7 +734,7 @@ public class ProcessServiceTest { |
|
|
|
|
|
|
|
|
|
|
|
DAG<String, TaskNode, TaskNodeRelation> stringTaskNodeTaskNodeRelationDAG = |
|
|
|
DAG<String, TaskNode, TaskNodeRelation> stringTaskNodeTaskNodeRelationDAG = |
|
|
|
processService.genDagGraph(processDefinition); |
|
|
|
processService.genDagGraph(processDefinition); |
|
|
|
Assert.assertEquals(1, stringTaskNodeTaskNodeRelationDAG.getNodesCount()); |
|
|
|
Assertions.assertEquals(1, stringTaskNodeTaskNodeRelationDAG.getNodesCount()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -799,7 +746,7 @@ public class ProcessServiceTest { |
|
|
|
int mockResult = 1; |
|
|
|
int mockResult = 1; |
|
|
|
Mockito.when(commandMapper.insert(command)).thenReturn(mockResult); |
|
|
|
Mockito.when(commandMapper.insert(command)).thenReturn(mockResult); |
|
|
|
int exeMethodResult = processService.createCommand(command); |
|
|
|
int exeMethodResult = processService.createCommand(command); |
|
|
|
Assert.assertEquals(mockResult, exeMethodResult); |
|
|
|
Assertions.assertEquals(mockResult, exeMethodResult); |
|
|
|
Mockito.verify(commandMapper, Mockito.times(1)).insert(command); |
|
|
|
Mockito.verify(commandMapper, Mockito.times(1)).insert(command); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -823,12 +770,12 @@ public class ProcessServiceTest { |
|
|
|
// test if input is null
|
|
|
|
// test if input is null
|
|
|
|
ResourceInfo resourceInfoNull = null; |
|
|
|
ResourceInfo resourceInfoNull = null; |
|
|
|
ResourceInfo updatedResourceInfo1 = processService.updateResourceInfo(resourceInfoNull); |
|
|
|
ResourceInfo updatedResourceInfo1 = processService.updateResourceInfo(resourceInfoNull); |
|
|
|
Assert.assertNull(updatedResourceInfo1); |
|
|
|
Assertions.assertNull(updatedResourceInfo1); |
|
|
|
|
|
|
|
|
|
|
|
// test if resource id less than 1
|
|
|
|
// test if resource id less than 1
|
|
|
|
ResourceInfo resourceInfoVoid = new ResourceInfo(); |
|
|
|
ResourceInfo resourceInfoVoid = new ResourceInfo(); |
|
|
|
ResourceInfo updatedResourceInfo2 = processService.updateResourceInfo(resourceInfoVoid); |
|
|
|
ResourceInfo updatedResourceInfo2 = processService.updateResourceInfo(resourceInfoVoid); |
|
|
|
Assert.assertNull(updatedResourceInfo2); |
|
|
|
Assertions.assertNull(updatedResourceInfo2); |
|
|
|
|
|
|
|
|
|
|
|
// test normal situation
|
|
|
|
// test normal situation
|
|
|
|
ResourceInfo resourceInfoNormal = new ResourceInfo(); |
|
|
|
ResourceInfo resourceInfoNormal = new ResourceInfo(); |
|
|
@ -841,9 +788,9 @@ public class ProcessServiceTest { |
|
|
|
|
|
|
|
|
|
|
|
ResourceInfo updatedResourceInfo3 = processService.updateResourceInfo(resourceInfoNormal); |
|
|
|
ResourceInfo updatedResourceInfo3 = processService.updateResourceInfo(resourceInfoNormal); |
|
|
|
|
|
|
|
|
|
|
|
Assert.assertEquals(1, updatedResourceInfo3.getId().intValue()); |
|
|
|
Assertions.assertEquals(1, updatedResourceInfo3.getId().intValue()); |
|
|
|
Assert.assertEquals("test.txt", updatedResourceInfo3.getRes()); |
|
|
|
Assertions.assertEquals("test.txt", updatedResourceInfo3.getRes()); |
|
|
|
Assert.assertEquals("/test.txt", updatedResourceInfo3.getResourceName()); |
|
|
|
Assertions.assertEquals("/test.txt", updatedResourceInfo3.getResourceName()); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -852,7 +799,7 @@ public class ProcessServiceTest { |
|
|
|
Mockito.when(taskGroupQueueMapper.insert(Mockito.any(TaskGroupQueue.class))).thenReturn(1); |
|
|
|
Mockito.when(taskGroupQueueMapper.insert(Mockito.any(TaskGroupQueue.class))).thenReturn(1); |
|
|
|
TaskGroupQueue taskGroupQueue = |
|
|
|
TaskGroupQueue taskGroupQueue = |
|
|
|
processService.insertIntoTaskGroupQueue(1, "task name", 1, 1, 1, TaskGroupQueueStatus.WAIT_QUEUE); |
|
|
|
processService.insertIntoTaskGroupQueue(1, "task name", 1, 1, 1, TaskGroupQueueStatus.WAIT_QUEUE); |
|
|
|
Assert.assertNotNull(taskGroupQueue); |
|
|
|
Assertions.assertNotNull(taskGroupQueue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -875,7 +822,7 @@ public class ProcessServiceTest { |
|
|
|
public void testFindTaskInstanceByIdList() { |
|
|
|
public void testFindTaskInstanceByIdList() { |
|
|
|
List<Integer> emptyList = new ArrayList<>(); |
|
|
|
List<Integer> emptyList = new ArrayList<>(); |
|
|
|
Mockito.when(taskInstanceMapper.selectBatchIds(emptyList)).thenReturn(new ArrayList<>()); |
|
|
|
Mockito.when(taskInstanceMapper.selectBatchIds(emptyList)).thenReturn(new ArrayList<>()); |
|
|
|
Assert.assertEquals(0, processService.findTaskInstanceByIdList(emptyList).size()); |
|
|
|
Assertions.assertEquals(0, processService.findTaskInstanceByIdList(emptyList).size()); |
|
|
|
|
|
|
|
|
|
|
|
List<Integer> idList = Collections.singletonList(1); |
|
|
|
List<Integer> idList = Collections.singletonList(1); |
|
|
|
TaskInstance instance = new TaskInstance(); |
|
|
|
TaskInstance instance = new TaskInstance(); |
|
|
@ -884,8 +831,8 @@ public class ProcessServiceTest { |
|
|
|
Mockito.when(taskInstanceMapper.selectBatchIds(idList)).thenReturn(Collections.singletonList(instance)); |
|
|
|
Mockito.when(taskInstanceMapper.selectBatchIds(idList)).thenReturn(Collections.singletonList(instance)); |
|
|
|
List<TaskInstance> taskInstanceByIdList = processService.findTaskInstanceByIdList(idList); |
|
|
|
List<TaskInstance> taskInstanceByIdList = processService.findTaskInstanceByIdList(idList); |
|
|
|
|
|
|
|
|
|
|
|
Assert.assertEquals(1, taskInstanceByIdList.size()); |
|
|
|
Assertions.assertEquals(1, taskInstanceByIdList.size()); |
|
|
|
Assert.assertEquals(instance.getId(), taskInstanceByIdList.get(0).getId()); |
|
|
|
Assertions.assertEquals(instance.getId(), taskInstanceByIdList.get(0).getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -896,7 +843,7 @@ public class ProcessServiceTest { |
|
|
|
int thisMasterSlot = 2; |
|
|
|
int thisMasterSlot = 2; |
|
|
|
List<Command> commandList = |
|
|
|
List<Command> commandList = |
|
|
|
processService.findCommandPageBySlot(pageSize, pageNumber, masterCount, thisMasterSlot); |
|
|
|
processService.findCommandPageBySlot(pageSize, pageNumber, masterCount, thisMasterSlot); |
|
|
|
Assert.assertEquals(0, commandList.size()); |
|
|
|
Assertions.assertEquals(0, commandList.size()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -908,13 +855,13 @@ public class ProcessServiceTest { |
|
|
|
// find test lastManualProcessInterval
|
|
|
|
// find test lastManualProcessInterval
|
|
|
|
ProcessInstance lastManualProcessInterval = |
|
|
|
ProcessInstance lastManualProcessInterval = |
|
|
|
processService.findLastManualProcessInterval(definitionCode, dateInterval, testFlag); |
|
|
|
processService.findLastManualProcessInterval(definitionCode, dateInterval, testFlag); |
|
|
|
Assert.assertEquals(null, lastManualProcessInterval); |
|
|
|
Assertions.assertNull(lastManualProcessInterval); |
|
|
|
|
|
|
|
|
|
|
|
// find online lastManualProcessInterval
|
|
|
|
// find online lastManualProcessInterval
|
|
|
|
testFlag = 0; |
|
|
|
testFlag = 0; |
|
|
|
lastManualProcessInterval = |
|
|
|
lastManualProcessInterval = |
|
|
|
processService.findLastManualProcessInterval(definitionCode, dateInterval, testFlag); |
|
|
|
processService.findLastManualProcessInterval(definitionCode, dateInterval, testFlag); |
|
|
|
Assert.assertEquals(null, lastManualProcessInterval); |
|
|
|
Assertions.assertNull(lastManualProcessInterval); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -924,13 +871,13 @@ public class ProcessServiceTest { |
|
|
|
// unbound testDataSourceId
|
|
|
|
// unbound testDataSourceId
|
|
|
|
Mockito.when(dataSourceMapper.queryTestDataSourceId(any(Integer.class))).thenReturn(null); |
|
|
|
Mockito.when(dataSourceMapper.queryTestDataSourceId(any(Integer.class))).thenReturn(null); |
|
|
|
Integer result = processService.queryTestDataSourceId(onlineDataSourceId); |
|
|
|
Integer result = processService.queryTestDataSourceId(onlineDataSourceId); |
|
|
|
Assert.assertNull(result); |
|
|
|
Assertions.assertNull(result); |
|
|
|
|
|
|
|
|
|
|
|
// bound testDataSourceId
|
|
|
|
// bound testDataSourceId
|
|
|
|
Integer testDataSourceId = 2; |
|
|
|
Integer testDataSourceId = 2; |
|
|
|
Mockito.when(dataSourceMapper.queryTestDataSourceId(any(Integer.class))).thenReturn(testDataSourceId); |
|
|
|
Mockito.when(dataSourceMapper.queryTestDataSourceId(any(Integer.class))).thenReturn(testDataSourceId); |
|
|
|
result = processService.queryTestDataSourceId(onlineDataSourceId); |
|
|
|
result = processService.queryTestDataSourceId(onlineDataSourceId); |
|
|
|
Assert.assertNotNull(result); |
|
|
|
Assertions.assertNotNull(result); |
|
|
|
} |
|
|
|
} |
|
|
|
private TaskGroupQueue getTaskGroupQueue() { |
|
|
|
private TaskGroupQueue getTaskGroupQueue() { |
|
|
|
TaskGroupQueue taskGroupQueue = new TaskGroupQueue(); |
|
|
|
TaskGroupQueue taskGroupQueue = new TaskGroupQueue(); |
|
|
|