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 0af5537b3d..7b5cc8c44d 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
@@ -594,6 +594,81 @@ public class JmeterDocumentParser implements DocumentParser {
if (!hashTree.hasChildNodes()) {
MSException.throwException(Translator.get("jmx_content_valid"));
}
+ Object tgTypes = context.getProperty("tgType");
+ String tgType = "ThreadGroup";
+ if (tgTypes instanceof List) {
+ Object o = ((List>) tgTypes).get(0);
+ ((List>) tgTypes).remove(0);
+ tgType = o.toString();
+ }
+ if (StringUtils.equals(tgType, THREAD_GROUP)) {
+ processBaseThreadGroup(threadGroup);
+ }
+ if (StringUtils.equals(tgType, CONCURRENCY_THREAD_GROUP)) {
+ processConcurrencyThreadGroup(threadGroup);
+ }
+
+ }
+
+ private void processBaseThreadGroup(Element threadGroup) {
+ /*
+
+ continue
+
+ false
+ 1
+
+ 1
+ 1
+ false
+
+
+ true
+
+ */
+ removeChildren(threadGroup);
+ Document document = threadGroup.getOwnerDocument();
+ Object targetLevels = context.getProperty("TargetLevel");
+ String threads = "10";
+ if (targetLevels instanceof List) {
+ Object o = ((List>) targetLevels).get(0);
+ ((List>) targetLevels).remove(0);
+ threads = o.toString();
+ }
+ Object rampUps = context.getProperty("RampUp");
+ String rampUp = "1";
+ if (rampUps instanceof List) {
+ Object o = ((List>) rampUps).get(0);
+ ((List>) rampUps).remove(0);
+ rampUp = o.toString();
+ }
+ Object holds = context.getProperty("Hold");
+ String hold = "2";
+ if (holds instanceof List) {
+ Object o = ((List>) holds).get(0);
+ ((List>) holds).remove(0);
+ hold = o.toString();
+ }
+ Element elementProp = document.createElement("elementProp");
+ elementProp.setAttribute("name", "ThreadGroup.main_controller");
+ elementProp.setAttribute("elementType", "LoopController");
+ elementProp.setAttribute("guiclass", "LoopControlPanel");
+ elementProp.setAttribute("testclass", "LoopController");
+ elementProp.setAttribute("testname", "Loop Controller");
+ elementProp.setAttribute("enabled", "true");
+ elementProp.appendChild(createBoolProp(document, "LoopController.continue_forever", false));
+ elementProp.appendChild(createStringProp(document, "LoopController.loops", "-1"));
+ threadGroup.appendChild(elementProp);
+ threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue"));
+ threadGroup.appendChild(createStringProp(document, "ThreadGroup.num_threads", threads));
+ threadGroup.appendChild(createStringProp(document, "ThreadGroup.ramp_time", rampUp));
+ threadGroup.appendChild(createStringProp(document, "ThreadGroup.duration", hold));
+ threadGroup.appendChild(createStringProp(document, "ThreadGroup.delay", "0"));
+ threadGroup.appendChild(createBoolProp(document, "ThreadGroup.scheduler", true));
+ threadGroup.appendChild(createBoolProp(document, "ThreadGroup.same_user_on_next_iteration", true));
+ }
+
+ private void processConcurrencyThreadGroup(Element threadGroup) {
// 重命名 tagName
Document document = threadGroup.getOwnerDocument();
document.renameNode(threadGroup, threadGroup.getNamespaceURI(), CONCURRENCY_THREAD_GROUP);
diff --git a/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue b/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue
index d78dbf9670..076c0df6a5 100644
--- a/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue
+++ b/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue
@@ -46,7 +46,9 @@
- {{ row.name.substring(row.name.lastIndexOf(".") + 1) }}
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -131,6 +145,7 @@ import MsChart from "@/business/components/common/chart/MsChart";
import {findThreadGroup} from "@/business/components/performance/test/model/ThreadGroup";
const HANDLER = "handler";
+const THREAD_GROUP_TYPE = "tgType";
const TARGET_LEVEL = "TargetLevel";
const RAMP_UP = "RampUp";
const ITERATE_RAMP_UP = "iterateRampUpTime";
@@ -265,6 +280,9 @@ export default {
case HANDLER:
this.threadGroups[i].handler = item.value;
break;
+ case THREAD_GROUP_TYPE:
+ this.threadGroups[i].tgType = item.value;
+ break;
default:
break;
}
@@ -535,6 +553,7 @@ export default {
{key: ITERATE_RAMP_UP, value: this.threadGroups[i].iterateRampUp},
{key: ENABLED, value: this.threadGroups[i].enabled},
{key: DELETED, value: this.threadGroups[i].deleted},
+ {key: THREAD_GROUP_TYPE, value: this.threadGroups[i].tgType},
]);
}
return result;
diff --git a/frontend/src/business/components/performance/test/model/ThreadGroup.js b/frontend/src/business/components/performance/test/model/ThreadGroup.js
index d97368e831..b4656c8af5 100644
--- a/frontend/src/business/components/performance/test/model/ThreadGroup.js
+++ b/frontend/src/business/components/performance/test/model/ThreadGroup.js
@@ -29,6 +29,8 @@ export function findThreadGroup(jmxContent, handler) {
tg.deleted = 'false';
tg.handler = handler;
tg.enabled = tg.attributes.enabled;
+ tg.tgType = tg.name;
+ tg.threadType = 'DURATION';
})
return threadGroups;
}