提交 8456c4c5 编写于 作者: W wenyann

jenkins相关接口

上级 a9f81bc5
......@@ -45,9 +45,10 @@ 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);
}
@PostMapping(value = "/schedule/update")
......@@ -89,4 +90,5 @@ public class APITestController {
public String run(@RequestBody SaveAPITestRequest request) {
return apiTestService.run(request);
}
}
......@@ -126,8 +126,8 @@ public class APITestService {
return apiTest;
}
public List<ApiTest> getApiTestByProjectId(String projectId) {
return extApiTestMapper.getApiTestByProjectId(projectId);
public ApiTest getApiTestByProjectId(String testId) {
return apiTestMapper.selectByPrimaryKey(testId);
}
public void delete(String testId) {
......
......@@ -45,7 +45,7 @@
</if>
</select>
<select id="getApiTestByProjectId" resultType="io.metersphere.base.domain.ApiTest">
select id,name
select id,name,status
from api_test
where project_id = #{projectId}
</select>
......
......@@ -12,4 +12,7 @@ public interface ExtTestCaseMapper {
List<TestCase> getTestCaseNames(@Param("request") QueryTestCaseRequest request);
List<TestCaseDTO> list(@Param("request") QueryTestCaseRequest request);
List<TestCaseDTO> listByMethod(@Param("request") QueryTestCaseRequest request);
}
......@@ -53,4 +53,23 @@
</foreach>
</if>
</select>
<select id="listByMethod" resultType="io.metersphere.track.dto.TestCaseDTO">
select test_case.* from test_case
<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>
<if test="request.projectId != null">
and test_case.project_id = #{request.projectId}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -16,6 +16,8 @@ public interface ExtTestPlanTestCaseMapper {
List<TestPlanCaseDTO> list(@Param("request") QueryTestPlanCaseRequest request);
List<TestPlanCaseDTO> listByNode(@Param("request") QueryTestPlanCaseRequest request);
List<String> findRelateTestPlanId(@Param("userId") String userId, @Param("workspaceId") String workspaceId);
List<TestPlanCaseDTO> getRecentTestedTestCase(@Param("request") QueryTestPlanCaseRequest request);
......
......@@ -63,6 +63,42 @@
</foreach>
</if>
</select>
<select id="listByNode" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_plan_test_case.*, test_case.*
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>
</foreach>
</if>
</where>
</select>
<select id="findRelateTestPlanId" resultType="java.lang.String">
select distinct plan_id from test_plan_test_case
......
......@@ -31,6 +31,14 @@ public class ProjectController {
return projectService.getProjectList(request);
}
/*jenkins项目列表*/
@GetMapping("/listAll/{workspaceId}")
public List<ProjectDTO> jlistAll(@PathVariable String workspaceId) {
ProjectRequest request = new ProjectRequest();
request.setWorkspaceId(workspaceId);
return projectService.getProjectList(request);
}
@GetMapping("/recent/{count}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<Project> recentProjects(@PathVariable int count) {
......
......@@ -54,6 +54,12 @@ public class PerformanceTestController {
return performanceTestService.getLoadTestByProjectId(projectId);
}
/*查询某个测试状态*/
@GetMapping("/list/all/{testId}")
public LoadTest listByTestId(@PathVariable String testId) {
return performanceTestService.getLoadTestBytestId(testId);
}
@PostMapping(value = "/save", consumes = {"multipart/form-data"})
public String save(
@RequestPart("request") SaveTestPlanRequest request,
......
......@@ -339,6 +339,10 @@ public class PerformanceTestService {
return extLoadTestMapper.getLoadTestByProjectId(projectId);
}
public LoadTest getLoadTestBytestId(String testId) {
return loadTestMapper.selectByPrimaryKey(testId);
}
public void copy(SaveTestPlanRequest request) {
// copy test
LoadTestWithBLOBs copy = loadTestMapper.selectByPrimaryKey(request.getId());
......
......@@ -36,6 +36,23 @@ public class TestCaseController {
return PageUtils.setPageInfo(page, testCaseService.listTestCase(request));
}
@GetMapping("/list/{projectId}")
public List<TestCaseDTO> list(@PathVariable String projectId) {
QueryTestCaseRequest request = new QueryTestCaseRequest();
request.setProjectId(projectId);
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);
}
@GetMapping("recent/{count}")
public List<TestCase> recentTestPlans(@PathVariable int count) {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
......
......@@ -23,7 +23,7 @@ public class TestCaseNodeController {
public List<TestCaseNodeDTO> getNodeByProjectId(@PathVariable String projectId){
return testCaseNodeService.getNodeTreeByProjectId(projectId);
}
/*模块列表列表*/
@GetMapping("/list/all/plan/{planId}")
public List<TestCaseNodeDTO> getAllNodeByPlanId(@PathVariable String planId){
return testCaseNodeService.getAllNodeByPlanId(planId);
......
......@@ -35,6 +35,15 @@ public class TestPlanController {
return PageUtils.setPageInfo(page, testPlanService.listTestPlan(request));
}
/*jenkins测试计划*/
@GetMapping("/list/all/{projectId}/{workspaceId}")
public List<TestPlanDTO> listByprojectId(@PathVariable String projectId, @PathVariable String workspaceId) {
QueryTestPlanRequest request = new QueryTestPlanRequest();
request.setWorkspaceId(workspaceId);
request.setProjectId(projectId);
return testPlanService.listTestPlan(request);
}
@PostMapping("/list/all")
public List<TestPlan> listAll() {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
......
......@@ -26,18 +26,26 @@ public class TestPlanTestCaseController {
TestPlanTestCaseService testPlanTestCaseService;
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<TestPlanCaseDTO>> getTestPlanCases(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanCaseRequest request){
public Pager<List<TestPlanCaseDTO>> getTestPlanCases(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanCaseRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testPlanTestCaseService.list(request));
}
@GetMapping("/list/{planId}/{nodeId}")
public List<TestPlanCaseDTO> getTestPlanCases(@PathVariable String planId, @PathVariable String nodeId) {
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
request.setPlanId(planId);
request.setNode(nodeId);
return testPlanTestCaseService.listByNode(request);
}
@GetMapping("/get/{caseId}")
public TestPlanCaseDTO getTestPlanCases(@PathVariable String caseId){
public TestPlanCaseDTO getTestPlanCases(@PathVariable String caseId) {
return testPlanTestCaseService.get(caseId);
}
@PostMapping("recent/{count}")
public List<TestPlanCaseDTO> getRecentTestCases(@PathVariable int count, @RequestBody QueryTestPlanCaseRequest request){
public List<TestPlanCaseDTO> getRecentTestCases(@PathVariable int count, @RequestBody QueryTestPlanCaseRequest request) {
return testPlanTestCaseService.getRecentTestCases(request, count);
}
......
......@@ -27,4 +27,6 @@ public class QueryTestPlanCaseRequest extends TestPlanTestCase {
private String name;
private String status;
private String node;
}
......@@ -125,14 +125,20 @@ public class TestCaseService {
return extTestCaseMapper.list(request);
}
public List<TestCaseDTO> listTestCaseMthod(QueryTestCaseRequest request) {
return extTestCaseMapper.listByMethod(request);
}
/**
* 获取测试用例
* 过滤已关联
*
* @param request
* @return
*/
public List<TestCase> getTestCaseNames(QueryTestCaseRequest request) {
if ( StringUtils.isNotBlank(request.getPlanId()) ) {
if (StringUtils.isNotBlank(request.getPlanId())) {
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
request.setProjectId(testPlan.getProjectId());
}
......
......@@ -55,6 +55,11 @@ public class TestPlanTestCaseService {
return list;
}
public List<TestPlanCaseDTO> listByNode(QueryTestPlanCaseRequest request) {
List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.listByNode(request);
return list;
}
public void editTestCase(TestPlanTestCaseWithBLOBs testPlanTestCase) {
if (StringUtils.equals(TestPlanTestCaseStatus.Prepare.name(), testPlanTestCase.getStatus())) {
testPlanTestCase.setStatus(TestPlanTestCaseStatus.Underway.name());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册