提交 55e6c252 编写于 作者: W wenyann

jenkins相关接口

上级 9f9109fb
......@@ -45,10 +45,15 @@ public class APITestController {
return PageUtils.setPageInfo(page, apiTestService.list(request));
}
@GetMapping("/list/{projectId}")
public List<ApiTest> list(@PathVariable String projectId) {
return apiTestService.getApiTestByProjectId(projectId);
}
/*查询某个api测试状态*/
@GetMapping("/list/all/{testId}")
public ApiTest list(@PathVariable String testId) {
return apiTestService.getApiTestByProjectId(testId);
public ApiTest apiState(@PathVariable String testId) {
return apiTestService.getApiTestByTestId(testId);
}
@PostMapping(value = "/schedule/update")
......
......@@ -115,10 +115,14 @@ public class APITestService {
return apiTest;
}
public ApiTest getApiTestByProjectId(String testId) {
public ApiTest getApiTestByTestId(String testId) {
return apiTestMapper.selectByPrimaryKey(testId);
}
public List<ApiTest> getApiTestByProjectId(String projectId) {
return extApiTestMapper.getApiTestByProjectId(projectId);
}
public void delete(String testId) {
deleteFileByTestId(testId);
apiReportService.deleteByTestId(testId);
......
......@@ -40,7 +40,7 @@
<if test="values != null and values.size() > 0">
and test_case.${key} in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
#{value}
</foreach>
</if>
</foreach>
......@@ -54,22 +54,18 @@
</if>
</select>
<select id="listByMethod" resultType="io.metersphere.track.dto.TestCaseDTO">
select test_case.* from test_case
SELECT id,name,status,project_id,type from api_test
<where>
<if test="request.method != null">
and test_case.method =#{request.method}
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_case.node_id in
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
<if test="request.projectId!=null">
and project_id=#{request.projectId}
</if>
<if test="request.projectId != null">
and test_case.project_id = #{request.projectId}
</where>
UNION ALL
select id,name,status,project_id,type from load_test
<where>
<if test="request.projectId!=null">
and project_id= #{request.projectId}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -68,34 +68,17 @@
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
<where>
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.id != null">
and test_case.id = #{request.id}
</if>
<if test="request.node != null">
and test_case.node_id =#{request.node}
</if>
<if test="request.status != null">
and test_plan_test_case.status = #{request.status}
</if>
<if test="request.executor != null">
and test_plan_test_case.executor = #{request.executor}
</if>
<if test="request.planId != null">
and test_plan_test_case.plan_id = #{request.planId}
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
and ${key} in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</if>
<if test="request.nodePaths != null and request.nodePaths.size() > 0">
and test_case.node_path in
<foreach collection="request.nodePaths" item="nodePaths" separator="," open="(" close=")">
#{nodePaths}
</foreach>
</if>
</where>
</select>
......
......@@ -43,12 +43,11 @@ public class TestCaseController {
return testCaseService.listTestCase(request);
}
/*项目下自动测试用例*/
/*项目下自动测试*/
@GetMapping("/list/method/{projectId}")
public List<TestCaseDTO> listByMethod(@PathVariable String projectId) {
QueryTestCaseRequest request = new QueryTestCaseRequest();
request.setProjectId(projectId);
request.setMethod("auto");
return testCaseService.listTestCaseMthod(request);
}
......
......@@ -16,6 +16,8 @@ import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@RequestMapping("/test/plan/case")
......@@ -31,11 +33,15 @@ public class TestPlanTestCaseController {
return PageUtils.setPageInfo(page, testPlanTestCaseService.list(request));
}
@GetMapping("/list/{planId}/{nodeId}")
public List<TestPlanCaseDTO> getTestPlanCases(@PathVariable String planId, @PathVariable String nodeId) {
/*jenkins测试计划下的测试用例*/
@GetMapping("/list/node/{planId}/{nodePaths}")
public List<TestPlanCaseDTO> getTestPlanCases(@PathVariable String planId, @PathVariable String nodePaths) {
String nodePath = nodePaths.replace("f", "/");
String[] array = nodePath.split(",");
List<String> list = Arrays.asList(array);
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
request.setPlanId(planId);
request.setNode(nodeId);
request.setNodePaths(list);
return testPlanTestCaseService.listByNode(request);
}
......@@ -50,36 +56,36 @@ public class TestPlanTestCaseController {
}
@PostMapping("pending/{count}")
public List<TestPlanCaseDTO> getPrepareTestCases(@PathVariable int count, @RequestBody QueryTestPlanCaseRequest request){
public List<TestPlanCaseDTO> getPrepareTestCases(@PathVariable int count, @RequestBody QueryTestPlanCaseRequest request) {
return testPlanTestCaseService.getPendingTestCases(request, count);
}
@PostMapping("/list/all")
public List<TestPlanCaseDTO> getTestPlanCases(@RequestBody QueryTestPlanCaseRequest request){
public List<TestPlanCaseDTO> getTestPlanCases(@RequestBody QueryTestPlanCaseRequest request) {
return testPlanTestCaseService.list(request);
}
@PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase){
public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase) {
testPlanTestCaseService.editTestCase(testPlanTestCase);
}
@PostMapping("/batch/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void editTestCaseBath(@RequestBody TestPlanCaseBatchRequest request){
public void editTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) {
testPlanTestCaseService.editTestCaseBath(request);
}
@PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void deleteTestCaseBath(@RequestBody TestPlanCaseBatchRequest request){
public void deleteTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) {
testPlanTestCaseService.deleteTestCaseBath(request);
}
@PostMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public int deleteTestCase(@PathVariable String id){
public int deleteTestCase(@PathVariable String id) {
return testPlanTestCaseService.deleteTestCase(id);
}
......
......@@ -14,6 +14,8 @@ public class QueryTestPlanCaseRequest extends TestPlanTestCase {
private List<String> nodeIds;
private List<String> nodePaths;
private List<OrderRequest> orders;
private Map<String, List<String>> filters;
......@@ -29,4 +31,6 @@ public class QueryTestPlanCaseRequest extends TestPlanTestCase {
private String status;
private String node;
private String method;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册