From c59cc92f28d527be31b761202faa6f690602e275 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 8 Mar 2021 18:37:42 +0800 Subject: [PATCH 01/13] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E8=87=AA=E5=AE=9A=E4=B9=89=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E4=B8=8D=E8=83=BD=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scenario/component/ApiComponent.vue | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue index 1f48fe7912..81103b6beb 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue @@ -251,16 +251,19 @@ this.reload(); }, run() { - if (!this.envMap || this.envMap.size === 0) { - this.$warning("请在环境配置中为该步骤所属项目选择运行环境!"); - return false; - } else if (this.envMap && this.envMap.size > 0) { - const env = this.envMap.get(this.request.projectId); - if (!env) { + if (this.isApiImport) { + if (!this.envMap || this.envMap.size === 0) { this.$warning("请在环境配置中为该步骤所属项目选择运行环境!"); return false; + } else if (this.envMap && this.envMap.size > 0) { + const env = this.envMap.get(this.request.projectId); + if (!env) { + this.$warning("请在环境配置中为该步骤所属项目选择运行环境!"); + return false; + } } } + this.request.active = true; this.loading = true; this.runData = []; From 3c970efd2d61db185bbb5e4a0c7ff0e5011ceeca Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Mon, 8 Mar 2021 19:11:51 +0800 Subject: [PATCH 02/13] chore: sync --- frontend/src/business/components/xpack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index e4422e1dc6..62ca85d34f 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit e4422e1dc640704febfbf469185cd85b78d2147a +Subproject commit 62ca85d34fdb89663cce69c9c694cf368e7bb3e6 From 9ba7639437f51a1b93ab0aa94482adac889ad5c6 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 9 Mar 2021 10:37:37 +0800 Subject: [PATCH 03/13] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=B8=AArestTemplateIgnoreSSL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/issue/AbstractIssuePlatform.java | 36 +++++++++++++++++++ .../metersphere/track/issue/JiraPlatform.java | 4 +-- 2 files changed, 38 insertions(+), 2 deletions(-) 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 c754a0e10a..6c89ff1732 100644 --- a/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/AbstractIssuePlatform.java @@ -8,6 +8,7 @@ import io.metersphere.commons.exception.MSException; import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.EncryptUtils; +import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.request.IntegrationRequest; import io.metersphere.service.IntegrationService; @@ -15,10 +16,21 @@ import io.metersphere.service.ProjectService; import io.metersphere.track.request.testcase.IssuesRequest; import io.metersphere.track.service.TestCaseService; import org.apache.commons.lang3.StringUtils; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.TrustStrategy; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; import org.springframework.http.HttpHeaders; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +import javax.net.ssl.SSLContext; +import java.security.cert.X509Certificate; public abstract class AbstractIssuePlatform implements IssuesPlatform { + private static RestTemplate restTemplate; + protected IntegrationService integrationService; protected TestCaseIssuesMapper testCaseIssuesMapper; protected ProjectService projectService; @@ -26,8 +38,29 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { protected IssuesMapper issuesMapper; protected ExtIssuesMapper extIssuesMapper; + protected RestTemplate restTemplateIgnoreSSL; + protected String testCaseId; + static { + try { + TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; + SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom() + .loadTrustMaterial(null, acceptingTrustStrategy) + .build(); + SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext); + CloseableHttpClient httpClient = HttpClients.custom() + .setSSLSocketFactory(csf) + .build(); + HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); + requestFactory.setHttpClient(httpClient); + + restTemplate = new RestTemplate(requestFactory); + } catch (Exception e) { + LogUtil.error(e); + } + } + public AbstractIssuePlatform(IssuesRequest issuesRequest) { this.integrationService = CommonBeanFactory.getBean(IntegrationService.class); this.testCaseIssuesMapper = CommonBeanFactory.getBean(TestCaseIssuesMapper.class); @@ -36,6 +69,8 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { this.issuesMapper = CommonBeanFactory.getBean(IssuesMapper.class); this.extIssuesMapper = CommonBeanFactory.getBean(ExtIssuesMapper.class); this.testCaseId = issuesRequest.getTestCaseId(); + // + this.restTemplateIgnoreSSL = restTemplate; } protected String getPlatformConfig(String platform) { @@ -64,6 +99,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform { /** * 获取平台与项目相关的属性 + * * @return 其他平台和本地项目绑定的属性值 */ abstract String getProjectId(); 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 a43465c48a..204366015e 100644 --- a/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java +++ b/backend/src/main/java/io/metersphere/track/issue/JiraPlatform.java @@ -186,8 +186,8 @@ public class JiraPlatform extends AbstractIssuePlatform { String url = object.getString("url"); HttpHeaders headers = auth(account, password); HttpEntity requestEntity = new HttpEntity<>(headers); - RestTemplate restTemplate = new RestTemplate(); - restTemplate.exchange(url + "rest/api/2/issue/createmeta", HttpMethod.GET, requestEntity, String.class); + // 忽略ssl + restTemplateIgnoreSSL.exchange(url + "rest/api/2/issue/createmeta", HttpMethod.GET, requestEntity, String.class); } catch (Exception e) { LogUtil.error(e.getMessage(), e); MSException.throwException("验证失败!"); From 8f5ffcb51a6769fcbf79650f5cec8f14413dea01 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Tue, 9 Mar 2021 11:38:11 +0800 Subject: [PATCH 04/13] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92)?= =?UTF-8?q?:=20=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=E5=8D=A1=E9=A1=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/automation/scenario/testplan/TestPlanList.vue | 8 -------- .../components/track/plan/components/TestPlanEdit.vue | 2 -- .../components/track/plan/components/TestPlanList.vue | 8 -------- 3 files changed, 18 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/testplan/TestPlanList.vue b/frontend/src/business/components/api/automation/scenario/testplan/TestPlanList.vue index ea2aceb4f9..7e631ce3a3 100644 --- a/frontend/src/business/components/api/automation/scenario/testplan/TestPlanList.vue +++ b/frontend/src/business/components/api/automation/scenario/testplan/TestPlanList.vue @@ -231,14 +231,6 @@ export default { let data = response.data; this.total = data.itemCount; this.tableData = data.listObject; - for (let i = 0; i < this.tableData.length; i++) { - let path = "/test/plan/project"; - this.$post(path, {planId: this.tableData[i].id}, res => { - let arr = res.data; - let projectIds = arr.map(data => data.id); - this.$set(this.tableData[i], "projectIds", projectIds); - }) - } }); }, buildPagePath(path) { diff --git a/frontend/src/business/components/track/plan/components/TestPlanEdit.vue b/frontend/src/business/components/track/plan/components/TestPlanEdit.vue index ee971a3524..a767856738 100644 --- a/frontend/src/business/components/track/plan/components/TestPlanEdit.vue +++ b/frontend/src/business/components/track/plan/components/TestPlanEdit.vue @@ -134,7 +134,6 @@ export default { plannedStartTime: '', plannedEndTime: '' }, - dbProjectIds: [], rules: { name: [ {required: true, message: this.$t('test_track.plan.input_plan_name'), trigger: 'blur'}, @@ -160,7 +159,6 @@ export default { let tmp = {}; Object.assign(tmp, testPlan); Object.assign(this.form, tmp); - this.dbProjectIds = JSON.parse(JSON.stringify(this.form.projectIds)); } listenGoBack(this.close); this.dialogFormVisible = true; diff --git a/frontend/src/business/components/track/plan/components/TestPlanList.vue b/frontend/src/business/components/track/plan/components/TestPlanList.vue index 7677da6ffd..033109e521 100644 --- a/frontend/src/business/components/track/plan/components/TestPlanList.vue +++ b/frontend/src/business/components/track/plan/components/TestPlanList.vue @@ -279,14 +279,6 @@ export default { let data = response.data; this.total = data.itemCount; this.tableData = data.listObject; - for (let i = 0; i < this.tableData.length; i++) { - let path = "/test/plan/project"; - this.$post(path, {planId: this.tableData[i].id}, res => { - let arr = res.data; - let projectIds = arr.filter(d => d.id !== this.tableData[i].projectId).map(data => data.id); - this.$set(this.tableData[i], "projectIds", projectIds); - }) - } }); }, buildPagePath(path) { From 66977ce60dd06e77d8b8594d1d54c545e5988e8d Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Tue, 9 Mar 2021 13:13:25 +0800 Subject: [PATCH 05/13] =?UTF-8?q?fix:=20=E5=9C=BA=E6=99=AF=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/db/migration/V78__v1.8_release.sql | 2 +- .../src/business/components/common/model/JsonData.js | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) 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 bb4704ecb4..c75d13da28 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 @@ -33,7 +33,7 @@ alter table swagger_url_project -- add_test_case alter table test_case - add demand_id varchar(50) null; + add demand_id varchar(120) null; alter table test_case add demand_name varchar(999) null; diff --git a/frontend/src/business/components/common/model/JsonData.js b/frontend/src/business/components/common/model/JsonData.js index d9dd6eae95..c6ae8d8dee 100644 --- a/frontend/src/business/components/common/model/JsonData.js +++ b/frontend/src/business/components/common/model/JsonData.js @@ -63,11 +63,16 @@ export const Api_Case_List = [ export const Api_Scenario_List = [ {id: 'num', label: "ID"}, {id: 'name', label: i18n.t('test_track.case.name')}, - {id: 'priority', label: i18n.t('test_track.case.priority')}, - {id: 'path', label: i18n.t('api_test.definition.api_path')}, + {id: 'level', label: i18n.t('api_test.automation.case_level')}, + {id: 'status', label: i18n.t('test_track.plan.plan_status')}, {id: 'tags', label: i18n.t('commons.tag')}, - {id: 'createUser', label: '创建人'}, + {id: 'userId', label: i18n.t('api_test.automation.creator')}, {id: 'updateTime', label: i18n.t('api_test.definition.api_last_time')}, + {id: 'stepTotal', label: i18n.t('api_test.automation.step')}, + {id: 'lastResult', label: i18n.t('api_test.automation.last_result')}, + {id: 'passRate', label: i18n.t('api_test.automation.passing_rate')}, + + ] //测试评审-测试用例 export const Test_Case_Review_Case_List = [ From 5f59602ddd7b91a8b196d8bb2d33c12bd0c1b6fe Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 9 Mar 2021 14:05:35 +0800 Subject: [PATCH 06/13] =?UTF-8?q?fix:=20=E5=8E=BB=E6=8E=89=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=9D=A2=E6=BB=9A=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/io/metersphere/xpack | 2 +- frontend/src/business/components/xpack | 2 +- frontend/src/login/Login.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index 3f497f88eb..d2fc4b4211 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit 3f497f88ebbd312a3b7637c1b694a8e28c68c287 +Subproject commit d2fc4b42117be97c679b4d15d6f979923e598f7f diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index 62ca85d34f..360d7214d1 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit 62ca85d34fdb89663cce69c9c694cf368e7bb3e6 +Subproject commit 360d7214d15951ae11b3973add795305a5c3d035 diff --git a/frontend/src/login/Login.vue b/frontend/src/login/Login.vue index 6dec041ed8..bb091d25c9 100644 --- a/frontend/src/login/Login.vue +++ b/frontend/src/login/Login.vue @@ -187,7 +187,6 @@ export default {