This commit is contained in:
chenjianxing 2021-02-04 17:44:32 +08:00
commit 91e1215d65
5 changed files with 54 additions and 89 deletions

View File

@ -87,7 +87,7 @@ public class MsScenario extends MsTestElement {
}
// 场景变量和环境变量
tree.add(arguments(config));
this.addCsvDataSet(tree, variables);
//this.addCsvDataSet(tree, variables);
this.addCounter(tree, variables);
this.addRandom(tree, variables);
if (CollectionUtils.isNotEmpty(hashTree)) {

View File

@ -196,6 +196,8 @@ public abstract class MsTestElement {
csvDataSet.setProperty("filename", BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName());
}
csvDataSet.setIgnoreFirstLine(false);
csvDataSet.setRecycle(true);
csvDataSet.setProperty("recycle", true);
csvDataSet.setProperty("delimiter", item.getDelimiter());
csvDataSet.setComment(StringUtils.isEmpty(item.getDescription()) ? "" : item.getDescription());
tree.add(csvDataSet);

View File

@ -171,12 +171,16 @@ public class HistoricalDataUpgradeService {
element = new MsJDBCSampler();
SqlRequest request1 = (SqlRequest) request;
BeanUtils.copyBean(element, request1);
EnvironmentDTO dto = environmentDTOMap.get(request1.getDataSource());
if (dto != null) {
((MsJDBCSampler) element).setEnvironmentId(dto.getEnvironmentId());
((MsJDBCSampler) element).setDataSourceId(dto.getDatabaseConfig().getId());
((MsJDBCSampler) element).setDataSource(dto.getDatabaseConfig());
}
if (CollectionUtils.isEmpty(request1.getVariables())) {
((MsJDBCSampler) element).setVariables(new ArrayList<>());
}
element.setType("JDBCSampler");
}
if (request instanceof TCPRequest) {

View File

@ -1,42 +0,0 @@
package io.metersphere.performance.job;
import com.fit2cloud.quartz.anno.QuartzScheduled;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.LoadTestReport;
import io.metersphere.base.domain.LoadTestReportDetailExample;
import io.metersphere.base.domain.LoadTestReportExample;
import io.metersphere.base.mapper.LoadTestReportDetailMapper;
import io.metersphere.base.mapper.LoadTestReportMapper;
import io.metersphere.commons.constants.PerformanceTestStatus;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
@Component
public class LoadTestReportDetailCleanJob {
@Resource
private LoadTestReportDetailMapper loadTestReportDetailMapper;
@Resource
private LoadTestReportMapper loadTestReportMapper;
/**
* 每天处理一次清理任务
*/
@QuartzScheduled(cron = "0 0 1 * * ?")
public void cleanCompletedTestDetail() {
LoadTestReportExample example = new LoadTestReportExample();
example.createCriteria().andStatusEqualTo(PerformanceTestStatus.Completed.name());
long count = loadTestReportMapper.countByExample(example);
for (int i = 0; i < count / 10; i++) {
PageHelper.startPage(i, 10);
List<LoadTestReport> loadTestReports = loadTestReportMapper.selectByExample(example);
loadTestReports.forEach(report -> {
// 清理文件
LoadTestReportDetailExample example2 = new LoadTestReportDetailExample();
example2.createCriteria().andReportIdEqualTo(report.getId());
loadTestReportDetailMapper.deleteByExample(example2);
});
}
}
}

View File

@ -469,11 +469,12 @@ export default {
},
},
watch: {
'report.testId': {
report: {
handler() {
this.getJmxContent();
},
}
deep: true
},
}
}
</script>