package cd.casic.server;

import cd.casic.ci.process.dto.req.stage.StageUpdateReq;
import cd.casic.ci.process.process.service.stage.StageService;
import com.alibaba.fastjson.JSON;
import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

@SpringBootTest(classes = {OpsServerApplication.class})
@ActiveProfiles("local")
public class StageTest {
    @Resource
    StageService stageService;
    @Test
    public void getStageRunState(){

    }

    // 修改名称
    @Test
    public void updateStage(){
        String reqStr = "{\n" +
                "  \"id\": \"716299524129296385\",\n" +
                "  \"stageName\": \"测试用例生成1\"\n" +
                "}";
        StageUpdateReq req = JSON.parseObject(reqStr, StageUpdateReq.class);
        stageService.updateStagesTask(req);
    }
    // 修改阶段排序
    @Test
    public void updateStage2(){
        StageUpdateReq req = new StageUpdateReq();
        req.setPipelineId("716299522803896320");
        req.setId("716299524129296385");
        req.setStageSort(3);
        stageService.updateStagesTask(req);
    }
    // 复制阶段
    @Test
    public void copyStage(){
        stageService.copyStage("716299524133490688");
    }
    // 删除阶段
    @Test
    public void deleteStage(){
        stageService.deleteFirstStage("717473535303487488");
    }
}
