From b1a48dcd943f97b6cc4408c8f43aa2935543bc70 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Fri, 2 Feb 2024 11:56:57 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=8E=AF=E5=A2=83=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/api/dto/ParameterConfig.java | 4 +++- .../metersphere/api/dto/ApiParamConfig.java | 6 +++--- .../api/dto/ApiScenarioParamConfig.java | 2 +- .../ApiScenarioControllerTests.java | 2 +- .../resources/file/tcpp-sampler-env-test.jar | Bin 522092 -> 522096 bytes .../dto/environment/EnvironmentConfig.java | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/backend/framework/plugin/plugin-api-sdk/src/main/java/io/metersphere/plugin/api/dto/ParameterConfig.java b/backend/framework/plugin/plugin-api-sdk/src/main/java/io/metersphere/plugin/api/dto/ParameterConfig.java index f691b4c67e..196b7abb16 100644 --- a/backend/framework/plugin/plugin-api-sdk/src/main/java/io/metersphere/plugin/api/dto/ParameterConfig.java +++ b/backend/framework/plugin/plugin-api-sdk/src/main/java/io/metersphere/plugin/api/dto/ParameterConfig.java @@ -3,6 +3,8 @@ package io.metersphere.plugin.api.dto; import io.metersphere.plugin.api.spi.AbstractMsTestElement; import lombok.Data; +import java.util.Map; + /** * @Author: jianxing * @CreateTime: 2023-10-27 17:30 @@ -21,5 +23,5 @@ public abstract class ParameterConfig { * @param msTestElement 当前 AbstractMsTestElement 的实现类对象 * @return */ - public abstract Object getProtocolEnvConfig(AbstractMsTestElement msTestElement); + public abstract Map getProtocolEnvConfig(AbstractMsTestElement msTestElement); } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/ApiParamConfig.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/ApiParamConfig.java index 6adc6a500d..7eb8482890 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/ApiParamConfig.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/ApiParamConfig.java @@ -30,7 +30,7 @@ public class ApiParamConfig extends ParameterConfig { @Override - public Object getProtocolEnvConfig(AbstractMsTestElement msTestElement) { + public Map getProtocolEnvConfig(AbstractMsTestElement msTestElement) { return getProtocolEnvConfig(msTestElement, getEnvConfig()); } @@ -40,7 +40,7 @@ public class ApiParamConfig extends ParameterConfig { * @param envConfig 当前的环境配置信息 * @return */ - public Object getProtocolEnvConfig(AbstractMsTestElement msTestElement, + public Map getProtocolEnvConfig(AbstractMsTestElement msTestElement, EnvironmentInfoDTO envConfig) { if (envConfig == null || envConfig.getConfig() == null @@ -49,7 +49,7 @@ public class ApiParamConfig extends ParameterConfig { || testElementClassPluginIdMap.get(msTestElement.getClass()) == null) { return null; } - Map pluginConfigMap = envConfig.getConfig().getPluginConfigMap(); + Map> pluginConfigMap = envConfig.getConfig().getPluginConfigMap(); String pluginId = testElementClassPluginIdMap.get(msTestElement.getClass()); return pluginConfigMap.get(pluginId); } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/ApiScenarioParamConfig.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/ApiScenarioParamConfig.java index 3258b02ec4..cac372a29f 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/ApiScenarioParamConfig.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/ApiScenarioParamConfig.java @@ -27,7 +27,7 @@ public class ApiScenarioParamConfig extends ApiParamConfig { private Boolean grouped; @Override - public Object getProtocolEnvConfig(AbstractMsTestElement msTestElement) { + public Map getProtocolEnvConfig(AbstractMsTestElement msTestElement) { if (BooleanUtils.isTrue(grouped)) { return getProtocolEnvConfig(msTestElement, projectEnvMap.get(msTestElement.getProjectId())); } else { diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java index 2d64e92d34..797b95365e 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java @@ -680,7 +680,7 @@ public class ApiScenarioControllerTests extends BaseTest { envRequest.setProjectId(DEFAULT_PROJECT_ID); envRequest.setName("test scenario debug"); // 添加插件的环境配置,供后续测试使用 - Map pluginConfigMap = new HashMap<>(); + Map> pluginConfigMap = new HashMap<>(); pluginConfigMap.put("tcpp-sampler", new HashMap<>()); EnvironmentConfig environmentConfig = new EnvironmentConfig(); environmentConfig.setPluginConfigMap(pluginConfigMap); diff --git a/backend/services/api-test/src/test/resources/file/tcpp-sampler-env-test.jar b/backend/services/api-test/src/test/resources/file/tcpp-sampler-env-test.jar index c93c81a7334ebb5bab98a73024a58198da495e01..e34ae891c2bd22235b9186552d3b7acb218b445e 100644 GIT binary patch delta 1674 zcmZWq4LFl)7~XvH+L};uDYe-$N+t784Gm2=WpW}}`KejQ#!jbF{+7&ADjYvw2%Te1 zB}~dH`XzsLQ0SyWr08cvv!cT}-_}*9bDj6Pp6h<^`~9xxeV^yO-urtuLU=zy(DLzu z)UhZ{O-)qgHd=<33__rCdJI4n+i00%ns^n?#h9tk8ADOwFBluB99b{LkRSGXc!IG;xL|(*~5kH)L>sXc!>0)w*pTU^0;a(T&(l=wGJqhl^zJ0xwcc~;(jZbqGsuGjn` z^O{KEw=P*=QbS(9Yj1h`H2=W{Zp2gBMEqjoKl{()udFPxx}Vc>oEqJCIo@vg@y9dr ztA_R_=Alnqdhd|+49pA0gC&7=jE)Jgrs0Eq>OI`-MpJI``0MCYQXnVQgJ1N>mU4Kx z#;cVpeQ8)jcU>>AJ2{ukm$FK#%#CQAd`QJiFiT*lY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iQ9pb z=SaJ+qkrD`rI`t@DtZ+EQd^uD**WUe?Cb*@xi=8+q;dTs2HZp-2jszw?yjNEFL={ zB;WC3??2=x7MQXU;ZFC`Q~s{!XC6*6stuQ~2|Lo8*}lg>TwbrC{gGS}wIC%y*5RI? znDtq4AC-gl8#65^`lMfLy}$L2+x89jk_Th`W^xr`YnCG5?h@0F&Ii%LrZ?vN!dCpX z!WLaC?=~87flM|v6p(DdYL^L)mqtxm$h7W+9Q|``#Ex41Qn^`0bcpy~nXNe-dsT60 zY6NxisE>m@B%)w~m00JBTO{~+VYtdUa3_s#-XnPc8YDzhIf;F5OSMf_6J_{B^?2t^ zY~uMr%W--N;ls8zaEo%2$pF|N8+6uq5U0>VH%i&*;y@perKz;w0Twu>3MH_C8csPD z#7Ucg4oYPm;Q#{^TC~?)Towu%&{$>vSIMeYz}v%tw=iJ$x()`-m%7%UwdQi*JAW#p zLpI3P2K*-7_j)-5eSAj+o_5ubpnoRKOD_kX;d0|!riN|KbDmD5`=M&mN|o>_F0fNqN`u3r zz+8Bk`|TC+++DySgP>ga??~a$DX?LIGUVuMeKH9JL6vF{WQ`Q`{Sl?c&|%&bSO{0p zfezd^0`Mlvd>h;lWtk>YH3fpG-;)s*rFy~Ea^RvWi7N-j=uQ@ZCs=??`=7kvi8^a) z5f*|Nb0BEttSutgprD3o0avhrK5WAWc$Kbs)4&)N4LeN(GnF5v^poLa#5Y0yX>hQ# wo5(>XIaV8jY-jCv0=_j3JXAV=IB>{mRuVHDzC8_WVCDxfSHpZOavebb0-i#pmjD0& diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/dto/environment/EnvironmentConfig.java b/backend/services/project-management/src/main/java/io/metersphere/project/dto/environment/EnvironmentConfig.java index a06bde8f46..4fa36cca14 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/dto/environment/EnvironmentConfig.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/dto/environment/EnvironmentConfig.java @@ -38,7 +38,7 @@ public class EnvironmentConfig implements Serializable { @Schema(description = "全局断言") private MsEnvAssertionConfig assertionConfig; @Schema(description = "插件自定义的配置项,key为插件ID,value 为对应配置") - private Map pluginConfigMap; + private Map> pluginConfigMap; public EnvironmentConfig() {