Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0afb257184
|
@ -393,14 +393,28 @@ public class APITestController {
|
||||||
String jmxString = runRequest.getTestElement().getJmx(hashTree);
|
String jmxString = runRequest.getTestElement().getJmx(hashTree);
|
||||||
|
|
||||||
String testName = runRequest.getName();
|
String testName = runRequest.getName();
|
||||||
//将ThreadGroup的testname改为接口名称
|
|
||||||
Document doc = DocumentHelper.parseText(jmxString);// 获取可续保保单列表报文模板
|
try{
|
||||||
Element root = doc.getRootElement();
|
//将ThreadGroup的testname改为接口名称
|
||||||
Element rootHashTreeElement = root.element("hashTree");
|
Document doc = DocumentHelper.parseText(jmxString);// 获取可续保保单列表报文模板
|
||||||
Element innerHashTreeElement = rootHashTreeElement.elements("hashTree").get(0);
|
Element root = doc.getRootElement();
|
||||||
Element theadGroupElement = innerHashTreeElement.elements("ThreadGroup").get(0);
|
Element rootHashTreeElement = root.element("hashTree");
|
||||||
theadGroupElement.attribute("testname").setText(testName);
|
Element innerHashTreeElement = rootHashTreeElement.elements("hashTree").get(0);
|
||||||
jmxString = root.asXML();
|
Element theadGroupElement = innerHashTreeElement.elements("ThreadGroup").get(0);
|
||||||
|
theadGroupElement.attribute("testname").setText(testName);
|
||||||
|
|
||||||
|
List<Element> thirdHashTreeElementList =innerHashTreeElement.elements("hashTree");
|
||||||
|
for (Element element:thirdHashTreeElementList) {
|
||||||
|
List<Element> sampleProxyElementList = element.elements("HTTPSamplerProxy");
|
||||||
|
for (Element itemElement: sampleProxyElementList) {
|
||||||
|
itemElement.attribute("testname").setText(testName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jmxString = root.asXML();
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
JmxInfoDTO dto = new JmxInfoDTO();
|
JmxInfoDTO dto = new JmxInfoDTO();
|
||||||
dto.setName(runRequest.getName()+".jmx");
|
dto.setName(runRequest.getName()+".jmx");
|
||||||
|
|
|
@ -421,6 +421,53 @@ public class TestPlanReportService {
|
||||||
models.setPerformanceInfo(JSONArray.toJSONString(performaneReportIDList));
|
models.setPerformanceInfo(JSONArray.toJSONString(performaneReportIDList));
|
||||||
testPlanReportDataMapper.updateByPrimaryKeyWithBLOBs(models);
|
testPlanReportDataMapper.updateByPrimaryKeyWithBLOBs(models);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虽然kafka已经设置了topic推送,但是当执行机器性能不够时会影响到报告状态当修改
|
||||||
|
* 同时如果执行过程中报告删除,那么此时也应当记为失败。
|
||||||
|
*/
|
||||||
|
List<String> updatePerformaneReportIDList = new ArrayList<>(performaneReportIDList);
|
||||||
|
executorService.submit(() -> {
|
||||||
|
//错误数据检查集合。 如果错误数据出现超过20次,则取消该条数据的检查
|
||||||
|
Map<String,Integer> errorDataCheckMap = new HashMap<>();
|
||||||
|
while (performaneReportIDList.size()>0) {
|
||||||
|
List<String> selectList = new ArrayList<>(performaneReportIDList);
|
||||||
|
for (String loadTestReportId:selectList) {
|
||||||
|
LoadTestReportWithBLOBs loadTestReportFromDatabase = loadTestReportMapper.selectByPrimaryKey(loadTestReportId);
|
||||||
|
if(loadTestReportFromDatabase == null){
|
||||||
|
//检查错误数据
|
||||||
|
if(errorDataCheckMap.containsKey(loadTestReportId)){
|
||||||
|
if(errorDataCheckMap.get(loadTestReportId)>20){
|
||||||
|
performaneReportIDList.remove(loadTestReportId);
|
||||||
|
}else {
|
||||||
|
errorDataCheckMap.put(loadTestReportId,errorDataCheckMap.get(loadTestReportId)+1);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
errorDataCheckMap.put(loadTestReportId,1);
|
||||||
|
}
|
||||||
|
}else if (StringUtils.equalsAny(loadTestReportFromDatabase.getStatus(),
|
||||||
|
PerformanceTestStatus.Completed.name(), PerformanceTestStatus.Error.name())) {
|
||||||
|
performaneReportIDList.remove(loadTestReportId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(performaneReportIDList.isEmpty()){
|
||||||
|
for (String string: updatePerformaneReportIDList) {
|
||||||
|
TestPlanLoadCaseEventDTO eventDTO = new TestPlanLoadCaseEventDTO();
|
||||||
|
eventDTO.setReportId(string);
|
||||||
|
eventDTO.setTriggerMode(ReportTriggerMode.SCHEDULE.name());
|
||||||
|
eventDTO.setStatus(PerformanceTestStatus.Completed.name());
|
||||||
|
this.updatePerformanceTestStatus(eventDTO);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
try {
|
||||||
|
//查询定时任务是否关闭
|
||||||
|
Thread.sleep(1000 * 10);// 检查 loadtest 的状态
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePerformanceTestStatus(TestPlanLoadCaseEventDTO eventDTO) {
|
public void updatePerformanceTestStatus(TestPlanLoadCaseEventDTO eventDTO) {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
v-if="!readOnly"
|
v-if="!readOnly"
|
||||||
class="tag-input el-input"
|
class="tag-input el-input"
|
||||||
v-model="newTag"
|
v-model="newTag"
|
||||||
placeholder="$t('commons.tag_tip)"
|
:placeholder="$t('commons.tag_tip')"
|
||||||
@keydown.delete.stop="removeLastTag"
|
@keydown.delete.stop="removeLastTag"
|
||||||
@keydown="addNew"
|
@keydown="addNew"
|
||||||
@blur="addNew"/>
|
@blur="addNew"/>
|
||||||
|
|
Loading…
Reference in New Issue