Browse Source

Merge pull request #16050 from thingsboard/fix/alarm-comment-audit-log-assertion

Compare deleted alarm comment audit log argument against the persisted comment
pull/16057/head
Viacheslav Klimov 1 week ago
committed by GitHub
parent
commit
bd062e3a0a
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  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