fix(接口自动化): 修复场景转性能测试时jmx结构有问题的缺陷

修复场景转性能测试时jmx结构有问题的缺陷
This commit is contained in:
song-tianyang 2021-12-22 09:23:30 +08:00 committed by fit2-zhao
parent 052c96668e
commit 7115516bf0
5 changed files with 28 additions and 13 deletions

View File

@ -33,6 +33,7 @@ import io.metersphere.job.sechedule.ApiTestJob;
import io.metersphere.service.FileService;
import io.metersphere.service.ScheduleService;
import io.metersphere.track.service.TestCaseService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.constants.CommonConstants;
@ -43,7 +44,6 @@ import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
@ -505,14 +505,9 @@ public class APITestService {
//HTTPSamplerProxy 进行附件转化 1.elementProp里去掉路径 2elementProp->filePath获取路径并读出来
attachmentFilePathList.addAll(this.parseAttachmentFileInfo(element));
//查看是否含有RunningDebugSampler,转jmx的时候去掉
List<Element> debugSamplerElementList = element.elements("DebugSampler");
for (Element debugSampler : debugSamplerElementList) {
String testname = debugSampler.attributeValue("testname");
if (StringUtils.equalsAnyIgnoreCase(testname, RunningParamKeys.RUNNING_DEBUG_SAMPLER_NAME)) {
element.remove(debugSampler);
}
}
//检查并去掉RunningDebugSampler,转jmx的时候去掉
this.checkAndRemoveRunningDebugSampler(element);
}
//如果存在证书文件也要匹配出来
attachmentFilePathList.addAll(this.parseAttachmentFileInfo(innerHashTreeElement));
@ -551,6 +546,23 @@ public class APITestService {
return returnDTO;
}
private void checkAndRemoveRunningDebugSampler(Element element) {
List<Element> childElements = element.elements();
if (CollectionUtils.isNotEmpty(childElements)) {
if (childElements.size() > 1) {
Element checkElement = childElements.get(childElements.size() - 2);
String elementName = checkElement.attributeValue("testname");
if (StringUtils.equalsIgnoreCase(elementName, RunningParamKeys.RUNNING_DEBUG_SAMPLER_NAME)) {
Element checkHashTreeElement = childElements.get(childElements.size() - 1);
if (StringUtils.equalsIgnoreCase("hashtree", checkHashTreeElement.getName())) {
element.remove(checkHashTreeElement);
element.remove(checkElement);
}
}
}
}
}
private List<String> parseAttachmentFileInfo(Element parentHashTreeElement) {
List<String> attachmentFilePathList = new ArrayList<>();
List<Element> parentElementList = parentHashTreeElement.elements();

View File

@ -27,7 +27,7 @@
<el-card :body-style="{ padding: '0px' }" class="ms-col">
<img src="@/assets/other.png" class="image">
<div style="padding: 10px;">
<span>预留模块敬请期待</span>
<span>{{ $t('commons.report_statistics.reserved') }}</span>
<div class="bottom clearfix">
<time class="time">{{ $t('commons.report_statistics.test_case_activity') }}</time>
</div>
@ -38,7 +38,7 @@
<el-card :body-style="{ padding: '0px' }" class="ms-col">
<img src="@/assets/other.png" class="image">
<div style="padding: 10px;">
<span>预留模块敬请期待</span>
<span>{{ $t('commons.report_statistics.reserved') }}</span>
<div class="bottom clearfix">
<time class="time">{{ $t('commons.report_statistics.test_case_activity') }}</time>
</div>
@ -49,7 +49,7 @@
<el-card :body-style="{ padding: '0px' }" class="ms-col">
<img src="@/assets/other.png" class="image">
<div style="padding: 10px;">
<span>预留模块敬请期待</span>
<span>{{ $t('commons.report_statistics.reserved') }}</span>
<div class="bottom clearfix">
<time class="time">{{ $t('commons.report_statistics.test_case_activity') }}</time>
</div>
@ -60,7 +60,7 @@
<el-card :body-style="{ padding: '0px' }" class="ms-col">
<img src="@/assets/other.png" class="image">
<div style="padding: 10px;">
<span>预留模块敬请期待</span>
<span>{{ $t('commons.report_statistics.reserved') }}</span>
<div class="bottom clearfix">
<time class="time">{{ $t('commons.report_statistics.test_case_activity') }}</time>
</div>

View File

@ -314,6 +314,7 @@ export default {
default_module: "Default module",
},
report_statistics: {
reserved: "Reserved",
menu: {
project_statistics: "Project statistics",
project_report: "Project report",

View File

@ -315,6 +315,7 @@ export default {
default_module: "默认模块",
},
report_statistics: {
reserved: "预留模块敬请期待",
menu: {
project_statistics: "项目报表",
project_report: "项目报告",

View File

@ -315,6 +315,7 @@ export default {
default_module: "默認模塊",
},
report_statistics: {
reserved: "預留模塊敬請期待",
menu: {
project_statistics: "項目報表",
project_report: "項目報告",