diff --git a/backend/pom.xml b/backend/pom.xml index cf3edac98c..0d10a92f60 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -137,7 +137,7 @@ com.alibaba fastjson - 1.2.72 + 1.2.80 diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/parse/ApiScenarioImportUtil.java b/backend/src/main/java/io/metersphere/api/dto/automation/parse/ApiScenarioImportUtil.java index 53b5467e23..745dea0eb4 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/parse/ApiScenarioImportUtil.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/parse/ApiScenarioImportUtil.java @@ -3,6 +3,7 @@ package io.metersphere.api.dto.automation.parse; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import io.metersphere.api.dto.automation.ApiScenarioModuleDTO; import io.metersphere.api.dto.definition.ApiDefinitionResult; import io.metersphere.api.dto.definition.parse.ms.NodeTree; @@ -13,7 +14,10 @@ import io.metersphere.api.parse.ApiImportAbstractParser; import io.metersphere.api.service.ApiDefinitionService; import io.metersphere.api.service.ApiScenarioModuleService; import io.metersphere.api.service.ApiTestCaseService; -import io.metersphere.base.domain.*; +import io.metersphere.base.domain.ApiDefinition; +import io.metersphere.base.domain.ApiDefinitionExample; +import io.metersphere.base.domain.ApiScenarioModule; +import io.metersphere.base.domain.ApiTestCaseWithBLOBs; import io.metersphere.base.mapper.ApiDefinitionMapper; import io.metersphere.base.mapper.ApiTestCaseMapper; import io.metersphere.commons.constants.APITestStatus; @@ -22,7 +26,6 @@ import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.service.CheckPermissionService; import org.apache.commons.collections.CollectionUtils; - import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; @@ -208,7 +211,7 @@ public class ApiScenarioImportUtil { object.put("projectId", projectId); object.put("useEnvironment",""); object.put("url",""); - JSONObject objectNew = JSONObject.parseObject(object.toJSONString()); + JSONObject objectNew = JSONObject.parseObject(object.toJSONString(), Feature.DisableSpecialKeyDetect); objectNew.remove("refType"); objectNew.remove("referenced"); test.setRequest(objectNew.toJSONString()); @@ -249,7 +252,7 @@ public class ApiScenarioImportUtil { object.put("resourceId", apiTestCase.getId()); object.put("projectId", projectId); object.put("useEnvironment",""); - JSONObject objectNew = JSONObject.parseObject(object.toJSONString()); + JSONObject objectNew = JSONObject.parseObject(object.toJSONString(),Feature.DisableSpecialKeyDetect); objectNew.remove("refType"); objectNew.remove("referenced"); apiTestCase.setRequest(objectNew.toJSONString()); diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsScenarioParser.java b/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsScenarioParser.java index f0ee0f0899..bd7be133f0 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsScenarioParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsScenarioParser.java @@ -61,7 +61,7 @@ public class MsScenarioParser extends MsAbstractParser { } private ScenarioImport parseMsFormat(String testStr, ApiTestImportRequest importRequest) { - ScenarioImport scenarioImport = JSON.parseObject(testStr, ScenarioImport.class); + ScenarioImport scenarioImport = JSON.parseObject(testStr, ScenarioImport.class,Feature.DisableSpecialKeyDetect); List data = scenarioImport.getData(); Set moduleIdSet = scenarioImport.getData().stream() diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/MsDefinitionParser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/MsDefinitionParser.java index cc89221985..28c136f386 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/MsDefinitionParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/MsDefinitionParser.java @@ -72,7 +72,7 @@ public class MsDefinitionParser extends MsAbstractParser { } private ApiDefinitionImport parseMsFormat(String testStr, ApiTestImportRequest importRequest) { - ApiDefinitionImport apiDefinitionImport = JSON.parseObject(testStr, ApiDefinitionImport.class); + ApiDefinitionImport apiDefinitionImport = JSON.parseObject(testStr, ApiDefinitionImport.class,Feature.DisableSpecialKeyDetect); Map> caseMap = new HashMap<>(); if (apiDefinitionImport.getCases() != null) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/PostmanDefinitionParser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/PostmanDefinitionParser.java index 008c4c7f0e..532cecee5f 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/PostmanDefinitionParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/PostmanDefinitionParser.java @@ -1,6 +1,7 @@ package io.metersphere.api.dto.definition.parse; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.parser.Feature; import io.metersphere.api.dto.ApiTestImportRequest; import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy; import io.metersphere.api.dto.parse.postman.PostmanCollection; @@ -9,15 +10,15 @@ import io.metersphere.api.dto.parse.postman.PostmanKeyValue; import io.metersphere.api.parse.PostmanAbstractParserParser; import io.metersphere.base.domain.ApiDefinitionWithBLOBs; import io.metersphere.base.domain.ApiModule; -import io.metersphere.commons.constants.ProjectApplicationType; -import io.metersphere.dto.ProjectConfig; -import io.metersphere.service.ProjectApplicationService; -import org.apache.commons.lang3.StringUtils; import io.metersphere.base.domain.ApiTestCaseWithBLOBs; import io.metersphere.base.domain.Project; import io.metersphere.base.mapper.ProjectMapper; +import io.metersphere.commons.constants.ProjectApplicationType; import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.CommonBeanFactory; +import io.metersphere.dto.ProjectConfig; +import io.metersphere.service.ProjectApplicationService; +import org.apache.commons.lang3.StringUtils; import java.io.InputStream; import java.util.*; @@ -32,7 +33,7 @@ public class PostmanDefinitionParser extends PostmanAbstractParserParser variables = postmanCollection.getVariable(); ApiDefinitionImport apiImport = new ApiDefinitionImport(); List results = new ArrayList<>(); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java index d795bce056..c24740b3a9 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java @@ -3,10 +3,13 @@ package io.metersphere.api.dto.definition.parse; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import io.metersphere.api.dto.ApiTestImportRequest; import io.metersphere.api.dto.definition.ApiModuleDTO; import io.metersphere.api.dto.definition.SwaggerApiExportResult; -import io.metersphere.api.dto.definition.parse.swagger.*; +import io.metersphere.api.dto.definition.parse.swagger.SwaggerApiInfo; +import io.metersphere.api.dto.definition.parse.swagger.SwaggerInfo; +import io.metersphere.api.dto.definition.parse.swagger.SwaggerParams; import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy; import io.metersphere.api.dto.definition.request.variable.JsonSchemaItem; import io.metersphere.api.dto.definition.response.HttpResponse; @@ -33,6 +36,7 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpMethod; + import java.io.InputStream; import java.util.*; @@ -594,17 +598,17 @@ public class Swagger3Parser extends SwaggerAbstractParser { } swaggerApiInfo.setTags(Arrays.asList(moduleName)); // 设置请求体 - JSONObject requestObject = JSON.parseObject(apiDefinition.getRequest()); // 将api的request属性转换成JSON对象以便获得参数 + JSONObject requestObject = JSON.parseObject(apiDefinition.getRequest(), Feature.DisableSpecialKeyDetect); // 将api的request属性转换成JSON对象以便获得参数 JSONObject requestBody = buildRequestBody(requestObject); swaggerApiInfo.setRequestBody(requestBody); // 设置响应体 - JSONObject responseObject = JSON.parseObject(apiDefinition.getResponse()); + JSONObject responseObject = JSON.parseObject(apiDefinition.getResponse(),Feature.DisableSpecialKeyDetect); swaggerApiInfo.setResponses(buildResponseBody(responseObject)); // 设置请求参数列表 List paramsList = buildParameters(requestObject); swaggerApiInfo.setParameters(paramsList); swaggerApiInfo.setDescription(apiDefinition.getDescription()); - JSONObject methodDetail = JSON.parseObject(JSON.toJSONString(swaggerApiInfo)); + JSONObject methodDetail = JSON.parseObject(JSON.toJSONString(swaggerApiInfo),Feature.DisableSpecialKeyDetect); if (paths.getJSONObject(apiDefinition.getPath()) == null) { paths.put(apiDefinition.getPath(), new JSONObject()); } // 一个路径下有多个发方法,如post,get,因此是一个 JSONObject 类型 diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/ElementUtil.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/ElementUtil.java index 1868fcfb42..aa889620de 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/ElementUtil.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/ElementUtil.java @@ -3,6 +3,7 @@ package io.metersphere.api.dto.definition.request; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -302,7 +303,7 @@ public class ElementUtil { } if (element.get("clazzName") == null && element.getString("type").equals("TCPSampler")) { if (element.getString("tcpPreProcessor") != null) { - JSONObject tcpPreProcessor = JSON.parseObject(element.getString("tcpPreProcessor")); + JSONObject tcpPreProcessor = JSON.parseObject(element.getString("tcpPreProcessor"), Feature.DisableSpecialKeyDetect); if (tcpPreProcessor != null && tcpPreProcessor.get("clazzName") == null) { tcpPreProcessor.fluentPut("clazzName", clazzMap.get(tcpPreProcessor.getString("type"))); element.fluentPut("tcpPreProcessor", tcpPreProcessor); @@ -310,7 +311,7 @@ public class ElementUtil { } } else if (element.getString("type").equals("HTTPSamplerProxy")) { if (element.getString("authManager") != null) { - JSONObject authManager = JSON.parseObject(element.getString("authManager")); + JSONObject authManager = JSON.parseObject(element.getString("authManager"),Feature.DisableSpecialKeyDetect); if (authManager != null && authManager.get("clazzName") == null) { authManager.fluentPut("clazzName", clazzMap.get(authManager.getString("type"))); element.fluentPut("authManager", authManager); @@ -388,7 +389,7 @@ public class ElementUtil { if (StringUtils.equals(environmentType, EnvironmentType.GROUP.name())) { environmentMap = environmentGroupProjectService.getEnvMap(environmentGroupId); } else if (StringUtils.equals(environmentType, EnvironmentType.JSON.name())) { - environmentMap = JSON.parseObject(environmentJson, Map.class); + environmentMap = JSON.parseObject(environmentJson, Map.class,Feature.DisableSpecialKeyDetect); } Map envConfig = new HashMap<>(16); if (environmentMap != null && !environmentMap.isEmpty()) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java index a299c39579..c7d3eecef0 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -216,7 +217,7 @@ public class MsScenario extends MsTestElement { mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); ApiScenarioWithBLOBs scenario = apiAutomationService.selectByPrimaryKey(this.getId()); if (scenario != null && StringUtils.isNotEmpty(scenario.getScenarioDefinition())) { - JSONObject element = JSON.parseObject(scenario.getScenarioDefinition()); + JSONObject element = JSON.parseObject(scenario.getScenarioDefinition(), Feature.DisableSpecialKeyDetect); // 历史数据处理 ElementUtil.dataFormatting(element.getJSONArray("hashTree")); this.setName(scenario.getName()); @@ -260,7 +261,7 @@ public class MsScenario extends MsTestElement { if (StringUtils.equals(environmentType, EnvironmentType.GROUP.name())) { this.environmentMap = environmentGroupProjectService.getEnvMap(environmentGroupId); } else if (StringUtils.equals(environmentType, EnvironmentType.JSON.name())) { - this.environmentMap = JSON.parseObject(environmentJson, Map.class); + this.environmentMap = JSON.parseObject(environmentJson, Map.class,Feature.DisableSpecialKeyDetect); } } else { this.setEnvironmentEnable(false); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJDBCPostProcessor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJDBCPostProcessor.java index c0afa06f47..90a6c2bce2 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJDBCPostProcessor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJDBCPostProcessor.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -182,7 +183,7 @@ public class MsJDBCPostProcessor extends MsTestElement { if (bloBs != null) { this.setName(bloBs.getName()); this.setProjectId(bloBs.getProjectId()); - JSONObject element = JSON.parseObject(bloBs.getRequest()); + JSONObject element = JSON.parseObject(bloBs.getRequest(), Feature.DisableSpecialKeyDetect); ElementUtil.dataFormatting(element); proxy = mapper.readValue(element.toJSONString(), new TypeReference() { }); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJDBCPreProcessor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJDBCPreProcessor.java index 9756cedb2e..af5f042e7e 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJDBCPreProcessor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJDBCPreProcessor.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -182,7 +183,7 @@ public class MsJDBCPreProcessor extends MsTestElement { if (bloBs != null) { this.setName(bloBs.getName()); this.setProjectId(bloBs.getProjectId()); - JSONObject element = JSON.parseObject(bloBs.getRequest()); + JSONObject element = JSON.parseObject(bloBs.getRequest(), Feature.DisableSpecialKeyDetect); ElementUtil.dataFormatting(element); proxy = mapper.readValue(element.toJSONString(), new TypeReference() { }); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java index 0bb2c9b624..aafc204c27 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -116,7 +117,7 @@ public class MsDubboSampler extends MsTestElement { ApiTestCaseWithBLOBs bloBs = apiTestCaseService.get(this.getId()); if (bloBs != null) { this.setProjectId(bloBs.getProjectId()); - JSONObject element = JSON.parseObject(bloBs.getRequest()); + JSONObject element = JSON.parseObject(bloBs.getRequest(), Feature.DisableSpecialKeyDetect); ElementUtil.dataFormatting(element); proxy = mapper.readValue(element.toJSONString(), new TypeReference() { }); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java index 5224ecfd53..a939dddf36 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -289,7 +290,7 @@ public class MsHTTPSamplerProxy extends MsTestElement { ApiTestCaseWithBLOBs bloBs = CommonBeanFactory.getBean(ApiTestCaseService.class).get(this.getId()); if (bloBs != null) { this.setProjectId(bloBs.getProjectId()); - JSONObject element = JSON.parseObject(bloBs.getRequest()); + JSONObject element = JSON.parseObject(bloBs.getRequest(), Feature.DisableSpecialKeyDetect); ElementUtil.dataFormatting(element); proxy = mapper.readValue(element.toJSONString(), new TypeReference() { }); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java index 83cacc5fb2..9ad6e2b149 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -240,7 +241,7 @@ public class MsJDBCSampler extends MsTestElement { if (bloBs != null) { this.setName(bloBs.getName()); this.setProjectId(bloBs.getProjectId()); - JSONObject element = JSON.parseObject(bloBs.getRequest()); + JSONObject element = JSON.parseObject(bloBs.getRequest(), Feature.DisableSpecialKeyDetect); ElementUtil.dataFormatting(element); proxy = mapper.readValue(element.toJSONString(), new TypeReference() { }); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java index 67d3840eb7..cce4277b27 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -195,7 +196,7 @@ public class MsTCPSampler extends MsTestElement { if (bloBs != null) { this.setName(bloBs.getName()); this.setProjectId(bloBs.getProjectId()); - JSONObject element = JSON.parseObject(bloBs.getRequest()); + JSONObject element = JSON.parseObject(bloBs.getRequest(), Feature.DisableSpecialKeyDetect); ElementUtil.dataFormatting(element); proxy = mapper.readValue(element.toJSONString(), new TypeReference() { }); diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java b/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java index 7bab3ae75f..ea9613cbe7 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java @@ -97,7 +97,7 @@ public class Body { } else { try { if (StringUtils.isNotEmpty(this.getRaw())) { - JSONObject jsonObject = JSON.parseObject(this.getRaw(), Feature.OrderedField); + JSONObject jsonObject = JSON.parseObject(this.getRaw(), Feature.OrderedField,Feature.DisableSpecialKeyDetect); if (!this.getRaw().contains("$ref")) { jsonMockParse(jsonObject); } diff --git a/backend/src/main/java/io/metersphere/api/exec/api/ApiExecuteService.java b/backend/src/main/java/io/metersphere/api/exec/api/ApiExecuteService.java index 65bfc0c72a..9bbdbd2237 100644 --- a/backend/src/main/java/io/metersphere/api/exec/api/ApiExecuteService.java +++ b/backend/src/main/java/io/metersphere/api/exec/api/ApiExecuteService.java @@ -2,6 +2,7 @@ package io.metersphere.api.exec.api; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import io.metersphere.api.dto.definition.RunCaseRequest; @@ -192,7 +193,7 @@ public class ApiExecuteService { } public HashTree generateHashTree(RunCaseRequest request, ApiTestCaseWithBLOBs testCaseWithBLOBs) throws Exception { - JSONObject elementObj = JSON.parseObject(testCaseWithBLOBs.getRequest()); + JSONObject elementObj = JSON.parseObject(testCaseWithBLOBs.getRequest(), Feature.DisableSpecialKeyDetect); ElementUtil.dataFormatting(elementObj); MsTestElement element = mapper.readValue(elementObj.toJSONString(), new TypeReference() { diff --git a/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioEnvService.java b/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioEnvService.java index b667733bc9..01a5e60913 100644 --- a/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioEnvService.java +++ b/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioEnvService.java @@ -2,6 +2,7 @@ package io.metersphere.api.exec.scenario; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; @@ -177,7 +178,7 @@ public class ApiScenarioEnvService { if (apiScenario != null) { env.getProjectIds().add(apiScenario.getProjectId()); String scenarioDefinition = apiScenario.getScenarioDefinition(); - JSONObject element1 = JSON.parseObject(scenarioDefinition); + JSONObject element1 = JSON.parseObject(scenarioDefinition, Feature.DisableSpecialKeyDetect); ElementUtil.dataFormatting(element1); LinkedList hashTree1 = mapper.readValue(element1.getString("hashTree"), new TypeReference>() { }); diff --git a/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioSerialService.java b/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioSerialService.java index 1772d1a814..bc1c2e89ec 100644 --- a/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioSerialService.java +++ b/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioSerialService.java @@ -2,6 +2,7 @@ package io.metersphere.api.exec.scenario; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import io.metersphere.api.dto.definition.request.ElementUtil; @@ -194,7 +195,7 @@ public class ApiScenarioSerialService { private MsTestElement parse(ApiTestCaseWithBLOBs caseWithBLOBs, String planId, String envId) { try { String api = caseWithBLOBs.getRequest(); - JSONObject element = JSON.parseObject(api); + JSONObject element = JSON.parseObject(api, Feature.DisableSpecialKeyDetect); ElementUtil.dataFormatting(element); LinkedList list = new LinkedList<>(); @@ -205,7 +206,7 @@ public class ApiScenarioSerialService { list.addAll(elements); } if (element.getString("type").equals("HTTPSamplerProxy")) { - MsHTTPSamplerProxy httpSamplerProxy = JSON.parseObject(api, MsHTTPSamplerProxy.class); + MsHTTPSamplerProxy httpSamplerProxy = JSON.parseObject(api, MsHTTPSamplerProxy.class,Feature.DisableSpecialKeyDetect); httpSamplerProxy.setHashTree(list); httpSamplerProxy.setName(planId); if (StringUtils.isNotEmpty(envId)) { @@ -214,7 +215,7 @@ public class ApiScenarioSerialService { return httpSamplerProxy; } if (element.getString("type").equals("TCPSampler")) { - MsTCPSampler msTCPSampler = JSON.parseObject(api, MsTCPSampler.class); + MsTCPSampler msTCPSampler = JSON.parseObject(api, MsTCPSampler.class,Feature.DisableSpecialKeyDetect); if (StringUtils.isNotEmpty(envId)) { msTCPSampler.setUseEnvironment(envId); } @@ -223,7 +224,7 @@ public class ApiScenarioSerialService { return msTCPSampler; } if (element.getString("type").equals("DubboSampler")) { - MsDubboSampler dubboSampler = JSON.parseObject(api, MsDubboSampler.class); + MsDubboSampler dubboSampler = JSON.parseObject(api, MsDubboSampler.class,Feature.DisableSpecialKeyDetect); if (StringUtils.isNotEmpty(envId)) { dubboSampler.setUseEnvironment(envId); } diff --git a/backend/src/main/java/io/metersphere/api/exec/utils/GenerateHashTreeUtil.java b/backend/src/main/java/io/metersphere/api/exec/utils/GenerateHashTreeUtil.java index 0faf6a27ed..8025d49ea7 100644 --- a/backend/src/main/java/io/metersphere/api/exec/utils/GenerateHashTreeUtil.java +++ b/backend/src/main/java/io/metersphere/api/exec/utils/GenerateHashTreeUtil.java @@ -2,6 +2,7 @@ package io.metersphere.api.exec.utils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -38,7 +39,7 @@ public class GenerateHashTreeUtil { public static MsScenario parseScenarioDefinition(String scenarioDefinition) { if (StringUtils.isNotEmpty(scenarioDefinition)) { - MsScenario scenario = JSONObject.parseObject(scenarioDefinition, MsScenario.class); + MsScenario scenario = JSONObject.parseObject(scenarioDefinition, MsScenario.class, Feature.DisableSpecialKeyDetect); if (scenario != null) { parse(scenarioDefinition, scenario); } @@ -51,7 +52,7 @@ public class GenerateHashTreeUtil { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { - JSONObject element = JSON.parseObject(scenarioDefinition); + JSONObject element = JSON.parseObject(scenarioDefinition, Feature.DisableSpecialKeyDetect); ElementUtil.dataFormatting(element); // 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取 if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) { @@ -74,7 +75,7 @@ public class GenerateHashTreeUtil { public static LinkedList getScenarioHashTree(String definition) { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - JSONObject element = JSON.parseObject(definition); + JSONObject element = JSON.parseObject(definition, Feature.DisableSpecialKeyDetect); try { if (element != null) { ElementUtil.dataFormatting(element); diff --git a/backend/src/main/java/io/metersphere/api/jmeter/TestResult.java b/backend/src/main/java/io/metersphere/api/jmeter/TestResult.java index db0a5cda64..1ef5a0a537 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/TestResult.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/TestResult.java @@ -2,6 +2,7 @@ package io.metersphere.api.jmeter; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.parser.Feature; import io.metersphere.commons.constants.DelimiterConstants; import io.metersphere.dto.RequestResult; import lombok.Data; @@ -135,7 +136,7 @@ public class TestResult { String itemAndScenarioName = ""; if (StringUtils.isNotEmpty(item.getScenario())) { //第1个:当前场景, 第all_id_names个:最后一层场景 - List all_id_names = JSON.parseObject(item.getScenario(), List.class); + List all_id_names = JSON.parseObject(item.getScenario(), List.class, Feature.DisableSpecialKeyDetect); if (all_id_names.size() > 1) { StringBuffer scenarioNames = new StringBuffer(); //因为要进行步骤统计,第一层级下的场景算作步骤,所以统计视角只按照第一级别场景来计算 diff --git a/backend/src/main/java/io/metersphere/api/parse/old/MsParser.java b/backend/src/main/java/io/metersphere/api/parse/old/MsParser.java index 5ec129288c..d4b0fd1c67 100644 --- a/backend/src/main/java/io/metersphere/api/parse/old/MsParser.java +++ b/backend/src/main/java/io/metersphere/api/parse/old/MsParser.java @@ -18,7 +18,7 @@ public class MsParser extends ApiImportAbstractParser { @Override public ApiImport parse(InputStream source, ApiTestImportRequest request) { String testStr = getApiTestStr(source); - ApiImport apiImport = JSON.parseObject(parsePluginFormat(testStr), ApiImport.class); + ApiImport apiImport = JSON.parseObject(parsePluginFormat(testStr), ApiImport.class,Feature.DisableSpecialKeyDetect); apiImport.getScenarios().forEach(scenario -> setScenarioByRequest(scenario, request)); return apiImport; } @@ -26,7 +26,7 @@ public class MsParser extends ApiImportAbstractParser { @Override public ApiDefinitionImport parseApi(InputStream source, ApiTestImportRequest request) { String testStr = getApiTestStr(source); - ApiDefinitionImport apiImport = JSON.parseObject(testStr, ApiDefinitionImport.class); + ApiDefinitionImport apiImport = JSON.parseObject(testStr, ApiDefinitionImport.class,Feature.DisableSpecialKeyDetect); return apiImport; } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index da402567e6..6f311a2397 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -3,6 +3,7 @@ package io.metersphere.api.service; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import io.metersphere.api.dto.*; import io.metersphere.api.dto.automation.*; import io.metersphere.api.dto.automation.parse.ApiScenarioImportUtil; @@ -402,7 +403,7 @@ public class ApiAutomationService { if (scenario == null || StringUtils.isEmpty(scenario.getScenarioDefinition())) { return; } - JSONObject element = JSON.parseObject(scenario.getScenarioDefinition()); + JSONObject element = JSON.parseObject(scenario.getScenarioDefinition(), Feature.DisableSpecialKeyDetect); JSONArray hashTree = element.getJSONArray("hashTree"); ApiScenarioImportUtil.formatHashTree(hashTree); setReferenced(hashTree, scenario.getVersionId(), scenario.getProjectId(), apiTestCaseMapper, apiDefinitionMapper, true); @@ -692,7 +693,7 @@ public class ApiAutomationService { public ApiScenarioDTO getNewApiScenario(String id) { ApiScenarioDTO scenarioWithBLOBs = extApiScenarioMapper.selectById(id); if (scenarioWithBLOBs != null && StringUtils.isNotEmpty(scenarioWithBLOBs.getScenarioDefinition())) { - JSONObject element = JSON.parseObject(scenarioWithBLOBs.getScenarioDefinition()); + JSONObject element = JSON.parseObject(scenarioWithBLOBs.getScenarioDefinition(), Feature.DisableSpecialKeyDetect); hashTreeService.dataFormatting(element); scenarioWithBLOBs.setScenarioDefinition(JSON.toJSONString(element)); } @@ -702,7 +703,7 @@ public class ApiAutomationService { public String setDomain(ApiScenarioEnvRequest request) { Boolean enable = request.getEnvironmentEnable(); String scenarioDefinition = request.getDefinition(); - JSONObject element = JSON.parseObject(scenarioDefinition); + JSONObject element = JSON.parseObject(scenarioDefinition, Feature.DisableSpecialKeyDetect); Map environmentMap = new HashMap<>(); if (BooleanUtils.isFalse(enable)) { String envType = request.getEnvironmentType(); @@ -2074,4 +2075,9 @@ public class ApiAutomationService { } } + public static void main(String args[]) { + String s = "{\"id\":\"a0b24269-96af-4e38-9527-abb8de9e298a\",\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"tags\":\"[]\",\"userId\":\"zhaoyong\",\"apiScenarioModuleId\":\"91b7822c-265f-4304-8256-92b7f862dbc5\",\"modulePath\":\"/MeterSphere-test\",\"name\":\"创建测试\",\"level\":\"P0\",\"status\":\"Underway\",\"principal\":\"zhaoyong\",\"stepTotal\":2,\"schedule\":null,\"createTime\":1649660714601,\"updateTime\":1649663715536,\"passRate\":\"0%\",\"lastResult\":\"Fail\",\"reportId\":\"aae35c28\",\"num\":100115,\"originalState\":null,\"customNum\":\"100115\",\"createUser\":null,\"version\":10,\"deleteTime\":null,\"deleteUserId\":null,\"executeTimes\":null,\"order\":null,\"environmentType\":\"JSON\",\"environmentGroupId\":null,\"versionId\":\"5b78930e-6880-11ec-a810-0242ac1e0a05\",\"refId\":\"a0b24269-96af-4e38-9527-abb8de9e298a\",\"latest\":null,\"scenarioDefinition\":{\"id\":\"a0b24269-96af-4e38-9527-abb8de9e298a\",\"enableCookieShare\":false,\"name\":\"创建测试\",\"type\":\"scenario\",\"clazzName\":\"io.metersphere.api.dto.definition.request.MsScenario\",\"variables\":[],\"headers\":[],\"referenced\":\"Created\",\"environmentMap\":{\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\":\"bdb7c2cb-76ba-4761-bdc1-dc136c492124\"},\"hashTree\":[{\"resourceId\":\"11335d47-ed41-2934-ecf8-150232d8d71d\",\"num\":\"\",\"refType\":\"CASE\",\"type\":\"HTTPSamplerProxy\",\"body\":{\"valid\":true,\"jsonSchema\":{\"hidden\":true,\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"title\":\"The Root Schema\",\"type\":\"object\",\"properties\":{\"password\":{\"hidden\":true,\"mock\":{\"mock\":\"Calong@2015\"},\"title\":\"The password Schema\",\"type\":\"string\",\"$id\":\"#/properties/password\"},\"username\":{\"hidden\":true,\"mock\":{\"mock\":\"admin\"},\"title\":\"The username Schema\",\"type\":\"string\",\"$id\":\"#/properties/username\"}},\"$id\":\"http://example.com/root.json\"},\"xml\":false,\"binary\":[],\"json\":true,\"kvs\":[],\"raw\":\"{\\n \\\"username\\\": \\\"admin\\\",\\n \\\"password\\\": \\\"Calong@2015\\\"\\n}\",\"kV\":false,\"oldKV\":false,\"type\":\"JSON\"},\"path\":\"/signin\",\"protocol\":\"HTTP\",\"enable\":true,\"followRedirects\":true,\"useEnvironment\":\"ec29256c-9523-48ff-b257-755f5daccb60\",\"connectTimeout\":\"60000\",\"hashTree\":[{\"resourceId\":\"4454ea7f-5c0e-4e1b-b66a-7fb925fc5b4c\",\"mockEnvironment\":false,\"active\":true,\"index\":1,\"type\":\"Extract\",\"regex\":[{\"valid\":true,\"expression\":\"Set-Cookie: (.*?); Path=/; HttpOnly;\",\"variable\":\"Cookie\",\"useHeaders\":\"true\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${Cookie}\"},{\"valid\":true,\"expression\":\"\\\"id\\\":\\\"(.*?)\\\"\",\"variable\":\"id\",\"useHeaders\":\"false\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${id}\"},{\"valid\":true,\"expression\":\"\\\"id\\\":\\\"(.+?)\\\"\",\"variable\":\"id2\",\"useHeaders\":\"false\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${id2}\"},{\"valid\":true,\"expression\":\"\\\"id\\\":\\\"(\\\\d+)\\\"\",\"variable\":\"id3\",\"useHeaders\":\"false\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${id3}\"},{\"valid\":true,\"expression\":\"\\\"id\\\":\\\"(.\\\\d+)\\\"\",\"variable\":\"id4\",\"useHeaders\":\"false\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${id4}\"}],\"xpath\":[],\"enable\":true,\"json\":[{\"valid\":true,\"expression\":\"$.data.csrfToken\",\"variable\":\"csrfToken\",\"multipleMatching\":false,\"type\":\"JSONPath\",\"value\":\"\"}],\"hashTree\":[],\"id\":\"bec13d6d-3dc0-3f20-ff73-d4fb0b8dcc99\",\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.extract.MsExtract\",\"parentIndex\":\"1_1\",\"checkBox\":false,\"isLeaf\":true},{\"jsr223\":[],\"resourceId\":\"5f22b989-279b-4417-b896-c3cbcdfd7448\",\"mockEnvironment\":false,\"document\":{\"data\":{\"xml\":[],\"json\":[],\"xmlFollowAPI\":\"false\",\"jsonFollowAPI\":\"false\"},\"enable\":true,\"type\":\"JSON\"},\"xpath2\":[],\"active\":false,\"index\":2,\"jsonPath\":[],\"type\":\"Assertions\",\"duration\":{\"valid\":false,\"enable\":true,\"type\":\"Duration\",\"value\":0},\"regex\":[],\"enable\":true,\"hashTree\":[],\"id\":\"e233298c-845b-5a48-8968-06266ebe775e\",\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.assertions.MsAssertions\",\"parentIndex\":\"1_2\",\"checkBox\":false,\"isLeaf\":true}],\"id\":\"4975f880-cb88-539d-38c6-01f134011946\",\"responseTimeout\":\"60000\",\"headers\":[{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"Content-Type\",\"urlEncode\":false,\"value\":\"application/json\",\"required\":true}],\"rest\":[],\"mockEnvironment\":false,\"method\":\"POST\",\"active\":false,\"index\":1,\"url\":\"\",\"customizeReq\":false,\"referenced\":\"Copy\",\"domain\":\"https://www.jd.com\",\"name\":\"登录ms\",\"isRefEnvironment\":true,\"arguments\":[{\"valid\":false,\"file\":false,\"enable\":true,\"type\":\"text\",\"contentType\":\"text/plain\",\"urlEncode\":false,\"required\":false}],\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy\",\"doMultipartPost\":false,\"parentIndex\":1,\"requestResult\":[{\"responseResult\":{}}],\"checkBox\":false,\"isBatchProcess\":false,\"isLeaf\":true},{\"resourceId\":\"459089ec-eb03-c66b-1e81-9d6b5905a54f\",\"num\":\"\",\"refType\":\"CASE\",\"type\":\"HTTPSamplerProxy\",\"body\":{\"valid\":true,\"jsonSchema\":{\"$id\":\"http://example.com/root.json\",\"title\":\"The Root Schema\",\"hidden\":true,\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"type\":\"object\",\"properties\":{\"@type\":{\"$id\":\"#/properties/@type\",\"title\":\"The @type Schema\",\"hidden\":true,\"mock\":{\"mock\":\"aaa\"},\"type\":\"string\"}}},\"xml\":false,\"binary\":[],\"json\":true,\"kvs\":[{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"request\",\"type\":\"text\",\"contentType\":\"application/json;boundary=----WebKitFormBoundarybikQMdDG93ZCVD4V\",\"urlEncode\":false,\"value\":\"{\\\"name\\\":\\\"测试1\\\",\\\"module\\\":\\\"f9ee3850-e0a4-4529-99f8-24c6cb9a5e57\\\",\\\"nodePath\\\":\\\"/未规划用例\\\",\\\"maintainer\\\":\\\"zyy\\\",\\\"priority\\\":\\\"P0\\\",\\\"type\\\":\\\"functional\\\",\\\"method\\\":\\\"\\\",\\\"prerequisite\\\":\\\"\\\",\\\"testId\\\":\\\"[]\\\",\\\"otherTestName\\\":\\\"\\\",\\\"steps\\\":\\\"[{\\\\\\\"num\\\\\\\":1,\\\\\\\"desc\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"result\\\\\\\":\\\\\\\"\\\\\\\"}]\\\",\\\"stepDesc\\\":\\\"\\\",\\\"stepResult\\\":\\\"\\\",\\\"selected\\\":[],\\\"remark\\\":\\\"\\\",\\\"tags\\\":\\\"[]\\\",\\\"demandId\\\":\\\"\\\",\\\"demandName\\\":\\\"\\\",\\\"status\\\":\\\"Prepare\\\",\\\"reviewStatus\\\":\\\"Prepare\\\",\\\"stepDescription\\\":\\\"\\\",\\\"expectedResult\\\":\\\"\\\",\\\"stepModel\\\":null,\\\"customNum\\\":\\\"\\\",\\\"followPeople\\\":\\\"\\\",\\\"follows\\\":[],\\\"customFields\\\":\\\"[{\\\\\\\"id\\\\\\\":\\\\\\\"ea902d54-ab30-11ec-bfae-0242ac1e0a02\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"责任人\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"zyy\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"member\\\\\\\",\\\\\\\"customData\\\\\\\":null},{\\\\\\\"id\\\\\\\":\\\\\\\"ea91b4b1-ab30-11ec-bfae-0242ac1e0a02\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"用例等级\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"P0\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"select\\\\\\\",\\\\\\\"customData\\\\\\\":null},{\\\\\\\"id\\\\\\\":\\\\\\\"ea991a6c-ab30-11ec-bfae-0242ac1e0a02\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"用例状态\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"Prepare\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"select\\\\\\\",\\\\\\\"customData\\\\\\\":null}]\\\",\\\"nodeId\\\":\\\"f9ee3850-e0a4-4529-99f8-24c6cb9a5e57\\\",\\\"projectId\\\":\\\"a79ac4e6-c3b7-4d82-8f11-b1c9be05c396\\\",\\\"casePublic\\\":false,\\\"updatedFileList\\\":[]}\",\"required\":false},{\"valid\":false,\"file\":false,\"enable\":true,\"type\":\"text\",\"contentType\":\"text/plain\",\"urlEncode\":false,\"required\":false}],\"raw\":\"{\\n \\\"@type\\\": \\\"aaa\\\"\\n}\",\"kV\":false,\"oldKV\":false,\"type\":\"JSON\"},\"path\":\"/test/case/add\",\"protocol\":\"HTTP\",\"enable\":true,\"followRedirects\":true,\"useEnvironment\":\"ec29256c-9523-48ff-b257-755f5daccb60\",\"connectTimeout\":\"60000\",\"hashTree\":[{\"jsr223\":[],\"resourceId\":\"f318347e-2a8f-4bbe-9753-506156d44656\",\"mockEnvironment\":false,\"document\":{\"data\":{\"xml\":[],\"json\":[],\"xmlFollowAPI\":\"false\",\"jsonFollowAPI\":\"false\"},\"enable\":true,\"type\":\"JSON\"},\"xpath2\":[],\"active\":false,\"index\":1,\"jsonPath\":[],\"type\":\"Assertions\",\"duration\":{\"valid\":false,\"enable\":true,\"type\":\"Duration\",\"value\":0},\"regex\":[],\"enable\":true,\"hashTree\":[],\"id\":\"aaa65613-b39c-dc42-852d-17e47366c6cb\",\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.assertions.MsAssertions\",\"parentIndex\":\"2_1\",\"checkBox\":false,\"isLeaf\":true}],\"id\":\"ab259fed-5328-71f7-8079-e05783a82499\",\"responseTimeout\":\"60000\",\"headers\":[{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"Content-Type\",\"urlEncode\":false,\"value\":\"application/json\",\"required\":true},{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"CSRF-TOKEN\",\"urlEncode\":false,\"value\":\"${csrfToken}\",\"required\":true},{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"Cookie\",\"urlEncode\":false,\"value\":\"${Cookie}\",\"required\":true},{\"valid\":false,\"file\":false,\"enable\":true,\"urlEncode\":false,\"required\":true}],\"rest\":[{\"valid\":false,\"file\":false,\"enable\":true,\"type\":\"text\",\"contentType\":\"text/plain\",\"urlEncode\":false,\"required\":false}],\"mockEnvironment\":false,\"method\":\"POST\",\"active\":true,\"index\":2,\"url\":\"\",\"customizeReq\":false,\"referenced\":\"Copy\",\"domain\":\"https://www.jd.com\",\"name\":\"创建功能用例\",\"isRefEnvironment\":true,\"arguments\":[{\"valid\":false,\"file\":false,\"enable\":true,\"type\":\"text\",\"contentType\":\"text/plain\",\"urlEncode\":false,\"required\":false}],\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy\",\"doMultipartPost\":false,\"parentIndex\":2,\"requestResult\":[{\"responseResult\":{}}],\"checkBox\":false,\"isBatchProcess\":false,\"isLeaf\":true,\"preSize\":0,\"postSize\":0,\"ruleSize\":0}],\"onSampleError\":true,\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\"},\"description\":null,\"useUrl\":null,\"environmentJson\":\"{\\\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\\\":\\\"bdb7c2cb-76ba-4761-bdc1-dc136c492124\\\"}\",\"projectName\":\"默认项目\",\"userName\":\"zz\",\"creatorName\":\"zz\",\"principalName\":\"zz\",\"tagNames\":null,\"deleteUser\":null,\"versionName\":\"v1.0.0\",\"versionEnable\":null,\"projectIds\":null,\"caseId\":null,\"environment\":null,\"env\":\"{\\\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\\\":\\\"bdb7c2cb-76ba-4761-bdc1-dc136c492124\\\"}\",\"environmentMap\":{\"默认项目\":\"JD\"},\"creator\":\"zhaoyong\",\"showBatchTip\":true,\"variables\":[],\"headers\":[],\"scenarioDefinitionOrg\":{\"apiScenarioModuleId\":\"91b7822c-265f-4304-8256-92b7f862dbc5\",\"name\":\"创建测试\",\"status\":\"Underway\",\"principal\":\"zhaoyong\",\"level\":\"P0\",\"tags\":[],\"description\":null,\"scenarioDefinition\":[{\"resourceId\":\"11335d47-ed41-2934-ecf8-150232d8d71d\",\"num\":\"\",\"refType\":\"CASE\",\"type\":\"HTTPSamplerProxy\",\"body\":{\"valid\":true,\"jsonSchema\":{\"hidden\":true,\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"title\":\"The Root Schema\",\"type\":\"object\",\"properties\":{\"password\":{\"hidden\":true,\"mock\":{\"mock\":\"Calong@2015\"},\"title\":\"The password Schema\",\"type\":\"string\",\"$id\":\"#/properties/password\"},\"username\":{\"hidden\":true,\"mock\":{\"mock\":\"admin\"},\"title\":\"The username Schema\",\"type\":\"string\",\"$id\":\"#/properties/username\"}},\"$id\":\"http://example.com/root.json\"},\"xml\":false,\"binary\":[],\"json\":true,\"kvs\":[],\"raw\":\"{\\n \\\"username\\\": \\\"admin\\\",\\n \\\"password\\\": \\\"Calong@2015\\\"\\n}\",\"kV\":false,\"oldKV\":false,\"type\":\"JSON\"},\"path\":\"/signin\",\"protocol\":\"HTTP\",\"enable\":true,\"followRedirects\":true,\"useEnvironment\":\"ec29256c-9523-48ff-b257-755f5daccb60\",\"connectTimeout\":\"60000\",\"hashTree\":[{\"resourceId\":\"4454ea7f-5c0e-4e1b-b66a-7fb925fc5b4c\",\"mockEnvironment\":false,\"active\":true,\"index\":1,\"type\":\"Extract\",\"regex\":[{\"valid\":true,\"expression\":\"Set-Cookie: (.*?); Path=/; HttpOnly;\",\"variable\":\"Cookie\",\"useHeaders\":\"true\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${Cookie}\"},{\"valid\":true,\"expression\":\"\\\"id\\\":\\\"(.*?)\\\"\",\"variable\":\"id\",\"useHeaders\":\"false\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${id}\"},{\"valid\":true,\"expression\":\"\\\"id\\\":\\\"(.+?)\\\"\",\"variable\":\"id2\",\"useHeaders\":\"false\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${id2}\"},{\"valid\":true,\"expression\":\"\\\"id\\\":\\\"(\\\\d+)\\\"\",\"variable\":\"id3\",\"useHeaders\":\"false\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${id3}\"},{\"valid\":true,\"expression\":\"\\\"id\\\":\\\"(.\\\\d+)\\\"\",\"variable\":\"id4\",\"useHeaders\":\"false\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${id4}\"}],\"xpath\":[],\"enable\":true,\"json\":[{\"valid\":true,\"expression\":\"$.data.csrfToken\",\"variable\":\"csrfToken\",\"multipleMatching\":false,\"type\":\"JSONPath\",\"value\":\"\"}],\"hashTree\":[],\"id\":\"bec13d6d-3dc0-3f20-ff73-d4fb0b8dcc99\",\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.extract.MsExtract\",\"parentIndex\":\"1_1\"},{\"jsr223\":[],\"resourceId\":\"5f22b989-279b-4417-b896-c3cbcdfd7448\",\"mockEnvironment\":false,\"document\":{\"data\":{\"xml\":[],\"json\":[],\"xmlFollowAPI\":\"false\",\"jsonFollowAPI\":\"false\"},\"enable\":true,\"type\":\"JSON\"},\"xpath2\":[],\"active\":false,\"index\":2,\"jsonPath\":[],\"type\":\"Assertions\",\"duration\":{\"valid\":false,\"enable\":true,\"type\":\"Duration\",\"value\":0},\"regex\":[],\"enable\":true,\"hashTree\":[],\"id\":\"e233298c-845b-5a48-8968-06266ebe775e\",\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.assertions.MsAssertions\",\"parentIndex\":\"1_2\"}],\"id\":\"4975f880-cb88-539d-38c6-01f134011946\",\"responseTimeout\":\"60000\",\"headers\":[{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"Content-Type\",\"urlEncode\":false,\"value\":\"application/json\",\"required\":true}],\"rest\":[],\"mockEnvironment\":false,\"method\":\"POST\",\"active\":false,\"index\":1,\"url\":\"\",\"customizeReq\":false,\"referenced\":\"Copy\",\"domain\":\"https://www.jd.com\",\"name\":\"登录ms\",\"isRefEnvironment\":true,\"arguments\":[{\"valid\":false,\"file\":false,\"enable\":true,\"type\":\"text\",\"contentType\":\"text/plain\",\"urlEncode\":false,\"required\":false}],\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy\",\"doMultipartPost\":false,\"parentIndex\":1},{\"resourceId\":\"459089ec-eb03-c66b-1e81-9d6b5905a54f\",\"num\":\"\",\"refType\":\"CASE\",\"type\":\"HTTPSamplerProxy\",\"body\":{\"valid\":true,\"jsonSchema\":{\"hidden\":true,\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"title\":\"The Root Schema\",\"type\":\"object\",\"properties\":{\"\\\\@type\":{\"hidden\":true,\"mock\":{\"mock\":\"aaa\"},\"title\":\"The \\\\@type Schema\",\"type\":\"string\",\"$id\":\"#/properties/\\\\@type\"}},\"$id\":\"http://example.com/root.json\"},\"xml\":false,\"binary\":[],\"json\":true,\"kvs\":[{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"request\",\"type\":\"text\",\"contentType\":\"application/json;boundary=----WebKitFormBoundarybikQMdDG93ZCVD4V\",\"urlEncode\":false,\"value\":\"{\\\"name\\\":\\\"测试1\\\",\\\"module\\\":\\\"f9ee3850-e0a4-4529-99f8-24c6cb9a5e57\\\",\\\"nodePath\\\":\\\"/未规划用例\\\",\\\"maintainer\\\":\\\"zyy\\\",\\\"priority\\\":\\\"P0\\\",\\\"type\\\":\\\"functional\\\",\\\"method\\\":\\\"\\\",\\\"prerequisite\\\":\\\"\\\",\\\"testId\\\":\\\"[]\\\",\\\"otherTestName\\\":\\\"\\\",\\\"steps\\\":\\\"[{\\\\\\\"num\\\\\\\":1,\\\\\\\"desc\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"result\\\\\\\":\\\\\\\"\\\\\\\"}]\\\",\\\"stepDesc\\\":\\\"\\\",\\\"stepResult\\\":\\\"\\\",\\\"selected\\\":[],\\\"remark\\\":\\\"\\\",\\\"tags\\\":\\\"[]\\\",\\\"demandId\\\":\\\"\\\",\\\"demandName\\\":\\\"\\\",\\\"status\\\":\\\"Prepare\\\",\\\"reviewStatus\\\":\\\"Prepare\\\",\\\"stepDescription\\\":\\\"\\\",\\\"expectedResult\\\":\\\"\\\",\\\"stepModel\\\":null,\\\"customNum\\\":\\\"\\\",\\\"followPeople\\\":\\\"\\\",\\\"follows\\\":[],\\\"customFields\\\":\\\"[{\\\\\\\"id\\\\\\\":\\\\\\\"ea902d54-ab30-11ec-bfae-0242ac1e0a02\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"责任人\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"zyy\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"member\\\\\\\",\\\\\\\"customData\\\\\\\":null},{\\\\\\\"id\\\\\\\":\\\\\\\"ea91b4b1-ab30-11ec-bfae-0242ac1e0a02\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"用例等级\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"P0\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"select\\\\\\\",\\\\\\\"customData\\\\\\\":null},{\\\\\\\"id\\\\\\\":\\\\\\\"ea991a6c-ab30-11ec-bfae-0242ac1e0a02\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"用例状态\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"Prepare\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"select\\\\\\\",\\\\\\\"customData\\\\\\\":null}]\\\",\\\"nodeId\\\":\\\"f9ee3850-e0a4-4529-99f8-24c6cb9a5e57\\\",\\\"projectId\\\":\\\"a79ac4e6-c3b7-4d82-8f11-b1c9be05c396\\\",\\\"casePublic\\\":false,\\\"updatedFileList\\\":[]}\",\"required\":false},{\"valid\":false,\"file\":false,\"enable\":true,\"type\":\"text\",\"contentType\":\"text/plain\",\"urlEncode\":false,\"required\":false}],\"raw\":\"{\\n \\\"\\\\\\\\@type\\\": \\\"aaa\\\"\\n}\",\"kV\":false,\"oldKV\":false,\"type\":\"JSON\"},\"path\":\"/test/case/add\",\"protocol\":\"HTTP\",\"enable\":true,\"followRedirects\":true,\"useEnvironment\":\"ec29256c-9523-48ff-b257-755f5daccb60\",\"connectTimeout\":\"60000\",\"hashTree\":[{\"jsr223\":[],\"resourceId\":\"f318347e-2a8f-4bbe-9753-506156d44656\",\"mockEnvironment\":false,\"document\":{\"data\":{\"xml\":[],\"json\":[],\"xmlFollowAPI\":\"false\",\"jsonFollowAPI\":\"false\"},\"enable\":true,\"type\":\"JSON\"},\"xpath2\":[],\"active\":false,\"index\":1,\"jsonPath\":[],\"type\":\"Assertions\",\"duration\":{\"valid\":false,\"enable\":true,\"type\":\"Duration\",\"value\":0},\"regex\":[],\"enable\":true,\"hashTree\":[],\"id\":\"aaa65613-b39c-dc42-852d-17e47366c6cb\",\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.assertions.MsAssertions\",\"parentIndex\":\"2_1\"}],\"id\":\"ab259fed-5328-71f7-8079-e05783a82499\",\"responseTimeout\":\"60000\",\"headers\":[{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"Content-Type\",\"urlEncode\":false,\"value\":\"application/json\",\"required\":true},{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"CSRF-TOKEN\",\"urlEncode\":false,\"value\":\"${csrfToken}\",\"required\":true},{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"Cookie\",\"urlEncode\":false,\"value\":\"${Cookie}\",\"required\":true},{\"valid\":false,\"file\":false,\"enable\":true,\"urlEncode\":false,\"required\":true}],\"rest\":[{\"valid\":false,\"file\":false,\"enable\":true,\"type\":\"text\",\"contentType\":\"text/plain\",\"urlEncode\":false,\"required\":false}],\"mockEnvironment\":false,\"method\":\"POST\",\"active\":true,\"index\":2,\"url\":\"\",\"customizeReq\":false,\"referenced\":\"Copy\",\"domain\":\"https://www.jd.com\",\"name\":\"创建功能用例\",\"isRefEnvironment\":true,\"arguments\":[{\"valid\":false,\"file\":false,\"enable\":true,\"type\":\"text\",\"contentType\":\"text/plain\",\"urlEncode\":false,\"required\":false}],\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy\",\"doMultipartPost\":false,\"parentIndex\":2}]},\"follows\":[],\"hashTree\":[{\"resourceId\":\"11335d47-ed41-2934-ecf8-150232d8d71d\",\"num\":\"\",\"refType\":\"CASE\",\"type\":\"HTTPSamplerProxy\",\"body\":{\"valid\":true,\"jsonSchema\":{\"hidden\":true,\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"title\":\"The Root Schema\",\"type\":\"object\",\"properties\":{\"password\":{\"hidden\":true,\"mock\":{\"mock\":\"Calong@2015\"},\"title\":\"The password Schema\",\"type\":\"string\",\"$id\":\"#/properties/password\"},\"username\":{\"hidden\":true,\"mock\":{\"mock\":\"admin\"},\"title\":\"The username Schema\",\"type\":\"string\",\"$id\":\"#/properties/username\"}},\"$id\":\"http://example.com/root.json\"},\"xml\":false,\"binary\":[],\"json\":true,\"kvs\":[],\"raw\":\"{\\n \\\"username\\\": \\\"admin\\\",\\n \\\"password\\\": \\\"Calong@2015\\\"\\n}\",\"kV\":false,\"oldKV\":false,\"type\":\"JSON\"},\"path\":\"/signin\",\"protocol\":\"HTTP\",\"enable\":true,\"followRedirects\":true,\"useEnvironment\":\"ec29256c-9523-48ff-b257-755f5daccb60\",\"connectTimeout\":\"60000\",\"hashTree\":[{\"resourceId\":\"4454ea7f-5c0e-4e1b-b66a-7fb925fc5b4c\",\"mockEnvironment\":false,\"active\":true,\"index\":1,\"type\":\"Extract\",\"regex\":[{\"valid\":true,\"expression\":\"Set-Cookie: (.*?); Path=/; HttpOnly;\",\"variable\":\"Cookie\",\"useHeaders\":\"true\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${Cookie}\"},{\"valid\":true,\"expression\":\"\\\"id\\\":\\\"(.*?)\\\"\",\"variable\":\"id\",\"useHeaders\":\"false\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${id}\"},{\"valid\":true,\"expression\":\"\\\"id\\\":\\\"(.+?)\\\"\",\"variable\":\"id2\",\"useHeaders\":\"false\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${id2}\"},{\"valid\":true,\"expression\":\"\\\"id\\\":\\\"(\\\\d+)\\\"\",\"variable\":\"id3\",\"useHeaders\":\"false\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${id3}\"},{\"valid\":true,\"expression\":\"\\\"id\\\":\\\"(.\\\\d+)\\\"\",\"variable\":\"id4\",\"useHeaders\":\"false\",\"multipleMatching\":false,\"type\":\"Regex\",\"value\":\"${id4}\"}],\"xpath\":[],\"enable\":true,\"json\":[{\"valid\":true,\"expression\":\"$.data.csrfToken\",\"variable\":\"csrfToken\",\"multipleMatching\":false,\"type\":\"JSONPath\",\"value\":\"\"}],\"hashTree\":[],\"id\":\"bec13d6d-3dc0-3f20-ff73-d4fb0b8dcc99\",\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.extract.MsExtract\",\"parentIndex\":\"1_1\",\"checkBox\":false,\"isLeaf\":true},{\"jsr223\":[],\"resourceId\":\"5f22b989-279b-4417-b896-c3cbcdfd7448\",\"mockEnvironment\":false,\"document\":{\"data\":{\"xml\":[],\"json\":[],\"xmlFollowAPI\":\"false\",\"jsonFollowAPI\":\"false\"},\"enable\":true,\"type\":\"JSON\"},\"xpath2\":[],\"active\":false,\"index\":2,\"jsonPath\":[],\"type\":\"Assertions\",\"duration\":{\"valid\":false,\"enable\":true,\"type\":\"Duration\",\"value\":0},\"regex\":[],\"enable\":true,\"hashTree\":[],\"id\":\"e233298c-845b-5a48-8968-06266ebe775e\",\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.assertions.MsAssertions\",\"parentIndex\":\"1_2\",\"checkBox\":false,\"isLeaf\":true}],\"id\":\"4975f880-cb88-539d-38c6-01f134011946\",\"responseTimeout\":\"60000\",\"headers\":[{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"Content-Type\",\"urlEncode\":false,\"value\":\"application/json\",\"required\":true}],\"rest\":[],\"mockEnvironment\":false,\"method\":\"POST\",\"active\":false,\"index\":1,\"url\":\"\",\"customizeReq\":false,\"referenced\":\"Copy\",\"domain\":\"https://www.jd.com\",\"name\":\"登录ms\",\"isRefEnvironment\":true,\"arguments\":[{\"valid\":false,\"file\":false,\"enable\":true,\"type\":\"text\",\"contentType\":\"text/plain\",\"urlEncode\":false,\"required\":false}],\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy\",\"doMultipartPost\":false,\"parentIndex\":1,\"requestResult\":[{\"responseResult\":{}}],\"checkBox\":false,\"isBatchProcess\":false,\"isLeaf\":true},{\"resourceId\":\"459089ec-eb03-c66b-1e81-9d6b5905a54f\",\"num\":\"\",\"refType\":\"CASE\",\"type\":\"HTTPSamplerProxy\",\"body\":{\"valid\":true,\"jsonSchema\":{\"$id\":\"http://example.com/root.json\",\"title\":\"The Root Schema\",\"hidden\":true,\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"type\":\"object\",\"properties\":{\"@type\":{\"$id\":\"#/properties/@type\",\"title\":\"The @type Schema\",\"hidden\":true,\"mock\":{\"mock\":\"aaa\"},\"type\":\"string\"}}},\"xml\":false,\"binary\":[],\"json\":true,\"kvs\":[{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"request\",\"type\":\"text\",\"contentType\":\"application/json;boundary=----WebKitFormBoundarybikQMdDG93ZCVD4V\",\"urlEncode\":false,\"value\":\"{\\\"name\\\":\\\"测试1\\\",\\\"module\\\":\\\"f9ee3850-e0a4-4529-99f8-24c6cb9a5e57\\\",\\\"nodePath\\\":\\\"/未规划用例\\\",\\\"maintainer\\\":\\\"zyy\\\",\\\"priority\\\":\\\"P0\\\",\\\"type\\\":\\\"functional\\\",\\\"method\\\":\\\"\\\",\\\"prerequisite\\\":\\\"\\\",\\\"testId\\\":\\\"[]\\\",\\\"otherTestName\\\":\\\"\\\",\\\"steps\\\":\\\"[{\\\\\\\"num\\\\\\\":1,\\\\\\\"desc\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"result\\\\\\\":\\\\\\\"\\\\\\\"}]\\\",\\\"stepDesc\\\":\\\"\\\",\\\"stepResult\\\":\\\"\\\",\\\"selected\\\":[],\\\"remark\\\":\\\"\\\",\\\"tags\\\":\\\"[]\\\",\\\"demandId\\\":\\\"\\\",\\\"demandName\\\":\\\"\\\",\\\"status\\\":\\\"Prepare\\\",\\\"reviewStatus\\\":\\\"Prepare\\\",\\\"stepDescription\\\":\\\"\\\",\\\"expectedResult\\\":\\\"\\\",\\\"stepModel\\\":null,\\\"customNum\\\":\\\"\\\",\\\"followPeople\\\":\\\"\\\",\\\"follows\\\":[],\\\"customFields\\\":\\\"[{\\\\\\\"id\\\\\\\":\\\\\\\"ea902d54-ab30-11ec-bfae-0242ac1e0a02\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"责任人\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"zyy\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"member\\\\\\\",\\\\\\\"customData\\\\\\\":null},{\\\\\\\"id\\\\\\\":\\\\\\\"ea91b4b1-ab30-11ec-bfae-0242ac1e0a02\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"用例等级\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"P0\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"select\\\\\\\",\\\\\\\"customData\\\\\\\":null},{\\\\\\\"id\\\\\\\":\\\\\\\"ea991a6c-ab30-11ec-bfae-0242ac1e0a02\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"用例状态\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"Prepare\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"select\\\\\\\",\\\\\\\"customData\\\\\\\":null}]\\\",\\\"nodeId\\\":\\\"f9ee3850-e0a4-4529-99f8-24c6cb9a5e57\\\",\\\"projectId\\\":\\\"a79ac4e6-c3b7-4d82-8f11-b1c9be05c396\\\",\\\"casePublic\\\":false,\\\"updatedFileList\\\":[]}\",\"required\":false},{\"valid\":false,\"file\":false,\"enable\":true,\"type\":\"text\",\"contentType\":\"text/plain\",\"urlEncode\":false,\"required\":false}],\"raw\":\"{\\n \\\"@type\\\": \\\"aaa\\\"\\n}\",\"kV\":false,\"oldKV\":false,\"type\":\"JSON\"},\"path\":\"/test/case/add\",\"protocol\":\"HTTP\",\"enable\":true,\"followRedirects\":true,\"useEnvironment\":\"ec29256c-9523-48ff-b257-755f5daccb60\",\"connectTimeout\":\"60000\",\"hashTree\":[{\"jsr223\":[],\"resourceId\":\"f318347e-2a8f-4bbe-9753-506156d44656\",\"mockEnvironment\":false,\"document\":{\"data\":{\"xml\":[],\"json\":[],\"xmlFollowAPI\":\"false\",\"jsonFollowAPI\":\"false\"},\"enable\":true,\"type\":\"JSON\"},\"xpath2\":[],\"active\":false,\"index\":1,\"jsonPath\":[],\"type\":\"Assertions\",\"duration\":{\"valid\":false,\"enable\":true,\"type\":\"Duration\",\"value\":0},\"regex\":[],\"enable\":true,\"hashTree\":[],\"id\":\"aaa65613-b39c-dc42-852d-17e47366c6cb\",\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.assertions.MsAssertions\",\"parentIndex\":\"2_1\",\"checkBox\":false,\"isLeaf\":true}],\"id\":\"ab259fed-5328-71f7-8079-e05783a82499\",\"responseTimeout\":\"60000\",\"headers\":[{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"Content-Type\",\"urlEncode\":false,\"value\":\"application/json\",\"required\":true},{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"CSRF-TOKEN\",\"urlEncode\":false,\"value\":\"${csrfToken}\",\"required\":true},{\"valid\":true,\"file\":false,\"enable\":true,\"name\":\"Cookie\",\"urlEncode\":false,\"value\":\"${Cookie}\",\"required\":true},{\"valid\":false,\"file\":false,\"enable\":true,\"urlEncode\":false,\"required\":true}],\"rest\":[{\"valid\":false,\"file\":false,\"enable\":true,\"type\":\"text\",\"contentType\":\"text/plain\",\"urlEncode\":false,\"required\":false}],\"mockEnvironment\":false,\"method\":\"POST\",\"active\":true,\"index\":2,\"url\":\"\",\"customizeReq\":false,\"referenced\":\"Copy\",\"domain\":\"https://www.jd.com\",\"name\":\"创建功能用例\",\"isRefEnvironment\":true,\"arguments\":[{\"valid\":false,\"file\":false,\"enable\":true,\"type\":\"text\",\"contentType\":\"text/plain\",\"urlEncode\":false,\"required\":false}],\"projectId\":\"a55ec10b-53ec-11ec-8069-0242ac1e0a04\",\"clazzName\":\"io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy\",\"doMultipartPost\":false,\"parentIndex\":2,\"requestResult\":[{\"responseResult\":{}}],\"checkBox\":false,\"isBatchProcess\":false,\"isLeaf\":true,\"preSize\":0,\"postSize\":0,\"ruleSize\":0}]}"; + JSONObject element = JSON.parseObject(s, Feature.DisableSpecialKeyDetect); + System.out.println(element); + } } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReferenceIdService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReferenceIdService.java index 73433dacbe..b0e5015e73 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReferenceIdService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReferenceIdService.java @@ -2,6 +2,7 @@ package io.metersphere.api.service; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import io.metersphere.base.domain.ApiScenarioReferenceId; import io.metersphere.base.domain.ApiScenarioReferenceIdExample; import io.metersphere.base.domain.ApiScenarioWithBLOBs; @@ -55,7 +56,7 @@ public class ApiScenarioReferenceIdService { this.deleteByScenarioId(scenario.getId()); Map referenceIdMap = new HashMap<>(); if (StringUtils.isNotEmpty(scenario.getScenarioDefinition())) { - JSONObject jsonObject = JSONObject.parseObject(scenario.getScenarioDefinition()); + JSONObject jsonObject = JSONObject.parseObject(scenario.getScenarioDefinition(), Feature.DisableSpecialKeyDetect); if (!jsonObject.containsKey(MsHashTreeService.HASH_TREE)) { return; } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java index 5fee5456cc..60386f0aa6 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java @@ -3,6 +3,7 @@ package io.metersphere.api.service; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import io.metersphere.api.dto.ApiScenarioReportDTO; import io.metersphere.api.dto.RequestResultExpandDTO; import io.metersphere.api.dto.StepTreeDTO; @@ -84,7 +85,7 @@ public class ApiScenarioReportStructureService { } public static StepTreeDTO dataFormatting(ApiScenarioWithBLOBs apiScenario, String reportType) { - JSONObject element = JSON.parseObject(apiScenario.getScenarioDefinition()); + JSONObject element = JSON.parseObject(apiScenario.getScenarioDefinition(), Feature.DisableSpecialKeyDetect); StepTreeDTO dto = null; if (element != null && element.getBoolean("enable")) { element = getRefElement(element); @@ -112,7 +113,7 @@ public class ApiScenarioReportStructureService { if (StringUtils.equals(element.getString("type"), "scenario")) { ApiScenarioWithBLOBs scenarioWithBLOBs = CommonBeanFactory.getBean(ApiScenarioMapper.class).selectByPrimaryKey(element.getString("id")); if (scenarioWithBLOBs != null) { - return JSON.parseObject(scenarioWithBLOBs.getScenarioDefinition()); + return JSON.parseObject(scenarioWithBLOBs.getScenarioDefinition(),Feature.DisableSpecialKeyDetect); } } } @@ -246,18 +247,18 @@ public class ApiScenarioReportStructureService { if (reportResults.size() > 1) { for (int i = 0; i < reportResults.size(); i++) { if (i == 0) { - dto.setValue(JSON.parseObject(new String(reportResults.get(i).getContent(), StandardCharsets.UTF_8), RequestResult.class)); + dto.setValue(JSON.parseObject(new String(reportResults.get(i).getContent(), StandardCharsets.UTF_8), RequestResult.class,Feature.DisableSpecialKeyDetect)); dto.setErrorCode(reportResults.get(0).getErrorCode()); } else { StepTreeDTO step = new StepTreeDTO(dto.getLabel(), UUID.randomUUID().toString(), dto.getType(), (i + 1)); - step.setValue(JSON.parseObject(new String(reportResults.get(i).getContent(), StandardCharsets.UTF_8), RequestResult.class)); + step.setValue(JSON.parseObject(new String(reportResults.get(i).getContent(), StandardCharsets.UTF_8), RequestResult.class,Feature.DisableSpecialKeyDetect)); step.setErrorCode(reportResults.get(i).getErrorCode()); dtoList.add(step); } } } else { String content = new String(reportResults.get(0).getContent(), StandardCharsets.UTF_8); - dto.setValue(JSON.parseObject(content, RequestResult.class)); + dto.setValue(JSON.parseObject(content, RequestResult.class,Feature.DisableSpecialKeyDetect)); dto.setErrorCode(reportResults.get(0).getErrorCode()); } } @@ -385,10 +386,10 @@ public class ApiScenarioReportStructureService { BeanUtils.copyBean(vo, item); if (StringUtils.isNotEmpty(item.getContent())) { try { - RequestResultExpandDTO resultExpandDTO = JSON.parseObject(item.getContent(), RequestResultExpandDTO.class); + RequestResultExpandDTO resultExpandDTO = JSON.parseObject(item.getContent(), RequestResultExpandDTO.class,Feature.DisableSpecialKeyDetect); vo.setRequestResult(resultExpandDTO); } catch (Exception e) { - vo.setRequestResult(JSON.parseObject(item.getContent(), RequestResult.class)); + vo.setRequestResult(JSON.parseObject(item.getContent(), RequestResult.class,Feature.DisableSpecialKeyDetect)); } if (vo.getRequestResult() != null) { vo.setPassAssertions(vo.getRequestResult().getPassAssertions()); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index 1e9c0a97d3..9b86bdf573 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -2,6 +2,7 @@ package io.metersphere.api.service; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import io.metersphere.api.dto.ApiCaseEditRequest; @@ -705,7 +706,7 @@ public class ApiTestCaseService { ApiTestCaseMapper batchMapper = sqlSession.getMapper(ApiTestCaseMapper.class); bloBs.forEach(apiTestCase -> { - JSONObject req = JSON.parseObject(apiTestCase.getRequest()); + JSONObject req = JSON.parseObject(apiTestCase.getRequest(), Feature.DisableSpecialKeyDetect); req.put("useEnvironment", request.getEnvId()); String requestStr = JSON.toJSONString(req); apiTestCase.setRequest(requestStr); @@ -727,9 +728,9 @@ public class ApiTestCaseService { ApiTestCaseMapper batchMapper = sqlSession.getMapper(ApiTestCaseMapper.class); bloBs.forEach(apiTestCase -> { - MsHTTPSamplerProxy req = JSON.parseObject(apiTestCase.getRequest(), MsHTTPSamplerProxy.class); + MsHTTPSamplerProxy req = JSON.parseObject(apiTestCase.getRequest(), MsHTTPSamplerProxy.class,Feature.DisableSpecialKeyDetect); try { - JSONObject element = JSON.parseObject(apiTestCase.getRequest()); + JSONObject element = JSON.parseObject(apiTestCase.getRequest(),Feature.DisableSpecialKeyDetect); ElementUtil.dataFormatting(element); if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) { diff --git a/backend/src/main/java/io/metersphere/api/service/MsHashTreeService.java b/backend/src/main/java/io/metersphere/api/service/MsHashTreeService.java index 154d343766..f2f3427ccc 100644 --- a/backend/src/main/java/io/metersphere/api/service/MsHashTreeService.java +++ b/backend/src/main/java/io/metersphere/api/service/MsHashTreeService.java @@ -3,6 +3,7 @@ package io.metersphere.api.service; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import io.metersphere.api.dto.automation.ApiScenarioDTO; import io.metersphere.api.dto.datacount.ApiMethodUrlDTO; import io.metersphere.api.dto.definition.ApiDefinitionResult; @@ -77,7 +78,7 @@ public class MsHashTreeService { if (refType.equals(CASE)) { ApiTestCaseWithBLOBs bloBs = apiTestCaseService.get(object.getString(ID)); if (bloBs != null) { - object = JSON.parseObject(bloBs.getRequest()); + object = JSON.parseObject(bloBs.getRequest(), Feature.DisableSpecialKeyDetect); object.put(ID, bloBs.getId()); object.put(NAME, bloBs.getName()); hashTree.set(i, object); @@ -85,14 +86,14 @@ public class MsHashTreeService { } else { ApiScenarioWithBLOBs bloBs = apiScenarioMapper.selectByPrimaryKey(object.getString(ID)); if (bloBs != null) { - object = JSON.parseObject(bloBs.getScenarioDefinition()); + object = JSON.parseObject(bloBs.getScenarioDefinition(),Feature.DisableSpecialKeyDetect); hashTree.set(i, object); } } } else if (SCENARIO.equals(object.getString(TYPE))) { ApiScenarioWithBLOBs bloBs = apiScenarioMapper.selectByPrimaryKey(object.getString(ID)); if (bloBs != null) { - object = JSON.parseObject(bloBs.getScenarioDefinition()); + object = JSON.parseObject(bloBs.getScenarioDefinition(),Feature.DisableSpecialKeyDetect); hashTree.set(i, object); } } @@ -182,7 +183,7 @@ public class MsHashTreeService { ApiTestCaseInfo apiTestCase = apiTestCaseService.get(element.getString(ID)); if (apiTestCase != null) { if (StringUtils.equalsIgnoreCase(element.getString(REFERENCED), REF)) { - JSONObject refElement = JSON.parseObject(apiTestCase.getRequest()); + JSONObject refElement = JSON.parseObject(apiTestCase.getRequest(),Feature.DisableSpecialKeyDetect); ElementUtil.dataFormatting(refElement); JSONArray array = refElement.getJSONArray(HASH_TREE); ElementUtil.copyBean(element, refElement); @@ -255,7 +256,7 @@ public class MsHashTreeService { ? element.getBoolean(VARIABLE_ENABLE) : true; if (StringUtils.equalsIgnoreCase(element.getString(REFERENCED), REF)) { - element = JSON.parseObject(scenarioWithBLOBs.getScenarioDefinition()); + element = JSON.parseObject(scenarioWithBLOBs.getScenarioDefinition(),Feature.DisableSpecialKeyDetect); element.put(REFERENCED, REF); element.put(NAME, scenarioWithBLOBs.getName()); } diff --git a/backend/src/main/java/io/metersphere/log/aspect/MsLogAspect.java b/backend/src/main/java/io/metersphere/log/aspect/MsLogAspect.java index c28e9d93dc..dfaa2ee512 100644 --- a/backend/src/main/java/io/metersphere/log/aspect/MsLogAspect.java +++ b/backend/src/main/java/io/metersphere/log/aspect/MsLogAspect.java @@ -1,10 +1,10 @@ package io.metersphere.log.aspect; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.parser.Feature; import io.metersphere.base.domain.OperatingLogWithBLOBs; import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.SessionUtils; -import io.metersphere.i18n.Translator; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.log.service.OperatingLogService; import io.metersphere.log.utils.ReflexObjectUtil; @@ -188,7 +188,7 @@ public class MsLogAspect { String content = expression.getValue(context, String.class); try { if (StringUtils.isNotEmpty(content)) { - OperatingLogDetails details = JSON.parseObject(content, OperatingLogDetails.class); + OperatingLogDetails details = JSON.parseObject(content, OperatingLogDetails.class, Feature.DisableSpecialKeyDetect); if (StringUtils.isNotEmpty(details.getProjectId())) { msOperLog.setProjectId(details.getProjectId()); } @@ -199,7 +199,7 @@ public class MsLogAspect { msOperLog.setCreateUser(details.getCreateUser()); } if (StringUtils.isNotEmpty(content) && StringUtils.isNotEmpty(msLog.beforeValue())) { - OperatingLogDetails details = JSON.parseObject(content, OperatingLogDetails.class); + OperatingLogDetails details = JSON.parseObject(content, OperatingLogDetails.class,Feature.DisableSpecialKeyDetect); List columns = ReflexObjectUtil.compared(JSON.parseObject(msLog.beforeValue(), OperatingLogDetails.class), details, msLog.module()); details.setColumns(columns); msOperLog.setOperContent(JSON.toJSONString(details));