From 2a798646c228e440d21e0c3927491737959f92f9 Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Mon, 14 Apr 2025 22:59:55 +0200 Subject: [PATCH] feat: use rabbit to projection bus --- .../projection/GameListRepositoryInMemory.kt | 8 +++--- .../projection/GameListRepositoryInRedis.kt | 8 +++--- .../projection/GameProjectionBusInMemory.kt | 5 ++-- .../projection/GameProjectionBusInRabbitMQ.kt | 25 +++++++++++++++++++ .../projection/GameStateRepositoryInMemory.kt | 6 ++--- .../projection/GameStateRepositoryInRedis.kt | 6 ++--- .../adapter/interfaceLayer/query/GameList.kt | 3 +-- .../interfaceLayer/query/ReadTheGameState.kt | 3 +-- .../business/command/action/ICantPlay.kt | 2 +- .../command/action/IWantToJoinTheGame.kt | 2 +- .../command/action/IWantToPlayCard.kt | 2 +- .../business/command/action/IamReadyToPlay.kt | 2 +- .../event/projection/GameProjection.kt | 8 ++++++ .../event/projection/GameProjectionBus.kt | 4 +-- .../event/projection/gameList/GameList.kt | 4 +-- .../projection/gameList/GameListBuilder.kt | 2 +- .../projection/gameList/GameListRepository.kt | 2 +- .../event/projection/gameState/GameState.kt | 4 +-- .../projection/gameState/GameStateBuilder.kt | 2 +- .../gameState/GameStateRepository.kt | 2 +- .../PlayerNotificationListener.kt | 2 +- .../projectionListener/ReactionListener.kt | 2 +- .../injection/ConfigureDIInfrastructure.kt | 8 +++--- .../configuration/ktor/ConfigureAuth.kt | 1 - .../interfaceLayer/query/GameListRouteTest.kt | 2 +- .../query/GameSimulationTest.kt | 2 +- .../query/GameStateRouteTest.kt | 4 +-- .../business/entity/PlayerHandKtTest.kt | 3 --- .../event/projection/GameStateBuilderTest.kt | 2 -- .../projection/GameStateRepositoryTest.kt | 2 -- .../event/projection/GameStateTest.kt | 1 - .../PlayerNotificationListenerTest.kt | 2 +- 32 files changed, 75 insertions(+), 56 deletions(-) create mode 100644 src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInRabbitMQ.kt create mode 100644 src/main/kotlin/eventDemo/business/event/projection/GameProjection.kt diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInMemory.kt b/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInMemory.kt index fc2c97e..a0ebc8f 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInMemory.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInMemory.kt @@ -3,11 +3,11 @@ package eventDemo.adapter.infrastructureLayer.event.projection import eventDemo.business.entity.GameId import eventDemo.business.event.GameEventBus import eventDemo.business.event.GameEventStore +import eventDemo.business.event.projection.GameList +import eventDemo.business.event.projection.GameListRepository import eventDemo.business.event.projection.GameProjectionBus -import eventDemo.business.event.projection.gameList.GameList -import eventDemo.business.event.projection.gameList.GameListRepository -import eventDemo.business.event.projection.gameList.apply -import eventDemo.business.event.projection.gameState.GameState +import eventDemo.business.event.projection.GameState +import eventDemo.business.event.projection.apply import eventDemo.libs.event.projection.ProjectionSnapshotRepositoryInMemory import eventDemo.libs.event.projection.SnapshotConfig import io.github.oshai.kotlinlogging.withLoggingContext diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInRedis.kt b/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInRedis.kt index a673212..6e4f539 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInRedis.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInRedis.kt @@ -3,11 +3,11 @@ package eventDemo.adapter.infrastructureLayer.event.projection import eventDemo.business.entity.GameId import eventDemo.business.event.GameEventBus import eventDemo.business.event.GameEventStore +import eventDemo.business.event.projection.GameList +import eventDemo.business.event.projection.GameListRepository import eventDemo.business.event.projection.GameProjectionBus -import eventDemo.business.event.projection.gameList.GameList -import eventDemo.business.event.projection.gameList.GameListRepository -import eventDemo.business.event.projection.gameList.apply -import eventDemo.business.event.projection.gameState.GameState +import eventDemo.business.event.projection.GameState +import eventDemo.business.event.projection.apply import eventDemo.libs.event.projection.ProjectionSnapshotRepositoryInRedis import eventDemo.libs.event.projection.SnapshotConfig import io.github.oshai.kotlinlogging.withLoggingContext diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInMemory.kt b/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInMemory.kt index 9a3c2d2..492af84 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInMemory.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInMemory.kt @@ -1,15 +1,14 @@ package eventDemo.adapter.infrastructureLayer.event.projection -import eventDemo.business.entity.GameId +import eventDemo.business.event.projection.GameProjection import eventDemo.business.event.projection.GameProjectionBus import eventDemo.libs.bus.Bus import eventDemo.libs.bus.BusInMemory -import eventDemo.libs.event.projection.Projection import java.util.UUID class GameProjectionBusInMemory : GameProjectionBus, - Bus> by BusInMemory(GameProjectionBusInMemory::class), + Bus by BusInMemory(GameProjectionBusInMemory::class), Comparable { private val instanceId: UUID = UUID.randomUUID() diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInRabbitMQ.kt b/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInRabbitMQ.kt new file mode 100644 index 0000000..8e6855c --- /dev/null +++ b/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInRabbitMQ.kt @@ -0,0 +1,25 @@ +package eventDemo.adapter.infrastructureLayer.event.projection + +import com.rabbitmq.client.ConnectionFactory +import eventDemo.business.event.projection.GameProjection +import eventDemo.business.event.projection.GameProjectionBus +import eventDemo.libs.bus.Bus +import eventDemo.libs.bus.BusInRabbitMQ +import kotlinx.serialization.json.Json +import java.util.UUID + +class GameProjectionBusInRabbitMQ( + private val connectionFactory: ConnectionFactory, +) : GameProjectionBus, + Bus by BusInRabbitMQ( + connectionFactory, + "GameProjection", + { Json.encodeToString(it) }, + { Json.decodeFromString(it) }, + ), + Comparable { + private val instanceId: UUID = UUID.randomUUID() + + override fun compareTo(other: GameProjectionBusInRabbitMQ): Int = + compareValues(instanceId, other.instanceId) +} diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInMemory.kt b/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInMemory.kt index 7303f67..b19bd88 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInMemory.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInMemory.kt @@ -5,9 +5,9 @@ import eventDemo.business.event.GameEventBus import eventDemo.business.event.GameEventStore import eventDemo.business.event.event.GameEvent import eventDemo.business.event.projection.GameProjectionBus -import eventDemo.business.event.projection.gameState.GameState -import eventDemo.business.event.projection.gameState.GameStateRepository -import eventDemo.business.event.projection.gameState.apply +import eventDemo.business.event.projection.GameState +import eventDemo.business.event.projection.GameStateRepository +import eventDemo.business.event.projection.apply import eventDemo.libs.event.projection.ProjectionSnapshotRepositoryInMemory import eventDemo.libs.event.projection.SnapshotConfig import io.github.oshai.kotlinlogging.withLoggingContext diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInRedis.kt b/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInRedis.kt index ea2e12d..969ea02 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInRedis.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInRedis.kt @@ -5,9 +5,9 @@ import eventDemo.business.event.GameEventBus import eventDemo.business.event.GameEventStore import eventDemo.business.event.event.GameEvent import eventDemo.business.event.projection.GameProjectionBus -import eventDemo.business.event.projection.gameState.GameState -import eventDemo.business.event.projection.gameState.GameStateRepository -import eventDemo.business.event.projection.gameState.apply +import eventDemo.business.event.projection.GameState +import eventDemo.business.event.projection.GameStateRepository +import eventDemo.business.event.projection.apply import eventDemo.libs.event.projection.ProjectionSnapshotRepositoryInRedis import eventDemo.libs.event.projection.SnapshotConfig import io.github.oshai.kotlinlogging.withLoggingContext diff --git a/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GameList.kt b/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GameList.kt index e165f08..a92530e 100644 --- a/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GameList.kt +++ b/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GameList.kt @@ -1,8 +1,7 @@ package eventDemo.adapter.interfaceLayer.query -import eventDemo.business.event.projection.gameList.GameListRepository +import eventDemo.business.event.projection.GameListRepository import io.ktor.resources.Resource -import io.ktor.server.application.call import io.ktor.server.auth.authenticate import io.ktor.server.resources.get import io.ktor.server.response.respond diff --git a/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/ReadTheGameState.kt b/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/ReadTheGameState.kt index 3985bf1..4f0b995 100644 --- a/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/ReadTheGameState.kt +++ b/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/ReadTheGameState.kt @@ -1,11 +1,10 @@ package eventDemo.adapter.interfaceLayer.query import eventDemo.business.entity.GameId -import eventDemo.business.event.projection.gameState.GameStateRepository +import eventDemo.business.event.projection.GameStateRepository import eventDemo.configuration.serializer.GameIdSerializer import io.ktor.http.HttpStatusCode import io.ktor.resources.Resource -import io.ktor.server.application.call import io.ktor.server.auth.authenticate import io.ktor.server.resources.get import io.ktor.server.response.respond diff --git a/src/main/kotlin/eventDemo/business/command/action/ICantPlay.kt b/src/main/kotlin/eventDemo/business/command/action/ICantPlay.kt index 81ea640..0d365e8 100644 --- a/src/main/kotlin/eventDemo/business/command/action/ICantPlay.kt +++ b/src/main/kotlin/eventDemo/business/command/action/ICantPlay.kt @@ -3,7 +3,7 @@ package eventDemo.business.command.action import eventDemo.business.command.CommandException import eventDemo.business.command.command.ICantPlayCommand import eventDemo.business.event.event.PlayerHavePassEvent -import eventDemo.business.event.projection.gameState.GameStateRepository +import eventDemo.business.event.projection.GameStateRepository /** * A command to perform an action to play a new card diff --git a/src/main/kotlin/eventDemo/business/command/action/IWantToJoinTheGame.kt b/src/main/kotlin/eventDemo/business/command/action/IWantToJoinTheGame.kt index 69adfb9..29f5ca4 100644 --- a/src/main/kotlin/eventDemo/business/command/action/IWantToJoinTheGame.kt +++ b/src/main/kotlin/eventDemo/business/command/action/IWantToJoinTheGame.kt @@ -3,7 +3,7 @@ package eventDemo.business.command.action import eventDemo.business.command.CommandException import eventDemo.business.command.command.IWantToJoinTheGameCommand import eventDemo.business.event.event.NewPlayerEvent -import eventDemo.business.event.projection.gameState.GameStateRepository +import eventDemo.business.event.projection.GameStateRepository /** * A command to perform an action to play a new card diff --git a/src/main/kotlin/eventDemo/business/command/action/IWantToPlayCard.kt b/src/main/kotlin/eventDemo/business/command/action/IWantToPlayCard.kt index 278f30c..6266aa7 100644 --- a/src/main/kotlin/eventDemo/business/command/action/IWantToPlayCard.kt +++ b/src/main/kotlin/eventDemo/business/command/action/IWantToPlayCard.kt @@ -3,7 +3,7 @@ package eventDemo.business.command.action import eventDemo.business.command.CommandException import eventDemo.business.command.command.IWantToPlayCardCommand import eventDemo.business.event.event.CardIsPlayedEvent -import eventDemo.business.event.projection.gameState.GameStateRepository +import eventDemo.business.event.projection.GameStateRepository /** * A command to perform an action to play a new card diff --git a/src/main/kotlin/eventDemo/business/command/action/IamReadyToPlay.kt b/src/main/kotlin/eventDemo/business/command/action/IamReadyToPlay.kt index 21ba8a8..0213419 100644 --- a/src/main/kotlin/eventDemo/business/command/action/IamReadyToPlay.kt +++ b/src/main/kotlin/eventDemo/business/command/action/IamReadyToPlay.kt @@ -3,7 +3,7 @@ package eventDemo.business.command.action import eventDemo.business.command.CommandException import eventDemo.business.command.command.IamReadyToPlayCommand import eventDemo.business.event.event.PlayerReadyEvent -import eventDemo.business.event.projection.gameState.GameStateRepository +import eventDemo.business.event.projection.GameStateRepository /** * A command to set as ready to play diff --git a/src/main/kotlin/eventDemo/business/event/projection/GameProjection.kt b/src/main/kotlin/eventDemo/business/event/projection/GameProjection.kt new file mode 100644 index 0000000..61db589 --- /dev/null +++ b/src/main/kotlin/eventDemo/business/event/projection/GameProjection.kt @@ -0,0 +1,8 @@ +package eventDemo.business.event.projection + +import eventDemo.business.entity.GameId +import eventDemo.libs.event.projection.Projection +import kotlinx.serialization.Serializable + +@Serializable +sealed interface GameProjection : Projection diff --git a/src/main/kotlin/eventDemo/business/event/projection/GameProjectionBus.kt b/src/main/kotlin/eventDemo/business/event/projection/GameProjectionBus.kt index 96625e3..323bd5e 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/GameProjectionBus.kt +++ b/src/main/kotlin/eventDemo/business/event/projection/GameProjectionBus.kt @@ -1,7 +1,5 @@ package eventDemo.business.event.projection -import eventDemo.business.entity.GameId import eventDemo.libs.bus.Bus -import eventDemo.libs.event.projection.Projection -interface GameProjectionBus : Bus> +interface GameProjectionBus : Bus diff --git a/src/main/kotlin/eventDemo/business/event/projection/gameList/GameList.kt b/src/main/kotlin/eventDemo/business/event/projection/gameList/GameList.kt index 84c0b4d..983bc9a 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/gameList/GameList.kt +++ b/src/main/kotlin/eventDemo/business/event/projection/gameList/GameList.kt @@ -1,4 +1,4 @@ -package eventDemo.business.event.projection.gameList +package eventDemo.business.event.projection import eventDemo.business.entity.GameId import eventDemo.business.entity.Player @@ -15,7 +15,7 @@ data class GameList( val status: Status = Status.OPENING, val players: Set = emptySet(), val winners: Set = emptySet(), -) : Projection { +) : GameProjection { enum class Status { OPENING, IS_STARTED, diff --git a/src/main/kotlin/eventDemo/business/event/projection/gameList/GameListBuilder.kt b/src/main/kotlin/eventDemo/business/event/projection/gameList/GameListBuilder.kt index 4fa18a7..ab3491d 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/gameList/GameListBuilder.kt +++ b/src/main/kotlin/eventDemo/business/event/projection/gameList/GameListBuilder.kt @@ -1,4 +1,4 @@ -package eventDemo.business.event.projection.gameList +package eventDemo.business.event.projection import eventDemo.business.event.event.CardIsPlayedEvent import eventDemo.business.event.event.GameEvent diff --git a/src/main/kotlin/eventDemo/business/event/projection/gameList/GameListRepository.kt b/src/main/kotlin/eventDemo/business/event/projection/gameList/GameListRepository.kt index f2440e3..8a4e3eb 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/gameList/GameListRepository.kt +++ b/src/main/kotlin/eventDemo/business/event/projection/gameList/GameListRepository.kt @@ -1,4 +1,4 @@ -package eventDemo.business.event.projection.gameList +package eventDemo.business.event.projection interface GameListRepository { fun getList(): List diff --git a/src/main/kotlin/eventDemo/business/event/projection/gameState/GameState.kt b/src/main/kotlin/eventDemo/business/event/projection/gameState/GameState.kt index 8237eaa..bcf9ce5 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/gameState/GameState.kt +++ b/src/main/kotlin/eventDemo/business/event/projection/gameState/GameState.kt @@ -1,4 +1,4 @@ -package eventDemo.business.event.projection.gameState +package eventDemo.business.event.projection import eventDemo.business.entity.Card import eventDemo.business.entity.Deck @@ -25,7 +25,7 @@ data class GameState( val isStarted: Boolean = false, val playerWins: Set = emptySet(), val lastEvent: GameEvent? = null, -) : Projection { +) : GameProjection { enum class Direction { CLOCKWISE, COUNTER_CLOCKWISE, diff --git a/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateBuilder.kt b/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateBuilder.kt index bea2ca6..425d3cb 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateBuilder.kt +++ b/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateBuilder.kt @@ -1,4 +1,4 @@ -package eventDemo.business.event.projection.gameState +package eventDemo.business.event.projection import eventDemo.business.entity.Card import eventDemo.business.event.event.CardIsPlayedEvent diff --git a/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateRepository.kt b/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateRepository.kt index 1cdf721..b8cd07a 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateRepository.kt +++ b/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateRepository.kt @@ -1,4 +1,4 @@ -package eventDemo.business.event.projection.gameState +package eventDemo.business.event.projection import eventDemo.business.entity.GameId import eventDemo.business.event.event.GameEvent diff --git a/src/main/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListener.kt b/src/main/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListener.kt index a12b98c..f1314e9 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListener.kt +++ b/src/main/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListener.kt @@ -11,7 +11,7 @@ import eventDemo.business.event.event.PlayerHavePassEvent import eventDemo.business.event.event.PlayerReadyEvent import eventDemo.business.event.event.PlayerWinEvent import eventDemo.business.event.projection.GameProjectionBus -import eventDemo.business.event.projection.gameState.GameState +import eventDemo.business.event.projection.GameState import eventDemo.business.notification.ItsTheTurnOfNotification import eventDemo.business.notification.Notification import eventDemo.business.notification.PlayerAsJoinTheGameNotification diff --git a/src/main/kotlin/eventDemo/business/event/projection/projectionListener/ReactionListener.kt b/src/main/kotlin/eventDemo/business/event/projection/projectionListener/ReactionListener.kt index 9e2a6ce..5813719 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/projectionListener/ReactionListener.kt +++ b/src/main/kotlin/eventDemo/business/event/projection/projectionListener/ReactionListener.kt @@ -5,7 +5,7 @@ import eventDemo.business.event.GameEventHandler import eventDemo.business.event.event.GameStartedEvent import eventDemo.business.event.event.PlayerWinEvent import eventDemo.business.event.projection.GameProjectionBus -import eventDemo.business.event.projection.gameState.GameState +import eventDemo.business.event.projection.GameState import eventDemo.libs.event.projection.Projection import io.github.oshai.kotlinlogging.KotlinLogging import io.github.oshai.kotlinlogging.withLoggingContext diff --git a/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIInfrastructure.kt b/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIInfrastructure.kt index d96900a..0c14786 100644 --- a/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIInfrastructure.kt +++ b/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIInfrastructure.kt @@ -6,13 +6,13 @@ import com.zaxxer.hikari.HikariDataSource import eventDemo.adapter.infrastructureLayer.event.GameEventBusInRabbinMQ import eventDemo.adapter.infrastructureLayer.event.GameEventStoreInPostgresql import eventDemo.adapter.infrastructureLayer.event.projection.GameListRepositoryInRedis -import eventDemo.adapter.infrastructureLayer.event.projection.GameProjectionBusInMemory +import eventDemo.adapter.infrastructureLayer.event.projection.GameProjectionBusInRabbitMQ import eventDemo.adapter.infrastructureLayer.event.projection.GameStateRepositoryInRedis import eventDemo.business.event.GameEventBus import eventDemo.business.event.GameEventStore +import eventDemo.business.event.projection.GameListRepository import eventDemo.business.event.projection.GameProjectionBus -import eventDemo.business.event.projection.gameList.GameListRepository -import eventDemo.business.event.projection.gameState.GameStateRepository +import eventDemo.business.event.projection.GameStateRepository import eventDemo.libs.event.projection.SnapshotConfig import org.koin.core.module.Module import org.koin.core.module.dsl.singleOf @@ -62,7 +62,7 @@ fun Module.configureDIInfrastructure(config: Configuration) { singleOf(::GameEventBusInRabbinMQ) bind GameEventBus::class singleOf(::GameEventStoreInPostgresql) bind GameEventStore::class - singleOf(::GameProjectionBusInMemory) bind GameProjectionBus::class + singleOf(::GameProjectionBusInRabbitMQ) bind GameProjectionBus::class single { GameStateRepositoryInRedis(get(), get(), snapshotConfig = SnapshotConfig()) diff --git a/src/main/kotlin/eventDemo/configuration/ktor/ConfigureAuth.kt b/src/main/kotlin/eventDemo/configuration/ktor/ConfigureAuth.kt index 24b889e..fba65d5 100644 --- a/src/main/kotlin/eventDemo/configuration/ktor/ConfigureAuth.kt +++ b/src/main/kotlin/eventDemo/configuration/ktor/ConfigureAuth.kt @@ -5,7 +5,6 @@ import com.auth0.jwt.algorithms.Algorithm import eventDemo.business.entity.Player import io.ktor.http.HttpStatusCode import io.ktor.server.application.Application -import io.ktor.server.application.call import io.ktor.server.auth.authentication import io.ktor.server.auth.jwt.JWTPrincipal import io.ktor.server.auth.jwt.jwt diff --git a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameListRouteTest.kt b/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameListRouteTest.kt index be7b648..87a85bc 100644 --- a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameListRouteTest.kt +++ b/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameListRouteTest.kt @@ -6,7 +6,7 @@ import eventDemo.business.event.GameEventHandler import eventDemo.business.event.event.GameStartedEvent import eventDemo.business.event.event.NewPlayerEvent import eventDemo.business.event.event.PlayerReadyEvent -import eventDemo.business.event.projection.gameList.GameList +import eventDemo.business.event.projection.GameList import eventDemo.testApplicationWithConfig import io.kotest.assertions.nondeterministic.eventually import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameSimulationTest.kt b/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameSimulationTest.kt index d6ee097..b6904d8 100644 --- a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameSimulationTest.kt +++ b/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameSimulationTest.kt @@ -12,7 +12,7 @@ import eventDemo.business.entity.GameId import eventDemo.business.entity.Player import eventDemo.business.event.GameEventStore import eventDemo.business.event.event.disableShuffleDeck -import eventDemo.business.event.projection.gameState.GameState +import eventDemo.business.event.projection.GameState import eventDemo.business.event.projection.projectionListener.PlayerNotificationListener import eventDemo.business.notification.CommandSuccessNotification import eventDemo.business.notification.ItsTheTurnOfNotification diff --git a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameStateRouteTest.kt b/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameStateRouteTest.kt index 083a9ed..9718347 100644 --- a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameStateRouteTest.kt +++ b/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameStateRouteTest.kt @@ -8,8 +8,8 @@ import eventDemo.business.event.event.CardIsPlayedEvent import eventDemo.business.event.event.NewPlayerEvent import eventDemo.business.event.event.PlayerReadyEvent import eventDemo.business.event.event.disableShuffleDeck -import eventDemo.business.event.projection.gameState.GameState -import eventDemo.business.event.projection.gameState.GameStateRepository +import eventDemo.business.event.projection.GameState +import eventDemo.business.event.projection.GameStateRepository import eventDemo.testApplicationWithConfig import io.kotest.assertions.nondeterministic.eventually import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/eventDemo/business/entity/PlayerHandKtTest.kt b/src/test/kotlin/eventDemo/business/entity/PlayerHandKtTest.kt index 0638b13..e826ab3 100644 --- a/src/test/kotlin/eventDemo/business/entity/PlayerHandKtTest.kt +++ b/src/test/kotlin/eventDemo/business/entity/PlayerHandKtTest.kt @@ -1,8 +1,5 @@ package eventDemo.business.entity -import eventDemo.business.entity.Card -import eventDemo.business.entity.Player -import eventDemo.business.entity.PlayersHands import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.ints.shouldBeExactly import kotlin.test.assertNotNull diff --git a/src/test/kotlin/eventDemo/business/event/projection/GameStateBuilderTest.kt b/src/test/kotlin/eventDemo/business/event/projection/GameStateBuilderTest.kt index e0508ed..fc5ae82 100644 --- a/src/test/kotlin/eventDemo/business/event/projection/GameStateBuilderTest.kt +++ b/src/test/kotlin/eventDemo/business/event/projection/GameStateBuilderTest.kt @@ -8,8 +8,6 @@ import eventDemo.business.event.event.GameStartedEvent import eventDemo.business.event.event.NewPlayerEvent import eventDemo.business.event.event.PlayerReadyEvent import eventDemo.business.event.event.disableShuffleDeck -import eventDemo.business.event.projection.gameState.GameState -import eventDemo.business.event.projection.gameState.apply import eventDemo.libs.event.VersionBuilderLocal import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.equals.shouldBeEqual diff --git a/src/test/kotlin/eventDemo/business/event/projection/GameStateRepositoryTest.kt b/src/test/kotlin/eventDemo/business/event/projection/GameStateRepositoryTest.kt index 77b3e47..5a5780c 100644 --- a/src/test/kotlin/eventDemo/business/event/projection/GameStateRepositoryTest.kt +++ b/src/test/kotlin/eventDemo/business/event/projection/GameStateRepositoryTest.kt @@ -9,8 +9,6 @@ import eventDemo.business.entity.GameId import eventDemo.business.entity.Player import eventDemo.business.event.GameEventHandler import eventDemo.business.event.event.NewPlayerEvent -import eventDemo.business.event.projection.gameState.GameState -import eventDemo.business.event.projection.gameState.GameStateRepository import eventDemo.testKoinApplicationWithConfig import eventDemo.withLogLevel import io.kotest.assertions.nondeterministic.eventually diff --git a/src/test/kotlin/eventDemo/business/event/projection/GameStateTest.kt b/src/test/kotlin/eventDemo/business/event/projection/GameStateTest.kt index 80e3300..52d7f4c 100644 --- a/src/test/kotlin/eventDemo/business/event/projection/GameStateTest.kt +++ b/src/test/kotlin/eventDemo/business/event/projection/GameStateTest.kt @@ -6,7 +6,6 @@ import eventDemo.business.entity.Discard import eventDemo.business.entity.GameId import eventDemo.business.entity.Player import eventDemo.business.entity.PlayersHands -import eventDemo.business.event.projection.gameState.GameState import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.equals.shouldBeEqual diff --git a/src/test/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListenerTest.kt b/src/test/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListenerTest.kt index d6e6c19..c752ede 100644 --- a/src/test/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListenerTest.kt +++ b/src/test/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListenerTest.kt @@ -4,7 +4,7 @@ import eventDemo.adapter.infrastructureLayer.event.projection.GameProjectionBusI import eventDemo.business.entity.GameId import eventDemo.business.entity.Player import eventDemo.business.event.event.NewPlayerEvent -import eventDemo.business.event.projection.gameState.GameState +import eventDemo.business.event.projection.GameState import eventDemo.business.notification.WelcomeToTheGameNotification import io.kotest.core.spec.style.FunSpec import io.mockk.mockk