@Test public void testGetAuditEventByWorkspaceIdWhenUserHasNoRightToReadEntryThenAccessDeniedEceptionShouldCome() { when(legacyStructuredEventDBService.findByWorkspaceIdAndId(TEST_DEFAULT_ORG_ID, TEST_AUDIT_ID)) .thenThrow(new AccessDeniedException(REPO_ACCESS_DENIED_MESSAGE)); thrown.expect(AccessDeniedException.class); thrown.expectMessage(REPO_ACCESS_DENIED_MESSAGE); underTest.getAuditEvent(TEST_AUDIT_ID); verify(legacyStructuredEventDBService, times(1)).findByWorkspaceIdAndId(TEST_DEFAULT_ORG_ID, TEST_AUDIT_ID); verify(converterUtil, times(0)).convert(any(StructuredEventEntity.class), AuditEventV4Response.class); }
public AuditEventV4Response getAuditEvent(Long auditId) { User user = userService.getOrCreate(legacyRestRequestThreadLocalService.getCloudbreakUser()); return getAuditEventByWorkspaceId(workspaceService.getDefaultWorkspaceForUser(user).getId(), auditId); }
AuditEventService extends AbstractWorkspaceAwareResourceService<StructuredEventEntity> { public AuditEventV4Response getAuditEvent(Long auditId) { User user = userService.getOrCreate(legacyRestRequestThreadLocalService.getCloudbreakUser()); return getAuditEventByWorkspaceId(workspaceService.getDefaultWorkspaceForUser(user).getId(), auditId); } }
AuditEventService extends AbstractWorkspaceAwareResourceService<StructuredEventEntity> { public AuditEventV4Response getAuditEvent(Long auditId) { User user = userService.getOrCreate(legacyRestRequestThreadLocalService.getCloudbreakUser()); return getAuditEventByWorkspaceId(workspaceService.getDefaultWorkspaceForUser(user).getId(), auditId); }  }
AuditEventService extends AbstractWorkspaceAwareResourceService<StructuredEventEntity> { public AuditEventV4Response getAuditEvent(Long auditId) { User user = userService.getOrCreate(legacyRestRequestThreadLocalService.getCloudbreakUser()); return getAuditEventByWorkspaceId(workspaceService.getDefaultWorkspaceForUser(user).getId(), auditId); }  AuditEventV4Response getAuditEvent(Long auditId); AuditEventV4Response getAuditEventByWorkspaceId(Long workspaceId, Long auditId); List<AuditEventV4Response> getAuditEventsByWorkspaceId(Long workspaceId, String resourceType, Long resourceId, String resourceCrn); @Override WorkspaceResourceRepository<StructuredEventEntity, Long> repository(); }
AuditEventService extends AbstractWorkspaceAwareResourceService<StructuredEventEntity> { public AuditEventV4Response getAuditEvent(Long auditId) { User user = userService.getOrCreate(legacyRestRequestThreadLocalService.getCloudbreakUser()); return getAuditEventByWorkspaceId(workspaceService.getDefaultWorkspaceForUser(user).getId(), auditId); }  AuditEventV4Response getAuditEvent(Long auditId); AuditEventV4Response getAuditEventByWorkspaceId(Long workspaceId, Long auditId); List<AuditEventV4Response> getAuditEventsByWorkspaceId(Long workspaceId, String resourceType, Long resourceId, String resourceCrn); @Override WorkspaceResourceRepository<StructuredEventEntity, Long> repository();  }