|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +package org.apache.dolphinscheduler.dao.entity; |
| 19 | + |
| 20 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 21 | + |
| 22 | +import org.apache.dolphinscheduler.common.enums.CommandType; |
| 23 | +import org.apache.dolphinscheduler.common.enums.FailureStrategy; |
| 24 | +import org.apache.dolphinscheduler.common.enums.Flag; |
| 25 | +import org.apache.dolphinscheduler.common.enums.Priority; |
| 26 | +import org.apache.dolphinscheduler.common.enums.TaskDependType; |
| 27 | +import org.apache.dolphinscheduler.common.enums.WarningType; |
| 28 | + |
| 29 | +import java.util.Date; |
| 30 | + |
| 31 | +import org.junit.jupiter.api.Test; |
| 32 | + |
| 33 | +class ErrorCommandTest { |
| 34 | + |
| 35 | + @Test |
| 36 | + void testConstructor() { |
| 37 | + Command command = new Command(); |
| 38 | + command.setId(1); |
| 39 | + command.setCommandType(CommandType.PAUSE); |
| 40 | + command.setExecutorId(1); |
| 41 | + command.setProcessDefinitionCode(123); |
| 42 | + command.setProcessDefinitionVersion(1); |
| 43 | + command.setProcessInstanceId(1); |
| 44 | + command.setCommandParam("param"); |
| 45 | + command.setTaskDependType(TaskDependType.TASK_POST); |
| 46 | + command.setFailureStrategy(FailureStrategy.CONTINUE); |
| 47 | + command.setWarningType(WarningType.ALL); |
| 48 | + command.setWarningGroupId(1); |
| 49 | + command.setScheduleTime(new Date()); |
| 50 | + command.setStartTime(new Date()); |
| 51 | + command.setUpdateTime(new Date()); |
| 52 | + command.setProcessInstancePriority(Priority.HIGHEST); |
| 53 | + command.setWorkerGroup("default"); |
| 54 | + command.setTenantCode("root"); |
| 55 | + command.setEnvironmentCode(1L); |
| 56 | + command.setDryRun(1); |
| 57 | + command.setTestFlag(Flag.NO.getCode()); |
| 58 | + |
| 59 | + ErrorCommand errorCommand = new ErrorCommand(command, "test"); |
| 60 | + assertEquals(command.getCommandType(), errorCommand.getCommandType()); |
| 61 | + assertEquals(command.getExecutorId(), errorCommand.getExecutorId()); |
| 62 | + assertEquals(command.getProcessDefinitionCode(), errorCommand.getProcessDefinitionCode()); |
| 63 | + assertEquals(command.getProcessDefinitionVersion(), errorCommand.getProcessDefinitionVersion()); |
| 64 | + assertEquals(command.getProcessInstanceId(), errorCommand.getProcessInstanceId()); |
| 65 | + assertEquals(command.getCommandParam(), errorCommand.getCommandParam()); |
| 66 | + assertEquals(command.getTaskDependType(), errorCommand.getTaskDependType()); |
| 67 | + assertEquals(command.getFailureStrategy(), errorCommand.getFailureStrategy()); |
| 68 | + assertEquals(command.getWarningType(), errorCommand.getWarningType()); |
| 69 | + assertEquals(command.getWarningGroupId(), errorCommand.getWarningGroupId()); |
| 70 | + assertEquals(command.getScheduleTime(), errorCommand.getScheduleTime()); |
| 71 | + assertEquals(command.getStartTime(), errorCommand.getStartTime()); |
| 72 | + assertEquals(command.getUpdateTime(), errorCommand.getUpdateTime()); |
| 73 | + assertEquals(command.getProcessInstancePriority(), errorCommand.getProcessInstancePriority()); |
| 74 | + assertEquals(command.getWorkerGroup(), errorCommand.getWorkerGroup()); |
| 75 | + assertEquals(command.getTenantCode(), errorCommand.getTenantCode()); |
| 76 | + assertEquals(command.getEnvironmentCode(), errorCommand.getEnvironmentCode()); |
| 77 | + assertEquals(command.getDryRun(), errorCommand.getDryRun()); |
| 78 | + assertEquals(command.getTestFlag(), errorCommand.getTestFlag()); |
| 79 | + assertEquals("test", errorCommand.getMessage()); |
| 80 | + } |
| 81 | + |
| 82 | +} |
0 commit comments