feat(接口测试): dubbo BeanShell

This commit is contained in:
chenjianxing 2020-08-18 19:01:49 +08:00
parent 65a033ce3a
commit d820bf400c
5 changed files with 25 additions and 6 deletions

View File

@ -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;
}

@ -1 +1 @@
Subproject commit 8eff343619df1572e1cded52f173257ef4b518a1
Subproject commit b86032cbbda9a9e6028308aa95a887cff2192f1c

View File

@ -44,6 +44,12 @@
<el-tab-pane :label="$t('api_test.request.extract.label')" name="extract">
<ms-api-extract :is-read-only="isReadOnly" :extract="request.extract"/>
</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-form>
</template>
@ -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;
}
</style>

View File

@ -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));
}
}

@ -1 +1 @@
Subproject commit 06fc0a321a9886419be5c607ddaa6b40efb5179b
Subproject commit 7e4d80cc2b870a8cac6dbb9fe6711ab6041faf6d