[Feature][dolphinscheduler-api] Return domain object after creating success (#8825)
Co-authored-by: ouyangyewei <yewei.oyyw@alibaba-inc.com>slim
parent
2335453482
commit
5fa1c4e7e3
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue