feat(消息通知): 消息通知新增接口MOCK类型

This commit is contained in:
guoyuqi 2024-01-22 20:03:27 +08:00 committed by Craftsman
parent 3baefe9981
commit 8186a259fa
10 changed files with 225 additions and 4 deletions

View File

@ -569,7 +569,7 @@ INSERT INTO message_task_blob(id, template) VALUES (@api_case_update_id, 'messag
SET @api_case_delete_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_case_delete_id, 'CASE_DELETE', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_delete');
INSERT INTO message_task_blob(id, template) VALUES (@api_case_delete_id, 'message.api_definition_task_delete');
INSERT INTO message_task_blob(id, template) VALUES (@api_case_delete_id, 'message.api_definition_task_case_delete');
SET @api_execute_success_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_execute_success_id, 'CASE_EXECUTE_SUCCESSFUL', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_execute_successful');
@ -583,6 +583,25 @@ SET @api_execute_failed_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_execute_failed_id, 'CASE_EXECUTE_FAILED', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_case_execute_failed');
INSERT INTO message_task_blob(id, template) VALUES (@api_execute_failed_id, 'message.api_definition_task_case_execute');
SET @api_mock_update_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_mock_update_id, 'MOCK_UPDATE', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_mock_update');
INSERT INTO message_task_blob(id, template) VALUES (@api_mock_update_id, 'message.api_definition_task_mock_update');
SET @api_mock_delete_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_mock_delete_id, 'MOCK_DELETE', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_mock_delete');
INSERT INTO message_task_blob(id, template) VALUES (@api_mock_delete_id, 'message.api_definition_task_mock_delete');
SET @api_mock_execute_success_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_mock_execute_success_id, 'MOCK_EXECUTE_SUCCESSFUL', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_mock_execute_successful');
INSERT INTO message_task_blob(id, template) VALUES (@api_mock_execute_success_id, 'message.api_definition_task_mock_execute');
SET @api_fake_error_id = UUID_SHORT();
INSERT INTO message_task_blob(id, template) VALUES (@api_fake_error_id, 'message.api_definition_task_case_execute');
SET @api_mock_execute_failed_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_mock_execute_failed_id, 'MOCK_EXECUTE_FAILED', 'CREATE_USER', @robot_in_site_id, 'API_DEFINITION_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_definition_task_mock_execute_failed');
INSERT INTO message_task_blob(id, template) VALUES (@api_mock_execute_failed_id, 'message.api_definition_task_mock_execute');
-- 初始化接口场景消息设置数据
SET @api_scenario_update_id = UUID_SHORT();
Insert into message_task(id, event, receiver, project_robot_id, task_type, test_id, project_id, enable, create_user, create_time, update_user, update_time, use_default_template, use_default_subject, subject) VALUES (@api_scenario_update_id, 'UPDATE', 'CREATE_USER', @robot_in_site_id, 'API_SCENARIO_TASK', 'NONE', '100001100001', true, 'admin', unix_timestamp() * 1000, 'admin', unix_timestamp() * 1000, true, true, 'message.title.api_scenario_task_update');

View File

@ -174,6 +174,11 @@ message.case_delete=删除用例
message.case_execute_successful=用例执行成功
message.case_execute_fake_error=用例执行误报
message.case_execute_failed=用例执行失败
message.mock_create=创建MOCK
message.mock_update=更新MOCK
message.mock_delete=删除MOCK
message.mock_execute_successful=MOCK执行成功
message.mock_execute_failed=MOCK执行失败
message.scenario_execute_successful=场景执行成功
message.scenario_execute_fake_error=场景执行误报
message.scenario_execute_failed=场景执行失败
@ -227,6 +232,10 @@ message.api_definition_task_case_create=${OPERATOR}创建了接口用例:${name}
message.api_definition_task_case_update=${OPERATOR}更新了接口用例:${name}
message.api_definition_task_case_delete=${OPERATOR}删除了接口用例:${name}
message.api_definition_task_case_execute=${OPERATOR}执行了接口用例:${name}
message.api_definition_task_mock_create=${OPERATOR}创建了接口MOCK:${name}
message.api_definition_task_mock_update=${OPERATOR}更新了接口MOCK:${name}
message.api_definition_task_mock_delete=${OPERATOR}删除了接口MOCK:${name}
message.api_definition_task_mock_execute=${OPERATOR}执行了接口MOCK:${name}
message.api_scenario_task_create=${OPERATOR}创建了接口场景:${name}
message.api_scenario_task_update=${OPERATOR}更新了接口场景:${name}
message.api_scenario_task_delete=${OPERATOR}删除了接口场景:${name}
@ -283,6 +292,11 @@ message.title.api_definition_task_case_delete=接口用例删除通知
message.title.api_definition_task_case_execute_successful=接口用例执行成功通知
message.title.api_definition_task_case_execute_fake_error=接口用例执行误报通知
message.title.api_definition_task_case_execute_failed=接口用例执行失败通知
message.title.api_definition_task_mock_create=MOCK创建通知
message.title.api_definition_task_mock_update=MOCK更新通知
message.title.api_definition_task_mock_delete=MOCK删除通知
message.title.api_definition_task_mock_execute_successful=MOCK执行成功通知
message.title.api_definition_task_mock_execute_failed=MOCK执行失败通知
message.title.api_scenario_task_create=接口场景创建通知
message.title.api_scenario_task_update=接口场景更新通知
message.title.api_scenario_task_delete=接口场景删除通知

View File

@ -210,6 +210,11 @@ message.case_delete=Delete case
message.case_execute_successful=Case executed successfully
message.case_execute_fake_error=Case execution fake error
message.case_execute_failed=Case execution failed
message.mock_create=Create MOCK
message.mock_update=Update MOCK
message.mock_delete=Delete MOCK
message.mock_execute_successful=MOCK executed successfully
message.mock_execute_failed=MOCK execution failed
message.scenario_execute_successful=Scenario executed successfully
message.scenario_execute_fake_error=Scenario execution fake error
message.scenario_execute_failed=Scenario execution failed
@ -264,6 +269,10 @@ message.api_definition_task_case_create=${OPERATOR} created the API case: ${name
message.api_definition_task_case_update=${OPERATOR} updated the API case: ${name}
message.api_definition_task_case_delete=${OPERATOR} deleted the API case: ${name}
message.api_definition_task_case_execute=${OPERATOR} executed the API case: ${name}
message.api_definition_task_mock_create=${OPERATOR} created the API MOCK: ${name}
message.api_definition_task_mock_update=${OPERATOR} updated the API MOCK: ${name}
message.api_definition_task_mock_delete=${OPERATOR} deleted the API MOCK: ${name}
message.api_definition_task_mock_execute=${OPERATOR} executed the API MOCK: ${name}
message.api_scenario_task_create=${OPERATOR} created the API scenario: ${name}
message.api_scenario_task_update=${OPERATOR} updated the API scenario: ${name}
message.api_scenario_task_delete=${OPERATOR} deleted the API scenario: ${name}
@ -317,6 +326,11 @@ message.title.api_definition_task_case_delete=API case deletion notification
message.title.api_definition_task_case_execute_successful=API case execution success notification
message.title.api_definition_task_case_execute_fake_error=API case execution fake error notification
message.title.api_definition_task_case_execute_failed=API case execution failure notification
message.title.api_definition_task_mock_create=MOCK creation notification
message.title.api_definition_task_mock_update=MOCK update notification
message.title.api_definition_task_mock_delete=MOCK deletion notification
message.title.api_definition_task_mock_execute_successful=MOCK execution success notification
message.title.api_definition_task_mock_execute_failed=MOCK execution failure notification
message.title.api_scenario_task_create=API scenario creation notification
message.title.api_scenario_task_update=API scenario update notification
message.title.api_scenario_task_delete=API scenario deletion notification

View File

@ -210,6 +210,11 @@ message.case_delete=删除用例
message.case_execute_successful=用例执行成功
message.case_execute_fake_error=用例执行误报
message.case_execute_failed=用例执行失败
message.mock_create=创建MOCK
message.mock_update=更新MOCK
message.mock_delete=删除MOCK
message.mock_execute_successful=MOCK执行成功
message.mock_execute_failed=MOCK执行失败
message.scenario_execute_successful=场景执行成功
message.scenario_execute_fake_error=场景执行误报
message.scenario_execute_failed=场景执行失败
@ -264,6 +269,10 @@ message.api_definition_task_case_create=${OPERATOR}创建了接口用例:${name}
message.api_definition_task_case_update=${OPERATOR}更新了接口用例:${name}
message.api_definition_task_case_delete=${OPERATOR}删除了接口用例:${name}
message.api_definition_task_case_execute=${OPERATOR}执行了接口用例:${name}
message.api_definition_task_mock_create=${OPERATOR}创建了接口MOCK:${name}
message.api_definition_task_mock_update=${OPERATOR}更新了接口MOCK:${name}
message.api_definition_task_mock_delete=${OPERATOR}删除了接口MOCK:${name}
message.api_definition_task_mock_execute=${OPERATOR}执行了接口MOCK:${name}
message.api_scenario_task_create=${OPERATOR}创建了接口场景:${name}
message.api_scenario_task_update=${OPERATOR}更新了接口场景:${name}
message.api_scenario_task_delete=${OPERATOR}删除了接口场景:${name}
@ -317,6 +326,11 @@ message.title.api_definition_task_case_delete=接口用例删除通知
message.title.api_definition_task_case_execute_successful=接口用例执行成功通知
message.title.api_definition_task_case_execute_fake_error=接口用例执行误报通知
message.title.api_definition_task_case_execute_failed=接口用例执行失败通知
message.title.api_definition_task_mock_create=MOCK创建通知
message.title.api_definition_task_mock_update=MOCK更新通知
message.title.api_definition_task_mock_delete=MOCK删除通知
message.title.api_definition_task_mock_execute_successful=MOCK执行成功通知
message.title.api_definition_task_mock_execute_failed=MOCK执行失败通知
message.title.api_scenario_task_create=接口场景创建通知
message.title.api_scenario_task_update=接口场景更新通知
message.title.api_scenario_task_delete=接口场景删除通知

View File

@ -210,6 +210,11 @@ message.case_delete=刪除用例
message.case_execute_successful=用例執行成功
message.case_execute_fake_error=用例執行誤報
message.case_execute_failed=用例執行失敗
message.mock_create=創建MOCK
message.mock_update=更新MOCK
message.mock_delete=删除MOCK
message.mock_execute_successful=MOCK執行成功
message.mock_execute_failed=MOCK執行失败
message.scenario_execute_successful=場景執行成功
message.scenario_execute_fake_error=場景執行誤報
message.scenario_execute_failed=場景執行失敗
@ -264,6 +269,10 @@ message.api_definition_task_case_create=${OPERATOR}創建了介面用例:${name}
message.api_definition_task_case_update=${OPERATOR}更新了介面用例:${name}
message.api_definition_task_case_delete=${OPERATOR}刪除了介面用例:${name}
message.api_definition_task_case_execute=${OPERATOR}執行了介面用例:${name}
message.api_definition_task_mock_create=${OPERATOR}創建了介面MOCK:${name}
message.api_definition_task_mock_update=${OPERATOR}更新了介面MOCK:${name}
message.api_definition_task_mock_delete=${OPERATOR}删除了介面MOCK:${name}
message.api_definition_task_mock_execute=${OPERATOR}執行了介面MOCK:${name}
message.api_scenario_task_create=${OPERATOR}創建了介面場景:${name}
message.api_scenario_task_update=${OPERATOR}更新了介面場景:${name}
message.api_scenario_task_delete=${OPERATOR}刪除了介面場景:${name}
@ -318,6 +327,11 @@ message.title.api_definition_task_case_delete=介面用例刪除通知
message.title.api_definition_task_case_execute_successful=介面用例執行成功通知
message.title.api_definition_task_case_execute_fake_error=介面用例執行誤報通知
message.title.api_definition_task_case_execute_failed=介面用例執行失敗通知
message.title.api_definition_task_mock_create=MOCK創建通知
message.title.api_definition_task_mock_update=MOCK更新通知
message.title.api_definition_task_mock_delete=MOCK删除通知
message.title.api_definition_task_mock_execute_successful=MOCK執行成功通知
message.title.api_definition_task_mock_execute_failed=MOCK執行失敗通知
message.title.api_scenario_task_create=介面場景創建通知
message.title.api_scenario_task_update=介面場景更新通知
message.title.api_scenario_task_delete=介面場景刪除通知

View File

@ -114,7 +114,7 @@ public class CreateRobotResourceService implements CreateProjectResourceService
for (MessageTaskDetailDTO messageTaskDetailDTO : messageTaskDetailDTOList) {
String event = messageTaskDetailDTO.getEvent();
List<OptionDTO> receivers = messageTaskDetailDTO.getReceivers();
if (StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CASE_CREATE) || CollectionUtils.isEmpty(receivers)) {
if (StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CASE_CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.MOCK_CREATE) || CollectionUtils.isEmpty(receivers)) {
continue;
}
for (OptionDTO receiver : receivers) {

View File

@ -784,6 +784,116 @@
"useDefaultSubject":true
}
]
},
{
"event":"MOCK_CREATE",
"eventName":"",
"receivers":[
{
"id": "",
"name": ""
}
],
"projectRobotConfigList":[
{
"robotId":"",
"enable":"",
"template":"",
"defaultTemplate":"",
"useDefaultTemplate":true,
"subject":"",
"defaultSubject":"",
"useDefaultSubject":true
}
]
},
{
"event":"MOCK_UPDATE",
"eventName":"",
"receivers":[
{
"id": "CREATE_USER",
"name": ""
}
],
"projectRobotConfigList":[
{
"robotId":"",
"enable":"",
"template":"",
"defaultTemplate":"",
"useDefaultTemplate":true,
"subject":"",
"defaultSubject":"",
"useDefaultSubject":true
}
]
},
{
"event":"MOCK_DELETE",
"eventName":"",
"receivers":[
{
"id": "CREATE_USER",
"name": ""
}
],
"projectRobotConfigList":[
{
"robotId":"",
"enable":"",
"template":"",
"defaultTemplate":"",
"useDefaultTemplate":true,
"subject":"",
"defaultSubject":"",
"useDefaultSubject":true
}
]
},
{
"event":"MOCK_EXECUTE_SUCCESSFUL",
"eventName":"",
"receivers":[
{
"id": "CREATE_USER",
"name": ""
}
],
"projectRobotConfigList":[
{
"robotId":"",
"enable":"",
"template":"",
"defaultTemplate":"",
"useDefaultTemplate":true,
"subject":"",
"defaultSubject":"",
"useDefaultSubject":true
}
]
},
{
"event":"MOCK_EXECUTE_FAILED",
"eventName":"",
"receivers":[
{
"id": "CREATE_USER",
"name": ""
}
],
"projectRobotConfigList":[
{
"robotId":"",
"enable":"",
"template":"",
"defaultTemplate":"",
"useDefaultTemplate":true,
"subject":"",
"defaultSubject":"",
"useDefaultSubject":true
}
]
}
]
},

View File

@ -624,7 +624,7 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
for (MessageTaskDetailDTO messageTaskDetailDTO : messageTaskDetailDTOList) {
String event = messageTaskDetailDTO.getEvent();
List<OptionDTO> receivers = messageTaskDetailDTO.getReceivers();
if (StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CASE_CREATE) || CollectionUtils.isEmpty(receivers)) {
if (StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CASE_CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.MOCK_CREATE) || CollectionUtils.isEmpty(receivers)) {
continue;
}
for (OptionDTO receiver : receivers) {

View File

@ -544,7 +544,7 @@ public class ProjectRobotControllerTests extends BaseTest {
for (MessageTaskDetailDTO messageTaskDetailDTO : messageTaskDetailDTOList) {
String event = messageTaskDetailDTO.getEvent();
List<OptionDTO> receivers = messageTaskDetailDTO.getReceivers();
if (StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CASE_CREATE) || CollectionUtils.isEmpty(receivers)) {
if (StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.CASE_CREATE) || StringUtils.equalsIgnoreCase(event, NoticeConstants.Event.MOCK_CREATE) || CollectionUtils.isEmpty(receivers)) {
continue;
}
for (OptionDTO receiver : receivers) {

View File

@ -180,6 +180,21 @@ public interface NoticeConstants {
@Schema(description = "message.case_execute_failed")
String CASE_EXECUTE_FAILED = "CASE_EXECUTE_FAILED";
@Schema(description = "message.mock_create")
String MOCK_CREATE = "MOCK_CREATE";
@Schema(description = "message.mock_update")
String MOCK_UPDATE = "MOCK_UPDATE";
@Schema(description = "message.mock_delete")
String MOCK_DELETE = "MOCK_DELETE";
@Schema(description = "message.mock_execute_successful")
String MOCK_EXECUTE_SUCCESSFUL = "MOCK_EXECUTE_SUCCESSFUL";
@Schema(description = "message.mock_execute_failed")
String MOCK_EXECUTE_FAILED = "MOCK_EXECUTE_FAILED";
@Schema(description = "message.scenario_execute_successful")
String SCENARIO_EXECUTE_SUCCESSFUL = "SCENARIO_EXECUTE_SUCCESSFUL";
@ -302,6 +317,17 @@ public interface NoticeConstants {
@Schema(description = "message.api_definition_task_case_execute")
String API_DEFINITION_TASK_CASE_EXECUTE_FAILED = "API_DEFINITION_TASK_CASE_EXECUTE_FAILED";//${OPERATOR}执行了接口用例:${name}
@Schema(description = "message.api_definition_task_mock_create")
String API_DEFINITION_TASK_MOCK_CREATE = "API_DEFINITION_TASK_MOCK_CREATE";//${OPERATOR}创建了接口MOCK:${name}
@Schema(description = "message.api_definition_task_mock_update")
String API_DEFINITION_TASK_MOCK_UPDATE = "API_DEFINITION_TASK_MOCK_UPDATE";//${OPERATOR}更新了接口MOCK:${name}
@Schema(description = "message.api_definition_task_mock_delete")
String API_DEFINITION_TASK_MOCK_DELETE = "API_DEFINITION_TASK_MOCK_DELETE";//${OPERATOR}删除了接口MOCK:${name}
@Schema(description = "message.api_definition_task_mock_execute")
String API_DEFINITION_TASK_MOCK_EXECUTE_SUCCESSFUL = "API_DEFINITION_TASK_MOCK_EXECUTE_SUCCESSFUL";//${OPERATOR}执行了接口MOCK:${name}
@Schema(description = "message.api_definition_task_mock_execute")
String API_DEFINITION_TASK_MOCK_EXECUTE_FAILED = "API_DEFINITION_TASK_MOCK_EXECUTE_FAILED";//${OPERATOR}执行了接口MOCK:${name}
@Schema(description = "message.api_scenario_task_create")
String API_SCENARIO_TASK_CREATE = "API_SCENARIO_TASK_CREATE";//${OPERATOR}创建了接口场景:${name}
@Schema(description = "message.api_scenario_task_update")
@ -437,6 +463,16 @@ public interface NoticeConstants {
String API_DEFINITION_TASK_CASE_EXECUTE_FAKE_ERROR = "API_DEFINITION_TASK_CASE_EXECUTE_FAKE_ERROR";
@Schema(description = "message.title.api_definition_task_case_execute_failed")//接口用例执行失败通知
String API_DEFINITION_TASK_CASE_EXECUTE_FAILED = "API_DEFINITION_TASK_CASE_EXECUTE_FAILED";
@Schema(description = "message.title.api_definition_task_mock_create")
String API_DEFINITION_TASK_MOCK_CREATE = "API_DEFINITION_TASK_MOCK_CREATE";
@Schema(description = "message.title.api_definition_task_mock_update")
String API_DEFINITION_TASK_MOCK_UPDATE = "API_DEFINITION_TASK_MOCK_UPDATE";
@Schema(description = "message.title.api_definition_task_mock_delete")
String API_DEFINITION_TASK_MOCK_DELETE = "API_DEFINITION_TASK_MOCK_DELETE";
@Schema(description = "message.title.api_definition_task_case_execute_successful")
String API_DEFINITION_TASK_MOCK_EXECUTE_SUCCESSFUL = "API_DEFINITION_TASK_MOCK_EXECUTE_SUCCESSFUL";
@Schema(description = "message.title.api_definition_task_case_execute_failed")
String API_DEFINITION_TASK_MOCK_EXECUTE_FAILED = "API_DEFINITION_TASK_MOCK_EXECUTE_FAILED";
@Schema(description = "message.title.api_scenario_task_create")//接口场景创建通知
String API_SCENARIO_TASK_CREATE = "API_SCENARIO_TASK_CREATE";