This commit is contained in:
chenjianxing 2020-06-30 09:34:09 +08:00
commit 19430cc6a4
8 changed files with 39 additions and 2 deletions

View File

@ -68,6 +68,8 @@ public class PerformanceTestService {
private ReportService reportService;
@Resource
private KafkaProperties kafkaProperties;
@Resource
private TestCaseMapper testCaseMapper;
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
@ -76,6 +78,20 @@ public class PerformanceTestService {
public void delete(DeleteTestPlanRequest request) {
String testId = request.getId();
// 是否关联测试用例
TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andTestIdEqualTo(testId);
List<TestCase> testCases = testCaseMapper.selectByExample(testCaseExample);
if (testCases.size() > 0) {
String caseName = "";
for (int i = 0; i < testCases.size(); i++) {
caseName = caseName + testCases.get(i).getName() + ",";
}
caseName = caseName.substring(0, caseName.length() - 1);
MSException.throwException(Translator.get("related_case_del_fail_prefix") + caseName + Translator.get("related_case_del_fail_suffix"));
}
LoadTestReportExample loadTestReportExample = new LoadTestReportExample();
loadTestReportExample.createCriteria().andTestIdEqualTo(testId);
List<LoadTestReport> loadTestReports = loadTestReportMapper.selectByExample(loadTestReportExample);

View File

@ -229,6 +229,9 @@ public class TestCaseNodeService {
public List<TestCaseNodeDTO> getAllNodeByPlanId(String planId) {
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(planId);
if (testPlan == null) {
return Collections.emptyList();
}
return getNodeTreeByProjectId(testPlan.getProjectId());
}

View File

@ -134,8 +134,10 @@ public class TestCaseService {
public List<TestCase> getTestCaseNames(QueryTestCaseRequest request) {
if ( StringUtils.isNotBlank(request.getPlanId()) ) {
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
if (testPlan != null) {
request.setProjectId(testPlan.getProjectId());
}
}
List<TestCase> testCaseNames = extTestCaseMapper.getTestCaseNames(request);

View File

@ -91,7 +91,7 @@ public class TestPlanService {
}
public TestPlan getTestPlan(String testPlanId) {
return testPlanMapper.selectByPrimaryKey(testPlanId);
return Optional.ofNullable(testPlanMapper.selectByPrimaryKey(testPlanId)).orElse(new TestPlan());
}
public int editTestPlan(TestPlan testPlan) {

View File

@ -42,6 +42,8 @@ load_test_already_exists=Duplicate load test name
no_nodes_message=No node message
duplicate_node_ip=Duplicate IPs
max_thread_insufficient=The number of concurrent users exceeds
related_case_del_fail_prefix=Connected to
related_case_del_fail_suffix=TestCase, please disassociate first
#workspace
workspace_name_is_null=Workspace name cannot be null
workspace_name_already_exists=The workspace name already exists

View File

@ -42,6 +42,8 @@ load_test_already_exists=测试名称不能重复
no_nodes_message=没有节点信息
duplicate_node_ip=节点 IP 重复
max_thread_insufficient=并发用户数超额
related_case_del_fail_prefix=已关联到
related_case_del_fail_suffix=测试用例,请先解除关联
#workspace
workspace_name_is_null=工作空间名不能为空
workspace_name_already_exists=工作空间名已存在

View File

@ -42,6 +42,8 @@ load_test_already_exists=測試名稱不能重復
no_nodes_message=沒有節點信息
duplicate_node_ip=節點 IP 重復
max_thread_insufficient=並發用戶數超額
related_case_del_fail_prefix=已關聯到
related_case_del_fail_suffix=測試用例,請先解除關聯
#workspace
workspace_name_is_null=工作空間名不能為空
workspace_name_already_exists=工作空間名已存在

View File

@ -9,8 +9,11 @@
<el-tree
class="filter-tree node-tree"
:data="treeNodes"
:default-expanded-keys="expandedNode"
node-key="id"
@node-drag-end="handleDragEnd"
@node-expand="nodeExpand"
@node-collapse="nodeCollapse"
:filter-node-method="filterNode"
:expand-on-click-node="false"
highlight-current
@ -64,6 +67,7 @@ export default {
data() {
return {
result: {},
expandedNode: [],
filterText: "",
defaultProps: {
children: "children",
@ -216,6 +220,12 @@ export default {
},
refreshNode() {
this.$emit("refresh");
},
nodeExpand(data) {
this.expandedNode.push(data.id);
},
nodeCollapse(data) {
this.expandedNode.splice(this.expandedNode.indexOf(data.id), 1);
}
}
};