diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java index db9e688e93..db1b73d8f6 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java @@ -44,6 +44,15 @@ public class ApiAutomationController { return PageUtils.setPageInfo(page, apiAutomationService.list(request)); } + @GetMapping("/list/{projectId}") + @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) + public List list(@PathVariable String projectId) { + ApiScenarioRequest request = new ApiScenarioRequest(); + request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); + request.setProjectId(projectId); + return apiAutomationService.list(request); + } + @PostMapping(value = "/create") public ApiScenario create(@RequestPart("request") SaveApiScenarioRequest request, @RequestPart(value = "files") List bodyFiles) { return apiAutomationService.create(request, bodyFiles); diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java b/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java index 26d20b7aae..01032800e6 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java @@ -44,7 +44,7 @@ public class ApiTestCaseController { if(!list.isEmpty()){ return list.get(0); }else { - return null; + return null; } } @@ -55,6 +55,14 @@ public class ApiTestCaseController { return PageUtils.setPageInfo(page, apiTestCaseService.listSimple(request)); } + @GetMapping("/list/{projectId}") + public List list(@PathVariable String projectId) { + ApiTestCaseRequest request = new ApiTestCaseRequest(); + request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); + request.setProjectId(projectId); + return apiTestCaseService.listSimple(request); + } + @PostMapping("/get/request") public Map listSimple(@RequestBody ApiTestCaseRequest request) { request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); diff --git a/backend/src/main/java/io/metersphere/base/domain/FileMetadata.java b/backend/src/main/java/io/metersphere/base/domain/FileMetadata.java index ee799a3fc4..4dd64f1051 100644 --- a/backend/src/main/java/io/metersphere/base/domain/FileMetadata.java +++ b/backend/src/main/java/io/metersphere/base/domain/FileMetadata.java @@ -18,5 +18,7 @@ public class FileMetadata implements Serializable { private Long size; + private Integer sort; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/FileMetadataExample.java b/backend/src/main/java/io/metersphere/base/domain/FileMetadataExample.java index 9146d5fe98..c7a308d6a0 100644 --- a/backend/src/main/java/io/metersphere/base/domain/FileMetadataExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/FileMetadataExample.java @@ -175,142 +175,142 @@ public class FileMetadataExample { } public Criteria andNameIsNull() { - addCriterion("name is null"); + addCriterion("`name` is null"); return (Criteria) this; } public Criteria andNameIsNotNull() { - addCriterion("name is not null"); + addCriterion("`name` is not null"); return (Criteria) this; } public Criteria andNameEqualTo(String value) { - addCriterion("name =", value, "name"); + addCriterion("`name` =", value, "name"); return (Criteria) this; } public Criteria andNameNotEqualTo(String value) { - addCriterion("name <>", value, "name"); + addCriterion("`name` <>", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThan(String value) { - addCriterion("name >", value, "name"); + addCriterion("`name` >", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThanOrEqualTo(String value) { - addCriterion("name >=", value, "name"); + addCriterion("`name` >=", value, "name"); return (Criteria) this; } public Criteria andNameLessThan(String value) { - addCriterion("name <", value, "name"); + addCriterion("`name` <", value, "name"); return (Criteria) this; } public Criteria andNameLessThanOrEqualTo(String value) { - addCriterion("name <=", value, "name"); + addCriterion("`name` <=", value, "name"); return (Criteria) this; } public Criteria andNameLike(String value) { - addCriterion("name like", value, "name"); + addCriterion("`name` like", value, "name"); return (Criteria) this; } public Criteria andNameNotLike(String value) { - addCriterion("name not like", value, "name"); + addCriterion("`name` not like", value, "name"); return (Criteria) this; } public Criteria andNameIn(List values) { - addCriterion("name in", values, "name"); + addCriterion("`name` in", values, "name"); return (Criteria) this; } public Criteria andNameNotIn(List values) { - addCriterion("name not in", values, "name"); + addCriterion("`name` not in", values, "name"); return (Criteria) this; } public Criteria andNameBetween(String value1, String value2) { - addCriterion("name between", value1, value2, "name"); + addCriterion("`name` between", value1, value2, "name"); return (Criteria) this; } public Criteria andNameNotBetween(String value1, String value2) { - addCriterion("name not between", value1, value2, "name"); + addCriterion("`name` not between", value1, value2, "name"); return (Criteria) this; } public Criteria andTypeIsNull() { - addCriterion("type is null"); + addCriterion("`type` is null"); return (Criteria) this; } public Criteria andTypeIsNotNull() { - addCriterion("type is not null"); + addCriterion("`type` is not null"); return (Criteria) this; } public Criteria andTypeEqualTo(String value) { - addCriterion("type =", value, "type"); + addCriterion("`type` =", value, "type"); return (Criteria) this; } public Criteria andTypeNotEqualTo(String value) { - addCriterion("type <>", value, "type"); + addCriterion("`type` <>", value, "type"); return (Criteria) this; } public Criteria andTypeGreaterThan(String value) { - addCriterion("type >", value, "type"); + addCriterion("`type` >", value, "type"); return (Criteria) this; } public Criteria andTypeGreaterThanOrEqualTo(String value) { - addCriterion("type >=", value, "type"); + addCriterion("`type` >=", value, "type"); return (Criteria) this; } public Criteria andTypeLessThan(String value) { - addCriterion("type <", value, "type"); + addCriterion("`type` <", value, "type"); return (Criteria) this; } public Criteria andTypeLessThanOrEqualTo(String value) { - addCriterion("type <=", value, "type"); + addCriterion("`type` <=", value, "type"); return (Criteria) this; } public Criteria andTypeLike(String value) { - addCriterion("type like", value, "type"); + addCriterion("`type` like", value, "type"); return (Criteria) this; } public Criteria andTypeNotLike(String value) { - addCriterion("type not like", value, "type"); + addCriterion("`type` not like", value, "type"); return (Criteria) this; } public Criteria andTypeIn(List values) { - addCriterion("type in", values, "type"); + addCriterion("`type` in", values, "type"); return (Criteria) this; } public Criteria andTypeNotIn(List values) { - addCriterion("type not in", values, "type"); + addCriterion("`type` not in", values, "type"); return (Criteria) this; } public Criteria andTypeBetween(String value1, String value2) { - addCriterion("type between", value1, value2, "type"); + addCriterion("`type` between", value1, value2, "type"); return (Criteria) this; } public Criteria andTypeNotBetween(String value1, String value2) { - addCriterion("type not between", value1, value2, "type"); + addCriterion("`type` not between", value1, value2, "type"); return (Criteria) this; } @@ -435,62 +435,122 @@ public class FileMetadataExample { } public Criteria andSizeIsNull() { - addCriterion("size is null"); + addCriterion("`size` is null"); return (Criteria) this; } public Criteria andSizeIsNotNull() { - addCriterion("size is not null"); + addCriterion("`size` is not null"); return (Criteria) this; } public Criteria andSizeEqualTo(Long value) { - addCriterion("size =", value, "size"); + addCriterion("`size` =", value, "size"); return (Criteria) this; } public Criteria andSizeNotEqualTo(Long value) { - addCriterion("size <>", value, "size"); + addCriterion("`size` <>", value, "size"); return (Criteria) this; } public Criteria andSizeGreaterThan(Long value) { - addCriterion("size >", value, "size"); + addCriterion("`size` >", value, "size"); return (Criteria) this; } public Criteria andSizeGreaterThanOrEqualTo(Long value) { - addCriterion("size >=", value, "size"); + addCriterion("`size` >=", value, "size"); return (Criteria) this; } public Criteria andSizeLessThan(Long value) { - addCriterion("size <", value, "size"); + addCriterion("`size` <", value, "size"); return (Criteria) this; } public Criteria andSizeLessThanOrEqualTo(Long value) { - addCriterion("size <=", value, "size"); + addCriterion("`size` <=", value, "size"); return (Criteria) this; } public Criteria andSizeIn(List values) { - addCriterion("size in", values, "size"); + addCriterion("`size` in", values, "size"); return (Criteria) this; } public Criteria andSizeNotIn(List values) { - addCriterion("size not in", values, "size"); + addCriterion("`size` not in", values, "size"); return (Criteria) this; } public Criteria andSizeBetween(Long value1, Long value2) { - addCriterion("size between", value1, value2, "size"); + addCriterion("`size` between", value1, value2, "size"); return (Criteria) this; } public Criteria andSizeNotBetween(Long value1, Long value2) { - addCriterion("size not between", value1, value2, "size"); + addCriterion("`size` not between", value1, value2, "size"); + return (Criteria) this; + } + + public Criteria andSortIsNull() { + addCriterion("sort is null"); + return (Criteria) this; + } + + public Criteria andSortIsNotNull() { + addCriterion("sort is not null"); + return (Criteria) this; + } + + public Criteria andSortEqualTo(Integer value) { + addCriterion("sort =", value, "sort"); + return (Criteria) this; + } + + public Criteria andSortNotEqualTo(Integer value) { + addCriterion("sort <>", value, "sort"); + return (Criteria) this; + } + + public Criteria andSortGreaterThan(Integer value) { + addCriterion("sort >", value, "sort"); + return (Criteria) this; + } + + public Criteria andSortGreaterThanOrEqualTo(Integer value) { + addCriterion("sort >=", value, "sort"); + return (Criteria) this; + } + + public Criteria andSortLessThan(Integer value) { + addCriterion("sort <", value, "sort"); + return (Criteria) this; + } + + public Criteria andSortLessThanOrEqualTo(Integer value) { + addCriterion("sort <=", value, "sort"); + return (Criteria) this; + } + + public Criteria andSortIn(List values) { + addCriterion("sort in", values, "sort"); + return (Criteria) this; + } + + public Criteria andSortNotIn(List values) { + addCriterion("sort not in", values, "sort"); + return (Criteria) this; + } + + public Criteria andSortBetween(Integer value1, Integer value2) { + addCriterion("sort between", value1, value2, "sort"); + return (Criteria) this; + } + + public Criteria andSortNotBetween(Integer value1, Integer value2) { + addCriterion("sort not between", value1, value2, "sort"); return (Criteria) this; } } diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCase.java b/backend/src/main/java/io/metersphere/base/domain/TestCase.java index 4569f6daca..b57a8b7649 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCase.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCase.java @@ -42,5 +42,9 @@ public class TestCase implements Serializable { private String tags; + private String demandId; + + private String demandName; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseExample.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseExample.java index 8796a2848b..2d88c502a7 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseExample.java @@ -1323,6 +1323,146 @@ public class TestCaseExample { addCriterion("tags not between", value1, value2, "tags"); return (Criteria) this; } + + public Criteria andDemandIdIsNull() { + addCriterion("demand_id is null"); + return (Criteria) this; + } + + public Criteria andDemandIdIsNotNull() { + addCriterion("demand_id is not null"); + return (Criteria) this; + } + + public Criteria andDemandIdEqualTo(String value) { + addCriterion("demand_id =", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdNotEqualTo(String value) { + addCriterion("demand_id <>", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdGreaterThan(String value) { + addCriterion("demand_id >", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdGreaterThanOrEqualTo(String value) { + addCriterion("demand_id >=", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdLessThan(String value) { + addCriterion("demand_id <", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdLessThanOrEqualTo(String value) { + addCriterion("demand_id <=", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdLike(String value) { + addCriterion("demand_id like", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdNotLike(String value) { + addCriterion("demand_id not like", value, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdIn(List values) { + addCriterion("demand_id in", values, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdNotIn(List values) { + addCriterion("demand_id not in", values, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdBetween(String value1, String value2) { + addCriterion("demand_id between", value1, value2, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandIdNotBetween(String value1, String value2) { + addCriterion("demand_id not between", value1, value2, "demandId"); + return (Criteria) this; + } + + public Criteria andDemandNameIsNull() { + addCriterion("demand_name is null"); + return (Criteria) this; + } + + public Criteria andDemandNameIsNotNull() { + addCriterion("demand_name is not null"); + return (Criteria) this; + } + + public Criteria andDemandNameEqualTo(String value) { + addCriterion("demand_name =", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameNotEqualTo(String value) { + addCriterion("demand_name <>", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameGreaterThan(String value) { + addCriterion("demand_name >", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameGreaterThanOrEqualTo(String value) { + addCriterion("demand_name >=", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameLessThan(String value) { + addCriterion("demand_name <", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameLessThanOrEqualTo(String value) { + addCriterion("demand_name <=", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameLike(String value) { + addCriterion("demand_name like", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameNotLike(String value) { + addCriterion("demand_name not like", value, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameIn(List values) { + addCriterion("demand_name in", values, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameNotIn(List values) { + addCriterion("demand_name not in", values, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameBetween(String value1, String value2) { + addCriterion("demand_name between", value1, value2, "demandName"); + return (Criteria) this; + } + + public Criteria andDemandNameNotBetween(String value1, String value2) { + addCriterion("demand_name not between", value1, value2, "demandName"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/mapper/FileMetadataMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/FileMetadataMapper.xml index 7f07002b5e..c123e5cc0a 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/FileMetadataMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/FileMetadataMapper.xml @@ -8,6 +8,7 @@ + @@ -68,7 +69,7 @@ - id, name, type, create_time, update_time, size + id, `name`, `type`, create_time, update_time, `size`, sort @@ -164,10 +171,10 @@ id = #{record.id,jdbcType=VARCHAR}, - name = #{record.name,jdbcType=VARCHAR}, + `name` = #{record.name,jdbcType=VARCHAR}, - type = #{record.type,jdbcType=VARCHAR}, + `type` = #{record.type,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=BIGINT}, @@ -176,7 +183,10 @@ update_time = #{record.updateTime,jdbcType=BIGINT}, - size = #{record.size,jdbcType=BIGINT}, + `size` = #{record.size,jdbcType=BIGINT}, + + + sort = #{record.sort,jdbcType=INTEGER}, @@ -186,11 +196,12 @@ update file_metadata set id = #{record.id,jdbcType=VARCHAR}, - name = #{record.name,jdbcType=VARCHAR}, - type = #{record.type,jdbcType=VARCHAR}, + `name` = #{record.name,jdbcType=VARCHAR}, + `type` = #{record.type,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT}, - size = #{record.size,jdbcType=BIGINT} + `size` = #{record.size,jdbcType=BIGINT}, + sort = #{record.sort,jdbcType=INTEGER} @@ -199,10 +210,10 @@ update file_metadata - name = #{name,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, - type = #{type,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=BIGINT}, @@ -211,18 +222,22 @@ update_time = #{updateTime,jdbcType=BIGINT}, - size = #{size,jdbcType=BIGINT}, + `size` = #{size,jdbcType=BIGINT}, + + + sort = #{sort,jdbcType=INTEGER}, where id = #{id,jdbcType=VARCHAR} update file_metadata - set name = #{name,jdbcType=VARCHAR}, - type = #{type,jdbcType=VARCHAR}, + set `name` = #{name,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT}, - size = #{size,jdbcType=BIGINT} + `size` = #{size,jdbcType=BIGINT}, + sort = #{sort,jdbcType=INTEGER} where id = #{id,jdbcType=VARCHAR} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml index 995cef9832..3f738911f0 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml @@ -10,16 +10,18 @@ - - - - - - - - - - + + + + + + + + + + + + @@ -86,7 +88,7 @@ id, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`, prerequisite, create_time, update_time, test_id, sort, num, other_test_name, review_status, - tags + tags, demand_id, demand_name remark, steps @@ -140,20 +142,22 @@ - insert into test_case (id, node_id, node_path, - project_id, `name`, `type`, - maintainer, priority, `method`, - prerequisite, create_time, update_time, - test_id, sort, num, - other_test_name, review_status, tags, - remark, steps) - values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR}, - #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, - #{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, - #{prerequisite,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, - #{testId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, - #{otherTestName,jdbcType=VARCHAR}, #{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, - #{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR}) + insert into test_case (id, node_id, node_path, + project_id, `name`, `type`, + maintainer, priority, `method`, + prerequisite, create_time, update_time, + test_id, sort, num, + other_test_name, review_status, tags, + demand_id, demand_name, remark, + steps) + values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR}, + #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, + #{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, + #{prerequisite,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, + #{testId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, + #{otherTestName,jdbcType=VARCHAR}, #{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, + #{demandId,jdbcType=VARCHAR}, #{demandName,jdbcType=VARCHAR}, #{remark,jdbcType=LONGVARCHAR}, + #{steps,jdbcType=LONGVARCHAR}) insert into test_case @@ -212,6 +216,12 @@ tags, + + demand_id, + + + demand_name, + remark, @@ -274,6 +284,12 @@ #{tags,jdbcType=VARCHAR}, + + #{demandId,jdbcType=VARCHAR}, + + + #{demandName,jdbcType=VARCHAR}, + #{remark,jdbcType=LONGVARCHAR}, @@ -345,6 +361,12 @@ tags = #{record.tags,jdbcType=VARCHAR}, + + demand_id = #{record.demandId,jdbcType=VARCHAR}, + + + demand_name = #{record.demandName,jdbcType=VARCHAR}, + remark = #{record.remark,jdbcType=LONGVARCHAR}, @@ -366,18 +388,20 @@ `type` = #{record.type,jdbcType=VARCHAR}, maintainer = #{record.maintainer,jdbcType=VARCHAR}, priority = #{record.priority,jdbcType=VARCHAR}, - `method` = #{record.method,jdbcType=VARCHAR}, - prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT}, - test_id = #{record.testId,jdbcType=VARCHAR}, - sort = #{record.sort,jdbcType=INTEGER}, - num = #{record.num,jdbcType=INTEGER}, - other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, - review_status = #{record.reviewStatus,jdbcType=VARCHAR}, - tags = #{record.tags,jdbcType=VARCHAR}, - remark = #{record.remark,jdbcType=LONGVARCHAR}, - steps = #{record.steps,jdbcType=LONGVARCHAR} + `method` = #{record.method,jdbcType=VARCHAR}, + prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + test_id = #{record.testId,jdbcType=VARCHAR}, + sort = #{record.sort,jdbcType=INTEGER}, + num = #{record.num,jdbcType=INTEGER}, + other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, + review_status = #{record.reviewStatus,jdbcType=VARCHAR}, + tags = #{record.tags,jdbcType=VARCHAR}, + demand_id = #{record.demandId,jdbcType=VARCHAR}, + demand_name = #{record.demandName,jdbcType=VARCHAR}, + remark = #{record.remark,jdbcType=LONGVARCHAR}, + steps = #{record.steps,jdbcType=LONGVARCHAR} @@ -391,17 +415,19 @@ `name` = #{record.name,jdbcType=VARCHAR}, `type` = #{record.type,jdbcType=VARCHAR}, maintainer = #{record.maintainer,jdbcType=VARCHAR}, - priority = #{record.priority,jdbcType=VARCHAR}, - `method` = #{record.method,jdbcType=VARCHAR}, - prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT}, - test_id = #{record.testId,jdbcType=VARCHAR}, - sort = #{record.sort,jdbcType=INTEGER}, - num = #{record.num,jdbcType=INTEGER}, - other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, - review_status = #{record.reviewStatus,jdbcType=VARCHAR}, - tags = #{record.tags,jdbcType=VARCHAR} + priority = #{record.priority,jdbcType=VARCHAR}, + `method` = #{record.method,jdbcType=VARCHAR}, + prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + test_id = #{record.testId,jdbcType=VARCHAR}, + sort = #{record.sort,jdbcType=INTEGER}, + num = #{record.num,jdbcType=INTEGER}, + other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, + review_status = #{record.reviewStatus,jdbcType=VARCHAR}, + tags = #{record.tags,jdbcType=VARCHAR}, + demand_id = #{record.demandId,jdbcType=VARCHAR}, + demand_name = #{record.demandName,jdbcType=VARCHAR} @@ -460,6 +486,12 @@ tags = #{tags,jdbcType=VARCHAR}, + + demand_id = #{demandId,jdbcType=VARCHAR}, + + + demand_name = #{demandName,jdbcType=VARCHAR}, + remark = #{remark,jdbcType=LONGVARCHAR}, @@ -471,46 +503,50 @@ update test_case - set node_id = #{nodeId,jdbcType=VARCHAR}, - node_path = #{nodePath,jdbcType=VARCHAR}, - project_id = #{projectId,jdbcType=VARCHAR}, - `name` = #{name,jdbcType=VARCHAR}, - `type` = #{type,jdbcType=VARCHAR}, - maintainer = #{maintainer,jdbcType=VARCHAR}, - priority = #{priority,jdbcType=VARCHAR}, - `method` = #{method,jdbcType=VARCHAR}, - prerequisite = #{prerequisite,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT}, - test_id = #{testId,jdbcType=VARCHAR}, - sort = #{sort,jdbcType=INTEGER}, - num = #{num,jdbcType=INTEGER}, - other_test_name = #{otherTestName,jdbcType=VARCHAR}, - review_status = #{reviewStatus,jdbcType=VARCHAR}, - tags = #{tags,jdbcType=VARCHAR}, - remark = #{remark,jdbcType=LONGVARCHAR}, - steps = #{steps,jdbcType=LONGVARCHAR} + set node_id = #{nodeId,jdbcType=VARCHAR}, + node_path = #{nodePath,jdbcType=VARCHAR}, + project_id = #{projectId,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + maintainer = #{maintainer,jdbcType=VARCHAR}, + priority = #{priority,jdbcType=VARCHAR}, + `method` = #{method,jdbcType=VARCHAR}, + prerequisite = #{prerequisite,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + test_id = #{testId,jdbcType=VARCHAR}, + sort = #{sort,jdbcType=INTEGER}, + num = #{num,jdbcType=INTEGER}, + other_test_name = #{otherTestName,jdbcType=VARCHAR}, + review_status = #{reviewStatus,jdbcType=VARCHAR}, + tags = #{tags,jdbcType=VARCHAR}, + demand_id = #{demandId,jdbcType=VARCHAR}, + demand_name = #{demandName,jdbcType=VARCHAR}, + remark = #{remark,jdbcType=LONGVARCHAR}, + steps = #{steps,jdbcType=LONGVARCHAR} where id = #{id,jdbcType=VARCHAR} update test_case - set node_id = #{nodeId,jdbcType=VARCHAR}, - node_path = #{nodePath,jdbcType=VARCHAR}, - project_id = #{projectId,jdbcType=VARCHAR}, - `name` = #{name,jdbcType=VARCHAR}, - `type` = #{type,jdbcType=VARCHAR}, - maintainer = #{maintainer,jdbcType=VARCHAR}, - priority = #{priority,jdbcType=VARCHAR}, - `method` = #{method,jdbcType=VARCHAR}, - prerequisite = #{prerequisite,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT}, - test_id = #{testId,jdbcType=VARCHAR}, - sort = #{sort,jdbcType=INTEGER}, - num = #{num,jdbcType=INTEGER}, - other_test_name = #{otherTestName,jdbcType=VARCHAR}, - review_status = #{reviewStatus,jdbcType=VARCHAR}, - tags = #{tags,jdbcType=VARCHAR} + set node_id = #{nodeId,jdbcType=VARCHAR}, + node_path = #{nodePath,jdbcType=VARCHAR}, + project_id = #{projectId,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + maintainer = #{maintainer,jdbcType=VARCHAR}, + priority = #{priority,jdbcType=VARCHAR}, + `method` = #{method,jdbcType=VARCHAR}, + prerequisite = #{prerequisite,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + test_id = #{testId,jdbcType=VARCHAR}, + sort = #{sort,jdbcType=INTEGER}, + num = #{num,jdbcType=INTEGER}, + other_test_name = #{otherTestName,jdbcType=VARCHAR}, + review_status = #{reviewStatus,jdbcType=VARCHAR}, + tags = #{tags,jdbcType=VARCHAR}, + demand_id = #{demandId,jdbcType=VARCHAR}, + demand_name = #{demandName,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java b/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java index 454e7c16c8..1dc094a0ca 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java +++ b/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java @@ -110,15 +110,6 @@ public class EngineFactory { final JSONArray jsonArray = JSONObject.parseArray(loadTest.getLoadConfiguration()); for (int i = 0; i < jsonArray.size(); i++) { - if (jsonArray.get(i) instanceof Map) { - JSONObject o = jsonArray.getJSONObject(i); - String key = o.getString("key"); - if ("TargetLevel".equals(key)) { - engineContext.addProperty(key, Math.round(((Integer) o.get("value")) * ratio)); - } else { - engineContext.addProperty(key, o.get("value")); - } - } if (jsonArray.get(i) instanceof List) { JSONArray o = jsonArray.getJSONArray(i); for (int j = 0; j < o.size(); j++) { diff --git a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java index 0af5537b3d..4a6c2a0998 100644 --- a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java +++ b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java @@ -594,6 +594,100 @@ public class JmeterDocumentParser implements DocumentParser { if (!hashTree.hasChildNodes()) { MSException.throwException(Translator.get("jmx_content_valid")); } + Object tgTypes = context.getProperty("tgType"); + String tgType = "ThreadGroup"; + if (tgTypes instanceof List) { + Object o = ((List) tgTypes).get(0); + ((List) tgTypes).remove(0); + tgType = o.toString(); + } + if (StringUtils.equals(tgType, THREAD_GROUP)) { + processBaseThreadGroup(threadGroup); + } + if (StringUtils.equals(tgType, CONCURRENCY_THREAD_GROUP)) { + processConcurrencyThreadGroup(threadGroup); + } + + } + + private void processBaseThreadGroup(Element threadGroup) { + /* + + continue + + false + 1 + + 1 + 1 + false + + + true + + */ + removeChildren(threadGroup); + Document document = threadGroup.getOwnerDocument(); + Object targetLevels = context.getProperty("TargetLevel"); + String threads = "10"; + if (targetLevels instanceof List) { + Object o = ((List) targetLevels).get(0); + ((List) targetLevels).remove(0); + threads = o.toString(); + } + Object rampUps = context.getProperty("RampUp"); + String rampUp = "1"; + if (rampUps instanceof List) { + Object o = ((List) rampUps).get(0); + ((List) rampUps).remove(0); + rampUp = o.toString(); + } + Object durations = context.getProperty("duration"); + String duration = "2"; + if (durations instanceof List) { + Object o = ((List) durations).get(0); + ((List) durations).remove(0); + duration = o.toString(); + } + Object deleteds = context.getProperty("deleted"); + String deleted = "false"; + if (deleteds instanceof List) { + Object o = ((List) deleteds).get(0); + ((List) deleteds).remove(0); + deleted = o.toString(); + } + Object enableds = context.getProperty("enabled"); + String enabled = "true"; + if (enableds instanceof List) { + Object o = ((List) enableds).get(0); + ((List) enableds).remove(0); + enabled = o.toString(); + } + + threadGroup.setAttribute("enabled", enabled); + if (BooleanUtils.toBoolean(deleted)) { + threadGroup.setAttribute("enabled", "false"); + } + Element elementProp = document.createElement("elementProp"); + elementProp.setAttribute("name", "ThreadGroup.main_controller"); + elementProp.setAttribute("elementType", "LoopController"); + elementProp.setAttribute("guiclass", "LoopControlPanel"); + elementProp.setAttribute("testclass", "LoopController"); + elementProp.setAttribute("testname", "Loop Controller"); + elementProp.setAttribute("enabled", "true"); + elementProp.appendChild(createBoolProp(document, "LoopController.continue_forever", false)); + elementProp.appendChild(createStringProp(document, "LoopController.loops", "-1")); + threadGroup.appendChild(elementProp); + threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue")); + threadGroup.appendChild(createStringProp(document, "ThreadGroup.num_threads", threads)); + threadGroup.appendChild(createStringProp(document, "ThreadGroup.ramp_time", rampUp)); + threadGroup.appendChild(createStringProp(document, "ThreadGroup.duration", duration)); + threadGroup.appendChild(createStringProp(document, "ThreadGroup.delay", "0")); + threadGroup.appendChild(createBoolProp(document, "ThreadGroup.scheduler", true)); + threadGroup.appendChild(createBoolProp(document, "ThreadGroup.same_user_on_next_iteration", true)); + } + + private void processConcurrencyThreadGroup(Element threadGroup) { // 重命名 tagName Document document = threadGroup.getOwnerDocument(); document.renameNode(threadGroup, threadGroup.getNamespaceURI(), CONCURRENCY_THREAD_GROUP); diff --git a/backend/src/main/java/io/metersphere/performance/request/EditTestPlanRequest.java b/backend/src/main/java/io/metersphere/performance/request/EditTestPlanRequest.java index 4bda36b6fd..944d491f88 100644 --- a/backend/src/main/java/io/metersphere/performance/request/EditTestPlanRequest.java +++ b/backend/src/main/java/io/metersphere/performance/request/EditTestPlanRequest.java @@ -5,9 +5,11 @@ import lombok.Getter; import lombok.Setter; import java.util.List; +import java.util.Map; @Getter @Setter public class EditTestPlanRequest extends TestPlanRequest { private List updatedFileList; + private Map fileSorts; } diff --git a/backend/src/main/java/io/metersphere/performance/request/SaveTestPlanRequest.java b/backend/src/main/java/io/metersphere/performance/request/SaveTestPlanRequest.java index 1c6d6f4944..05c63cd9b1 100644 --- a/backend/src/main/java/io/metersphere/performance/request/SaveTestPlanRequest.java +++ b/backend/src/main/java/io/metersphere/performance/request/SaveTestPlanRequest.java @@ -5,9 +5,11 @@ import lombok.Getter; import lombok.Setter; import java.util.List; +import java.util.Map; @Setter @Getter public class SaveTestPlanRequest extends TestPlanRequest { private List updatedFileList; + private Map fileSorts; } diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index 53f28286f0..c5cb712610 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -135,36 +135,37 @@ public class PerformanceTestService { List importFiles = request.getUpdatedFileList(); List importFileIds = importFiles.stream().map(FileMetadata::getId).collect(Collectors.toList()); // 导入项目里其他的文件 - this.importFiles(importFileIds, loadTest.getId()); + this.importFiles(importFileIds, loadTest.getId(), request.getFileSorts()); // 保存上传的文件 - this.saveUploadFiles(files, loadTest.getId()); + this.saveUploadFiles(files, loadTest.getId(), request.getFileSorts()); return loadTest.getId(); } - private void saveUploadFiles(List files, String testId) { + private void saveUploadFiles(List files, String testId, Map fileSorts) { if (files != null) { - files.forEach(file -> { - final FileMetadata fileMetadata = fileService.saveFile(file); + for (int i = 0; i < files.size(); i++) { + MultipartFile file = files.get(i); + final FileMetadata fileMetadata = fileService.saveFile(file, fileSorts.getOrDefault(file.getOriginalFilename(), i)); LoadTestFile loadTestFile = new LoadTestFile(); loadTestFile.setTestId(testId); loadTestFile.setFileId(fileMetadata.getId()); loadTestFileMapper.insert(loadTestFile); - }); + } } } - private void importFiles(List importFileIds, String testId) { - importFileIds.forEach(fileId -> { - if (StringUtils.isBlank(fileId)) { - return; - } + private void importFiles(List importFileIds, String testId, Map fileSorts) { + for (int i = 0; i < importFileIds.size(); i++) { + String fileId = importFileIds.get(i); FileMetadata fileMetadata = fileService.copyFile(fileId); + fileMetadata.setSort(fileSorts.getOrDefault(fileMetadata.getName(), i)); + fileService.updateFileMetadata(fileMetadata); LoadTestFile loadTestFile = new LoadTestFile(); loadTestFile.setTestId(testId); loadTestFile.setFileId(fileMetadata.getId()); loadTestFileMapper.insert(loadTestFile); - }); + } } private LoadTestWithBLOBs saveLoadTest(SaveTestPlanRequest request) { @@ -211,8 +212,8 @@ public class PerformanceTestService { fileService.deleteFileByIds(deleteFileIds); // 导入项目里其他的文件 List addFileIds = ListUtils.subtract(updatedFileIds, originFileIds); - this.importFiles(addFileIds, request.getId()); - this.saveUploadFiles(files, request.getId()); + this.importFiles(addFileIds, request.getId(), request.getFileSorts()); + this.saveUploadFiles(files, request.getId(), request.getFileSorts()); loadTest.setName(request.getName()); loadTest.setProjectId(request.getProjectId()); diff --git a/backend/src/main/java/io/metersphere/service/FileService.java b/backend/src/main/java/io/metersphere/service/FileService.java index 4938f950e9..a5c2695f37 100644 --- a/backend/src/main/java/io/metersphere/service/FileService.java +++ b/backend/src/main/java/io/metersphere/service/FileService.java @@ -47,6 +47,7 @@ public class FileService { List fileIds = loadTestFiles.stream().map(LoadTestFile::getFileId).collect(Collectors.toList()); FileMetadataExample example = new FileMetadataExample(); example.createCriteria().andIdIn(fileIds); + example.setOrderByClause("sort asc"); // 安装顺序排序 return fileMetadataMapper.selectByExample(example); } @@ -85,6 +86,10 @@ public class FileService { } public FileMetadata saveFile(MultipartFile file) { + return saveFile(file, 0); + } + + public FileMetadata saveFile(MultipartFile file, Integer sort) { final FileMetadata fileMetadata = new FileMetadata(); fileMetadata.setId(UUID.randomUUID().toString()); fileMetadata.setName(file.getOriginalFilename()); @@ -93,6 +98,7 @@ public class FileService { fileMetadata.setUpdateTime(System.currentTimeMillis()); FileType fileType = getFileType(fileMetadata.getName()); fileMetadata.setType(fileType.name()); + fileMetadata.setSort(sort); fileMetadataMapper.insert(fileMetadata); FileContent fileContent = new FileContent(); @@ -107,7 +113,7 @@ public class FileService { return fileMetadata; } - public FileMetadata saveFile(byte[] fileByte,String fileName,Long fileSize) { + public FileMetadata saveFile(byte[] fileByte, String fileName, Long fileSize) { final FileMetadata fileMetadata = new FileMetadata(); fileMetadata.setId(UUID.randomUUID().toString()); fileMetadata.setName(fileName); @@ -175,4 +181,8 @@ public class FileService { fileMetadataMapper.selectByExample(example); return null; } + + public void updateFileMetadata(FileMetadata fileMetadata) { + fileMetadataMapper.updateByPrimaryKeySelective(fileMetadata); + } } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseDemandController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseDemandController.java new file mode 100644 index 0000000000..93f63e6bc9 --- /dev/null +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseDemandController.java @@ -0,0 +1,23 @@ +package io.metersphere.track.controller; + +import io.metersphere.track.dto.DemandDTO; +import io.metersphere.track.service.DemandService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +@RequestMapping("demand") +@RestController +public class TestCaseDemandController { + @Resource + private DemandService DemandService; + + @GetMapping("/list/{projectId}") + public List getDemandList(@PathVariable String projectId) { + return DemandService.getDemandList(projectId); + } +} diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java index ac3544d130..6ea0f97fb8 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java @@ -45,8 +45,8 @@ public class TestCaseReviewController { @PostMapping("/save") @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) - public void saveCaseReview(@RequestBody SaveTestCaseReviewRequest reviewRequest) { - testCaseReviewService.saveTestCaseReview(reviewRequest); + public String saveCaseReview(@RequestBody SaveTestCaseReviewRequest reviewRequest) { + return testCaseReviewService.saveTestCaseReview(reviewRequest); } @PostMapping("/project") diff --git a/backend/src/main/java/io/metersphere/track/dto/DemandDTO.java b/backend/src/main/java/io/metersphere/track/dto/DemandDTO.java new file mode 100644 index 0000000000..546f1a836c --- /dev/null +++ b/backend/src/main/java/io/metersphere/track/dto/DemandDTO.java @@ -0,0 +1,11 @@ +package io.metersphere.track.dto; + +import lombok.Getter; +import lombok.Setter; + +@Setter +@Getter +public class DemandDTO { + private String id; + private String name; +} diff --git a/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java b/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java index 4a5ba53f7a..c754a0e10a 100644 --- a/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java @@ -41,7 +41,9 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { protected String getPlatformConfig(String platform) { SessionUser user = SessionUtils.getUser(); String orgId = user.getLastOrganizationId(); - +/* + String orgId = "88aceecf-5764-4094-96a9-f82bd52e77ad"; +*/ IntegrationRequest request = new IntegrationRequest(); if (StringUtils.isBlank(orgId)) { MSException.throwException("organization id is null"); diff --git a/backend/src/main/java/io/metersphere/track/issue/IssuesPlatform.java b/backend/src/main/java/io/metersphere/track/issue/IssuesPlatform.java index 8bb25cc063..8e70ef30a6 100644 --- a/backend/src/main/java/io/metersphere/track/issue/IssuesPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/IssuesPlatform.java @@ -1,6 +1,7 @@ package io.metersphere.track.issue; import io.metersphere.base.domain.Issues; +import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.request.testcase.IssuesRequest; @@ -10,18 +11,24 @@ public interface IssuesPlatform { /** * 获取平台相关联的缺陷 + * * @return platform issues list */ List getIssue(); + /*获取平台相关需求*/ + List getDemandList(String projectId); + /** * 添加缺陷到缺陷平台 + * * @param issuesRequest issueRequest */ void addIssue(IssuesRequest issuesRequest); /** * 删除缺陷平台缺陷 + * * @param id issue id */ void deleteIssue(String id); diff --git a/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java index 50a4e66c37..a43465c48a 100644 --- a/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java @@ -7,6 +7,7 @@ import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.EncryptUtils; import io.metersphere.commons.utils.LogUtil; +import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.request.testcase.IssuesRequest; import org.apache.commons.lang3.StringUtils; @@ -78,6 +79,11 @@ public class JiraPlatform extends AbstractIssuePlatform { return list; } + @Override + public List getDemandList(String projectId) { + return null; + } + @Override public void addIssue(IssuesRequest issuesRequest) { String config = getPlatformConfig(IssuesManagePlatform.Jira.toString()); diff --git a/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java b/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java index 7db678e738..a588c95092 100644 --- a/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/LocalPlatform.java @@ -5,6 +5,7 @@ import io.metersphere.base.domain.TestCaseIssues; import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.request.testcase.IssuesRequest; @@ -22,6 +23,11 @@ public class LocalPlatform extends AbstractIssuePlatform { return extIssuesMapper.getIssues(testCaseId, IssuesManagePlatform.Local.toString()); } + @Override + public List getDemandList(String projectId) { + return null; + } + @Override public void addIssue(IssuesRequest issuesRequest) { SessionUser user = SessionUtils.getUser(); diff --git a/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java b/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java index fc7e2f3137..6440c70074 100644 --- a/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/TapdPlatform.java @@ -9,6 +9,7 @@ import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.ResultHolder; +import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.request.testcase.IssuesRequest; import org.apache.commons.lang3.StringUtils; @@ -64,6 +65,23 @@ public class TapdPlatform extends AbstractIssuePlatform { return list; } + @Override + public List getDemandList(String projectId) { + System.out.println(projectId); + List demandList = new ArrayList<>(); + String url = "https://api.tapd.cn/stories?workspace_id=" + projectId; + ResultHolder call = call(url); + String listJson = JSON.toJSONString(call.getData()); + JSONArray jsonArray = JSON.parseArray(listJson); + System.out.println(jsonArray); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject o = jsonArray.getJSONObject(i); + DemandDTO demand = o.getObject("Story", DemandDTO.class); + demandList.add(demand); + } + return demandList; + } + private Issues getTapdIssues(String projectId, String issuesId) { String url = "https://api.tapd.cn/bugs?workspace_id=" + projectId + "&id=" + issuesId; ResultHolder call = call(url); @@ -208,4 +226,5 @@ public class TapdPlatform extends AbstractIssuePlatform { } + } diff --git a/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java b/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java index 749deecfb4..dd2b0caa51 100644 --- a/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/ZentaoPlatform.java @@ -7,6 +7,7 @@ import io.metersphere.base.domain.*; import io.metersphere.commons.constants.IssuesManagePlatform; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; +import io.metersphere.track.dto.DemandDTO; import io.metersphere.track.issue.domain.PlatformUser; import io.metersphere.track.issue.domain.ZentaoBuild; import io.metersphere.track.request.testcase.IssuesRequest; @@ -85,6 +86,11 @@ public class ZentaoPlatform extends AbstractIssuePlatform { } + @Override + public List getDemandList(String projectId) { + return null; + } + private Issues getZentaoIssues(String bugId) { String session = login(); HttpEntity requestEntity = new HttpEntity<>(new HttpHeaders()); diff --git a/backend/src/main/java/io/metersphere/track/service/DemandService.java b/backend/src/main/java/io/metersphere/track/service/DemandService.java new file mode 100644 index 0000000000..06a89abd43 --- /dev/null +++ b/backend/src/main/java/io/metersphere/track/service/DemandService.java @@ -0,0 +1,76 @@ +package io.metersphere.track.service; + +import io.metersphere.base.domain.Issues; +import io.metersphere.base.domain.Project; +import io.metersphere.base.mapper.ProjectMapper; +import io.metersphere.commons.constants.IssuesManagePlatform; +import io.metersphere.commons.user.SessionUser; +import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.service.ProjectService; +import io.metersphere.track.dto.DemandDTO; +import io.metersphere.track.issue.AbstractIssuePlatform; +import io.metersphere.track.issue.IssueFactory; +import io.metersphere.track.request.testcase.IssuesRequest; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +@Service +@Transactional(rollbackFor = Exception.class) +public class DemandService { + @Resource + private ProjectService projectService; + @Resource + private IssuesService issuesService; + @Resource + private ProjectMapper projectMapper; + + public List getDemandList(String projectId) { + Project project = projectMapper.selectByPrimaryKey(projectId); + SessionUser user = SessionUtils.getUser(); +/* + String orgId = "88aceecf-5764-4094-96a9-f82bd52e77ad"; +*/ + String orgId = user.getLastOrganizationId(); + boolean tapd = issuesService.isIntegratedPlatform(orgId, IssuesManagePlatform.Tapd.toString()); + boolean jira = issuesService.isIntegratedPlatform(orgId, IssuesManagePlatform.Jira.toString()); + boolean zentao = issuesService.isIntegratedPlatform(orgId, IssuesManagePlatform.Zentao.toString()); + List list = new ArrayList<>(); + List platforms = new ArrayList<>(); + IssuesRequest issueRequest = new IssuesRequest(); + if (tapd) { + // 是否关联了项目 + String tapdId = project.getTapdId(); + if (StringUtils.isNotBlank(tapdId)) { + platforms.add(IssuesManagePlatform.Tapd.name()); + } + issueRequest.setProjectId(tapdId); + } + + if (jira) { + String jiraKey = project.getJiraKey(); + if (StringUtils.isNotBlank(jiraKey)) { + platforms.add(IssuesManagePlatform.Jira.name()); + } + issueRequest.setProjectId(jiraKey); + } + + if (zentao) { + String zentaoId = project.getZentaoId(); + if (StringUtils.isNotBlank(zentaoId)) { + platforms.add(IssuesManagePlatform.Zentao.name()); + } + issueRequest.setProjectId(zentaoId); + } + List platformList = IssueFactory.createPlatforms(platforms, issueRequest); + platformList.forEach(platform -> { + List demand = platform.getDemandList(issueRequest.getProjectId()); + list.addAll(demand); + }); + return list; + } +} diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java index a5944ec526..2857fecd68 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java @@ -78,7 +78,7 @@ public class TestCaseReviewService { @Resource private SystemParameterService systemParameterService; - public void saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) { + public String saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) { checkCaseReviewExist(reviewRequest); String reviewId = UUID.randomUUID().toString(); List userIds = reviewRequest.getUserIds();//执行人 @@ -109,6 +109,7 @@ public class TestCaseReviewService { .event(NoticeConstants.Event.CREATE) .build(); noticeSendService.send(NoticeConstants.TaskType.REVIEW_TASK, noticeModel); + return reviewRequest.getId(); } //评审内容 diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 32593286fe..5b1c1772b7 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -100,6 +100,8 @@ public class TestCaseService { testCase.setUpdateTime(System.currentTimeMillis()); testCase.setNum(getNextNum(testCase.getProjectId())); testCase.setReviewStatus(TestCaseReviewStatus.Prepare.name()); + testCase.setDemandId(testCase.getDemandId()); + testCase.setDemandName(testCase.getDemandName()); testCaseMapper.insert(testCase); return testCase; } diff --git a/backend/src/main/resources/db/migration/V78__v1.8_release.sql b/backend/src/main/resources/db/migration/V78__v1.8_release.sql index 02c5752381..b798da63f9 100644 --- a/backend/src/main/resources/db/migration/V78__v1.8_release.sql +++ b/backend/src/main/resources/db/migration/V78__v1.8_release.sql @@ -28,7 +28,24 @@ CREATE TABLE IF NOT EXISTS `api_document_share` ( ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- test_case_review add coloumn +ALTER TABLE test_case_review + ADD tags VARCHAR(2000) NULL; + +-- swagger_url_project +alter table swagger_url_project + modify module_id varchar(120) null; + +-- add_test_case +alter table test_case + add demand_id varchar(50) null; + +alter table test_case + add demand_name varchar(999) null; +-- test_case_review add column ALTER TABLE test_case_review ADD tags VARCHAR(2000) NULL; -- alter test_plan_api_scenario -alter table test_plan_api_scenario change environment_id environment longtext null comment 'Relevance environment'; \ No newline at end of file +alter table test_plan_api_scenario change environment_id environment longtext null comment 'Relevance environment'; + +-- file add sort column +alter table file_metadata add sort int default 0; \ No newline at end of file diff --git a/backend/src/main/resources/generatorConfig.xml b/backend/src/main/resources/generatorConfig.xml index 8a049afd7a..5798709de6 100644 --- a/backend/src/main/resources/generatorConfig.xml +++ b/backend/src/main/resources/generatorConfig.xml @@ -64,13 +64,14 @@ - + -
+ +
\ No newline at end of file diff --git a/frontend/src/business/components/api/definition/model/JsonData.js b/frontend/src/business/components/api/definition/model/JsonData.js index a5befa8363..6d16657b77 100644 --- a/frontend/src/business/components/api/definition/model/JsonData.js +++ b/frontend/src/business/components/api/definition/model/JsonData.js @@ -61,6 +61,11 @@ export const CASE_PRIORITY = [ {id: 'P3', label: 'P3'} ] +export const REVIEW_STATUS = [ + {id: 'Prepare', label: '未评审'}, + {id: 'Pass', label: '通过'}, + {id: 'UnPass', label: '未通过'} +] export const API_STATUS = [ {id: 'Prepare', label: '未开始'}, {id: 'Underway', label: '进行中'}, diff --git a/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue b/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue index f9b594afd1..3a5d5b0c28 100644 --- a/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue +++ b/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue @@ -49,25 +49,39 @@ size="mini"/>
- - - - - - - +
+ + + + + + + +
+ +
+ + + + +
+
diff --git a/frontend/src/business/components/performance/test/EditPerformanceTest.vue b/frontend/src/business/components/performance/test/EditPerformanceTest.vue index 499b82bbd8..6ae9d29709 100644 --- a/frontend/src/business/components/performance/test/EditPerformanceTest.vue +++ b/frontend/src/business/components/performance/test/EditPerformanceTest.vue @@ -190,6 +190,7 @@ export default { } // 基本配置 this.test.updatedFileList = this.$refs.basicConfig.updatedFileList(); + this.test.fileSorts = this.$refs.basicConfig.fileSorts(); // 压力配置 this.test.loadConfiguration = JSON.stringify(this.$refs.pressureConfig.convertProperty()); this.test.testResourcePoolId = this.$refs.pressureConfig.resourcePool; diff --git a/frontend/src/business/components/performance/test/components/ExistFiles.vue b/frontend/src/business/components/performance/test/components/ExistFiles.vue index 880b559eda..5a8814d357 100644 --- a/frontend/src/business/components/performance/test/components/ExistFiles.vue +++ b/frontend/src/business/components/performance/test/components/ExistFiles.vue @@ -121,7 +121,6 @@ export default { if (this.loadType === 'resource') { rows.forEach(row => { - this.fileList.push(row); this.tableData.push(row); }) this.$success(this.$t('test_track.case.import.success')); @@ -142,7 +141,6 @@ export default { this.scenarios.push(tg); }); let file = new File([d.jmx], d.name); - this.fileList.push(file); this.uploadList.push(file); this.tableData.push({ name: file.name, diff --git a/frontend/src/business/components/performance/test/components/ExistScenarios.vue b/frontend/src/business/components/performance/test/components/ExistScenarios.vue index ededff4630..8b6c058279 100644 --- a/frontend/src/business/components/performance/test/components/ExistScenarios.vue +++ b/frontend/src/business/components/performance/test/components/ExistScenarios.vue @@ -138,7 +138,6 @@ export default { this.scenarios.push(tg); }); let file = new File([d.jmx], d.name + ".jmx"); - this.fileList.push(file); this.uploadList.push(file); this.tableData.push({ name: file.name, diff --git a/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue b/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue index bf6643ec18..076c0df6a5 100644 --- a/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue +++ b/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue @@ -46,7 +46,9 @@ { + fileSorts[f.name] = index; + }); + return fileSorts; + }, loadJMX() { this.$refs.existFiles.open('jmx'); }, diff --git a/frontend/src/business/components/performance/test/components/PerformancePressureConfig.vue b/frontend/src/business/components/performance/test/components/PerformancePressureConfig.vue index 4267865cd7..ae16b130fd 100644 --- a/frontend/src/business/components/performance/test/components/PerformancePressureConfig.vue +++ b/frontend/src/business/components/performance/test/components/PerformancePressureConfig.vue @@ -62,25 +62,39 @@ size="mini"/>
- - - - - - - +
+ + + + + + + +
+ +
+ + + + +
+
@@ -131,6 +145,7 @@ import MsChart from "@/business/components/common/chart/MsChart"; import {findThreadGroup} from "@/business/components/performance/test/model/ThreadGroup"; const HANDLER = "handler"; +const THREAD_GROUP_TYPE = "tgType"; const TARGET_LEVEL = "TargetLevel"; const RAMP_UP = "RampUp"; const ITERATE_RAMP_UP = "iterateRampUpTime"; @@ -265,6 +280,9 @@ export default { case HANDLER: this.threadGroups[i].handler = item.value; break; + case THREAD_GROUP_TYPE: + this.threadGroups[i].tgType = item.value; + break; default: break; } @@ -535,6 +553,7 @@ export default { {key: ITERATE_RAMP_UP, value: this.threadGroups[i].iterateRampUp}, {key: ENABLED, value: this.threadGroups[i].enabled}, {key: DELETED, value: this.threadGroups[i].deleted}, + {key: THREAD_GROUP_TYPE, value: this.threadGroups[i].tgType}, ]); } return result; diff --git a/frontend/src/business/components/performance/test/model/ThreadGroup.js b/frontend/src/business/components/performance/test/model/ThreadGroup.js index d97368e831..b4656c8af5 100644 --- a/frontend/src/business/components/performance/test/model/ThreadGroup.js +++ b/frontend/src/business/components/performance/test/model/ThreadGroup.js @@ -29,6 +29,8 @@ export function findThreadGroup(jmxContent, handler) { tg.deleted = 'false'; tg.handler = handler; tg.enabled = tg.attributes.enabled; + tg.tgType = tg.name; + tg.threadType = 'DURATION'; }) return threadGroups; } diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index b618625b53..52f9002568 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -1,40 +1,72 @@ --> + v-if="item.id == 'priority'" + prop="priority" + :filters="priorityFilters" + column-key="priority" + min-width="100px" + :label="$t('test_track.case.priority')" + show-overflow-tooltip + :key="index"> - + + + v-if="item.id=='status'" + :filters="statusFilters" + column-key="status" + min-width="100px" + :label="$t('test_track.case.status')" + :key="index"> - + icon="el-icon-document-copy" + type="success" @exec="handleCopy(scope.row)"/> + + + + @@ -415,6 +401,7 @@ export default { handleCopy(testCase) { this.$get('test/case/get/' + testCase.id, response => { let testCase = response.data; + testCase.name='copy_'+testCase.name this.$emit('testCaseCopy', testCase); }); }, diff --git a/frontend/src/business/components/track/common/TestCaseNodeTree.vue b/frontend/src/business/components/track/common/TestCaseNodeTree.vue index ca434508e0..e3d268daab 100644 --- a/frontend/src/business/components/track/common/TestCaseNodeTree.vue +++ b/frontend/src/business/components/track/common/TestCaseNodeTree.vue @@ -1,25 +1,57 @@