From d820bf400c2eb2207aa4111fb24b3300faf3063a Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 18 Aug 2020 19:01:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20d?= =?UTF-8?q?ubbo=20BeanShell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/scenario/request/DubboRequest.java | 6 ++++++ backend/src/main/java/io/metersphere/xpack | 2 +- .../test/components/request/ApiDubboRequestForm.vue | 10 ++++++++++ .../components/api/test/model/ScenarioModel.js | 11 +++++++---- frontend/src/business/components/xpack | 2 +- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/request/DubboRequest.java b/backend/src/main/java/io/metersphere/api/dto/scenario/request/DubboRequest.java index 8aa161c334..c8202d07b6 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/request/DubboRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/request/DubboRequest.java @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.metersphere.api.dto.scenario.KeyValue; import io.metersphere.api.dto.scenario.assertions.Assertions; import io.metersphere.api.dto.scenario.extract.Extract; +import io.metersphere.api.dto.scenario.processor.BeanShellPostProcessor; +import io.metersphere.api.dto.scenario.processor.BeanShellPreProcessor; import io.metersphere.api.dto.scenario.request.dubbo.ConfigCenter; import io.metersphere.api.dto.scenario.request.dubbo.ConsumerAndService; import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter; @@ -43,4 +45,8 @@ public class DubboRequest implements Request { private Assertions assertions; @JSONField(ordinal = 11) private Extract extract; + @JSONField(ordinal = 12) + private BeanShellPreProcessor beanShellPreProcessor; + @JSONField(ordinal = 13) + private BeanShellPostProcessor beanShellPostProcessor; } diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index 8eff343619..b86032cbbd 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit 8eff343619df1572e1cded52f173257ef4b518a1 +Subproject commit b86032cbbda9a9e6028308aa95a887cff2192f1c diff --git a/frontend/src/business/components/api/test/components/request/ApiDubboRequestForm.vue b/frontend/src/business/components/api/test/components/request/ApiDubboRequestForm.vue index f550fea856..167b68f6d2 100644 --- a/frontend/src/business/components/api/test/components/request/ApiDubboRequestForm.vue +++ b/frontend/src/business/components/api/test/components/request/ApiDubboRequestForm.vue @@ -44,6 +44,12 @@ + + + + + + @@ -59,10 +65,12 @@ import MsDubboRegistryCenter from "@/business/components/api/test/components/request/dubbo/RegistryCenter"; import MsDubboConfigCenter from "@/business/components/api/test/components/request/dubbo/ConfigCenter"; import MsDubboConsumerService from "@/business/components/api/test/components/request/dubbo/ConsumerAndService"; + import MsBeanShellProcessor from "../processor/BeanShellProcessor"; export default { name: "MsApiDubboRequestForm", components: { + MsBeanShellProcessor, MsDubboConsumerService, MsDubboConfigCenter, MsDubboRegistryCenter, @@ -134,4 +142,6 @@ color: #F56C6C; } + + diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js index a2f261f2a8..22ddb31906 100644 --- a/frontend/src/business/components/api/test/model/ScenarioModel.js +++ b/frontend/src/business/components/api/test/model/ScenarioModel.js @@ -381,6 +381,8 @@ export class DubboRequest extends Request { // Scenario.dubboConfig this.dubboConfig = undefined; this.debugReport = undefined; + this.beanShellPreProcessor = new BeanShellProcessor(options.beanShellPreProcessor); + this.beanShellPostProcessor = new BeanShellProcessor(options.beanShellPostProcessor); this.sets({args: KeyValue, attachmentArgs: KeyValue}, options); } @@ -831,9 +833,10 @@ class JMXGenerator { } else { this.addRequestBody(sampler, request); } - this.addBeanShellProcessor(sampler, request); } + this.addBeanShellProcessor(sampler, request); + this.addRequestAssertion(sampler, request); this.addRequestExtractor(sampler, request); @@ -900,13 +903,13 @@ class JMXGenerator { } } - addBeanShellProcessor(httpSamplerProxy, request) { + addBeanShellProcessor(sampler, request) { let name = request.name; if (request.beanShellPreProcessor && request.beanShellPreProcessor.script) { - httpSamplerProxy.put(new BeanShellPreProcessor(name, request.beanShellPreProcessor)); + sampler.put(new BeanShellPreProcessor(name, request.beanShellPreProcessor)); } if (request.beanShellPostProcessor && request.beanShellPostProcessor.script) { - httpSamplerProxy.put(new BeanShellPostProcessor(name, request.beanShellPostProcessor)); + sampler.put(new BeanShellPostProcessor(name, request.beanShellPostProcessor)); } } diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index 06fc0a321a..7e4d80cc2b 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit 06fc0a321a9886419be5c607ddaa6b40efb5179b +Subproject commit 7e4d80cc2b870a8cac6dbb9fe6711ab6041faf6d