fix(接口测试): 设置环境变量参数时允许设置为空

设置环境变量参数时允许设置为空
This commit is contained in:
song-tianyang 2022-03-07 13:12:48 +08:00 committed by fit2-zhao
parent 9f4eb2a1fa
commit cd41d140e1
1 changed files with 25 additions and 27 deletions

View File

@ -128,7 +128,6 @@ public class ApiEnvironmentRunningParamService {
for (String env : envStringArr) { for (String env : envStringArr) {
if (StringUtils.contains(env, "=")) { if (StringUtils.contains(env, "=")) {
String[] envItem = env.split("="); String[] envItem = env.split("=");
if (envItem.length > 1) {
String jmeterVarKey = envItem[0]; String jmeterVarKey = envItem[0];
if (this.checkValidity(jmeterVarKey, "MS.ENV.")) { if (this.checkValidity(jmeterVarKey, "MS.ENV.")) {
String[] envAndKeyArr = jmeterVarKey.substring("MS.ENV.".length()).split("\\."); String[] envAndKeyArr = jmeterVarKey.substring("MS.ENV.".length()).split("\\.");
@ -136,7 +135,7 @@ public class ApiEnvironmentRunningParamService {
String[] keyArr = ArrayUtils.remove(envAndKeyArr, 0); String[] keyArr = ArrayUtils.remove(envAndKeyArr, 0);
String key = StringUtils.join(keyArr, "."); String key = StringUtils.join(keyArr, ".");
String value = StringUtils.substring(env, jmeterVarKey.length() + 1); String value = StringUtils.substring(env, jmeterVarKey.length() + 1);
if (StringUtils.isNoneEmpty(envId, key, value)) { if (StringUtils.isNoneEmpty(envId, key)) {
if (envVarsMap.containsKey(envId)) { if (envVarsMap.containsKey(envId)) {
envVarsMap.get(envId).put(key, value); envVarsMap.get(envId).put(key, value);
} else { } else {
@ -148,7 +147,6 @@ public class ApiEnvironmentRunningParamService {
} }
} }
} }
}
if (MapUtils.isNotEmpty(envVarsMap)) { if (MapUtils.isNotEmpty(envVarsMap)) {
for (Map.Entry<String, Map<String, String>> entry : envVarsMap.entrySet()) { for (Map.Entry<String, Map<String, String>> entry : envVarsMap.entrySet()) {