diff --git a/services/statisticsservice.yaml b/services/statisticsservice.yaml index 69bd0e8..37f58ff 100644 --- a/services/statisticsservice.yaml +++ b/services/statisticsservice.yaml @@ -12,7 +12,7 @@ paths: operationId: getConsultantStatistics responses: 200: - description: OK - successfull operation + description: OK - successful operation 400: description: BAD REQUEST - invalid/incomplete request or body object 403: @@ -29,7 +29,7 @@ paths: operationId: getConsultantStatisticsCsv responses: 200: - description: OK - successfull operation + description: OK - successful operation 400: description: BAD REQUEST - invalid/incomplete request or body object 403: @@ -124,10 +124,19 @@ components: format: int64 description: The id of the session example: 12345 + adviceSeekerId: + type: string + description: The id of the adviceseeker + example: 12345 videoCallUuid: type: string description: The uuid of the video call example: 123e4567-e89b-12d3-a456-556642440000 + tenantId: + type: integer + format: int64 + description: The id of the tenant + example: 12345 StopVideoCallStatisticsEventMessage: type: object diff --git a/src/main/java/de/caritas/cob/videoservice/api/controller/VideoController.java b/src/main/java/de/caritas/cob/videoservice/api/controller/VideoController.java index 61171bf..eb887c7 100644 --- a/src/main/java/de/caritas/cob/videoservice/api/controller/VideoController.java +++ b/src/main/java/de/caritas/cob/videoservice/api/controller/VideoController.java @@ -7,12 +7,14 @@ import de.caritas.cob.videoservice.api.model.VideoCallResponseDTO; import de.caritas.cob.videoservice.api.service.RejectVideoCallService; import de.caritas.cob.videoservice.api.service.video.VideoCallUrlGeneratorService; +import de.caritas.cob.videoservice.api.tenant.TenantContext; import de.caritas.cob.videoservice.generated.api.controller.VideocallsApi; import io.swagger.annotations.Api; import java.util.UUID; import javax.validation.Valid; import lombok.NonNull; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestHeader; @@ -28,6 +30,9 @@ public class VideoController implements VideocallsApi { private final @NonNull RejectVideoCallService rejectVideoCallService; private final @NonNull VideoCallUrlGeneratorService videoCallUrlGeneratorService; + @Value("${multitenancy.enabled}") + private boolean multitenancy; + /** * Starts a new video call. * @@ -58,6 +63,11 @@ public ResponseEntity stopVideoCall(UUID roomId) { @Override public ResponseEntity handleVideoCallStoppedEvent(String roomId) { + if (multitenancy) { + // prosody events are tenant-unaware, therefore set the tenant to 0 to be able to send + // messages + TenantContext.setCurrentTenant(0L); + } videoCallFacade.handleVideoCallStoppedEvent(roomId); return ResponseEntity.noContent().build(); } diff --git a/src/main/java/de/caritas/cob/videoservice/api/facade/VideoCallFacade.java b/src/main/java/de/caritas/cob/videoservice/api/facade/VideoCallFacade.java index 2fa294f..780310c 100644 --- a/src/main/java/de/caritas/cob/videoservice/api/facade/VideoCallFacade.java +++ b/src/main/java/de/caritas/cob/videoservice/api/facade/VideoCallFacade.java @@ -20,6 +20,7 @@ import de.caritas.cob.videoservice.api.service.statistics.event.StopVideoCallStatisticsEvent; import de.caritas.cob.videoservice.api.service.video.VideoCallUrlGeneratorService; import de.caritas.cob.videoservice.api.service.video.VideoRoomService; +import de.caritas.cob.videoservice.api.tenant.TenantContext; import de.caritas.cob.videoservice.liveservice.generated.web.model.EventType; import de.caritas.cob.videoservice.liveservice.generated.web.model.LiveEventMessage; import de.caritas.cob.videoservice.liveservice.generated.web.model.VideoCallRequestDTO; @@ -85,15 +86,17 @@ private VideoCallResponseDTO startOneToOneVideoCall( singletonList(consultantSessionDto.getAskerId())); this.videoRoomService.createOneToOneVideoRoom( - consultantSessionDto.getId(), - consultantSessionDto.getGroupId(), - videoCallUuid, - videoCallUrls.getModeratorVideoUrl()); + consultantSessionDto.getId(), consultantSessionDto.getGroupId(), videoCallUuid); var createVideoCallResponseDto = new VideoCallResponseDTO().moderatorVideoCallUrl(videoCallUrls.getModeratorVideoUrl()); statisticsService.fireEvent( new StartVideoCallStatisticsEvent( - authenticatedUser.getUserId(), UserRole.CONSULTANT, sessionId, videoCallUuid)); + authenticatedUser.getUserId(), + UserRole.CONSULTANT, + sessionId, + videoCallUuid, + consultantSessionDto.getAskerId(), + TenantContext.getCurrentTenant())); log.info("Started one to one video call for sessionId {}", sessionId); return createVideoCallResponseDto; @@ -124,15 +127,13 @@ private VideoCallResponseDTO startGroupVideoCall( var groupVideoRoom = this.videoRoomService.createGroupVideoRoom( - createVideoCallRequest.getGroupChatId(), - chatById.getGroupId(), - videoCallUuid, - videoCallUrls.getUserVideoUrl()); + createVideoCallRequest.getGroupChatId(), chatById.getGroupId(), videoCallUuid); messageService.createAndSendVideoCallStartedMessage( chatById.getGroupId(), authenticatedUser.getUsername(), groupVideoRoom, + videoCallUrls.getUserVideoUrl(), createVideoCallRequest.getInitiatorDisplayName(), initiatorRcUserId); diff --git a/src/main/java/de/caritas/cob/videoservice/api/model/VideoRoomEntity.java b/src/main/java/de/caritas/cob/videoservice/api/model/VideoRoomEntity.java index e93024d..3b60d3d 100644 --- a/src/main/java/de/caritas/cob/videoservice/api/model/VideoRoomEntity.java +++ b/src/main/java/de/caritas/cob/videoservice/api/model/VideoRoomEntity.java @@ -41,9 +41,6 @@ public class VideoRoomEntity { @Column(name = "group_chat_id", updatable = false) private Long groupChatId; - @Column(name = "guest_video_link", nullable = false) - private String guestVideoLink; - @Column(name = "create_date", nullable = false) private LocalDateTime createDate; diff --git a/src/main/java/de/caritas/cob/videoservice/api/service/message/MessageService.java b/src/main/java/de/caritas/cob/videoservice/api/service/message/MessageService.java index 6c56a84..0ee8b91 100644 --- a/src/main/java/de/caritas/cob/videoservice/api/service/message/MessageService.java +++ b/src/main/java/de/caritas/cob/videoservice/api/service/message/MessageService.java @@ -64,12 +64,14 @@ public void createAndSendVideoCallStartedMessage( String groupId, String username, VideoRoomEntity videoRoomEntity, + String guestVideoUrl, String initiatorDisplayName, String initiatorRcUserId) { AliasMessageDTO message = createVideoChatMessage( username, videoRoomEntity, + guestVideoUrl, "Videochat has started. Initiating moderator has joined the call.", EventTypeEnum.CALL_STARTED); message.getVideoCallMessageDTO().setInitiatorRcUserId(initiatorRcUserId); @@ -78,11 +80,12 @@ public void createAndSendVideoCallStartedMessage( } public void createAndSendVideoCallEndedMessage( - String groupId, String username, VideoRoomEntity videoRoomEntity) { + String groupId, String username, VideoRoomEntity videoRoomEntity, String guestVideoUrl) { AliasMessageDTO message = createVideoChatMessage( username, videoRoomEntity, + guestVideoUrl, "Videochat has ended. All moderators have left the call.", EventTypeEnum.CALL_ENDED); message.getVideoCallMessageDTO().setInitiatorRcUserId(""); @@ -90,15 +93,23 @@ public void createAndSendVideoCallEndedMessage( sendMessage(groupId, message); } + public void createAndSendVideoCallEndedMessage( + String groupId, String username, VideoRoomEntity videoRoomEntity) { + createAndSendVideoCallEndedMessage(groupId, username, videoRoomEntity, ""); + } + private AliasMessageDTO createVideoChatMessage( String username, VideoRoomEntity videoRoomEntity, + String guestVideoUrl, String messageTitle, EventTypeEnum eventType) { AliasMessageDTO message = new AliasMessageDTO(); message.setContent( - getMessageContent(username, videoRoomEntity, messageTitle, message, eventType).toString()); + getMessageContent( + username, videoRoomEntity, guestVideoUrl, messageTitle, message, eventType) + .toString()); message.setVideoCallMessageDTO(new VideoCallMessageDTO().eventType(eventType)); return message; } @@ -106,6 +117,7 @@ private AliasMessageDTO createVideoChatMessage( JSONObject getMessageContent( String username, VideoRoomEntity videoRoomEntity, + String guestVideoUrl, String messageTitle, AliasMessageDTO message, EventTypeEnum eventType) { @@ -114,7 +126,7 @@ JSONObject getMessageContent( message.setMessageType(MessageType.VIDEOCALL); messageContent.put("date", videoRoomEntity.getCreateDate()); messageContent.put("moderator_user", username); - messageContent.put("note", videoRoomEntity.getGuestVideoLink()); + messageContent.put("note", guestVideoUrl); long calculateDurationInSecods = calculateDurationInSeconds(videoRoomEntity); messageContent.put("durationSeconds", calculateDurationInSecods); messageContent.put("eventType", eventType.getValue()); diff --git a/src/main/java/de/caritas/cob/videoservice/api/service/statistics/event/StartVideoCallStatisticsEvent.java b/src/main/java/de/caritas/cob/videoservice/api/service/statistics/event/StartVideoCallStatisticsEvent.java index e4f7fc0..8489c88 100644 --- a/src/main/java/de/caritas/cob/videoservice/api/service/statistics/event/StartVideoCallStatisticsEvent.java +++ b/src/main/java/de/caritas/cob/videoservice/api/service/statistics/event/StartVideoCallStatisticsEvent.java @@ -7,10 +7,12 @@ import de.caritas.cob.videoservice.statisticsservice.generated.web.model.StartVideoCallStatisticsEventMessage; import de.caritas.cob.videoservice.statisticsservice.generated.web.model.UserRole; import java.util.Optional; +import lombok.AllArgsConstructor; import lombok.NonNull; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor +@AllArgsConstructor public class StartVideoCallStatisticsEvent implements StatisticsEvent { private static final EventType EVENT_TYPE = EventType.START_VIDEO_CALL; @@ -19,6 +21,9 @@ public class StartVideoCallStatisticsEvent implements StatisticsEvent { private @NonNull UserRole userRole; private @NonNull Long sessionId; private @NonNull String videoCallUuid; + private @NonNull String adviceSeekerId; + + private Long tenantId; /** {@inheritDoc} */ @Override @@ -40,6 +45,8 @@ private StartVideoCallStatisticsEventMessage createStartVideoCallStatisticsEvent .userRole(userRole) .sessionId(sessionId) .videoCallUuid(videoCallUuid) + .adviceSeekerId(adviceSeekerId) + .tenantId(tenantId) .timestamp(CustomOffsetDateTime.nowInUtc()); } } diff --git a/src/main/java/de/caritas/cob/videoservice/api/service/video/VideoRoomService.java b/src/main/java/de/caritas/cob/videoservice/api/service/video/VideoRoomService.java index 5a62f04..15b3e5d 100644 --- a/src/main/java/de/caritas/cob/videoservice/api/service/video/VideoRoomService.java +++ b/src/main/java/de/caritas/cob/videoservice/api/service/video/VideoRoomService.java @@ -17,24 +17,21 @@ public class VideoRoomService { private final @NonNull VideoRoomRepository videoRoomRepository; public VideoRoomEntity createOneToOneVideoRoom( - Long sessionId, String rocketChatRoomId, String jitsiRoomId, String videoLink) { + Long sessionId, String rocketChatRoomId, String jitsiRoomId) { var videoRoom = new VideoRoomEntity(); videoRoom.setSessionId(sessionId); videoRoom.setRocketChatRoomId(rocketChatRoomId); videoRoom.setJitsiRoomId(jitsiRoomId); - videoRoom.setGuestVideoLink(videoLink); videoRoom.setCreateDate(LocalDateTime.now()); return videoRoomRepository.save(videoRoom); } public VideoRoomEntity createGroupVideoRoom( - Long groupChatId, String rocketChatRoomId, String jitsiRoomId, String guestVideoLink) { + Long groupChatId, String rocketChatRoomId, String jitsiRoomId) { var videoRoom = new VideoRoomEntity(); videoRoom.setGroupChatId(groupChatId); videoRoom.setJitsiRoomId(jitsiRoomId); videoRoom.setRocketChatRoomId(rocketChatRoomId); - - videoRoom.setGuestVideoLink(guestVideoLink); videoRoom.setCreateDate(LocalDateTime.now()); videoRoom.setCloseDate(null); return videoRoomRepository.save(videoRoom); diff --git a/src/main/java/de/caritas/cob/videoservice/filter/HttpTenantFilter.java b/src/main/java/de/caritas/cob/videoservice/filter/HttpTenantFilter.java index edf40a6..d044ddf 100644 --- a/src/main/java/de/caritas/cob/videoservice/filter/HttpTenantFilter.java +++ b/src/main/java/de/caritas/cob/videoservice/filter/HttpTenantFilter.java @@ -25,7 +25,13 @@ public class HttpTenantFilter extends OncePerRequestFilter { private static final String[] TENANCY_FILTER_WHITELIST = - new String[] {"/actuator/health", "/actuator/health/**", "/swagger-ui.html", "/favicon.ico"}; + new String[] { + "/actuator/health", + "/actuator/health/**", + "/swagger-ui.html", + "/favicon.ico", + "/videocalls/event/stop/" + }; private final TenantResolverService tenantResolverService; private final DefaultRequiresTenantFilterMatcher requiresTenantFilterMatcher = new DefaultRequiresTenantFilterMatcher(); diff --git a/src/main/resources/db/changelog/changeset/0001_initsql/initTables.sql b/src/main/resources/db/changelog/changeset/0001_initsql/initTables.sql index c80d273..bfd2cbb 100644 --- a/src/main/resources/db/changelog/changeset/0001_initsql/initTables.sql +++ b/src/main/resources/db/changelog/changeset/0001_initsql/initTables.sql @@ -6,7 +6,6 @@ CREATE TABLE videoservice.`videoroom` ( `group_chat_id` bigint(21) NULL, `jitsi_room_id` varchar(40) NOT NULL, `rocketchat_room_id` varchar(40) NULL, - `guest_video_link` varchar(1024) COLLATE utf8_unicode_ci NOT NULL, `create_date` datetime NOT NULL DEFAULT (UTC_TIMESTAMP), `close_date` datetime NULL, PRIMARY KEY (`id`) diff --git a/src/test/java/de/caritas/cob/videoservice/api/facade/VideoCallFacadeTest.java b/src/test/java/de/caritas/cob/videoservice/api/facade/VideoCallFacadeTest.java index fe1803f..43efecc 100644 --- a/src/test/java/de/caritas/cob/videoservice/api/facade/VideoCallFacadeTest.java +++ b/src/test/java/de/caritas/cob/videoservice/api/facade/VideoCallFacadeTest.java @@ -122,11 +122,7 @@ public void startVideoCall_Should_ReturnCorrectVideoCallUrl_When_UrlWasGenerated // then assertThat(result.getModeratorVideoCallUrl()).isEqualTo(videoCallUrls.getModeratorVideoUrl()); verify(videoRoomService) - .createGroupVideoRoom( - Mockito.eq(GROUP_CHAT_ID), - Mockito.eq(ROCKETCHAT_ROOM_ID), - Mockito.eq(VIDEO_CALL_UUID), - Mockito.anyString()); + .createGroupVideoRoom(GROUP_CHAT_ID, ROCKETCHAT_ROOM_ID, VIDEO_CALL_UUID); ArgumentCaptor> captor = ArgumentCaptor.forClass(List.class); diff --git a/src/test/java/de/caritas/cob/videoservice/api/repository/VideoRoomRepositoryTest.java b/src/test/java/de/caritas/cob/videoservice/api/repository/VideoRoomRepositoryTest.java index 1477c84..dc6ab28 100644 --- a/src/test/java/de/caritas/cob/videoservice/api/repository/VideoRoomRepositoryTest.java +++ b/src/test/java/de/caritas/cob/videoservice/api/repository/VideoRoomRepositoryTest.java @@ -54,7 +54,6 @@ void findById_Should_findRoomBySessionId() { void create_Should_createVideoRoom() { // given VideoRoomEntity entity = new VideoRoomEntity(); - entity.setGuestVideoLink("https://videolink." + UUID.randomUUID()); entity.setCreateDate(LocalDateTime.now()); entity.setJitsiRoomId(UUID.randomUUID().toString()); entity.setSessionId(1L); diff --git a/src/test/java/de/caritas/cob/videoservice/api/service/message/MessageServiceTest.java b/src/test/java/de/caritas/cob/videoservice/api/service/message/MessageServiceTest.java index 3e42ada..5e5300c 100644 --- a/src/test/java/de/caritas/cob/videoservice/api/service/message/MessageServiceTest.java +++ b/src/test/java/de/caritas/cob/videoservice/api/service/message/MessageServiceTest.java @@ -25,7 +25,12 @@ void getMessageContent_Should_CalculateCallDuration() { // when JSONObject messageContent = this.messageService.getMessageContent( - "user", videoRoomEntity, "title", new AliasMessageDTO(), EventTypeEnum.CALL_STARTED); + "user", + videoRoomEntity, + "guestVideoCallUrl", + "title", + new AliasMessageDTO(), + EventTypeEnum.CALL_STARTED); // then assertThat((Long) messageContent.get("durationSeconds")).isGreaterThanOrEqualTo(60L); } @@ -37,7 +42,12 @@ void getMessageContent_Should_CalculateCallDurationToZero_When_CreateDateIsNotSe // when JSONObject messageContent = this.messageService.getMessageContent( - "user", videoRoomEntity, "title", new AliasMessageDTO(), EventTypeEnum.CALL_STARTED); + "user", + videoRoomEntity, + "guestVideoCallUrl", + "title", + new AliasMessageDTO(), + EventTypeEnum.CALL_STARTED); // then assertThat((Long) messageContent.get("durationSeconds")).isZero(); } diff --git a/src/test/java/de/caritas/cob/videoservice/api/service/statistics/StatisticsServiceIT.java b/src/test/java/de/caritas/cob/videoservice/api/service/statistics/StatisticsServiceIT.java index 736ca1b..9d97617 100644 --- a/src/test/java/de/caritas/cob/videoservice/api/service/statistics/StatisticsServiceIT.java +++ b/src/test/java/de/caritas/cob/videoservice/api/service/statistics/StatisticsServiceIT.java @@ -1,5 +1,6 @@ package de.caritas.cob.videoservice.api.service.statistics; +import static de.caritas.cob.videoservice.api.testhelper.TestConstants.ADVICESEEKER_ID; import static de.caritas.cob.videoservice.api.testhelper.TestConstants.CONSULTANT_ID; import static de.caritas.cob.videoservice.api.testhelper.TestConstants.SESSION_ID; import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals; @@ -43,7 +44,7 @@ public void fireEvent_Should_Send_ExpectedAssignSessionStatisticsEventMessageToQ UUID uuid = UUID.randomUUID(); StartVideoCallStatisticsEvent startVideoCallStatisticsEvent = new StartVideoCallStatisticsEvent( - CONSULTANT_ID, UserRole.CONSULTANT, SESSION_ID, uuid.toString()); + CONSULTANT_ID, UserRole.CONSULTANT, SESSION_ID, uuid.toString(), ADVICESEEKER_ID); statisticsService.fireEvent(startVideoCallStatisticsEvent); Message message = @@ -52,6 +53,9 @@ public void fireEvent_Should_Send_ExpectedAssignSessionStatisticsEventMessageToQ String expectedJson = "{" + + " \"adviceSeekerId\":\"" + + ADVICESEEKER_ID + + "\"," + " \"userId\":\"" + CONSULTANT_ID + "\"," diff --git a/src/test/java/de/caritas/cob/videoservice/api/service/statistics/event/StartVideoCallStatisticsEventTest.java b/src/test/java/de/caritas/cob/videoservice/api/service/statistics/event/StartVideoCallStatisticsEventTest.java index c1d785c..93c7fc2 100644 --- a/src/test/java/de/caritas/cob/videoservice/api/service/statistics/event/StartVideoCallStatisticsEventTest.java +++ b/src/test/java/de/caritas/cob/videoservice/api/service/statistics/event/StartVideoCallStatisticsEventTest.java @@ -22,12 +22,18 @@ public class StartVideoCallStatisticsEventTest { private StartVideoCallStatisticsEvent startVideoCallStatisticsEvent; private UUID uuid; + private UUID adviceSeekerUuid; + @Before public void setup() { uuid = UUID.randomUUID(); startVideoCallStatisticsEvent = new StartVideoCallStatisticsEvent( - CONSULTANT_ID, UserRole.CONSULTANT, SESSION_ID, uuid.toString()); + CONSULTANT_ID, + UserRole.CONSULTANT, + SESSION_ID, + uuid.toString(), + adviceSeekerUuid.toString()); } @Test diff --git a/src/test/java/de/caritas/cob/videoservice/api/service/video/VideoRoomServiceTest.java b/src/test/java/de/caritas/cob/videoservice/api/service/video/VideoRoomServiceTest.java index bde78d2..da543de 100644 --- a/src/test/java/de/caritas/cob/videoservice/api/service/video/VideoRoomServiceTest.java +++ b/src/test/java/de/caritas/cob/videoservice/api/service/video/VideoRoomServiceTest.java @@ -28,8 +28,7 @@ void createOneToOneVideoRoom_Should_ReturnsCreatedVideoRoom() { String jitsiRoomId = UUID.randomUUID().toString(); String rocketChatRoomId = UUID.randomUUID().toString(); var videoRoomResult = - videoRoomService.createOneToOneVideoRoom( - 1L, rocketChatRoomId, jitsiRoomId, "https://test.de"); + videoRoomService.createOneToOneVideoRoom(1L, rocketChatRoomId, jitsiRoomId); // Then ArgumentCaptor captor = ArgumentCaptor.forClass(VideoRoomEntity.class); @@ -38,7 +37,6 @@ void createOneToOneVideoRoom_Should_ReturnsCreatedVideoRoom() { assertThat(capturedValue.getJitsiRoomId()).isEqualTo(jitsiRoomId); assertThat(capturedValue.getSessionId()).isEqualTo(1L); assertThat(capturedValue.getRocketChatRoomId()).isEqualTo(rocketChatRoomId); - assertThat(capturedValue.getGuestVideoLink()).isEqualTo("https://test.de"); assertThat(capturedValue.getCreateDate()).isNotNull(); } @@ -47,8 +45,7 @@ void createGroupVideoRoom_Should_ReturnsCreatedVideoRoom() { // When String jitsiRoomId = UUID.randomUUID().toString(); String rocketChatRoomId = UUID.randomUUID().toString(); - var videoRoomResult = - videoRoomService.createGroupVideoRoom(1L, rocketChatRoomId, jitsiRoomId, "https://test.de"); + var videoRoomResult = videoRoomService.createGroupVideoRoom(1L, rocketChatRoomId, jitsiRoomId); // Then ArgumentCaptor captor = ArgumentCaptor.forClass(VideoRoomEntity.class); @@ -56,7 +53,6 @@ void createGroupVideoRoom_Should_ReturnsCreatedVideoRoom() { VideoRoomEntity capturedValue = captor.getValue(); assertThat(capturedValue.getJitsiRoomId()).isEqualTo(jitsiRoomId); assertThat(capturedValue.getGroupChatId()).isEqualTo(1L); - assertThat(capturedValue.getGuestVideoLink()).isEqualTo("https://test.de"); } @Test diff --git a/src/test/java/de/caritas/cob/videoservice/api/testhelper/TestConstants.java b/src/test/java/de/caritas/cob/videoservice/api/testhelper/TestConstants.java index 424a499..eacedca 100644 --- a/src/test/java/de/caritas/cob/videoservice/api/testhelper/TestConstants.java +++ b/src/test/java/de/caritas/cob/videoservice/api/testhelper/TestConstants.java @@ -57,6 +57,8 @@ public class TestConstants { public static final String USERNAME = "username"; public static final String CONSULTANT_ID = "fb3cbee2-c5f3-4582-a5e4-d853572e9860"; + public static final String ADVICESEEKER_ID = "jkhdsahas-c5f3-4582-a5e5-d853572e9861"; + /* * Common */ diff --git a/src/test/java/de/caritas/cob/videoservice/filter/HttpTenantFilterTest.java b/src/test/java/de/caritas/cob/videoservice/filter/HttpTenantFilterTest.java index 136789f..e9a1aa6 100644 --- a/src/test/java/de/caritas/cob/videoservice/filter/HttpTenantFilterTest.java +++ b/src/test/java/de/caritas/cob/videoservice/filter/HttpTenantFilterTest.java @@ -39,6 +39,20 @@ void doFilterInternal_Should_NotApply_When_RequestBelongsToTenancyWhiteList() Mockito.verifyNoInteractions(tenantResolverService); } + @Test + void doFilterInternal_Should_NotApply_When_RequestBelongsToTenancyWhiteListForStopEvent() + throws ServletException, IOException { + // given + Mockito.when(request.getRequestURI()) + .thenReturn("/videocalls/event/stop/5bb0dc45-eb79-4f75-af53-a4d0de4eeaf2@muc.meet.jitsi"); + + // when + httpTenantFilter.doFilterInternal(request, response, filterChain); + + // then + Mockito.verifyNoInteractions(tenantResolverService); + } + @Test void doFilterInternal_Should_Apply_When_DoesNotBelongBelongsToTenancyWhiteList() throws ServletException, IOException { diff --git a/src/test/resources/database/VideoData.sql b/src/test/resources/database/VideoData.sql index d81d6cd..3cc7a42 100644 --- a/src/test/resources/database/VideoData.sql +++ b/src/test/resources/database/VideoData.sql @@ -1,6 +1,6 @@ TRUNCATE TABLE videoroom; -INSERT INTO videoroom (id, session_id, group_chat_id, rocketchat_room_id, jitsi_room_id, guest_video_link, create_date) VALUES (1, 2, NULL, 'rocketchatroomid1', '653ae5b9-a932-42a6-8935-d24010e3c5c1', 'https://meet.jit.si/room1', '2024-01-01'); -INSERT INTO videoroom (id, session_id, group_chat_id, rocketchat_room_id, jitsi_room_id, guest_video_link, create_date) VALUES (2, NULL, 1, 'rocketchatroomid1', '999ae5b9-a932-42a6-8935-d24010e3c999', 'https://meet.jit.si/room1', '2024-01-01'); +INSERT INTO videoroom (id, session_id, group_chat_id, rocketchat_room_id, jitsi_room_id, create_date) VALUES (1, 2, NULL, 'rocketchatroomid1', '653ae5b9-a932-42a6-8935-d24010e3c5c1', '2024-01-01'); +INSERT INTO videoroom (id, session_id, group_chat_id, rocketchat_room_id, jitsi_room_id, create_date) VALUES (2, NULL, 1, 'rocketchatroomid1', '999ae5b9-a932-42a6-8935-d24010e3c999', '2024-01-01'); -- insert example data to videoroom table diff --git a/src/test/resources/database/VideoServiceDatabase.sql b/src/test/resources/database/VideoServiceDatabase.sql index 67be01b..209bc82 100644 --- a/src/test/resources/database/VideoServiceDatabase.sql +++ b/src/test/resources/database/VideoServiceDatabase.sql @@ -5,7 +5,6 @@ CREATE TABLE IF NOT EXISTS VIDEOROOM group_chat_id bigint NULL, jitsi_room_id varchar(40) NOT NULL, rocketchat_room_id varchar(40) NOT NULL, - guest_video_link varchar(1024) NOT NULL, create_date datetime NOT NULL, close_date datetime, CONSTRAINT PK_VIDEOROOM PRIMARY KEY (ID)