@Test public void testGetAuditEventWhenEventExistsAndHasPermissionToReadItThenTheExpectedEventShouldReturn() { AuditEventV4Response expected = mock(AuditEventV4Response.class); StructuredEventEntity repoResult = new StructuredEventEntity(); when(converterUtil.convert(repoResult, AuditEventV4Response.class)).thenReturn(expected); when(legacyStructuredEventDBService.findByWorkspaceIdAndId(TEST_DEFAULT_ORG_ID, TEST_AUDIT_ID)).thenReturn(repoResult); AuditEventV4Response actual = underTest.getAuditEvent(TEST_AUDIT_ID); Assert.assertEquals(expected, actual); verify(converterUtil, times(1)).convert(repoResult, AuditEventV4Response.class); verify(legacyStructuredEventDBService, times(1)).findByWorkspaceIdAndId(TEST_DEFAULT_ORG_ID, TEST_AUDIT_ID); }
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();  }