Browse Source

Compare deleted alarm comment audit log argument against the persisted comment

pull/16050/head
Viacheslav Klimov 1 week ago
parent
commit
3a58059931
Failed to extract signature
  1. 12
      application/src/test/java/org/thingsboard/server/controller/AlarmCommentControllerTest.java

12
application/src/test/java/org/thingsboard/server/controller/AlarmCommentControllerTest.java

@ -231,6 +231,10 @@ public class AlarmCommentControllerTest extends AbstractControllerTest {
.comment(JacksonUtil.newObjectNode().put("text", String.format("Comment was deleted by user %s",
CUSTOMER_USER_EMAIL)))
.build();
// The audit log receives the persisted comment, and AlarmComment equality covers the
// inherited id and createdTime, which the builder cannot populate.
expectedAlarmComment.setId(alarmComment.getId());
expectedAlarmComment.setCreatedTime(alarmComment.getCreatedTime());
testLogEntityActionEntityEqClass(alarm, alarm.getId(), tenantId, customerId, customerUserId, CUSTOMER_USER_EMAIL, ActionType.DELETED_COMMENT, 1, expectedAlarmComment);
}
@ -255,6 +259,10 @@ public class AlarmCommentControllerTest extends AbstractControllerTest {
.comment(JacksonUtil.newObjectNode().put("text", String.format("Comment was deleted by user %s",
TENANT_ADMIN_EMAIL)))
.build();
// The audit log receives the persisted comment, and AlarmComment equality covers the
// inherited id and createdTime, which the builder cannot populate.
expectedAlarmComment.setId(alarmComment.getId());
expectedAlarmComment.setCreatedTime(alarmComment.getCreatedTime());
testLogEntityActionEntityEqClass(alarm, alarm.getId(), tenantId, customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.DELETED_COMMENT, 1, expectedAlarmComment);
}
@ -286,6 +294,10 @@ public class AlarmCommentControllerTest extends AbstractControllerTest {
.comment(JacksonUtil.newObjectNode().put("text", String.format("Comment was deleted by user %s",
TENANT_ADMIN_EMAIL)))
.build();
// The audit log receives the persisted comment, and AlarmComment equality covers the
// inherited id and createdTime, which the builder cannot populate.
expectedAlarmComment.setId(alarmComment.getId());
expectedAlarmComment.setCreatedTime(alarmComment.getCreatedTime());
testLogEntityActionEntityEqClass(alarm, alarm.getId(), tenantId, customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.DELETED_COMMENT, 1, expectedAlarmComment);
}

Loading…
Cancel
Save