You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.2 KiB
101 lines
3.2 KiB
5 years ago
|
/*
|
||
|
* 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.
|
||
|
*/
|
||
2 years ago
|
|
||
5 years ago
|
package org.apache.dolphinscheduler.server.master;
|
||
5 years ago
|
|
||
5 years ago
|
import org.apache.dolphinscheduler.common.enums.CommandType;
|
||
|
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
|
||
|
import org.apache.dolphinscheduler.common.enums.WarningType;
|
||
|
import org.apache.dolphinscheduler.dao.entity.Command;
|
||
|
import org.apache.dolphinscheduler.dao.mapper.CommandMapper;
|
||
|
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
|
||
3 years ago
|
|
||
2 years ago
|
import org.junit.jupiter.api.Disabled;
|
||
|
import org.junit.jupiter.api.Test;
|
||
5 years ago
|
import org.slf4j.Logger;
|
||
|
import org.slf4j.LoggerFactory;
|
||
|
|
||
|
/**
|
||
|
* master test
|
||
|
*/
|
||
2 years ago
|
@Disabled
|
||
1 year ago
|
public class MasterMessageTest {
|
||
5 years ago
|
|
||
1 year ago
|
private final Logger logger = LoggerFactory.getLogger(MasterMessageTest.class);
|
||
5 years ago
|
|
||
|
private CommandMapper commandMapper;
|
||
|
|
||
5 years ago
|
private ProcessDefinitionMapper processDefinitionMapper;
|
||
|
|
||
5 years ago
|
@Test
|
||
2 years ago
|
public void startFromFailedCommand() {
|
||
5 years ago
|
Command cmd = new Command();
|
||
|
cmd.setCommandType(CommandType.START_FAILURE_TASK_PROCESS);
|
||
|
cmd.setCommandParam("{\"ProcessInstanceId\":325}");
|
||
3 years ago
|
cmd.setProcessDefinitionCode(63);
|
||
5 years ago
|
|
||
|
commandMapper.insert(cmd);
|
||
|
|
||
|
}
|
||
|
|
||
|
@Test
|
||
2 years ago
|
public void recoverSuspendCommand() {
|
||
5 years ago
|
|
||
|
Command cmd = new Command();
|
||
3 years ago
|
cmd.setProcessDefinitionCode(44);
|
||
5 years ago
|
cmd.setCommandParam("{\"ProcessInstanceId\":290}");
|
||
|
cmd.setCommandType(CommandType.RECOVER_SUSPENDED_PROCESS);
|
||
|
|
||
|
commandMapper.insert(cmd);
|
||
|
}
|
||
|
|
||
|
@Test
|
||
2 years ago
|
public void startNewProcessCommand() {
|
||
5 years ago
|
Command cmd = new Command();
|
||
|
cmd.setCommandType(CommandType.START_PROCESS);
|
||
3 years ago
|
cmd.setProcessDefinitionCode(167);
|
||
5 years ago
|
cmd.setFailureStrategy(FailureStrategy.CONTINUE);
|
||
|
cmd.setWarningType(WarningType.NONE);
|
||
|
cmd.setWarningGroupId(4);
|
||
|
cmd.setExecutorId(19);
|
||
|
|
||
|
commandMapper.insert(cmd);
|
||
|
}
|
||
|
|
||
|
@Test
|
||
2 years ago
|
public void toleranceCommand() {
|
||
5 years ago
|
Command cmd = new Command();
|
||
|
cmd.setCommandType(CommandType.RECOVER_TOLERANCE_FAULT_PROCESS);
|
||
|
cmd.setCommandParam("{\"ProcessInstanceId\":816}");
|
||
3 years ago
|
cmd.setProcessDefinitionCode(15);
|
||
5 years ago
|
|
||
|
commandMapper.insert(cmd);
|
||
|
}
|
||
|
|
||
|
@Test
|
||
2 years ago
|
public void insertCommand() {
|
||
5 years ago
|
Command cmd = new Command();
|
||
|
cmd.setCommandType(CommandType.START_PROCESS);
|
||
|
cmd.setFailureStrategy(FailureStrategy.CONTINUE);
|
||
|
cmd.setWarningType(WarningType.ALL);
|
||
3 years ago
|
cmd.setProcessDefinitionCode(72);
|
||
5 years ago
|
cmd.setExecutorId(10);
|
||
|
commandMapper.insert(cmd);
|
||
|
}
|
||
|
|
||
|
}
|