From c85cd23fc0c587a46e32880f4e6b172d5eab3056 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 15 Dec 2020 14:21:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E9=83=A8=E5=88=86=E7=BC=BA=E9=99=B7=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/ApiTestCaseController.java | 6 ++ .../dto/definition/request/MsScenario.java | 8 +-- .../dto/definition/request/MsTestElement.java | 3 +- .../request/auth/MsAuthManager.java | 18 ++--- .../configurations/MsHeaderManager.java | 2 +- .../request/processors/MsJSR223Processor.java | 4 +- .../post/MsJSR223PostProcessor.java | 4 +- .../processors/pre/MsJSR223PreProcessor.java | 4 +- .../request/sampler/MsHTTPSamplerProxy.java | 32 ++++----- .../request/sampler/MsJDBCSampler.java | 16 ++--- .../request/sampler/MsTCPSampler.java | 48 ++++++------- .../request/timer/MsConstantTimer.java | 4 +- .../api/service/ApiTestCaseService.java | 2 +- backend/src/main/java/io/metersphere/xpack | 2 +- .../api/automation/report/ApiReportDetail.vue | 12 ++-- .../report/components/RequestResult.vue | 15 ++++- .../api/automation/scenario/AddTag.vue | 8 +-- .../api/automation/scenario/ApiComponent.vue | 4 +- .../automation/scenario/EditApiScenario.vue | 67 ++++++++----------- .../components/response/ResponseResult.vue | 6 +- 20 files changed, 136 insertions(+), 129 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java b/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java index 7d4f44855b..a31ccdeab0 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java @@ -4,6 +4,7 @@ import io.metersphere.api.dto.definition.ApiTestCaseRequest; import io.metersphere.api.dto.definition.ApiTestCaseResult; import io.metersphere.api.dto.definition.SaveApiTestCaseRequest; import io.metersphere.api.service.ApiTestCaseService; +import io.metersphere.base.domain.ApiTestCaseWithBLOBs; import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.SessionUtils; import org.apache.shiro.authz.annotation.Logical; @@ -43,4 +44,9 @@ public class ApiTestCaseController { apiTestCaseService.delete(id); } + @GetMapping("/get/{id}") + public ApiTestCaseWithBLOBs get(@PathVariable String id) { + return apiTestCaseService.get(id); + } + } 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 92290a861e..97b40aad07 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 @@ -32,16 +32,16 @@ import java.util.List; public class MsScenario extends MsTestElement { private String type = "scenario"; - @JSONField(ordinal = 10) + @JSONField(ordinal = 20) private String name; - @JSONField(ordinal = 11) + @JSONField(ordinal = 21) private String referenced; - @JSONField(ordinal = 12) + @JSONField(ordinal = 22) private String environmentId; - @JSONField(ordinal = 13) + @JSONField(ordinal = 23) private List variables; public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java index afc6f625dd..79ae051156 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java @@ -76,8 +76,9 @@ public abstract class MsTestElement { private String index; @JSONField(ordinal = 8) private boolean enable = true; - @JSONField(ordinal = 9) + private String refType ; + @JSONField(ordinal = 10) private LinkedList hashTree; // 公共环境逐层传递,如果自身有环境 以自身引用环境为准否则以公共环境作为请求环境 diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/auth/MsAuthManager.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/auth/MsAuthManager.java index 326aec4705..1fa4106320 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/auth/MsAuthManager.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/auth/MsAuthManager.java @@ -24,31 +24,31 @@ import java.util.List; @JSONType(typeName = "AuthManager") public class MsAuthManager extends MsTestElement { private String type = "AuthManager"; - @JSONField(ordinal = 10) + @JSONField(ordinal = 20) private String username; - @JSONField(ordinal = 11) + @JSONField(ordinal = 21) private String password; - @JSONField(ordinal = 12) + @JSONField(ordinal = 22) private String url; - @JSONField(ordinal = 13) + @JSONField(ordinal = 23) private String realm; - @JSONField(ordinal = 14) + @JSONField(ordinal = 24) private String verification; - @JSONField(ordinal = 15) + @JSONField(ordinal = 25) private String mechanism; - @JSONField(ordinal = 16) + @JSONField(ordinal = 26) private String encrypt; - @JSONField(ordinal = 17) + @JSONField(ordinal = 27) private String domain; - @JSONField(ordinal = 18) + @JSONField(ordinal = 28) private String environment; public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/configurations/MsHeaderManager.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/configurations/MsHeaderManager.java index 50e77d1e09..d8158136db 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/configurations/MsHeaderManager.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/configurations/MsHeaderManager.java @@ -22,7 +22,7 @@ import java.util.List; public class MsHeaderManager extends MsTestElement { private String type = "HeaderManager"; - @JSONField(ordinal = 10) + @JSONField(ordinal = 20) private List headers; public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/MsJSR223Processor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/MsJSR223Processor.java index 237636e640..da6773894a 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/MsJSR223Processor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/MsJSR223Processor.java @@ -20,10 +20,10 @@ import java.util.List; public class MsJSR223Processor extends MsTestElement { private String type = "JSR223Processor"; - @JSONField(ordinal = 10) + @JSONField(ordinal = 20) private String script; - @JSONField(ordinal = 11) + @JSONField(ordinal = 21) private String scriptLanguage; public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java index be3af32823..08ac2e12c1 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java @@ -20,10 +20,10 @@ import java.util.List; public class MsJSR223PostProcessor extends MsTestElement { private String type = "JSR223PostProcessor"; - @JSONField(ordinal = 10) + @JSONField(ordinal = 20) private String script; - @JSONField(ordinal = 11) + @JSONField(ordinal = 21) private String scriptLanguage; diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java index d8344ddf7c..7afd64dfc2 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java @@ -20,10 +20,10 @@ import java.util.List; public class MsJSR223PreProcessor extends MsTestElement { private String type = "JSR223PreProcessor"; - @JSONField(ordinal = 10) + @JSONField(ordinal = 20) private String script; - @JSONField(ordinal = 11) + @JSONField(ordinal = 21) private String scriptLanguage; public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { 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 57cecc27a0..1aeba0e999 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 @@ -40,52 +40,52 @@ import java.util.regex.Pattern; public class MsHTTPSamplerProxy extends MsTestElement { private String type = "HTTPSamplerProxy"; - @JSONField(ordinal = 10) + @JSONField(ordinal = 20) private String protocol; - @JSONField(ordinal = 11) + @JSONField(ordinal = 21) private String domain; - @JSONField(ordinal = 12) + @JSONField(ordinal = 22) private String port; - @JSONField(ordinal = 13) + @JSONField(ordinal = 23) private String method; - @JSONField(ordinal = 14) + @JSONField(ordinal = 24) private String path; - @JSONField(ordinal = 15) + @JSONField(ordinal = 25) private String connectTimeout; - @JSONField(ordinal = 16) + @JSONField(ordinal = 26) private String responseTimeout; - @JSONField(ordinal = 17) + @JSONField(ordinal = 27) private List headers; - @JSONField(ordinal = 18) + @JSONField(ordinal = 28) private Body body; - @JSONField(ordinal = 19) + @JSONField(ordinal = 29) private List rest; - @JSONField(ordinal = 20) + @JSONField(ordinal = 30) private String url; - @JSONField(ordinal = 21) + @JSONField(ordinal = 31) private boolean followRedirects; - @JSONField(ordinal = 22) + @JSONField(ordinal = 32) private boolean doMultipartPost; - @JSONField(ordinal = 23) + @JSONField(ordinal = 33) private String useEnvironment; - @JSONField(ordinal = 24) + @JSONField(ordinal = 34) private List arguments; - @JSONField(ordinal = 25) + @JSONField(ordinal = 35) private Object requestResult; public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { 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 0bcc0a6769..a943d13ccb 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 @@ -24,21 +24,21 @@ import java.util.List; public class MsJDBCSampler extends MsTestElement { // type 必须放最前面,以便能够转换正确的类 private String type = "JDBCSampler"; - @JSONField(ordinal = 10) + @JSONField(ordinal = 20) private DatabaseConfig dataSource; - @JSONField(ordinal = 11) + @JSONField(ordinal = 21) private String query; - @JSONField(ordinal = 12) + @JSONField(ordinal = 22) private long queryTimeout; - @JSONField(ordinal = 13) + @JSONField(ordinal = 23) private String resultVariable; - @JSONField(ordinal = 14) + @JSONField(ordinal = 24) private String variableNames; - @JSONField(ordinal = 15) + @JSONField(ordinal = 25) private List variables; - @JSONField(ordinal = 16) + @JSONField(ordinal = 26) private String environmentId; - @JSONField(ordinal = 17) + @JSONField(ordinal = 27) private Object requestResult; public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { 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 b3e5b92409..25515a8f03 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 @@ -20,35 +20,35 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) @JSONType(typeName = "TCPSampler") public class MsTCPSampler extends MsTestElement { - @JSONField(ordinal = 10) - private String type = "TCPSampler"; - @JSONField(ordinal = 11) - private String classname = ""; - @JSONField(ordinal = 12) - private String server = ""; - @JSONField(ordinal = 13) - private String port = ""; - @JSONField(ordinal = 14) - private String ctimeout = ""; - @JSONField(ordinal = 15) - private String timeout = ""; - @JSONField(ordinal = 16) - private boolean reUseConnection = true; - @JSONField(ordinal = 17) - private boolean nodelay; - @JSONField(ordinal = 18) - private boolean closeConnection; - @JSONField(ordinal = 19) - private String soLinger = ""; @JSONField(ordinal = 20) - private String eolByte = ""; + private String type = "TCPSampler"; @JSONField(ordinal = 21) - private String username = ""; + private String classname = ""; @JSONField(ordinal = 22) - private String password = ""; + private String server = ""; @JSONField(ordinal = 23) - private String request; + private String port = ""; @JSONField(ordinal = 24) + private String ctimeout = ""; + @JSONField(ordinal = 25) + private String timeout = ""; + @JSONField(ordinal = 26) + private boolean reUseConnection = true; + @JSONField(ordinal = 27) + private boolean nodelay; + @JSONField(ordinal = 28) + private boolean closeConnection; + @JSONField(ordinal = 29) + private String soLinger = ""; + @JSONField(ordinal = 30) + private String eolByte = ""; + @JSONField(ordinal = 31) + private String username = ""; + @JSONField(ordinal = 32) + private String password = ""; + @JSONField(ordinal = 33) + private String request; + @JSONField(ordinal = 34) private Object requestResult; public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/timer/MsConstantTimer.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/timer/MsConstantTimer.java index 64eb4b8824..490bd87588 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/timer/MsConstantTimer.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/timer/MsConstantTimer.java @@ -19,9 +19,9 @@ import java.util.List; @JSONType(typeName = "ConstantTimer") public class MsConstantTimer extends MsTestElement { private String type = "ConstantTimer"; - @JSONField(ordinal = 10) + @JSONField(ordinal = 20) private String id; - @JSONField(ordinal = 11) + @JSONField(ordinal = 21) private String delay; public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { 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 94881afbbb..fbad044c3b 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -52,7 +52,7 @@ public class ApiTestCaseService { return extApiTestCaseMapper.list(request); } - public ApiTestCase get(String id) { + public ApiTestCaseWithBLOBs get(String id) { return apiTestCaseMapper.selectByPrimaryKey(id); } diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index acb5adf44c..1fe20ba15a 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit acb5adf44cf5f4a3b512abbff1e437957a9fcfb5 +Subproject commit 1fe20ba15a7ca3fe9f77ddf866021e7c7dfe5969 diff --git a/frontend/src/business/components/api/automation/report/ApiReportDetail.vue b/frontend/src/business/components/api/automation/report/ApiReportDetail.vue index 2606122ccf..8f987d24be 100644 --- a/frontend/src/business/components/api/automation/report/ApiReportDetail.vue +++ b/frontend/src/business/components/api/automation/report/ApiReportDetail.vue @@ -11,12 +11,12 @@
- -
- -
-
+ + + + + + diff --git a/frontend/src/business/components/api/automation/report/components/RequestResult.vue b/frontend/src/business/components/api/automation/report/components/RequestResult.vue index 3bd2e6a620..81c067ed34 100644 --- a/frontend/src/business/components/api/automation/report/components/RequestResult.vue +++ b/frontend/src/business/components/api/automation/report/components/RequestResult.vue @@ -36,6 +36,13 @@ + + +
+ +
+
@@ -44,21 +51,23 @@ import MsAssertionResults from "./AssertionResults"; import MsRequestText from "./RequestText"; import MsResponseText from "./ResponseText"; + import MsRequestResultTail from "./RequestResultTail"; export default { name: "MsRequestResult", - components: {MsResponseText, MsRequestText, MsAssertionResults, MsRequestMetric}, + components: {MsResponseText, MsRequestText, MsAssertionResults, MsRequestMetric, MsRequestResultTail}, props: { request: Object, scenarioName: String, indexNumber: Number, }, data() { - return {} + return {isActive: false, requestType: undefined,} }, methods: { active() { - this.$emit("requestResult", {request: this.request, scenarioName: this.scenarioName}); + this.isActive = !this.isActive; + //this.$emit("requestResult", {request: this.request, scenarioName: this.scenarioName}); } }, } diff --git a/frontend/src/business/components/api/automation/scenario/AddTag.vue b/frontend/src/business/components/api/automation/scenario/AddTag.vue index 4bb4dd12dd..a3e20b71bd 100644 --- a/frontend/src/business/components/api/automation/scenario/AddTag.vue +++ b/frontend/src/business/components/api/automation/scenario/AddTag.vue @@ -1,5 +1,5 @@