From 3fe9a65c9b85a3164a3766c64bab25fd4d96e1a1 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 12 Oct 2021 17:25:41 +0800 Subject: [PATCH] =?UTF-8?q?fix=20(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=89=B9=E9=87=8F=E6=89=A7=E8=A1=8C=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E8=B5=84=E6=BA=90=E6=B1=A0=E6=89=BE=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/metersphere/api/jmeter/JMeterService.java | 4 ++-- .../io/metersphere/api/service/ApiAutomationService.java | 8 +++++++- .../api/service/task/SerialScenarioExecTask.java | 8 +++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java b/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java index b063a893d9..6c597ccce4 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java @@ -155,9 +155,9 @@ public class JMeterService { if (baseInfo != null) { platformUrl = baseInfo.getUrl(); } - platformUrl += "/api/jmeter/download?testId=" + testId + "&reportId=" + reportId + "&testPlanScenarioId" + "&runMode=" + runMode; + platformUrl += "/api/jmeter/download?testId=" + testId + "&reportId=" + reportId + "&runMode=" + runMode; if (StringUtils.isNotEmpty(testPlanScenarioId)) { - platformUrl += "=" + testPlanScenarioId; + platformUrl += "&testPlanScenarioId=" + testPlanScenarioId; } runRequest.setUrl(platformUrl); runRequest.setRunMode(runMode); 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 4c382ffd53..facf109096 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -1253,7 +1253,13 @@ public class ApiAutomationService { for (String reportId : executeQueue.keySet()) { if (request.getConfig() != null && StringUtils.isNotEmpty(request.getConfig().getResourcePoolId())) { - jMeterService.runTest(executeQueue.get(reportId).getTestId(), reportId, request.getRunMode(), request.getPlanScenarioId(), request.getConfig()); + String testPlanScenarioId = ""; + if (request.getScenarioTestPlanIdMap() != null && request.getScenarioTestPlanIdMap().containsKey(executeQueue.get(reportId).getTestId())) { + testPlanScenarioId = request.getScenarioTestPlanIdMap().get(executeQueue.get(reportId).getTestId()); + } else { + testPlanScenarioId = request.getPlanScenarioId(); + } + jMeterService.runTest(executeQueue.get(reportId).getTestId(), reportId, request.getRunMode(), testPlanScenarioId, request.getConfig()); } else { jMeterService.runLocal(reportId, executeQueue.get(reportId).getHashTree(), TriggerMode.BATCH.name().equals(request.getTriggerMode()) ? TriggerMode.BATCH.name() : request.getReportId(), request.getRunMode()); diff --git a/backend/src/main/java/io/metersphere/api/service/task/SerialScenarioExecTask.java b/backend/src/main/java/io/metersphere/api/service/task/SerialScenarioExecTask.java index b4b80e058e..520a42b9a4 100644 --- a/backend/src/main/java/io/metersphere/api/service/task/SerialScenarioExecTask.java +++ b/backend/src/main/java/io/metersphere/api/service/task/SerialScenarioExecTask.java @@ -38,7 +38,13 @@ public class SerialScenarioExecTask implements Callable { return null; } if (request.getConfig() != null && StringUtils.isNotBlank(request.getConfig().getResourcePoolId())) { - jMeterService.runTest(runModeDataDTO.getTestId(), runModeDataDTO.getReport().getId(), request.getRunMode(), request.getPlanScenarioId(), request.getConfig()); + String testPlanScenarioId = ""; + if (request.getScenarioTestPlanIdMap() != null && request.getScenarioTestPlanIdMap().containsKey(runModeDataDTO.getTestId())) { + testPlanScenarioId = request.getScenarioTestPlanIdMap().get(runModeDataDTO.getTestId()); + } else { + testPlanScenarioId = request.getPlanScenarioId(); + } + jMeterService.runTest(runModeDataDTO.getTestId(), runModeDataDTO.getReport().getId(), request.getRunMode(), testPlanScenarioId, request.getConfig()); } else { jMeterService.runLocal(runModeDataDTO.getReport().getId(), runModeDataDTO.getHashTree(), TriggerMode.BATCH.name().equals(request.getTriggerMode()) ? TriggerMode.BATCH.name() : request.getReportId(), request.getRunMode()); }