From a49eb5a4168547b939b7cecae2a0e976e91a4ab0 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 1 Mar 2021 12:11:21 +0800 Subject: [PATCH 01/11] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89)?= =?UTF-8?q?:=20=E6=96=B0=E7=89=88=E6=9C=ACauth=20=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/definition/request/auth/MsAuthManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/auth/MsAuthManager.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/auth/MsAuthManager.java index fcded90f88..96cf3fc04e 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/auth/MsAuthManager.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/auth/MsAuthManager.java @@ -71,9 +71,13 @@ public class MsAuthManager extends MsTestElement { ApiTestEnvironmentWithBLOBs environmentWithBLOBs = environmentService.get(environment); EnvironmentConfig envConfig = JSONObject.parseObject(environmentWithBLOBs.getConfig(), EnvironmentConfig.class); this.url = envConfig.getHttpConfig().getProtocol() + "://" + envConfig.getHttpConfig().getSocket(); + } else if (config != null && config.isEffective(this.getProjectId())) { + if (config.isEffective(this.getProjectId())) { + String url = config.getConfig().get(this.getProjectId()).getHttpConfig().getProtocol() + "://" + config.getConfig().get(this.getProjectId()).getHttpConfig().getSocket(); + auth.setURL(url); + } } } - auth.setDomain(this.domain); auth.setUser(this.username); auth.setPass(this.password); auth.setMechanism(AuthManager.Mechanism.DIGEST); From cbd3f6a9b4977ea363ccb6b2628c3a2ebbd90f4b Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 1 Mar 2021 13:58:18 +0800 Subject: [PATCH 02/11] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89)?= =?UTF-8?q?:=20=E9=87=8D=E5=86=99=E8=AE=A4=E8=AF=81=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/auth/MsAuthManager.java | 33 ++++++++++++------- .../request/sampler/MsHTTPSamplerProxy.java | 3 +- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/auth/MsAuthManager.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/auth/MsAuthManager.java index 96cf3fc04e..cae25e201f 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/auth/MsAuthManager.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/auth/MsAuthManager.java @@ -1,19 +1,15 @@ package io.metersphere.api.dto.definition.request.auth; -import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; import io.metersphere.api.dto.definition.request.MsTestElement; import io.metersphere.api.dto.definition.request.ParameterConfig; -import io.metersphere.api.dto.scenario.environment.EnvironmentConfig; -import io.metersphere.api.service.ApiTestEnvironmentService; -import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs; -import io.metersphere.commons.utils.CommonBeanFactory; import lombok.Data; import lombok.EqualsAndHashCode; import org.apache.commons.lang3.StringUtils; import org.apache.jmeter.protocol.http.control.AuthManager; import org.apache.jmeter.protocol.http.control.Authorization; +import org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy; import org.apache.jmeter.save.SaveService; import org.apache.jmeter.testelement.TestElement; import org.apache.jorphan.collections.HashTree; @@ -66,12 +62,7 @@ public class MsAuthManager extends MsTestElement { if (this.url != null) { auth.setURL(this.url); } else { - if (environment != null) { - ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class); - ApiTestEnvironmentWithBLOBs environmentWithBLOBs = environmentService.get(environment); - EnvironmentConfig envConfig = JSONObject.parseObject(environmentWithBLOBs.getConfig(), EnvironmentConfig.class); - this.url = envConfig.getHttpConfig().getProtocol() + "://" + envConfig.getHttpConfig().getSocket(); - } else if (config != null && config.isEffective(this.getProjectId())) { + if (config != null && config.isEffective(this.getProjectId())) { if (config.isEffective(this.getProjectId())) { String url = config.getConfig().get(this.getProjectId()).getHttpConfig().getProtocol() + "://" + config.getConfig().get(this.getProjectId()).getHttpConfig().getSocket(); auth.setURL(url); @@ -84,4 +75,24 @@ public class MsAuthManager extends MsTestElement { authManager.addAuth(auth); tree.add(authManager); } + + public void setAuth(HashTree tree, MsAuthManager msAuthManager, HTTPSamplerProxy samplerProxy) { + try { + AuthManager authManager = new AuthManager(); + authManager.setEnabled(true); + authManager.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "AuthManager"); + authManager.setProperty(TestElement.TEST_CLASS, AuthManager.class.getName()); + authManager.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("AuthPanel")); + Authorization auth = new Authorization(); + auth.setURL(samplerProxy.getUrl().toString()); + auth.setDomain(samplerProxy.getDomain()); + auth.setUser(msAuthManager.getUsername()); + auth.setPass(msAuthManager.getPassword()); + auth.setMechanism(AuthManager.Mechanism.DIGEST); + authManager.addAuth(auth); + tree.add(authManager); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java index 5557952920..cf61040421 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java @@ -8,7 +8,6 @@ import io.metersphere.api.dto.definition.request.auth.MsAuthManager; import io.metersphere.api.dto.definition.request.dns.MsDNSCacheManager; import io.metersphere.api.dto.scenario.Body; import io.metersphere.api.dto.scenario.KeyValue; -import io.metersphere.api.dto.scenario.environment.EnvironmentConfig; import io.metersphere.commons.constants.MsTestElementConstants; import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.ScriptEngineUtils; @@ -232,7 +231,7 @@ public class MsHTTPSamplerProxy extends MsTestElement { } } if (this.authManager != null) { - this.authManager.toHashTree(tree, hashTree, config); + this.authManager.setAuth(tree, this.authManager, sampler); } } From 3b2fe5ddb35ab894a34a042df35b20c2d75541db Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 1 Mar 2021 14:59:50 +0800 Subject: [PATCH 03/11] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E9=A1=BA=E5=BA=8F=E4=B8=8D=E5=9B=BA=E5=AE=9A=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/scenario/ApiScenarioEnv.vue | 53 ++++++++++--------- .../automation/scenario/EditApiScenario.vue | 3 +- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioEnv.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioEnv.vue index 5ec2dccd2d..5547777048 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioEnv.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioEnv.vue @@ -6,8 +6,8 @@ :destroy-on-close="true" :before-close="handleClose"> -
-
+
+
{{ getProjectName(pe.id) }} @@ -29,51 +29,55 @@
- 取 消 - 确 定 - + 取 消 + 确 定 + + + + diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 3400e7e644..4f4ef858e5 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -186,7 +186,8 @@ - + From 1a633fe2caa237dbef7237156cfc7821f57b90d4 Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Mon, 1 Mar 2021 15:21:10 +0800 Subject: [PATCH 04/11] =?UTF-8?q?feat:=20=E6=94=B9=E9=80=A0=E8=AF=84?= =?UTF-8?q?=E5=AE=A1=E7=94=A8=E4=BE=8B=EF=BC=8C=E5=88=9B=E5=BB=BA=E8=AF=84?= =?UTF-8?q?=E5=AE=A1=EF=BC=8C=E8=AF=84=E5=AE=A1=E8=AF=A6=E6=83=85=20fix?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/domain/TestCaseReview.java | 2 + .../base/domain/TestCaseReviewExample.java | 70 ++++++++++++ .../base/mapper/TestCaseReviewMapper.xml | 31 ++++-- .../mapper/ext/ExtTestCaseReviewMapper.xml | 3 +- .../src/main/resources/generatorConfig.xml | 1 + .../definition/components/list/ApiList.vue | 31 +++++- .../components/runtest/RunTestHTTPPage.vue | 2 + .../components/common/head/HeaderCustom.vue | 6 +- .../components/common/model/JsonData.js | 1 + .../review/components/TestCaseReviewEdit.vue | 12 +- .../review/components/TestCaseReviewList.vue | 14 +++ .../track/review/view/TestCaseReviewView.vue | 104 +++++++++++------- .../review/view/components/TestReviewApi.vue | 94 ++++++++++++++++ .../view/components/TestReviewFunction.vue | 93 ++++++++++++++++ .../review/view/components/TestReviewLoad.vue | 94 ++++++++++++++++ .../components/TestReviewTestCaseList.vue | 8 ++ 16 files changed, 515 insertions(+), 51 deletions(-) create mode 100644 frontend/src/business/components/track/review/view/components/TestReviewApi.vue create mode 100644 frontend/src/business/components/track/review/view/components/TestReviewFunction.vue create mode 100644 frontend/src/business/components/track/review/view/components/TestReviewLoad.vue diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseReview.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseReview.java index 3787996ee7..f3a6e98dac 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseReview.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseReview.java @@ -21,6 +21,8 @@ public class TestCaseReview implements Serializable { private String projectId; + private String tags; + private String description; private static final long serialVersionUID = 1L; diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseReviewExample.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseReviewExample.java index 1935c4c171..61d810336f 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseReviewExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseReviewExample.java @@ -633,6 +633,76 @@ public class TestCaseReviewExample { addCriterion("project_id not between", value1, value2, "projectId"); return (Criteria) this; } + + public Criteria andTagsIsNull() { + addCriterion("tags is null"); + return (Criteria) this; + } + + public Criteria andTagsIsNotNull() { + addCriterion("tags is not null"); + return (Criteria) this; + } + + public Criteria andTagsEqualTo(String value) { + addCriterion("tags =", value, "tags"); + return (Criteria) this; + } + + public Criteria andTagsNotEqualTo(String value) { + addCriterion("tags <>", value, "tags"); + return (Criteria) this; + } + + public Criteria andTagsGreaterThan(String value) { + addCriterion("tags >", value, "tags"); + return (Criteria) this; + } + + public Criteria andTagsGreaterThanOrEqualTo(String value) { + addCriterion("tags >=", value, "tags"); + return (Criteria) this; + } + + public Criteria andTagsLessThan(String value) { + addCriterion("tags <", value, "tags"); + return (Criteria) this; + } + + public Criteria andTagsLessThanOrEqualTo(String value) { + addCriterion("tags <=", value, "tags"); + return (Criteria) this; + } + + public Criteria andTagsLike(String value) { + addCriterion("tags like", value, "tags"); + return (Criteria) this; + } + + public Criteria andTagsNotLike(String value) { + addCriterion("tags not like", value, "tags"); + return (Criteria) this; + } + + public Criteria andTagsIn(List values) { + addCriterion("tags in", values, "tags"); + return (Criteria) this; + } + + public Criteria andTagsNotIn(List values) { + addCriterion("tags not in", values, "tags"); + return (Criteria) this; + } + + public Criteria andTagsBetween(String value1, String value2) { + addCriterion("tags between", value1, value2, "tags"); + return (Criteria) this; + } + + public Criteria andTagsNotBetween(String value1, String value2) { + addCriterion("tags not between", value1, value2, "tags"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseReviewMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReviewMapper.xml index 16691a5515..aad38c2b1c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseReviewMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReviewMapper.xml @@ -10,6 +10,7 @@ + @@ -73,7 +74,7 @@ - id, `name`, creator, `status`, create_time, update_time, end_time, project_id + id, `name`, creator, `status`, create_time, update_time, end_time, project_id, tags description @@ -129,12 +130,12 @@ insert into test_case_review (id, `name`, creator, `status`, create_time, update_time, - end_time, project_id, description - ) + end_time, project_id, tags, + description) values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, - #{endTime,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR} - ) + #{endTime,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, + #{description,jdbcType=LONGVARCHAR}) insert into test_case_review @@ -163,6 +164,9 @@ project_id, + + tags, + description, @@ -192,6 +196,9 @@ #{projectId,jdbcType=VARCHAR}, + + #{tags,jdbcType=VARCHAR}, + #{description,jdbcType=LONGVARCHAR}, @@ -230,6 +237,9 @@ project_id = #{record.projectId,jdbcType=VARCHAR}, + + tags = #{record.tags,jdbcType=VARCHAR}, + description = #{record.description,jdbcType=LONGVARCHAR}, @@ -248,6 +258,7 @@ update_time = #{record.updateTime,jdbcType=BIGINT}, end_time = #{record.endTime,jdbcType=BIGINT}, project_id = #{record.projectId,jdbcType=VARCHAR}, + tags = #{record.tags,jdbcType=VARCHAR}, description = #{record.description,jdbcType=LONGVARCHAR} @@ -262,7 +273,8 @@ create_time = #{record.createTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT}, end_time = #{record.endTime,jdbcType=BIGINT}, - project_id = #{record.projectId,jdbcType=VARCHAR} + project_id = #{record.projectId,jdbcType=VARCHAR}, + tags = #{record.tags,jdbcType=VARCHAR} @@ -291,6 +303,9 @@ project_id = #{projectId,jdbcType=VARCHAR}, + + tags = #{tags,jdbcType=VARCHAR}, + description = #{description,jdbcType=LONGVARCHAR}, @@ -306,6 +321,7 @@ update_time = #{updateTime,jdbcType=BIGINT}, end_time = #{endTime,jdbcType=BIGINT}, project_id = #{projectId,jdbcType=VARCHAR}, + tags = #{tags,jdbcType=VARCHAR}, description = #{description,jdbcType=LONGVARCHAR} where id = #{id,jdbcType=VARCHAR} @@ -317,7 +333,8 @@ create_time = #{createTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT}, end_time = #{endTime,jdbcType=BIGINT}, - project_id = #{projectId,jdbcType=VARCHAR} + project_id = #{projectId,jdbcType=VARCHAR}, + tags = #{tags,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewMapper.xml index 02af9171cd..1798133e8e 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseReviewMapper.xml @@ -4,7 +4,8 @@