From 3dbd5a3a742ad4d998764d39dcdaf07a4a0791cd Mon Sep 17 00:00:00 2001 From: joffrey-bion Date: Mon, 15 Feb 2021 23:40:55 +0100 Subject: Add basic metrics --- .../sevenwonders/server/controllers/GameBrowserControllerTest.kt | 8 +++++--- .../luxons/sevenwonders/server/controllers/HomeControllerTest.kt | 6 ++++-- .../luxons/sevenwonders/server/controllers/LobbyControllerTest.kt | 8 +++++--- .../sevenwonders/server/repositories/LobbyRepositoryTest.kt | 4 +++- .../sevenwonders/server/repositories/PlayerRepositoryTest.kt | 4 +++- .../server/validation/DestinationAccessValidatorTest.kt | 4 +++- 6 files changed, 23 insertions(+), 11 deletions(-) (limited to 'sw-server/src/test') diff --git a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserControllerTest.kt b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserControllerTest.kt index df2e02ee..0f6e031b 100644 --- a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserControllerTest.kt +++ b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/controllers/GameBrowserControllerTest.kt @@ -1,5 +1,6 @@ package org.luxons.sevenwonders.server.controllers +import io.micrometer.core.instrument.simple.SimpleMeterRegistry import org.junit.Before import org.junit.Test import org.luxons.sevenwonders.model.api.GameListEvent @@ -23,10 +24,11 @@ class GameBrowserControllerTest { @Before fun setUp() { - playerRepository = PlayerRepository() - val lobbyRepository = LobbyRepository() + val meterRegistry = SimpleMeterRegistry() + playerRepository = PlayerRepository(meterRegistry) + val lobbyRepository = LobbyRepository(meterRegistry) val template = mockSimpMessagingTemplate() - val lobbyController = LobbyController(lobbyRepository, playerRepository, template, "UNUSED") + val lobbyController = LobbyController(lobbyRepository, playerRepository, template, "UNUSED", meterRegistry) gameBrowserController = GameBrowserController(lobbyController, lobbyRepository, playerRepository, template) } diff --git a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/controllers/HomeControllerTest.kt b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/controllers/HomeControllerTest.kt index f820621a..c73fba10 100644 --- a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/controllers/HomeControllerTest.kt +++ b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/controllers/HomeControllerTest.kt @@ -1,5 +1,6 @@ package org.luxons.sevenwonders.server.controllers +import io.micrometer.core.instrument.simple.SimpleMeterRegistry import org.junit.Test import org.luxons.sevenwonders.model.api.actions.ChooseNameAction import org.luxons.sevenwonders.model.api.actions.Icon @@ -10,8 +11,9 @@ class HomeControllerTest { @Test fun chooseName() { - val playerRepository = PlayerRepository() - val homeController = HomeController(playerRepository) + val meterRegistry = SimpleMeterRegistry() + val playerRepository = PlayerRepository(meterRegistry) + val homeController = HomeController(playerRepository, meterRegistry) val action = ChooseNameAction("Test User", Icon("person"), isHuman = true) val principal = TestPrincipal("testuser") diff --git a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/controllers/LobbyControllerTest.kt b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/controllers/LobbyControllerTest.kt index 351c2e9e..7d9db01d 100644 --- a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/controllers/LobbyControllerTest.kt +++ b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/controllers/LobbyControllerTest.kt @@ -1,5 +1,6 @@ package org.luxons.sevenwonders.server.controllers +import io.micrometer.core.instrument.simple.SimpleMeterRegistry import org.junit.Before import org.junit.Test import org.luxons.sevenwonders.model.Settings @@ -27,10 +28,11 @@ class LobbyControllerTest { @Before fun setUp() { + val meterRegistry = SimpleMeterRegistry() val template = mockSimpMessagingTemplate() - playerRepository = PlayerRepository() - lobbyRepository = LobbyRepository() - lobbyController = LobbyController(lobbyRepository, playerRepository, template, "UNUSED") + playerRepository = PlayerRepository(meterRegistry) + lobbyRepository = LobbyRepository(meterRegistry) + lobbyController = LobbyController(lobbyRepository, playerRepository, template, "UNUSED", meterRegistry) } @Test diff --git a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/repositories/LobbyRepositoryTest.kt b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/repositories/LobbyRepositoryTest.kt index 442edac2..eb80d909 100644 --- a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/repositories/LobbyRepositoryTest.kt +++ b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/repositories/LobbyRepositoryTest.kt @@ -1,5 +1,6 @@ package org.luxons.sevenwonders.server.repositories +import io.micrometer.core.instrument.simple.SimpleMeterRegistry import org.junit.Before import org.junit.Test import org.luxons.sevenwonders.server.lobby.Player @@ -15,7 +16,8 @@ class LobbyRepositoryTest { @Before fun setUp() { - repository = LobbyRepository() + val meterRegistry = SimpleMeterRegistry() + repository = LobbyRepository(meterRegistry) } @Test diff --git a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/repositories/PlayerRepositoryTest.kt b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/repositories/PlayerRepositoryTest.kt index 8e554546..231cf610 100644 --- a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/repositories/PlayerRepositoryTest.kt +++ b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/repositories/PlayerRepositoryTest.kt @@ -1,5 +1,6 @@ package org.luxons.sevenwonders.server.repositories +import io.micrometer.core.instrument.simple.SimpleMeterRegistry import org.junit.Before import org.junit.Test import kotlin.test.assertEquals @@ -14,7 +15,8 @@ class PlayerRepositoryTest { @Before fun setUp() { - repository = PlayerRepository() + val meterRegistry = SimpleMeterRegistry() + repository = PlayerRepository(meterRegistry) } @Test diff --git a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/validation/DestinationAccessValidatorTest.kt b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/validation/DestinationAccessValidatorTest.kt index c5ef3f44..0bcb45f3 100644 --- a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/validation/DestinationAccessValidatorTest.kt +++ b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/validation/DestinationAccessValidatorTest.kt @@ -1,5 +1,6 @@ package org.luxons.sevenwonders.server.validation +import io.micrometer.core.instrument.simple.SimpleMeterRegistry import org.junit.Before import org.junit.Test import org.luxons.sevenwonders.server.lobby.Lobby @@ -18,7 +19,8 @@ class DestinationAccessValidatorTest { @Before fun setup() { - lobbyRepository = LobbyRepository() + val meterRegistry = SimpleMeterRegistry() + lobbyRepository = LobbyRepository(meterRegistry) destinationAccessValidator = DestinationAccessValidator(lobbyRepository) } -- cgit