[Feature][dolphinscheduler-api] Return domain object after creating success (#8825)

Co-authored-by: ouyangyewei <yewei.oyyw@alibaba-inc.com>
slim
ouyangyewei 2022-03-13 21:20:36 +08:00 committed by GitHub
parent 2335453482
commit 5fa1c4e7e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 2 deletions

View File

@ -157,7 +157,12 @@ public class AlertGroupServiceImpl extends BaseServiceImpl implements AlertGroup
// insert
try {
int insert = alertGroupMapper.insert(alertGroup);
putMsg(result, insert > 0 ? Status.SUCCESS : Status.CREATE_ALERT_GROUP_ERROR);
if (insert > 0) {
result.put(Constants.DATA_LIST, alertGroup);
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.CREATE_ALERT_GROUP_ERROR);
}
} catch (DuplicateKeyException ex) {
logger.error("Create alert group error.", ex);
putMsg(result, Status.ALERT_GROUP_EXIST);

View File

@ -91,8 +91,8 @@ public class AlertPluginInstanceServiceImpl extends BaseServiceImpl implements A
}
int i = alertPluginInstanceMapper.insert(alertPluginInstance);
if (i > 0) {
result.put(Constants.DATA_LIST, alertPluginInstance);
putMsg(result, Status.SUCCESS);
return result;
}

View File

@ -110,6 +110,7 @@ public class AlertGroupServiceTest {
result = alertGroupService.createAlertgroup(user, groupName, groupName, null);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
Assert.assertNotNull(result.get(Constants.DATA_LIST));
}
@Test

View File

@ -163,6 +163,7 @@ public class AlertPluginInstanceServiceTest {
Mockito.when(alertPluginInstanceMapper.insert(Mockito.any())).thenReturn(1);
result = alertPluginInstanceService.create(user, 1, "test1", uiParams);
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
Assert.assertNotNull(result.get(Constants.DATA_LIST));
}
@Test