forked from Onlineberatung/onlineBeratung-videoService
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: run live-event call asynchronously
- Loading branch information
1 parent
f732f54
commit ff8ea23
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/de/caritas/cob/videoservice/config/apiclient/SpringAsyncConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...ava/de/caritas/cob/videoservice/api/service/liveevent/LiveEventNotificationServiceIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
public 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()); | ||
} | ||
} |