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 34a683f4b0..52f204b3aa 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 @@ -100,26 +100,13 @@ public class JmeterDocumentParser implements DocumentParser { processCheckoutBackendListener(ele); processCheckoutAutoStopListener(ele); } else if (nodeNameEquals(ele, CONCURRENCY_THREAD_GROUP)) { - processThreadGroup(ele); + processThreadType(ele); processThreadGroupName(ele); processCheckoutTimer(ele); } else if (nodeNameEquals(ele, VARIABLE_THROUGHPUT_TIMER)) { processVariableThroughputTimer(ele); } else if (nodeNameEquals(ele, THREAD_GROUP)) { - Object threadType = context.getProperty("threadType"); - if (threadType instanceof List) { - Object o = ((List) threadType).get(0); - ((List) threadType).remove(0); - if ("DURATION".equals(o)) { - processThreadGroup(ele); - } - if ("ITERATION".equals(o)) { - processIterationThreadGroup(ele); - } - } else { - processThreadGroup(ele); - } - + processThreadType(ele); processThreadGroupName(ele); processCheckoutTimer(ele); } else if (nodeNameEquals(ele, BACKEND_LISTENER)) { @@ -147,6 +134,22 @@ public class JmeterDocumentParser implements DocumentParser { } } + private void processThreadType(Element ele) { + Object threadType = context.getProperty("threadType"); + if (threadType instanceof List) { + Object o = ((List) threadType).get(0); + ((List) threadType).remove(0); + if ("DURATION".equals(o)) { + processThreadGroup(ele); + } + if ("ITERATION".equals(o)) { + processIterationThreadGroup(ele); + } + } else { + processThreadGroup(ele); + } + } + private void processAutoStopListener(Element autoStopListener) { Object autoStopDelays = context.getProperty("autoStopDelay"); String autoStopDelay = "30"; @@ -695,6 +698,10 @@ public class JmeterDocumentParser implements DocumentParser { } private void processBaseThreadGroup(Element threadGroup) { + Document document = threadGroup.getOwnerDocument(); + document.renameNode(threadGroup, threadGroup.getNamespaceURI(), THREAD_GROUP); + threadGroup.setAttribute("guiclass", THREAD_GROUP + "Gui"); + threadGroup.setAttribute("testclass", THREAD_GROUP); /* continue @@ -711,7 +718,6 @@ public class JmeterDocumentParser implements DocumentParser { */ removeChildren(threadGroup); - Document document = threadGroup.getOwnerDocument(); Object targetLevels = context.getProperty("TargetLevel"); String threads = "10"; if (targetLevels instanceof List) { @@ -893,6 +899,10 @@ public class JmeterDocumentParser implements DocumentParser { } private void processIterationThreadGroup(Element threadGroup) { + Document document = threadGroup.getOwnerDocument(); + document.renameNode(threadGroup, threadGroup.getNamespaceURI(), THREAD_GROUP); + threadGroup.setAttribute("guiclass", THREAD_GROUP + "Gui"); + threadGroup.setAttribute("testclass", THREAD_GROUP); // 检查 threadgroup 后面的hashtree是否为空 Node hashTree = threadGroup.getNextSibling(); while (!(hashTree instanceof Element)) { @@ -901,8 +911,6 @@ public class JmeterDocumentParser implements DocumentParser { if (!hashTree.hasChildNodes()) { MSException.throwException(Translator.get("jmx_content_valid")); } - // 重命名 tagName - Document document = threadGroup.getOwnerDocument(); removeChildren(threadGroup); // 选择按照迭代次数处理线程组 diff --git a/backend/src/main/java/io/metersphere/service/FileService.java b/backend/src/main/java/io/metersphere/service/FileService.java index 74c095bc0f..b0f574b6be 100644 --- a/backend/src/main/java/io/metersphere/service/FileService.java +++ b/backend/src/main/java/io/metersphere/service/FileService.java @@ -3,7 +3,6 @@ package io.metersphere.service; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.FileContentMapper; import io.metersphere.base.mapper.FileMetadataMapper; -import io.metersphere.base.mapper.LoadTestFileMapper; import io.metersphere.base.mapper.TestCaseFileMapper; import io.metersphere.commons.constants.FileType; import io.metersphere.commons.exception.MSException; @@ -27,8 +26,6 @@ public class FileService { @Resource private FileMetadataMapper fileMetadataMapper; @Resource - private LoadTestFileMapper loadTestFileMapper; - @Resource private FileContentMapper fileContentMapper; @Resource private TestCaseFileMapper testCaseFileMapper; @@ -61,23 +58,10 @@ public class FileService { FileContentExample example2 = new FileContentExample(); example2.createCriteria().andFileIdIn(ids); fileContentMapper.deleteByExample(example2); - - LoadTestFileExample example3 = new LoadTestFileExample(); - example3.createCriteria().andFileIdIn(ids); - loadTestFileMapper.deleteByExample(example3); } public void deleteFileRelatedByIds(List ids) { - if (CollectionUtils.isEmpty(ids)) { - return; - } - FileMetadataExample example = new FileMetadataExample(); - example.createCriteria().andIdIn(ids); - fileMetadataMapper.deleteByExample(example); - - FileContentExample example2 = new FileContentExample(); - example2.createCriteria().andFileIdIn(ids); - fileContentMapper.deleteByExample(example2); + deleteFileByIds(ids); } public FileMetadata saveFile(MultipartFile file, String projectId, String fileId) {