refactor(性能测试): 测试计划调整参数后计算粒度修改

This commit is contained in:
Captain.B 2021-09-23 19:02:21 +08:00 committed by 刘瑞斌
parent 4091dc8fff
commit f6a3b4d8dc
1 changed files with 2 additions and 3 deletions

View File

@ -826,13 +826,12 @@ public class PerformanceTestService {
Integer granularity = CommonBeanFactory.getBean(JmeterProperties.class).getReport().getGranularity(); Integer granularity = CommonBeanFactory.getBean(JmeterProperties.class).getReport().getGranularity();
try { try {
LoadTestReportWithBLOBs report = loadTestReportMapper.selectByPrimaryKey(reportId); LoadTestReportWithBLOBs report = loadTestReportMapper.selectByPrimaryKey(reportId);
LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(report.getTestId()); JSONObject advancedConfig = JSON.parseObject(report.getAdvancedConfiguration());
JSONObject advancedConfig = JSON.parseObject(loadTest.getAdvancedConfiguration());
if (advancedConfig.getInteger("granularity") != null) { if (advancedConfig.getInteger("granularity") != null) {
return advancedConfig.getInteger("granularity") * 1000;// 单位是ms return advancedConfig.getInteger("granularity") * 1000;// 单位是ms
} }
AtomicReference<Integer> maxDuration = new AtomicReference<>(0); AtomicReference<Integer> maxDuration = new AtomicReference<>(0);
List<List<JSONObject>> pressureConfigLists = JSON.parseObject(loadTest.getLoadConfiguration(), new TypeReference<List<List<JSONObject>>>() { List<List<JSONObject>> pressureConfigLists = JSON.parseObject(report.getLoadConfiguration(), new TypeReference<List<List<JSONObject>>>() {
}); });
// 按照最长的执行时间来确定 // 按照最长的执行时间来确定
pressureConfigLists.forEach(pcList -> { pressureConfigLists.forEach(pcList -> {