Merge remote-tracking branch 'origin/master'

This commit is contained in:
Captain.B 2020-07-01 14:10:17 +08:00
commit 32ecb65cc1
18 changed files with 138 additions and 22 deletions

View File

@ -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);
}
}

View File

@ -115,8 +115,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) {

View File

@ -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>

View File

@ -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);
}

View File

@ -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>

View 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);

View File

@ -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

View File

@ -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) {

View File

@ -55,6 +55,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,

View File

@ -364,6 +364,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());

View File

@ -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();

View File

@ -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);

View File

@ -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();

View File

@ -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);
}

View File

@ -27,4 +27,6 @@ public class QueryTestPlanCaseRequest extends TestPlanTestCase {
private String name;
private String status;
private String node;
}

View File

@ -132,14 +132,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());
if (testPlan != null) {
request.setProjectId(testPlan.getProjectId());

View File

@ -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());

View File

@ -154,17 +154,6 @@
this.form = Object.assign({}, row);
},
editPassword(row) {
this.$get("ldap/test", res => {
console.log(res)
})
this.$get("ldap/find/admin", res => {
console.log(res)
})
this.$get("ldap/testUser", res => {
console.log(res)
})
this.editPasswordVisible = true;
},
updateUser(updateUserForm) {