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()); samplerHashTree.add(tcpConfig());
tree.set(tcpSampler(config), samplerHashTree); tree.set(tcpSampler(config), samplerHashTree);
setUserParameters(samplerHashTree); setUserParameters(samplerHashTree);
samplerHashTree.add(tcpPreProcessor.getJSR223PreProcessor()); if (tcpPreProcessor != null) {
samplerHashTree.add(tcpPreProcessor.getJSR223PreProcessor());
}
if (CollectionUtils.isNotEmpty(hashTree)) { if (CollectionUtils.isNotEmpty(hashTree)) {
hashTree.forEach(el -> { hashTree.forEach(el -> {
el.toHashTree(samplerHashTree, el.getHashTree(), config); el.toHashTree(samplerHashTree, el.getHashTree(), config);

View File

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

View File

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

View File

@ -50,6 +50,10 @@ public class JmeterFileService {
} }
private void setThreadNum(LoadTestWithBLOBs t, Integer limit) { private void setThreadNum(LoadTestWithBLOBs t, Integer limit) {
// 传入limit才去改这个值
if (limit <= 0) {
return;
}
String loadConfiguration = t.getLoadConfiguration(); String loadConfiguration = t.getLoadConfiguration();
JSONArray jsonArray = JSON.parseArray(loadConfiguration); JSONArray jsonArray = JSON.parseArray(loadConfiguration);
for (int i = 0; i < jsonArray.size(); i++) { 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 io.metersphere.i18n.Translator;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -39,29 +40,16 @@ public class NodeResourcePoolService {
} }
deleteTestResource(testResourcePool.getId()); deleteTestResource(testResourcePool.getId());
List<String> nodeIps = testResourcePool.getResources().stream() List<ImmutablePair> Ip_Port = testResourcePool.getResources().stream()
.map(resource -> { .map(resource -> {
NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class); NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class);
return nodeDTO.getIp(); return new ImmutablePair(nodeDTO.getIp(), nodeDTO.getPort());
}) })
.distinct() .distinct()
.collect(Collectors.toList()); .collect(Collectors.toList());
List<Integer> nodePorts = testResourcePool.getResources().stream() if (Ip_Port.size() < testResourcePool.getResources().size()) {
.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()) {
MSException.throwException(Translator.get("duplicate_node_ip_port")); 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()); testResourcePool.setStatus(VALID.name());
boolean isValid = true; boolean isValid = true;
for (TestResource resource : testResourcePool.getResources()) { for (TestResource resource : testResourcePool.getResources()) {

View File

@ -50,7 +50,7 @@ public class TestPlanController {
QueryTestPlanRequest request = new QueryTestPlanRequest(); QueryTestPlanRequest request = new QueryTestPlanRequest();
request.setWorkspaceId(workspaceId); request.setWorkspaceId(workspaceId);
request.setProjectId(projectId); request.setProjectId(projectId);
return testPlanService.listTestPlan(request); return testPlanService.listTestPlanByProject(request);
} }
@PostMapping("/list/all") @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"> <el-tab-pane v-if="activeName == 'body'" :disabled="true" name="mode" class="pane assertions">
<template v-slot:label> <template v-slot:label>
<ms-dropdown v-if="!isSqlType" :commands="modes" :default-command="mode" @command="modeChange"/> <ms-dropdown v-if="request.method==='SQL'" :commands="sqlModes" :default-command="mode" @command="sqlModeChange"/>
<ms-dropdown v-if="isSqlType" :commands="sqlModes" :default-command="mode" @command="sqlModeChange"/> <ms-dropdown v-else :commands="modes" :default-command="mode" @command="modeChange" ref="modeDropdown"/>
</template> </template>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@ -110,7 +110,7 @@
computed: { computed: {
isSqlType() { 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> <el-collapse-transition>
<div v-if="data.active && showCollapse" :draggable="draggable"> <div v-if="data.active && showCollapse" :draggable="draggable">
<el-divider></el-divider> <fieldset :disabled="data.disabled" style="border: 0px">
<slot></slot> <el-divider></el-divider>
<slot></slot>
</fieldset>
</div> </div>
</el-collapse-transition> </el-collapse-transition>
</el-card> </el-card>

View File

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

View File

@ -6,6 +6,7 @@
:data="scenario" :data="scenario"
:show-collapse="false" :show-collapse="false"
:is-show-name-input="!isDeletedOrRef" :is-show-name-input="!isDeletedOrRef"
:is-disabled="true"
color="#606266" color="#606266"
background-color="#F4F4F5" background-color="#F4F4F5"
:title="$t('api_test.automation.scenario_import')"> :title="$t('api_test.automation.scenario_import')">
@ -45,6 +46,10 @@
if (response.data.scenarioDefinition) { if (response.data.scenarioDefinition) {
this.scenario.hashTree = JSON.parse(response.data.scenarioDefinition).hashTree; 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.scenario.name = response.data.name;
this.$emit('refReload'); this.$emit('refReload');
} else { } else {
@ -85,6 +90,22 @@
this.loading = false 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> </script>

View File

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

View File

@ -95,7 +95,7 @@
<!-- HTTP 请求返回数据 --> <!-- HTTP 请求返回数据 -->
<p class="tip">{{$t('api_test.definition.request.res_param')}}</p> <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"/> <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-form :model="formData" :rules="rules" label-width="100px" v-loading="result.loading" ref="form">
<el-row> <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-col :span="11">
<el-form-item :label="$t('commons.import_module')" <el-form-item :label="$t('commons.import_module')">
v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)">
<el-select size="small" v-model="formData.moduleId" class="project-select" clearable> <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-option v-for="item in moduleOptions" :key="item.id" :label="item.path" :value="item.id"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('commons.import_mode')" <el-form-item :label="$t('commons.import_mode')">
v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)">
<el-select size="small" v-model="formData.modeId" class="project-select" clearable> <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-option v-for="item in modeOptions" :key="item.id" :label="item.name" :value="item.id"/>
</el-select> </el-select>
@ -43,7 +37,16 @@
:active-text="$t('api_test.api_import.swagger_url_import')"> :active-text="$t('api_test.api_import.swagger_url_import')">
</el-switch> </el-switch>
</el-form-item> </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 <el-switch
v-model="swaggerSynchronization" v-model="swaggerSynchronization"
@click.native="scheduleEdit" @click.native="scheduleEdit"
@ -51,10 +54,6 @@
</el-switch> </el-switch>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="1"
v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)">
<el-divider direction="vertical"/>
</el-col>
<el-col :span="12" <el-col :span="12"
v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)"> v-if="selectedPlatformValue != 'Swagger2' || (selectedPlatformValue == 'Swagger2' && !swaggerUrlEable)">
<el-upload <el-upload

View File

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

View File

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

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