Skip to content

Commit

Permalink
Merge pull request #14 from Onlineberatung/develop
Browse files Browse the repository at this point in the history
[pull] develop from Onlineberatung:develop
  • Loading branch information
tkuzynow authored Oct 21, 2022
2 parents b28f20c + 1de259e commit c0273c8
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:11.0.10-jre-slim-buster
FROM adoptopenjdk/openjdk11
VOLUME ["/tmp","/log"]
EXPOSE 8080
ARG JAR_FILE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
Expand All @@ -26,6 +27,7 @@ public class LiveEventNotificationService {
* @param liveEventMessage {@link LiveEventMessage}
* @param userIds list of receiver user Ids
*/
@Async
public void sendVideoCallRequestLiveEvent(LiveEventMessage liveEventMessage,
List<String> userIds) {
await();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package de.caritas.cob.videoservice.config.apiclient;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;

@Configuration
@EnableAsync
public class SpringAsyncConfig {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package de.caritas.cob.videoservice.api.service.liveevent;

import static org.junit.jupiter.api.Assertions.assertEquals;

import de.caritas.cob.videoservice.liveservice.generated.web.LiveControllerApi;
import de.caritas.cob.videoservice.liveservice.generated.web.model.LiveEventMessage;
import java.lang.management.ManagementFactory;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;

@SpringBootTest
@ActiveProfiles("testing")
@DirtiesContext
class LiveEventNotificationServiceIT {

@Autowired
private LiveEventNotificationService underTest;

@MockBean
@Qualifier("liveControllerApi")
@SuppressWarnings("unused")
private LiveControllerApi liveControllerApi;

@Test
void sendVideoCallRequestLiveEventShouldRunInAnotherThread() {
var threadCount = ManagementFactory.getThreadMXBean().getThreadCount();

underTest.sendVideoCallRequestLiveEvent(new LiveEventMessage(), List.of());

assertEquals(threadCount + 1, ManagementFactory.getThreadMXBean().getThreadCount());
}
}

0 comments on commit c0273c8

Please sign in to comment.