From e6121017d01782d9f0b6b54b1ba118d666baf936 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 19 Dec 2022 17:52:26 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0=E7=B3=BB=E7=BB=9F=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=BB=84=E6=88=90=E5=91=98=E6=97=B6=E6=A3=80=E6=9F=A5=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/service/GroupService.java | 8 ++--- .../io/metersphere/service/GroupService.java | 8 ++++- .../io/metersphere/service/UserService.java | 30 +++++++++++-------- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/project-management/backend/src/main/java/io/metersphere/service/GroupService.java b/project-management/backend/src/main/java/io/metersphere/service/GroupService.java index 58327c28c6..0c857795b7 100644 --- a/project-management/backend/src/main/java/io/metersphere/service/GroupService.java +++ b/project-management/backend/src/main/java/io/metersphere/service/GroupService.java @@ -511,12 +511,10 @@ public class GroupService { return; } - if (StringUtils.equals(group.getType(), UserGroupType.SYSTEM)) { - this.addSystemGroupUser(group, request.getUserIds()); + if (!StringUtils.equals(group.getType(), UserGroupType.SYSTEM) && CollectionUtils.isNotEmpty(request.getSourceIds())) { + this.addNotSystemGroupUser(group, request.getUserIds(), request.getSourceIds()); } else { - if (CollectionUtils.isNotEmpty(request.getSourceIds())) { - this.addNotSystemGroupUser(group, request.getUserIds(), request.getSourceIds()); - } + LogUtil.warn("no permission to add system group!"); } } diff --git a/system-setting/backend/src/main/java/io/metersphere/service/GroupService.java b/system-setting/backend/src/main/java/io/metersphere/service/GroupService.java index 4d4d9180ec..d2b5874abe 100644 --- a/system-setting/backend/src/main/java/io/metersphere/service/GroupService.java +++ b/system-setting/backend/src/main/java/io/metersphere/service/GroupService.java @@ -471,7 +471,13 @@ public class GroupService { } if (StringUtils.equals(group.getType(), UserGroupType.SYSTEM)) { - this.addSystemGroupUser(group, request.getUserIds()); + SessionUser user = Objects.requireNonNull(SessionUtils.getUser()); + long count = user.getGroups().stream().filter(g -> StringUtils.equals(g.getType(), UserGroupType.SYSTEM)).count(); + if (count > 0) { + this.addSystemGroupUser(group, request.getUserIds()); + } else { + LogUtil.warn("no permission to add system group!"); + } } else { if (CollectionUtils.isNotEmpty(request.getSourceIds())) { this.addNotSystemGroupUser(group, request.getUserIds(), request.getSourceIds()); diff --git a/system-setting/backend/src/main/java/io/metersphere/service/UserService.java b/system-setting/backend/src/main/java/io/metersphere/service/UserService.java index 2f062012a8..f825a6f952 100644 --- a/system-setting/backend/src/main/java/io/metersphere/service/UserService.java +++ b/system-setting/backend/src/main/java/io/metersphere/service/UserService.java @@ -808,25 +808,31 @@ public class UserService { } } + SessionUser user = Objects.requireNonNull(SessionUtils.getUser()); + long systemGroupCount = user.getGroups().stream().filter(g -> StringUtils.equals(g.getType(), UserGroupType.SYSTEM)).count(); + for (String userId : userIds) { Set set = sourceMap.keySet(); for (String group : set) { Group gp = groupMapper.selectByPrimaryKey(group); if (gp != null) { if (StringUtils.equals(UserGroupType.SYSTEM, gp.getType())) { - UserGroupExample userGroupExample = new UserGroupExample(); - userGroupExample.createCriteria().andGroupIdEqualTo(group).andUserIdEqualTo(userId); - List userGroups = userGroupMapper.selectByExample(userGroupExample); - if (CollectionUtils.isEmpty(userGroups)) { - UserGroup userGroup = new UserGroup(); - userGroup.setId(UUID.randomUUID().toString()); - userGroup.setGroupId(group); - userGroup.setSourceId("system"); - userGroup.setUserId(userId); - userGroup.setUpdateTime(System.currentTimeMillis()); - userGroup.setCreateTime(System.currentTimeMillis()); - userGroupMapper.insertSelective(userGroup); + if (systemGroupCount > 0) { + UserGroupExample userGroupExample = new UserGroupExample(); + userGroupExample.createCriteria().andGroupIdEqualTo(group).andUserIdEqualTo(userId); + List userGroups = userGroupMapper.selectByExample(userGroupExample); + if (CollectionUtils.isEmpty(userGroups)) { + UserGroup userGroup = new UserGroup(); + userGroup.setId(UUID.randomUUID().toString()); + userGroup.setGroupId(group); + userGroup.setSourceId("system"); + userGroup.setUserId(userId); + userGroup.setUpdateTime(System.currentTimeMillis()); + userGroup.setCreateTime(System.currentTimeMillis()); + userGroupMapper.insertSelective(userGroup); + } } + } else { // 组织、工作空间、项目 UserGroupExample userGroupExample = new UserGroupExample(); From 6d9e08172f91c64310f5d2da8988ae51ecbeb4e8 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Mon, 19 Dec 2022 18:00:57 +0800 Subject: [PATCH 2/7] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E5=A4=8D=E5=88=B6=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=97=B6=E9=87=8C=E9=9D=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=A1=BA=E5=BA=8F=E4=B8=8D=E5=AF=B9=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 --bug=1020633 --user=宋天阳 【测试跟踪】github #20421,复制测试计划,里面关联的接口测试顺序与原测试计划的关联接口测试顺序不一致。 https://www.tapd.cn/55049933/s/1317058 --- .../io/metersphere/service/plan/TestPlanApiCaseService.java | 4 +--- .../metersphere/service/plan/TestPlanScenarioCaseService.java | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanApiCaseService.java b/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanApiCaseService.java index 224aaeb56c..e18a091aa1 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanApiCaseService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanApiCaseService.java @@ -621,7 +621,6 @@ public class TestPlanApiCaseService { List testPlanApiCases = testPlanApiCaseMapper.selectByExample(testPlanApiCaseExample); TestPlanApiCaseMapper apiCaseMapper = sqlSession.getMapper(TestPlanApiCaseMapper.class); if (!CollectionUtils.isEmpty(testPlanApiCases)) { - Long nextApiOrder = ServiceUtils.getNextOrder(targetPlanId, extTestPlanApiCaseMapper::getLastOrder); for (TestPlanApiCase apiCase : testPlanApiCases) { TestPlanApiCase api = new TestPlanApiCase(); api.setId(UUID.randomUUID().toString()); @@ -631,8 +630,7 @@ public class TestPlanApiCaseService { api.setCreateTime(System.currentTimeMillis()); api.setUpdateTime(System.currentTimeMillis()); api.setCreateUser(SessionUtils.getUserId()); - api.setOrder(nextApiOrder); - nextApiOrder += 5000; + api.setOrder(apiCase.getOrder()); apiCaseMapper.insert(api); } } diff --git a/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanScenarioCaseService.java b/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanScenarioCaseService.java index 7e9fcdd251..f412017812 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanScenarioCaseService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanScenarioCaseService.java @@ -711,7 +711,6 @@ public class TestPlanScenarioCaseService { List apiScenarios = testPlanApiScenarioMapper.selectByExampleWithBLOBs(testPlanApiScenarioExample); TestPlanApiScenarioMapper apiScenarioMapper = sqlSession.getMapper(TestPlanApiScenarioMapper.class); if (!CollectionUtils.isEmpty(apiScenarios)) { - Long nextScenarioOrder = ServiceUtils.getNextOrder(targetPlanId, extTestPlanScenarioCaseMapper::getLastOrder); for (TestPlanApiScenario apiScenario : apiScenarios) { TestPlanApiScenario planScenario = new TestPlanApiScenario(); planScenario.setId(UUID.randomUUID().toString()); @@ -724,8 +723,7 @@ public class TestPlanScenarioCaseService { planScenario.setCreateTime(System.currentTimeMillis()); planScenario.setUpdateTime(System.currentTimeMillis()); planScenario.setCreateUser(SessionUtils.getUserId()); - planScenario.setOrder(nextScenarioOrder); - nextScenarioOrder += 5000; + planScenario.setOrder(apiScenario.getOrder()); apiScenarioMapper.insert(planScenario); } } From 70831ef161d46b173c1f259b5e5d5cd399debc32 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Mon, 19 Dec 2022 18:02:42 +0800 Subject: [PATCH 3/7] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B?= =?UTF-8?q?=E8=AF=95):=20=E6=8E=A5=E5=8F=A3=E5=AF=BC=E5=85=A5=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E8=B0=83=E6=95=B4,=E5=85=B3=E9=97=AD=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=AE=A1=E7=90=86=EF=BC=8C=E8=A6=86=E7=9B=96=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=88=A4=E6=96=AD=E9=87=8D=E5=A4=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=A6=81=E6=8E=92=E9=99=A4=E8=87=AA=E5=B7=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1020875--user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001020875 --- .../service/definition/ApiDefinitionImportUtilService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java index 46ef0ced30..f9aac4a518 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java @@ -663,7 +663,7 @@ public class ApiDefinitionImportUtilService { } if (apiDefinition.getLatest()) { for (ApiDefinitionWithBLOBs apiDefinitionWithBLOBs : repeatList) { - if (apiDefinitionWithBLOBs.getLatest()) { + if (apiDefinitionWithBLOBs.getLatest() && !apiDefinition.getId().equalsIgnoreCase(apiDefinitionWithBLOBs.getId())) { apiDefinitionWithBLOBs.setLatest(false); } batchMapper.updateByPrimaryKey(apiDefinitionWithBLOBs); From e4ac3929363489557cb37db697fc8ef16b3552ce Mon Sep 17 00:00:00 2001 From: zhangyong Date: Mon, 19 Dec 2022 17:08:05 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92-=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=8A=A5=E5=91=8A-UI=E6=B5=8B=E8=AF=95=E7=9A=84=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4=E6=98=AF=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=88=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1020985 --user=张勇 【UI测试】测试计划-导出报告-UI测试的开始结束时间是时间戳 https://www.tapd.cn/55049933/s/1317048 --- .../view/comonents/report/detail/ui/ApiReportViewHeader.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-track/frontend/src/business/plan/view/comonents/report/detail/ui/ApiReportViewHeader.vue b/test-track/frontend/src/business/plan/view/comonents/report/detail/ui/ApiReportViewHeader.vue index c504783ed0..dd74ff9c13 100644 --- a/test-track/frontend/src/business/plan/view/comonents/report/detail/ui/ApiReportViewHeader.vue +++ b/test-track/frontend/src/business/plan/view/comonents/report/detail/ui/ApiReportViewHeader.vue @@ -19,9 +19,9 @@ {{ $t('report.test_start_time') }}: - {{ report.createTime | timestampFormatDate }} + {{ report.createTime | datetimeFormat }} {{ $t('report.test_end_time') }}: - {{ report.endTime | timestampFormatDate }} + {{ report.endTime | datetimeFormat }}
Date: Mon, 19 Dec 2022 20:12:56 +0800 Subject: [PATCH 5/7] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8Dbeanshell=E8=84=9A=E6=9C=AC=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=90=8E=E6=B2=A1=E6=9C=89=E6=98=BE=E7=A4=BA=E4=B8=BA?= =?UTF-8?q?ms=E6=A0=BC=E5=BC=8F=E7=9A=84=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1020951 --user=王孝刚 【接口测试】接口场景中导入带BeanShell自定义脚本的jmx文件,beanshell自定义脚本建议和系统中原有的自定义脚本一样 https://www.tapd.cn/55049933/s/1317174 --- .../metersphere/api/parse/scenario/JMeterParser.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api-test/backend/src/main/java/io/metersphere/api/parse/scenario/JMeterParser.java b/api-test/backend/src/main/java/io/metersphere/api/parse/scenario/JMeterParser.java index d61d00faca..9cdf5a96b6 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/parse/scenario/JMeterParser.java +++ b/api-test/backend/src/main/java/io/metersphere/api/parse/scenario/JMeterParser.java @@ -66,6 +66,7 @@ import org.apache.jmeter.protocol.http.control.HeaderManager; import org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy; import org.apache.jmeter.protocol.http.util.HTTPArgument; import org.apache.jmeter.protocol.http.util.HTTPFileArg; +import org.apache.jmeter.protocol.java.sampler.BeanShellSampler; import org.apache.jmeter.protocol.java.sampler.JSR223Sampler; import org.apache.jmeter.protocol.jdbc.config.DataSourceElement; import org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler; @@ -737,12 +738,21 @@ public class JMeterParser extends ApiImportAbstractParser { ((MsJSR223Processor) elementNode).setScript(jsr223Sampler.getPropertyAsString(ElementConstants.SCRIPT)); ((MsJSR223Processor) elementNode).setScriptLanguage(jsr223Sampler.getPropertyAsString("scriptLanguage")); } + // BeanShell自定义脚本 + else if (key instanceof BeanShellSampler) { + BeanShellSampler jsr223Sampler = (BeanShellSampler) key; + elementNode = new MsJSR223Processor(); + BeanUtils.copyBean(elementNode, jsr223Sampler); + ((MsJSR223Processor) elementNode).setJsrEnable(false); + ((MsJSR223Processor) elementNode).setScript(jsr223Sampler.getPropertyAsString(ElementConstants.SCRIPT)); + ((MsJSR223Processor) elementNode).setScriptLanguage(jsr223Sampler.getPropertyAsString("scriptLanguage")); + } // 后置脚本 else if (key instanceof JSR223PostProcessor) { JSR223PostProcessor jsr223Sampler = (JSR223PostProcessor) key; elementNode = new MsJSR223PostProcessor(); BeanUtils.copyBean(elementNode, jsr223Sampler); - ((MsJSR223PostProcessor) elementNode).setScript(jsr223Sampler.getPropertyAsString(ElementConstants.SCRIPT)); + ((MsJSR223PostProcessor) elementNode).setScript(jsr223Sampler.getPropertyAsString("BeanShellSampler.query")); ((MsJSR223PostProcessor) elementNode).setScriptLanguage(jsr223Sampler.getPropertyAsString("scriptLanguage")); } else if (key instanceof BeanShellPostProcessor) { elementNode = getMsTestElement((BeanShellPostProcessor) key); From c85972a808a918dc434255c093b6dff5777683c7 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Mon, 19 Dec 2022 21:06:45 +0800 Subject: [PATCH 6/7] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8Djsonpath=E6=96=AD=E8=A8=80=E5=88=A4?= =?UTF-8?q?=E6=96=ADnull=E5=80=BC=E5=A4=B1=E8=B4=A5=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1019569 --user=王孝刚 [接口测试]github#19637jsonpath断言,响应体中字段为null的值识别不到,导致断言失败 https://www.tapd.cn/55049933/s/1317177 --- .../src/main/java/io/metersphere/utils/DocumentUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/utils/DocumentUtils.java b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/utils/DocumentUtils.java index d4f8384290..2aed6d5fb9 100644 --- a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/utils/DocumentUtils.java +++ b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/utils/DocumentUtils.java @@ -1,6 +1,6 @@ package io.metersphere.utils; -import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import io.metersphere.vo.Condition; import io.metersphere.vo.ElementCondition; import net.minidev.json.JSONArray; @@ -106,7 +106,7 @@ public class DocumentUtils { if (subj == null) { str = "null"; } else if (subj instanceof Map) { - str = new Gson().toJson(subj); + str = new GsonBuilder().serializeNulls().create().toJson(subj); } else if (!(subj instanceof Double) && !(subj instanceof Float)) { str = subj.toString(); } else { From bc17173f84d1f6ca7a77953526ab1f1c0033399e Mon Sep 17 00:00:00 2001 From: zhangdahai112 Date: Tue, 20 Dec 2022 02:21:06 +0800 Subject: [PATCH 7/7] =?UTF-8?q?fix(UI=E8=87=AA=E5=8A=A8=E5=8C=96):=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E6=94=B9?= =?UTF-8?q?=E6=88=90=E4=B8=8B=E6=8B=89=E8=8F=9C=E5=8D=95=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1020929 --user=张大海 【系统设置】环境管理-通用配置-鼠标悬浮到导出按钮上未下拉展示 https://www.tapd.cn/55049933/s/1317225 --- .../commons/ApiScenarioVariables.vue | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/framework/sdk-parent/frontend/src/components/environment/commons/ApiScenarioVariables.vue b/framework/sdk-parent/frontend/src/components/environment/commons/ApiScenarioVariables.vue index 33215bf754..9c1799bbb6 100644 --- a/framework/sdk-parent/frontend/src/components/environment/commons/ApiScenarioVariables.vue +++ b/framework/sdk-parent/frontend/src/components/environment/commons/ApiScenarioVariables.vue @@ -18,21 +18,18 @@ :content="$t('commons.import')" @click="importJSON" /> - + - + + {{ $t('envrionment.export_variable_tip') }} + + +