fix(场景自动化) 增加数组数据处理
This commit is contained in:
parent
4931c7816b
commit
8b50869490
|
@ -274,6 +274,25 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
addCertificate(config, httpSamplerTree);
|
||||
|
||||
//增加全局前后至脚本
|
||||
if (httpConfig != null) {
|
||||
this.setScript(httpConfig, httpSamplerTree, config);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
for (MsTestElement el : hashTree) {
|
||||
if (el.getEnvironmentId() == null) {
|
||||
if (this.getEnvironmentId() == null) {
|
||||
el.setEnvironmentId(useEnvironment);
|
||||
} else {
|
||||
el.setEnvironmentId(this.getEnvironmentId());
|
||||
}
|
||||
}
|
||||
el.toHashTree(httpSamplerTree, el.getHashTree(), config);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setScript(HttpConfig httpConfig, HashTree httpSamplerTree, ParameterConfig config) {
|
||||
MsJSR223PreProcessor preProcessor = httpConfig.getPreProcessor();
|
||||
MsJSR223PostProcessor postProcessor = httpConfig.getPostProcessor();
|
||||
if (preProcessor != null) {
|
||||
|
@ -296,19 +315,6 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
}
|
||||
postProcessor.toHashTree(httpSamplerTree, postProcessor.getHashTree(), config);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
for (MsTestElement el : hashTree) {
|
||||
if (el.getEnvironmentId() == null) {
|
||||
if (this.getEnvironmentId() == null) {
|
||||
el.setEnvironmentId(useEnvironment);
|
||||
} else {
|
||||
el.setEnvironmentId(this.getEnvironmentId());
|
||||
}
|
||||
}
|
||||
el.toHashTree(httpSamplerTree, el.getHashTree(), config);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initConnectAndResponseTimeout(ParameterConfig config) {
|
||||
|
@ -348,7 +354,8 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
if (jsonArray.size() > 0) {
|
||||
this.authManager = jsonArray.getJSONObject(0).toJavaObject(MsAuthManager.class);
|
||||
}
|
||||
}catch (Exception e){}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(useEvnId) && !StringUtils.equals(useEvnId, this.getEnvironmentId())) {
|
||||
this.setEnvironmentId(useEvnId);
|
||||
|
|
|
@ -63,19 +63,29 @@ public class HttpConfig {
|
|||
}
|
||||
}
|
||||
|
||||
public HttpConfig getModuleCondition(String moduleId, HttpConfigCondition configCondition) {
|
||||
List<String> moduleIds = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(configCondition.getDetails())) {
|
||||
if (CollectionUtils.isEmpty(configCondition.getModuleIds())) {
|
||||
for (KeyValue keyValue : configCondition.getDetails()) {
|
||||
getAllChild(keyValue.getValue(), moduleIds);
|
||||
}
|
||||
configCondition.setModuleIds(moduleIds);
|
||||
} else {
|
||||
moduleIds = configCondition.getModuleIds();
|
||||
}
|
||||
// public HttpConfig getModuleCondition(String moduleId, HttpConfigCondition configCondition) {
|
||||
// List<String> moduleIds = new ArrayList<>();
|
||||
// if (CollectionUtils.isNotEmpty(configCondition.getDetails())) {
|
||||
// if (CollectionUtils.isEmpty(configCondition.getModuleIds())) {
|
||||
// for (KeyValue keyValue : configCondition.getDetails()) {
|
||||
// getAllChild(keyValue.getValue(), moduleIds);
|
||||
// }
|
||||
// configCondition.setModuleIds(moduleIds);
|
||||
// } else {
|
||||
// moduleIds = configCondition.getModuleIds();
|
||||
// }
|
||||
//
|
||||
// if (moduleIds.contains(moduleId)) {
|
||||
// return initHttpConfig(configCondition);
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
if (moduleIds.contains(moduleId)) {
|
||||
public HttpConfig getModuleCondition(String moduleId, HttpConfigCondition configCondition) {
|
||||
if (CollectionUtils.isNotEmpty(configCondition.getDetails())) {
|
||||
List<KeyValue> details = configCondition.getDetails().stream().filter(detail -> StringUtils.contains(detail.getValue(), moduleId)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(details)) {
|
||||
return initHttpConfig(configCondition);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6e2b1d3d7d79f985e6edf81eb593670b8da87465
|
||||
Subproject commit a6a66f87a57346cdd7da22086bac5e82a7e47bdb
|
|
@ -99,6 +99,7 @@
|
|||
import ApiDefinitionStepButton from "../components/ApiDefinitionStepButton";
|
||||
import {hasPermission} from '@/common/js/utils';
|
||||
import Convert from "@/business/components/common/json-schema/convert/convert";
|
||||
|
||||
export default {
|
||||
name: "MsApiHttpRequestForm",
|
||||
components: {
|
||||
|
@ -209,19 +210,22 @@
|
|||
let index = this.request.hashTree.indexOf(row);
|
||||
this.request.hashTree.splice(index, 1);
|
||||
this.reload();
|
||||
},
|
||||
}
|
||||
,
|
||||
copyRow(row) {
|
||||
let obj = JSON.parse(JSON.stringify(row));
|
||||
obj.id = getUUID();
|
||||
this.request.hashTree.push(obj);
|
||||
this.reload();
|
||||
},
|
||||
}
|
||||
,
|
||||
reload() {
|
||||
this.isReloadData = true
|
||||
this.$nextTick(() => {
|
||||
this.isReloadData = false
|
||||
})
|
||||
},
|
||||
}
|
||||
,
|
||||
init() {
|
||||
if (!this.request.body) {
|
||||
this.request.body = new Body();
|
||||
|
@ -235,17 +239,20 @@
|
|||
if (!this.request.arguments) {
|
||||
this.request.arguments = [];
|
||||
}
|
||||
},
|
||||
}
|
||||
,
|
||||
// 解决修改请求头后 body 显示错位
|
||||
reloadBody() {
|
||||
this.isBodyShow = false;
|
||||
this.$nextTick(() => {
|
||||
this.isBodyShow = true;
|
||||
});
|
||||
},
|
||||
}
|
||||
,
|
||||
batchAdd() {
|
||||
this.$refs.batchAddParameter.open();
|
||||
},
|
||||
}
|
||||
,
|
||||
format(array, obj) {
|
||||
if (array) {
|
||||
let isAdd = true;
|
||||
|
@ -260,7 +267,8 @@
|
|||
this.request.arguments.unshift(obj);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
,
|
||||
batchSave(data) {
|
||||
if (data) {
|
||||
let params = data.split("\n");
|
||||
|
@ -311,16 +319,19 @@
|
|||
height: 18px;
|
||||
border-radius: 42%;
|
||||
}
|
||||
|
||||
.ms-header {
|
||||
background: #783887;
|
||||
color: white;
|
||||
height: 18px;
|
||||
border-radius: 42%;
|
||||
}
|
||||
|
||||
.request-tabs {
|
||||
margin: 20px;
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
.ms-el-link {
|
||||
float: right;
|
||||
margin-right: 45px;
|
||||
|
|
Loading…
Reference in New Issue