mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-11-29 18:58:05 +08:00
Fix ErrorCommand loss some fields in Command (#15847)
This commit is contained in:
parent
5ad7b1509f
commit
6844c659bf
@ -52,6 +52,10 @@ public class ErrorCommand {
|
||||
*/
|
||||
private long processDefinitionCode;
|
||||
|
||||
private int processDefinitionVersion;
|
||||
|
||||
private int processInstanceId;
|
||||
|
||||
/**
|
||||
* executor id
|
||||
*/
|
||||
@ -73,7 +77,7 @@ public class ErrorCommand {
|
||||
private FailureStrategy failureStrategy;
|
||||
|
||||
/**
|
||||
* warning type
|
||||
* warning type
|
||||
*/
|
||||
private WarningType warningType;
|
||||
|
||||
@ -135,21 +139,26 @@ public class ErrorCommand {
|
||||
|
||||
public ErrorCommand() {
|
||||
}
|
||||
|
||||
public ErrorCommand(Command command, String message) {
|
||||
this.id = command.getId();
|
||||
this.commandType = command.getCommandType();
|
||||
this.executorId = command.getExecutorId();
|
||||
this.processDefinitionCode = command.getProcessDefinitionCode();
|
||||
this.processDefinitionVersion = command.getProcessDefinitionVersion();
|
||||
this.processInstanceId = command.getProcessInstanceId();
|
||||
this.commandParam = command.getCommandParam();
|
||||
this.taskDependType = command.getTaskDependType();
|
||||
this.failureStrategy = command.getFailureStrategy();
|
||||
this.warningType = command.getWarningType();
|
||||
this.warningGroupId = command.getWarningGroupId();
|
||||
this.scheduleTime = command.getScheduleTime();
|
||||
this.taskDependType = command.getTaskDependType();
|
||||
this.failureStrategy = command.getFailureStrategy();
|
||||
this.startTime = command.getStartTime();
|
||||
this.updateTime = command.getUpdateTime();
|
||||
this.environmentCode = command.getEnvironmentCode();
|
||||
this.processInstancePriority = command.getProcessInstancePriority();
|
||||
this.workerGroup = command.getWorkerGroup();
|
||||
this.tenantCode = command.getTenantCode();
|
||||
this.environmentCode = command.getEnvironmentCode();
|
||||
this.message = message;
|
||||
this.dryRun = command.getDryRun();
|
||||
this.testFlag = command.getTestFlag();
|
||||
|
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.dao.entity;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.apache.dolphinscheduler.common.enums.CommandType;
|
||||
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
|
||||
import org.apache.dolphinscheduler.common.enums.Flag;
|
||||
import org.apache.dolphinscheduler.common.enums.Priority;
|
||||
import org.apache.dolphinscheduler.common.enums.TaskDependType;
|
||||
import org.apache.dolphinscheduler.common.enums.WarningType;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class ErrorCommandTest {
|
||||
|
||||
@Test
|
||||
void testConstructor() {
|
||||
Command command = new Command();
|
||||
command.setId(1);
|
||||
command.setCommandType(CommandType.PAUSE);
|
||||
command.setExecutorId(1);
|
||||
command.setProcessDefinitionCode(123);
|
||||
command.setProcessDefinitionVersion(1);
|
||||
command.setProcessInstanceId(1);
|
||||
command.setCommandParam("param");
|
||||
command.setTaskDependType(TaskDependType.TASK_POST);
|
||||
command.setFailureStrategy(FailureStrategy.CONTINUE);
|
||||
command.setWarningType(WarningType.ALL);
|
||||
command.setWarningGroupId(1);
|
||||
command.setScheduleTime(new Date());
|
||||
command.setStartTime(new Date());
|
||||
command.setUpdateTime(new Date());
|
||||
command.setProcessInstancePriority(Priority.HIGHEST);
|
||||
command.setWorkerGroup("default");
|
||||
command.setTenantCode("root");
|
||||
command.setEnvironmentCode(1L);
|
||||
command.setDryRun(1);
|
||||
command.setTestFlag(Flag.NO.getCode());
|
||||
|
||||
ErrorCommand errorCommand = new ErrorCommand(command, "test");
|
||||
assertEquals(command.getCommandType(), errorCommand.getCommandType());
|
||||
assertEquals(command.getExecutorId(), errorCommand.getExecutorId());
|
||||
assertEquals(command.getProcessDefinitionCode(), errorCommand.getProcessDefinitionCode());
|
||||
assertEquals(command.getProcessDefinitionVersion(), errorCommand.getProcessDefinitionVersion());
|
||||
assertEquals(command.getProcessInstanceId(), errorCommand.getProcessInstanceId());
|
||||
assertEquals(command.getCommandParam(), errorCommand.getCommandParam());
|
||||
assertEquals(command.getTaskDependType(), errorCommand.getTaskDependType());
|
||||
assertEquals(command.getFailureStrategy(), errorCommand.getFailureStrategy());
|
||||
assertEquals(command.getWarningType(), errorCommand.getWarningType());
|
||||
assertEquals(command.getWarningGroupId(), errorCommand.getWarningGroupId());
|
||||
assertEquals(command.getScheduleTime(), errorCommand.getScheduleTime());
|
||||
assertEquals(command.getStartTime(), errorCommand.getStartTime());
|
||||
assertEquals(command.getUpdateTime(), errorCommand.getUpdateTime());
|
||||
assertEquals(command.getProcessInstancePriority(), errorCommand.getProcessInstancePriority());
|
||||
assertEquals(command.getWorkerGroup(), errorCommand.getWorkerGroup());
|
||||
assertEquals(command.getTenantCode(), errorCommand.getTenantCode());
|
||||
assertEquals(command.getEnvironmentCode(), errorCommand.getEnvironmentCode());
|
||||
assertEquals(command.getDryRun(), errorCommand.getDryRun());
|
||||
assertEquals(command.getTestFlag(), errorCommand.getTestFlag());
|
||||
assertEquals("test", errorCommand.getMessage());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user