From 7b1ad66eb49abd3d5bba045e6e0476052efda875 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 1 Apr 2021 21:27:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=98=B6=E6=AE=B5?= =?UTF-8?q?=E5=8A=A0=E5=8E=8B=E5=8A=9B=E7=9A=84=E9=A2=84=E8=AE=A1=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E6=97=B6=E9=97=B4=E8=AE=A1=E7=AE=97=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parse/xml/reader/jmx/JmeterDocumentParser.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java index 790be02d19..3b9e263ae2 100644 --- a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java +++ b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java @@ -824,12 +824,22 @@ public class JmeterDocumentParser implements DocumentParser { enabled = o.toString(); } + Object durations = context.getProperty("duration"); + String duration = "2"; + if (durations instanceof List) { + Object o = ((List) durations).get(0); + ((List) durations).remove(0); + duration = o.toString(); + } + switch (unit) { case "M": + duration = String.valueOf(Long.parseLong(duration) * 60); hold = String.valueOf(Long.parseLong(hold) * 60); rampUp = String.valueOf(Long.parseLong(rampUp) * 60); break; case "H": + duration = String.valueOf(Long.parseLong(duration) * 60 * 60); hold = String.valueOf(Long.parseLong(hold) * 60 * 60); rampUp = String.valueOf(Long.parseLong(rampUp) * 60 * 60); break; @@ -837,7 +847,7 @@ public class JmeterDocumentParser implements DocumentParser { break; } // 处理预计结束时间 - processExpectedEndTime(hold); + processExpectedEndTime(duration); threadGroup.setAttribute("enabled", enabled); if (BooleanUtils.toBoolean(deleted)) {