Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2021-01-26 20:22:04 +08:00
commit 0e2ee19237
17 changed files with 65 additions and 45 deletions

View File

@ -82,7 +82,9 @@ public class MsTCPSampler extends MsTestElement {
samplerHashTree.add(tcpConfig());
tree.set(tcpSampler(config), samplerHashTree);
setUserParameters(samplerHashTree);
samplerHashTree.add(tcpPreProcessor.getJSR223PreProcessor());
if (tcpPreProcessor != null) {
samplerHashTree.add(tcpPreProcessor.getJSR223PreProcessor());
}
if (CollectionUtils.isNotEmpty(hashTree)) {
hashTree.forEach(el -> {
el.toHashTree(samplerHashTree, el.getHashTree(), config);

View File

@ -356,6 +356,8 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
return protocol.toUpperCase();
}
return RequestType.DUBBO;
} else if (StringUtils.contains(result.getResponseHeaders(), "url:jdbc")) {
return "SQL";
} else {
// Http Method
String method = StringUtils.substringBefore(body, " ");

View File

@ -95,7 +95,7 @@ public class DockerTestEngine extends AbstractEngine {
env.put("BOOTSTRAP_SERVERS", kafkaProperties.getBootstrapServers());
env.put("LOG_TOPIC", kafkaProperties.getLog().getTopic());
env.put("RESOURCE_ID", resource.getId());
env.put("THREAD_NUM", "" + threadNum);
env.put("THREAD_NUM", "0");// 传入0表示不用修改线程数
env.put("HEAP", jmeterProperties.getHeap());

View File

@ -50,6 +50,10 @@ public class JmeterFileService {
}
private void setThreadNum(LoadTestWithBLOBs t, Integer limit) {
// 传入limit才去改这个值
if (limit <= 0) {
return;
}
String loadConfiguration = t.getLoadConfiguration();
JSONArray jsonArray = JSON.parseArray(loadConfiguration);
for (int i = 0; i < jsonArray.size(); i++) {

View File

@ -12,6 +12,7 @@ import io.metersphere.dto.TestResourcePoolDTO;
import io.metersphere.i18n.Translator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
@ -39,29 +40,16 @@ public class NodeResourcePoolService {
}
deleteTestResource(testResourcePool.getId());
List<String> nodeIps = testResourcePool.getResources().stream()
List<ImmutablePair> Ip_Port = testResourcePool.getResources().stream()
.map(resource -> {
NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class);
return nodeDTO.getIp();
return new ImmutablePair(nodeDTO.getIp(), nodeDTO.getPort());
})
.distinct()
.collect(Collectors.toList());
List<Integer> nodePorts = testResourcePool.getResources().stream()
.map(resource -> {
NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class);
return nodeDTO.getPort();
})
.distinct()
.collect(Collectors.toList());
if (nodeIps.size() < testResourcePool.getResources().size() && nodePorts.size() < testResourcePool.getResources().size()) {
if (Ip_Port.size() < testResourcePool.getResources().size()) {
MSException.throwException(Translator.get("duplicate_node_ip_port"));
}
else if (nodeIps.size() < testResourcePool.getResources().size()) {
MSException.throwException(Translator.get("duplicate_node_ip"));
}
else if (nodePorts.size() < testResourcePool.getResources().size()) {
MSException.throwException(Translator.get("duplicate_node_port"));
}
testResourcePool.setStatus(VALID.name());
boolean isValid = true;
for (TestResource resource : testResourcePool.getResources()) {

View File

@ -50,7 +50,7 @@ public class TestPlanController {
QueryTestPlanRequest request = new QueryTestPlanRequest();
request.setWorkspaceId(workspaceId);
request.setProjectId(projectId);
return testPlanService.listTestPlan(request);
return testPlanService.listTestPlanByProject(request);
}
@PostMapping("/list/all")

@ -1 +1 @@
Subproject commit ed891ee7503cc1ca4679b4779a5c12e2ffee986d
Subproject commit 792ace0c68d2b4ff42a74d8e6df32ca7f290ca1c

View File

@ -45,8 +45,8 @@
<el-tab-pane v-if="activeName == 'body'" :disabled="true" name="mode" class="pane assertions">
<template v-slot:label>
<ms-dropdown v-if="!isSqlType" :commands="modes" :default-command="mode" @command="modeChange"/>
<ms-dropdown v-if="isSqlType" :commands="sqlModes" :default-command="mode" @command="sqlModeChange"/>
<ms-dropdown v-if="request.method==='SQL'" :commands="sqlModes" :default-command="mode" @command="sqlModeChange"/>
<ms-dropdown v-else :commands="modes" :default-command="mode" @command="modeChange" ref="modeDropdown"/>
</template>
</el-tab-pane>
</el-tabs>
@ -110,7 +110,7 @@
computed: {
isSqlType() {
return (this.requestType === RequestFactory.TYPES.SQL && this.response.responseCode === '200');
return ((this.requestType === RequestFactory.TYPES.SQL || this.request.method === RequestFactory.TYPES.SQL) && this.response.responseCode === '200'&& this.mode === 'table');
}
}
}

View File

@ -40,8 +40,10 @@
<el-collapse-transition>
<div v-if="data.active && showCollapse" :draggable="draggable">
<el-divider></el-divider>
<slot></slot>
<fieldset :disabled="data.disabled" style="border: 0px">
<el-divider></el-divider>
<slot></slot>
</fieldset>
</div>
</el-collapse-transition>
</el-card>

View File

@ -190,6 +190,7 @@
}
this.request.requestResult = requestResult;
this.request.id = response.data.id;
this.request.disabled = true;
this.reload();
this.sort();
} else {
@ -200,6 +201,7 @@
},
recursiveSorting(arr) {
for (let i in arr) {
arr[i].disabled = true;
arr[i].index = Number(i) + 1;
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.recursiveSorting(arr[i].hashTree);
@ -208,6 +210,7 @@
},
sort() {
for (let i in this.request.hashTree) {
this.request.hashTree[i].disabled = true;
this.request.hashTree[i].index = Number(i) + 1;
if (this.request.hashTree[i].hashTree != undefined && this.request.hashTree[i].hashTree.length > 0) {
this.recursiveSorting(this.request.hashTree[i].hashTree);

View File

@ -6,6 +6,7 @@
:data="scenario"
:show-collapse="false"
:is-show-name-input="!isDeletedOrRef"
:is-disabled="true"
color="#606266"
background-color="#F4F4F5"
:title="$t('api_test.automation.scenario_import')">
@ -45,6 +46,10 @@
if (response.data.scenarioDefinition) {
this.scenario.hashTree = JSON.parse(response.data.scenarioDefinition).hashTree;
}
if (this.scenario.hashTree) {
this.setDisabled(this.scenario.hashTree);
}
this.scenario.disabled = true;
this.scenario.name = response.data.name;
this.$emit('refReload');
} else {
@ -85,6 +90,22 @@
this.loading = false
})
},
recursive(arr) {
for (let i in arr) {
arr[i].disabled = true;
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.recursive(arr[i].hashTree);
}
}
},
setDisabled(scenarioDefinition) {
for (let i in scenarioDefinition) {
scenarioDefinition[i].disabled = true;
if (scenarioDefinition[i].hashTree != undefined && scenarioDefinition[i].hashTree.length > 0) {
this.recursive(scenarioDefinition[i].hashTree);
}
}
},
}
}
</script>

View File

@ -222,7 +222,6 @@
}
if (this.$refs.apiConfig) {
this.$refs.apiConfig.forEach(item => {
console.log(item);
item.removeListener();
}); // tab ctrl + s
let tabs = this.apiTabs;

View File

@ -95,7 +95,7 @@
<!-- HTTP 请求返回数据 -->
<p class="tip">{{$t('api_test.definition.request.res_param')}}</p>
<api-response-component :api-item="apiCase"/>
<api-response-component :currentProtocol="apiCase.request.protocol" :api-item="apiCase"/>
<ms-jmx-step :request="apiCase.request" :response="apiCase.responseData"/>
<!-- 保存操作 -->

View File

@ -20,19 +20,13 @@
<el-form :model="formData" :rules="rules" label-width="100px" v-loading="result.loading" ref="form">
<el-row>
<el-form-item :label="'Swagger URL'" prop="swaggerUrl" v-if="isSwagger2 && swaggerUrlEable" class="swagger-url">
<el-input size="small" v-model="formData.swaggerUrl" clearable show-word-limit/>
</el-form-item>
<el-col :span="11">
<el-form-item :label="$t('commons.import_module')"
v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)">
<el-form-item :label="$t('commons.import_module')">
<el-select size="small" v-model="formData.moduleId" class="project-select" clearable>
<el-option v-for="item in moduleOptions" :key="item.id" :label="item.path" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('commons.import_mode')"
v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)">
<el-form-item :label="$t('commons.import_mode')">
<el-select size="small" v-model="formData.modeId" class="project-select" clearable>
<el-option v-for="item in modeOptions" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
@ -43,7 +37,16 @@
:active-text="$t('api_test.api_import.swagger_url_import')">
</el-switch>
</el-form-item>
<el-form-item v-show="isSwagger2 && swaggerUrlEable">
</el-col>
<el-col :span="1">
<el-divider direction="vertical"/>
</el-col>
<el-col :span="12" v-show="isSwagger2 && swaggerUrlEable" style="margin-top: 40px">
<el-form-item :label="'Swagger URL'" prop="swaggerUrl" class="swagger-url">
<el-input size="small" v-model="formData.swaggerUrl" clearable show-word-limit/>
</el-form-item>
<el-form-item>
<el-switch
v-model="swaggerSynchronization"
@click.native="scheduleEdit"
@ -51,10 +54,6 @@
</el-switch>
</el-form-item>
</el-col>
<el-col :span="1"
v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)">
<el-divider direction="vertical"/>
</el-col>
<el-col :span="12"
v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)">
<el-upload

View File

@ -1,7 +1,6 @@
import Vue from "vue";
import VueRouter from 'vue-router'
import RouterSidebar from "./RouterSidebar";
import axios from "axios";
import Setting from "@/business/components/settings/router";
import API from "@/business/components/api/router";
import Performance from "@/business/components/performance/router";
@ -31,8 +30,8 @@ router.beforeEach((to, from, next) => {
//解决localStorage清空cookie没失效导致的卡死问题
if (!localStorage.getItem('Admin-Token')) {
axios.get("/signout");
console.log("signout");
// axios.get("/signout");
// console.log("signout");
localStorage.setItem('Admin-Token', "{}");
window.location.href = "/login";
next();

View File

@ -104,7 +104,8 @@
search() {
this.selectRows = new Set();
this.loading = true;
this.condition.filters = ["Prepare", "Underway", "Completed"];
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
this.condition.moduleIds = this.selectNodeIds;

@ -1 +1 @@
Subproject commit 6d6ed5226849337876ecf55312aa6b5f13ba6472
Subproject commit 416645a24d941eb9727c07c19be70422c2e66cc7