提交 d820bf40 编写于 作者: C chenjianxing

feat(接口测试): dubbo BeanShell

上级 65a033ce
...@@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; ...@@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import io.metersphere.api.dto.scenario.KeyValue; import io.metersphere.api.dto.scenario.KeyValue;
import io.metersphere.api.dto.scenario.assertions.Assertions; import io.metersphere.api.dto.scenario.assertions.Assertions;
import io.metersphere.api.dto.scenario.extract.Extract; 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.ConfigCenter;
import io.metersphere.api.dto.scenario.request.dubbo.ConsumerAndService; import io.metersphere.api.dto.scenario.request.dubbo.ConsumerAndService;
import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter; import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter;
...@@ -43,4 +45,8 @@ public class DubboRequest implements Request { ...@@ -43,4 +45,8 @@ public class DubboRequest implements Request {
private Assertions assertions; private Assertions assertions;
@JSONField(ordinal = 11) @JSONField(ordinal = 11)
private Extract extract; private Extract extract;
@JSONField(ordinal = 12)
private BeanShellPreProcessor beanShellPreProcessor;
@JSONField(ordinal = 13)
private BeanShellPostProcessor beanShellPostProcessor;
} }
Subproject commit 8eff343619df1572e1cded52f173257ef4b518a1 Subproject commit b86032cbbda9a9e6028308aa95a887cff2192f1c
...@@ -44,6 +44,12 @@ ...@@ -44,6 +44,12 @@
<el-tab-pane :label="$t('api_test.request.extract.label')" name="extract"> <el-tab-pane :label="$t('api_test.request.extract.label')" name="extract">
<ms-api-extract :is-read-only="isReadOnly" :extract="request.extract"/> <ms-api-extract :is-read-only="isReadOnly" :extract="request.extract"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('api_test.request.processor.pre_exec_script')" name="beanShellPreProcessor">
<ms-bean-shell-processor :is-read-only="isReadOnly" :bean-shell-processor="request.beanShellPreProcessor"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.request.processor.post_exec_script')" name="beanShellPostProcessor">
<ms-bean-shell-processor :is-read-only="isReadOnly" :bean-shell-processor="request.beanShellPostProcessor"/>
</el-tab-pane>
</el-tabs> </el-tabs>
</el-form> </el-form>
</template> </template>
...@@ -59,10 +65,12 @@ ...@@ -59,10 +65,12 @@
import MsDubboRegistryCenter from "@/business/components/api/test/components/request/dubbo/RegistryCenter"; import MsDubboRegistryCenter from "@/business/components/api/test/components/request/dubbo/RegistryCenter";
import MsDubboConfigCenter from "@/business/components/api/test/components/request/dubbo/ConfigCenter"; import MsDubboConfigCenter from "@/business/components/api/test/components/request/dubbo/ConfigCenter";
import MsDubboConsumerService from "@/business/components/api/test/components/request/dubbo/ConsumerAndService"; import MsDubboConsumerService from "@/business/components/api/test/components/request/dubbo/ConsumerAndService";
import MsBeanShellProcessor from "../processor/BeanShellProcessor";
export default { export default {
name: "MsApiDubboRequestForm", name: "MsApiDubboRequestForm",
components: { components: {
MsBeanShellProcessor,
MsDubboConsumerService, MsDubboConsumerService,
MsDubboConfigCenter, MsDubboConfigCenter,
MsDubboRegistryCenter, MsDubboRegistryCenter,
...@@ -134,4 +142,6 @@ ...@@ -134,4 +142,6 @@
color: #F56C6C; color: #F56C6C;
} }
</style> </style>
...@@ -381,6 +381,8 @@ export class DubboRequest extends Request { ...@@ -381,6 +381,8 @@ export class DubboRequest extends Request {
// Scenario.dubboConfig // Scenario.dubboConfig
this.dubboConfig = undefined; this.dubboConfig = undefined;
this.debugReport = undefined; this.debugReport = undefined;
this.beanShellPreProcessor = new BeanShellProcessor(options.beanShellPreProcessor);
this.beanShellPostProcessor = new BeanShellProcessor(options.beanShellPostProcessor);
this.sets({args: KeyValue, attachmentArgs: KeyValue}, options); this.sets({args: KeyValue, attachmentArgs: KeyValue}, options);
} }
...@@ -831,9 +833,10 @@ class JMXGenerator { ...@@ -831,9 +833,10 @@ class JMXGenerator {
} else { } else {
this.addRequestBody(sampler, request); this.addRequestBody(sampler, request);
} }
this.addBeanShellProcessor(sampler, request);
} }
this.addBeanShellProcessor(sampler, request);
this.addRequestAssertion(sampler, request); this.addRequestAssertion(sampler, request);
this.addRequestExtractor(sampler, request); this.addRequestExtractor(sampler, request);
...@@ -900,13 +903,13 @@ class JMXGenerator { ...@@ -900,13 +903,13 @@ class JMXGenerator {
} }
} }
addBeanShellProcessor(httpSamplerProxy, request) { addBeanShellProcessor(sampler, request) {
let name = request.name; let name = request.name;
if (request.beanShellPreProcessor && request.beanShellPreProcessor.script) { 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) { if (request.beanShellPostProcessor && request.beanShellPostProcessor.script) {
httpSamplerProxy.put(new BeanShellPostProcessor(name, request.beanShellPostProcessor)); sampler.put(new BeanShellPostProcessor(name, request.beanShellPostProcessor));
} }
} }
......
Subproject commit 06fc0a321a9886419be5c607ddaa6b40efb5179b Subproject commit 7e4d80cc2b870a8cac6dbb9fe6711ab6041faf6d
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册