diff --git a/build.gradle.kts b/build.gradle.kts index dbf1931..e78e74a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,9 +12,9 @@ val kotest_version: String by project plugins { application - kotlin("jvm") version "2.1.10" - id("io.ktor.plugin") version "3.1.1" - id("org.jetbrains.kotlin.plugin.serialization") version "2.1.10" + kotlin("jvm") version "2.1.21" + id("io.ktor.plugin") version "3.5.1" + id("org.jetbrains.kotlin.plugin.serialization") version "2.4.10" id("org.jlleitschuh.gradle.ktlint") version "12.2.0" id("com.avast.gradle.docker-compose") version "0.17.12" } diff --git a/docker/parts/docker-compose-databases.yaml b/docker/parts/docker-compose-databases.yaml index c00e941..1479687 100644 --- a/docker/parts/docker-compose-databases.yaml +++ b/docker/parts/docker-compose-databases.yaml @@ -1,6 +1,6 @@ services: redis: - image: redis/redis-stack:7.4.0-v3 + image: redis/redis-stack:7.4.0-v8 healthcheck: test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ] volumes: @@ -19,7 +19,7 @@ services: restart: no postgresql: - image: postgres:17.4 + image: postgres:18.4 command: postgres -c 'max_connections=500' environment: POSTGRES_PASSWORD_FILE: /run/secrets/postgresql_password @@ -32,7 +32,7 @@ services: timeout: 5s retries: 10 volumes: - - postgresql_data:/var/lib/postgresql/data + - postgresql_data:/var/lib/postgresql rabbitmq: image: rabbitmq:4-management-alpine diff --git a/gradle.properties b/gradle.properties index 6bf0b33..136f432 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ -ktor_version=3.1.1 -kotlin_version=2.1.10 -kotlin_serialization_version=1.8.0 -logback_version=1.5.17 -koin_version=4.0.2 -kotlin_logging_version=7.0.5 -kotest_version=6.0.0.M2 +ktor_version=3.5.1 +kotlin_version=2.1.21 +kotlin_serialization_version=1.11.0 +logback_version=1.5.38 +koin_version=4.2.1 +kotlin_logging_version=8.0.4 +kotest_version=6.2.2 kotlin.code.style=official diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e411586..52ad5e7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/GameEventBusInMemory.kt b/src/main/kotlin/eventDemo/adapter/infrastructure/event/GameEventBusInMemory.kt similarity index 73% rename from src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/GameEventBusInMemory.kt rename to src/main/kotlin/eventDemo/adapter/infrastructure/event/GameEventBusInMemory.kt index b57d6a3..d72487d 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/GameEventBusInMemory.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructure/event/GameEventBusInMemory.kt @@ -1,7 +1,7 @@ -package eventDemo.adapter.infrastructureLayer.event +package eventDemo.adapter.infrastructure.event -import eventDemo.business.event.GameEventBus -import eventDemo.business.event.event.GameEvent +import eventDemo.domain.event.GameEventBus +import eventDemo.domain.event.event.GameEvent import eventDemo.libs.bus.Bus import eventDemo.libs.bus.BusInMemory import java.util.UUID diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/GameEventBusInRabbinMQ.kt b/src/main/kotlin/eventDemo/adapter/infrastructure/event/GameEventBusInRabbinMQ.kt similarity index 81% rename from src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/GameEventBusInRabbinMQ.kt rename to src/main/kotlin/eventDemo/adapter/infrastructure/event/GameEventBusInRabbinMQ.kt index fae10c5..03baba9 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/GameEventBusInRabbinMQ.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructure/event/GameEventBusInRabbinMQ.kt @@ -1,8 +1,8 @@ -package eventDemo.adapter.infrastructureLayer.event +package eventDemo.adapter.infrastructure.event import com.rabbitmq.client.ConnectionFactory -import eventDemo.business.event.GameEventBus -import eventDemo.business.event.event.GameEvent +import eventDemo.domain.event.GameEventBus +import eventDemo.domain.event.event.GameEvent import eventDemo.libs.bus.Bus import eventDemo.libs.bus.BusInRabbitMQ import kotlinx.serialization.json.Json diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/GameEventStoreInMemory.kt b/src/main/kotlin/eventDemo/adapter/infrastructure/event/GameEventStoreInMemory.kt similarity index 57% rename from src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/GameEventStoreInMemory.kt rename to src/main/kotlin/eventDemo/adapter/infrastructure/event/GameEventStoreInMemory.kt index c561089..386e7b3 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/GameEventStoreInMemory.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructure/event/GameEventStoreInMemory.kt @@ -1,8 +1,8 @@ -package eventDemo.adapter.infrastructureLayer.event +package eventDemo.adapter.infrastructure.event -import eventDemo.business.entity.GameId -import eventDemo.business.event.GameEventStore -import eventDemo.business.event.event.GameEvent +import eventDemo.domain.entity.GameId +import eventDemo.domain.event.GameEventStore +import eventDemo.domain.event.event.GameEvent import eventDemo.libs.event.EventStore import eventDemo.libs.event.EventStoreInMemory diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/GameEventStoreInPostgresql.kt b/src/main/kotlin/eventDemo/adapter/infrastructure/event/GameEventStoreInPostgresql.kt similarity index 70% rename from src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/GameEventStoreInPostgresql.kt rename to src/main/kotlin/eventDemo/adapter/infrastructure/event/GameEventStoreInPostgresql.kt index 99f7e49..395fe83 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/GameEventStoreInPostgresql.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructure/event/GameEventStoreInPostgresql.kt @@ -1,8 +1,8 @@ -package eventDemo.adapter.infrastructureLayer.event +package eventDemo.adapter.infrastructure.event -import eventDemo.business.entity.GameId -import eventDemo.business.event.GameEventStore -import eventDemo.business.event.event.GameEvent +import eventDemo.domain.entity.GameId +import eventDemo.domain.event.GameEventStore +import eventDemo.domain.event.event.GameEvent import eventDemo.libs.event.EventStore import eventDemo.libs.event.EventStoreInPostgresql import kotlinx.serialization.json.Json diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInMemory.kt b/src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameListRepositoryInMemory.kt similarity index 72% rename from src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInMemory.kt rename to src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameListRepositoryInMemory.kt index 4491510..42e3575 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInMemory.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameListRepositoryInMemory.kt @@ -1,12 +1,12 @@ -package eventDemo.adapter.infrastructureLayer.event.projection +package eventDemo.adapter.infrastructure.event.projection -import eventDemo.business.entity.GameId -import eventDemo.business.event.GameEventBus -import eventDemo.business.event.projection.GameList -import eventDemo.business.event.projection.GameListRepository -import eventDemo.business.event.projection.GameProjectionBus -import eventDemo.business.event.projection.GameState -import eventDemo.business.event.projection.apply +import eventDemo.domain.entity.GameId +import eventDemo.domain.event.GameEventBus +import eventDemo.domain.event.projection.GameList +import eventDemo.domain.event.projection.GameListRepository +import eventDemo.domain.event.projection.GameProjectionBus +import eventDemo.domain.event.projection.GameState +import eventDemo.domain.event.projection.apply import eventDemo.libs.event.projection.ProjectionRepositoryInMemory 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/infrastructure/event/projection/GameListRepositoryInRedis.kt similarity index 76% rename from src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInRedis.kt rename to src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameListRepositoryInRedis.kt index cadbc34..51ed7e1 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameListRepositoryInRedis.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameListRepositoryInRedis.kt @@ -1,12 +1,12 @@ -package eventDemo.adapter.infrastructureLayer.event.projection +package eventDemo.adapter.infrastructure.event.projection -import eventDemo.business.entity.GameId -import eventDemo.business.event.GameEventBus -import eventDemo.business.event.projection.GameList -import eventDemo.business.event.projection.GameListRepository -import eventDemo.business.event.projection.GameProjectionBus -import eventDemo.business.event.projection.GameState -import eventDemo.business.event.projection.apply +import eventDemo.domain.entity.GameId +import eventDemo.domain.event.GameEventBus +import eventDemo.domain.event.projection.GameList +import eventDemo.domain.event.projection.GameListRepository +import eventDemo.domain.event.projection.GameProjectionBus +import eventDemo.domain.event.projection.GameState +import eventDemo.domain.event.projection.apply import eventDemo.libs.event.projection.ProjectionRepositoryInRedis import io.github.oshai.kotlinlogging.withLoggingContext import kotlinx.serialization.json.Json diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInMemory.kt b/src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameProjectionBusInMemory.kt similarity index 70% rename from src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInMemory.kt rename to src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameProjectionBusInMemory.kt index 492af84..02f46d4 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInMemory.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameProjectionBusInMemory.kt @@ -1,7 +1,7 @@ -package eventDemo.adapter.infrastructureLayer.event.projection +package eventDemo.adapter.infrastructure.event.projection -import eventDemo.business.event.projection.GameProjection -import eventDemo.business.event.projection.GameProjectionBus +import eventDemo.domain.event.projection.GameProjection +import eventDemo.domain.event.projection.GameProjectionBus import eventDemo.libs.bus.Bus import eventDemo.libs.bus.BusInMemory import java.util.UUID diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInRabbitMQ.kt b/src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameProjectionBusInRabbitMQ.kt similarity index 78% rename from src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInRabbitMQ.kt rename to src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameProjectionBusInRabbitMQ.kt index 8e6855c..d067a61 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameProjectionBusInRabbitMQ.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameProjectionBusInRabbitMQ.kt @@ -1,8 +1,8 @@ -package eventDemo.adapter.infrastructureLayer.event.projection +package eventDemo.adapter.infrastructure.event.projection import com.rabbitmq.client.ConnectionFactory -import eventDemo.business.event.projection.GameProjection -import eventDemo.business.event.projection.GameProjectionBus +import eventDemo.domain.event.projection.GameProjection +import eventDemo.domain.event.projection.GameProjectionBus import eventDemo.libs.bus.Bus import eventDemo.libs.bus.BusInRabbitMQ import kotlinx.serialization.json.Json diff --git a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInMemory.kt b/src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameStateRepositoryInMemory.kt similarity index 73% rename from src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInMemory.kt rename to src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameStateRepositoryInMemory.kt index 612a195..5e2dd5a 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInMemory.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameStateRepositoryInMemory.kt @@ -1,11 +1,11 @@ -package eventDemo.adapter.infrastructureLayer.event.projection +package eventDemo.adapter.infrastructure.event.projection -import eventDemo.business.entity.GameId -import eventDemo.business.event.GameEventBus -import eventDemo.business.event.projection.GameProjectionBus -import eventDemo.business.event.projection.GameState -import eventDemo.business.event.projection.GameStateRepository -import eventDemo.business.event.projection.apply +import eventDemo.domain.entity.GameId +import eventDemo.domain.event.GameEventBus +import eventDemo.domain.event.projection.GameProjectionBus +import eventDemo.domain.event.projection.GameState +import eventDemo.domain.event.projection.GameStateRepository +import eventDemo.domain.event.projection.apply import eventDemo.libs.event.projection.ProjectionRepositoryInMemory 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/infrastructure/event/projection/GameStateRepositoryInRedis.kt similarity index 78% rename from src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInRedis.kt rename to src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameStateRepositoryInRedis.kt index 4fcf615..3963b48 100644 --- a/src/main/kotlin/eventDemo/adapter/infrastructureLayer/event/projection/GameStateRepositoryInRedis.kt +++ b/src/main/kotlin/eventDemo/adapter/infrastructure/event/projection/GameStateRepositoryInRedis.kt @@ -1,11 +1,11 @@ -package eventDemo.adapter.infrastructureLayer.event.projection +package eventDemo.adapter.infrastructure.event.projection -import eventDemo.business.entity.GameId -import eventDemo.business.event.GameEventBus -import eventDemo.business.event.projection.GameProjectionBus -import eventDemo.business.event.projection.GameState -import eventDemo.business.event.projection.GameStateRepository -import eventDemo.business.event.projection.apply +import eventDemo.domain.entity.GameId +import eventDemo.domain.event.GameEventBus +import eventDemo.domain.event.projection.GameProjectionBus +import eventDemo.domain.event.projection.GameState +import eventDemo.domain.event.projection.GameStateRepository +import eventDemo.domain.event.projection.apply import eventDemo.libs.event.projection.ProjectionRepositoryInRedis import io.github.oshai.kotlinlogging.withLoggingContext import kotlinx.serialization.json.Json diff --git a/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GameCommandRouteWebSocket.kt b/src/main/kotlin/eventDemo/adapter/presenter/query/GameCommandRouteWebSocket.kt similarity index 85% rename from src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GameCommandRouteWebSocket.kt rename to src/main/kotlin/eventDemo/adapter/presenter/query/GameCommandRouteWebSocket.kt index 780d665..b7d0b1f 100644 --- a/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GameCommandRouteWebSocket.kt +++ b/src/main/kotlin/eventDemo/adapter/presenter/query/GameCommandRouteWebSocket.kt @@ -1,10 +1,10 @@ -package eventDemo.adapter.interfaceLayer.query +package eventDemo.adapter.presenter.query -import eventDemo.business.command.GameCommandHandler -import eventDemo.business.command.command.GameCommand -import eventDemo.business.entity.GameId -import eventDemo.business.event.projection.projectionListener.PlayerNotificationListener -import eventDemo.business.notification.Notification +import eventDemo.domain.command.GameCommandHandler +import eventDemo.domain.command.command.GameCommand +import eventDemo.domain.entity.GameId +import eventDemo.domain.event.projection.projectionListener.PlayerNotificationListener +import eventDemo.domain.notification.Notification import eventDemo.libs.fromFrameChannel import eventDemo.libs.toObjectChannel import io.github.oshai.kotlinlogging.withLoggingContext diff --git a/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GameList.kt b/src/main/kotlin/eventDemo/adapter/presenter/query/GameList.kt similarity index 83% rename from src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GameList.kt rename to src/main/kotlin/eventDemo/adapter/presenter/query/GameList.kt index a92530e..c8718ff 100644 --- a/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GameList.kt +++ b/src/main/kotlin/eventDemo/adapter/presenter/query/GameList.kt @@ -1,6 +1,6 @@ -package eventDemo.adapter.interfaceLayer.query +package eventDemo.adapter.presenter.query -import eventDemo.business.event.projection.GameListRepository +import eventDemo.domain.event.projection.GameListRepository import io.ktor.resources.Resource import io.ktor.server.auth.authenticate import io.ktor.server.resources.get diff --git a/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GetPlayerCredentials.kt b/src/main/kotlin/eventDemo/adapter/presenter/query/GetPlayerCredentials.kt similarity index 80% rename from src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GetPlayerCredentials.kt rename to src/main/kotlin/eventDemo/adapter/presenter/query/GetPlayerCredentials.kt index e3b9141..766996a 100644 --- a/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/GetPlayerCredentials.kt +++ b/src/main/kotlin/eventDemo/adapter/presenter/query/GetPlayerCredentials.kt @@ -1,6 +1,6 @@ -package eventDemo.adapter.interfaceLayer.query +package eventDemo.adapter.presenter.query -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Player import io.ktor.server.application.ApplicationCall import io.ktor.server.auth.jwt.JWTPrincipal import io.ktor.server.auth.principal diff --git a/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/ReadTheGameState.kt b/src/main/kotlin/eventDemo/adapter/presenter/query/ReadTheGameState.kt similarity index 88% rename from src/main/kotlin/eventDemo/adapter/interfaceLayer/query/ReadTheGameState.kt rename to src/main/kotlin/eventDemo/adapter/presenter/query/ReadTheGameState.kt index 50dc4f6..aa5e161 100644 --- a/src/main/kotlin/eventDemo/adapter/interfaceLayer/query/ReadTheGameState.kt +++ b/src/main/kotlin/eventDemo/adapter/presenter/query/ReadTheGameState.kt @@ -1,7 +1,7 @@ -package eventDemo.adapter.interfaceLayer.query +package eventDemo.adapter.presenter.query -import eventDemo.business.entity.GameId -import eventDemo.business.event.projection.GameStateRepository +import eventDemo.domain.entity.GameId +import eventDemo.domain.event.projection.GameStateRepository import eventDemo.configuration.serializer.GameIdSerializer import io.ktor.http.HttpStatusCode import io.ktor.resources.Resource diff --git a/src/main/kotlin/eventDemo/business/command/GameCommandActionRunner.kt b/src/main/kotlin/eventDemo/business/command/GameCommandActionRunner.kt deleted file mode 100644 index 7b4701e..0000000 --- a/src/main/kotlin/eventDemo/business/command/GameCommandActionRunner.kt +++ /dev/null @@ -1,27 +0,0 @@ -package eventDemo.business.command - -import eventDemo.business.command.action.ICantPlay -import eventDemo.business.command.action.IWantToJoinTheGame -import eventDemo.business.command.action.IWantToPlayCard -import eventDemo.business.command.action.IamReadyToPlay -import eventDemo.business.command.command.GameCommand -import eventDemo.business.command.command.ICantPlayCommand -import eventDemo.business.command.command.IWantToJoinTheGameCommand -import eventDemo.business.command.command.IWantToPlayCardCommand -import eventDemo.business.command.command.IamReadyToPlayCommand -import eventDemo.business.event.event.GameEvent - -class GameCommandActionRunner( - private val iWantToPlayCard: IWantToPlayCard, - private val iamReadyToPlay: IamReadyToPlay, - private val iWantToJoinTheGame: IWantToJoinTheGame, - private val iCantPlay: ICantPlay, -) { - fun run(command: GameCommand): (version: Int) -> GameEvent = - when (command) { - is IWantToPlayCardCommand -> iWantToPlayCard.run(command) - is IamReadyToPlayCommand -> iamReadyToPlay.run(command) - is IWantToJoinTheGameCommand -> iWantToJoinTheGame.run(command) - is ICantPlayCommand -> iCantPlay.run(command) - } -} diff --git a/src/main/kotlin/eventDemo/business/event/GameEventBus.kt b/src/main/kotlin/eventDemo/business/event/GameEventBus.kt deleted file mode 100644 index 746a2ae..0000000 --- a/src/main/kotlin/eventDemo/business/event/GameEventBus.kt +++ /dev/null @@ -1,6 +0,0 @@ -package eventDemo.business.event - -import eventDemo.business.event.event.GameEvent -import eventDemo.libs.bus.Bus - -interface GameEventBus : Bus diff --git a/src/main/kotlin/eventDemo/business/event/GameEventStore.kt b/src/main/kotlin/eventDemo/business/event/GameEventStore.kt deleted file mode 100644 index 7354184..0000000 --- a/src/main/kotlin/eventDemo/business/event/GameEventStore.kt +++ /dev/null @@ -1,7 +0,0 @@ -package eventDemo.business.event - -import eventDemo.business.entity.GameId -import eventDemo.business.event.event.GameEvent -import eventDemo.libs.event.EventStore - -interface GameEventStore : EventStore diff --git a/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateRepository.kt b/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateRepository.kt deleted file mode 100644 index 8f3187f..0000000 --- a/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateRepository.kt +++ /dev/null @@ -1,7 +0,0 @@ -package eventDemo.business.event.projection - -import eventDemo.business.entity.GameId - -interface GameStateRepository { - fun get(gameId: GameId): GameState -} diff --git a/src/main/kotlin/eventDemo/configuration/Configure.kt b/src/main/kotlin/eventDemo/configuration/Configure.kt index 4fb602c..fb45a18 100644 --- a/src/main/kotlin/eventDemo/configuration/Configure.kt +++ b/src/main/kotlin/eventDemo/configuration/Configure.kt @@ -1,6 +1,6 @@ package eventDemo.configuration -import eventDemo.configuration.business.configureGameListener +import eventDemo.configuration.domain.configureGameListener import eventDemo.configuration.ktor.configureHttpRouting import eventDemo.configuration.ktor.configureKoin import eventDemo.configuration.ktor.configureSecurity diff --git a/src/main/kotlin/eventDemo/configuration/business/ConfigureGameListener.kt b/src/main/kotlin/eventDemo/configuration/business/ConfigureGameListener.kt deleted file mode 100644 index 0e076ad..0000000 --- a/src/main/kotlin/eventDemo/configuration/business/ConfigureGameListener.kt +++ /dev/null @@ -1,21 +0,0 @@ -package eventDemo.configuration.business - -import eventDemo.adapter.infrastructureLayer.event.projection.GameListRepositoryInRedis -import eventDemo.adapter.infrastructureLayer.event.projection.GameStateRepositoryInRedis -import eventDemo.business.command.GameCommandHandler -import eventDemo.business.event.projection.projectionListener.ReactionListener -import org.koin.core.Koin - -fun Koin.configureGameListener() { - get() - .subscribeToBus(get()) - - get() - .subscribeToBus(get(), get()) - - get() - .subscribeToBus(get(), get()) - - get() - .subscribeToBus(get()) -} diff --git a/src/main/kotlin/eventDemo/configuration/domain/ConfigureGameListener.kt b/src/main/kotlin/eventDemo/configuration/domain/ConfigureGameListener.kt new file mode 100644 index 0000000..c49bcfe --- /dev/null +++ b/src/main/kotlin/eventDemo/configuration/domain/ConfigureGameListener.kt @@ -0,0 +1,21 @@ +package eventDemo.configuration.domain + +import eventDemo.adapter.infrastructure.event.projection.GameListRepositoryInRedis +import eventDemo.adapter.infrastructure.event.projection.GameStateRepositoryInRedis +import eventDemo.domain.command.GameCommandHandler +import eventDemo.domain.event.projection.projectionListener.ReactionListener +import org.koin.core.Koin + +fun Koin.configureGameListener() { + get() + .subscribeToBus(get()) + + get() + .subscribeToBus(get(), get()) + + get() + .subscribeToBus(get(), get()) + + get() + .subscribeToBus(get()) +} diff --git a/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIAction.kt b/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIAction.kt index 14c3dba..9060c2b 100644 --- a/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIAction.kt +++ b/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIAction.kt @@ -1,9 +1,9 @@ package eventDemo.configuration.injection -import eventDemo.business.command.action.ICantPlay -import eventDemo.business.command.action.IWantToJoinTheGame -import eventDemo.business.command.action.IWantToPlayCard -import eventDemo.business.command.action.IamReadyToPlay +import eventDemo.domain.command.action.ICantPlay +import eventDemo.domain.command.action.IWantToJoinTheGame +import eventDemo.domain.command.action.IWantToPlayCard +import eventDemo.domain.command.action.IamReadyToPlay import org.koin.core.module.Module import org.koin.core.module.dsl.singleOf diff --git a/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIBusiness.kt b/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIBusiness.kt index c41885b..8364dd0 100644 --- a/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIBusiness.kt +++ b/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIBusiness.kt @@ -1,10 +1,10 @@ package eventDemo.configuration.injection -import eventDemo.business.command.GameCommandActionRunner -import eventDemo.business.command.GameCommandHandler -import eventDemo.business.event.GameEventHandler -import eventDemo.business.event.projection.projectionListener.PlayerNotificationListener -import eventDemo.business.event.projection.projectionListener.ReactionListener +import eventDemo.domain.command.GameCommandActionRunner +import eventDemo.domain.command.GameCommandHandler +import eventDemo.domain.event.GameEventHandler +import eventDemo.domain.event.projection.projectionListener.PlayerNotificationListener +import eventDemo.domain.event.projection.projectionListener.ReactionListener import org.koin.core.module.Module import org.koin.core.module.dsl.singleOf diff --git a/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIInfrastructure.kt b/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIInfrastructure.kt index f1147d0..e99894e 100644 --- a/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIInfrastructure.kt +++ b/src/main/kotlin/eventDemo/configuration/injection/ConfigureDIInfrastructure.kt @@ -3,16 +3,16 @@ package eventDemo.configuration.injection import com.rabbitmq.client.ConnectionFactory import com.zaxxer.hikari.HikariConfig 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.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.GameStateRepository +import eventDemo.adapter.infrastructure.event.GameEventBusInRabbinMQ +import eventDemo.adapter.infrastructure.event.GameEventStoreInPostgresql +import eventDemo.adapter.infrastructure.event.projection.GameListRepositoryInRedis +import eventDemo.adapter.infrastructure.event.projection.GameProjectionBusInRabbitMQ +import eventDemo.adapter.infrastructure.event.projection.GameStateRepositoryInRedis +import eventDemo.domain.event.GameEventBus +import eventDemo.domain.event.GameEventStore +import eventDemo.domain.event.projection.GameListRepository +import eventDemo.domain.event.projection.GameProjectionBus +import eventDemo.domain.event.projection.GameStateRepository import org.koin.core.module.Module import org.koin.core.module.dsl.singleOf import org.koin.core.scope.Scope diff --git a/src/main/kotlin/eventDemo/configuration/ktor/ConfigureAuth.kt b/src/main/kotlin/eventDemo/configuration/ktor/ConfigureAuth.kt index fba65d5..88a7fd2 100644 --- a/src/main/kotlin/eventDemo/configuration/ktor/ConfigureAuth.kt +++ b/src/main/kotlin/eventDemo/configuration/ktor/ConfigureAuth.kt @@ -2,7 +2,7 @@ package eventDemo.configuration.ktor import com.auth0.jwt.JWT import com.auth0.jwt.algorithms.Algorithm -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Player import io.ktor.http.HttpStatusCode import io.ktor.server.application.Application import io.ktor.server.auth.authentication diff --git a/src/main/kotlin/eventDemo/configuration/ktor/ConfigureSerialization.kt b/src/main/kotlin/eventDemo/configuration/ktor/ConfigureSerialization.kt index f2d0ab9..363996f 100644 --- a/src/main/kotlin/eventDemo/configuration/ktor/ConfigureSerialization.kt +++ b/src/main/kotlin/eventDemo/configuration/ktor/ConfigureSerialization.kt @@ -1,7 +1,7 @@ package eventDemo.configuration.ktor -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.CommandIdSerializer import eventDemo.configuration.serializer.GameIdSerializer import eventDemo.configuration.serializer.PlayerIdSerializer diff --git a/src/main/kotlin/eventDemo/configuration/route/DeclareHttpRoutes.kt b/src/main/kotlin/eventDemo/configuration/route/DeclareHttpRoutes.kt index 6cd1f14..e37e7d3 100644 --- a/src/main/kotlin/eventDemo/configuration/route/DeclareHttpRoutes.kt +++ b/src/main/kotlin/eventDemo/configuration/route/DeclareHttpRoutes.kt @@ -1,7 +1,7 @@ package eventDemo.configuration.route -import eventDemo.adapter.interfaceLayer.query.readGamesList -import eventDemo.adapter.interfaceLayer.query.readTheGameState +import eventDemo.adapter.presenter.query.readGamesList +import eventDemo.adapter.presenter.query.readTheGameState import io.ktor.server.application.Application import io.ktor.server.routing.routing import org.koin.ktor.ext.get diff --git a/src/main/kotlin/eventDemo/configuration/route/DeclareWebSocketsGameRoute.kt b/src/main/kotlin/eventDemo/configuration/route/DeclareWebSocketsGameRoute.kt index 5297230..573f1f3 100644 --- a/src/main/kotlin/eventDemo/configuration/route/DeclareWebSocketsGameRoute.kt +++ b/src/main/kotlin/eventDemo/configuration/route/DeclareWebSocketsGameRoute.kt @@ -1,8 +1,8 @@ package eventDemo.configuration.route -import eventDemo.adapter.interfaceLayer.query.gameWebSocket -import eventDemo.business.command.GameCommandHandler -import eventDemo.business.event.projection.projectionListener.PlayerNotificationListener +import eventDemo.adapter.presenter.query.gameWebSocket +import eventDemo.domain.command.GameCommandHandler +import eventDemo.domain.event.projection.projectionListener.PlayerNotificationListener import io.ktor.server.application.Application import io.ktor.server.routing.routing import kotlinx.coroutines.DelicateCoroutinesApi diff --git a/src/main/kotlin/eventDemo/configuration/serializer/GameIdSerializer.kt b/src/main/kotlin/eventDemo/configuration/serializer/GameIdSerializer.kt index 88fa44a..d425738 100644 --- a/src/main/kotlin/eventDemo/configuration/serializer/GameIdSerializer.kt +++ b/src/main/kotlin/eventDemo/configuration/serializer/GameIdSerializer.kt @@ -1,6 +1,6 @@ package eventDemo.configuration.serializer -import eventDemo.business.entity.GameId +import eventDemo.domain.entity.GameId import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.PrimitiveKind import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor diff --git a/src/main/kotlin/eventDemo/configuration/serializer/PlayerIdSerializer.kt b/src/main/kotlin/eventDemo/configuration/serializer/PlayerIdSerializer.kt index 57c1a72..91559d4 100644 --- a/src/main/kotlin/eventDemo/configuration/serializer/PlayerIdSerializer.kt +++ b/src/main/kotlin/eventDemo/configuration/serializer/PlayerIdSerializer.kt @@ -1,6 +1,6 @@ package eventDemo.configuration.serializer -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Player import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.PrimitiveKind import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor diff --git a/src/main/kotlin/eventDemo/business/command/CommandException.kt b/src/main/kotlin/eventDemo/domain/command/CommandException.kt similarity index 69% rename from src/main/kotlin/eventDemo/business/command/CommandException.kt rename to src/main/kotlin/eventDemo/domain/command/CommandException.kt index 6b487c0..187d59f 100644 --- a/src/main/kotlin/eventDemo/business/command/CommandException.kt +++ b/src/main/kotlin/eventDemo/domain/command/CommandException.kt @@ -1,4 +1,4 @@ -package eventDemo.business.command +package eventDemo.domain.command class CommandException( override val message: String, diff --git a/src/main/kotlin/eventDemo/domain/command/GameCommandActionRunner.kt b/src/main/kotlin/eventDemo/domain/command/GameCommandActionRunner.kt new file mode 100644 index 0000000..d5d421d --- /dev/null +++ b/src/main/kotlin/eventDemo/domain/command/GameCommandActionRunner.kt @@ -0,0 +1,27 @@ +package eventDemo.domain.command + +import eventDemo.domain.command.action.ICantPlay +import eventDemo.domain.command.action.IWantToJoinTheGame +import eventDemo.domain.command.action.IWantToPlayCard +import eventDemo.domain.command.action.IamReadyToPlay +import eventDemo.domain.command.command.GameCommand +import eventDemo.domain.command.command.ICantPlayCommand +import eventDemo.domain.command.command.IWantToJoinTheGameCommand +import eventDemo.domain.command.command.IWantToPlayCardCommand +import eventDemo.domain.command.command.IamReadyToPlayCommand +import eventDemo.domain.event.event.GameEvent + +class GameCommandActionRunner( + private val iWantToPlayCard: IWantToPlayCard, + private val iamReadyToPlay: IamReadyToPlay, + private val iWantToJoinTheGame: IWantToJoinTheGame, + private val iCantPlay: ICantPlay, +) { + fun run(command: GameCommand): (version: Int) -> GameEvent = + when (command) { + is IWantToPlayCardCommand -> iWantToPlayCard.run(command) + is IamReadyToPlayCommand -> iamReadyToPlay.run(command) + is IWantToJoinTheGameCommand -> iWantToJoinTheGame.run(command) + is ICantPlayCommand -> iCantPlay.run(command) + } +} diff --git a/src/main/kotlin/eventDemo/business/command/GameCommandHandler.kt b/src/main/kotlin/eventDemo/domain/command/GameCommandHandler.kt similarity index 89% rename from src/main/kotlin/eventDemo/business/command/GameCommandHandler.kt rename to src/main/kotlin/eventDemo/domain/command/GameCommandHandler.kt index 3b16325..534af5c 100644 --- a/src/main/kotlin/eventDemo/business/command/GameCommandHandler.kt +++ b/src/main/kotlin/eventDemo/domain/command/GameCommandHandler.kt @@ -1,14 +1,14 @@ -package eventDemo.business.command +package eventDemo.domain.command -import eventDemo.business.command.command.GameCommand -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.event.GameEventBus -import eventDemo.business.event.GameEventStore -import eventDemo.business.event.event.GameEvent -import eventDemo.business.notification.CommandErrorNotification -import eventDemo.business.notification.CommandSuccessNotification -import eventDemo.business.notification.Notification +import eventDemo.domain.command.command.GameCommand +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.event.GameEventBus +import eventDemo.domain.event.GameEventStore +import eventDemo.domain.event.event.GameEvent +import eventDemo.domain.notification.CommandErrorNotification +import eventDemo.domain.notification.CommandSuccessNotification +import eventDemo.domain.notification.Notification import eventDemo.libs.command.CommandHandler import eventDemo.libs.command.CommandRunnerController import eventDemo.libs.event.EventHandlerImpl diff --git a/src/main/kotlin/eventDemo/business/command/action/CommandAction.kt b/src/main/kotlin/eventDemo/domain/command/action/CommandAction.kt similarity index 80% rename from src/main/kotlin/eventDemo/business/command/action/CommandAction.kt rename to src/main/kotlin/eventDemo/domain/command/action/CommandAction.kt index 86e295f..35fee72 100644 --- a/src/main/kotlin/eventDemo/business/command/action/CommandAction.kt +++ b/src/main/kotlin/eventDemo/domain/command/action/CommandAction.kt @@ -1,4 +1,4 @@ -package eventDemo.business.command.action +package eventDemo.domain.command.action import eventDemo.libs.command.Command import eventDemo.libs.event.Event diff --git a/src/main/kotlin/eventDemo/business/command/action/ICantPlay.kt b/src/main/kotlin/eventDemo/domain/command/action/ICantPlay.kt similarity index 77% rename from src/main/kotlin/eventDemo/business/command/action/ICantPlay.kt rename to src/main/kotlin/eventDemo/domain/command/action/ICantPlay.kt index 2084d56..0a9b284 100644 --- a/src/main/kotlin/eventDemo/business/command/action/ICantPlay.kt +++ b/src/main/kotlin/eventDemo/domain/command/action/ICantPlay.kt @@ -1,9 +1,9 @@ -package eventDemo.business.command.action +package eventDemo.domain.command.action -import eventDemo.business.command.CommandException -import eventDemo.business.command.command.ICantPlayCommand -import eventDemo.business.event.event.PlayerHavePassEvent -import eventDemo.business.event.projection.GameStateRepository +import eventDemo.domain.command.CommandException +import eventDemo.domain.command.command.ICantPlayCommand +import eventDemo.domain.event.event.PlayerHavePassEvent +import eventDemo.domain.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/domain/command/action/IWantToJoinTheGame.kt similarity index 70% rename from src/main/kotlin/eventDemo/business/command/action/IWantToJoinTheGame.kt rename to src/main/kotlin/eventDemo/domain/command/action/IWantToJoinTheGame.kt index 34b67be..b0b99c4 100644 --- a/src/main/kotlin/eventDemo/business/command/action/IWantToJoinTheGame.kt +++ b/src/main/kotlin/eventDemo/domain/command/action/IWantToJoinTheGame.kt @@ -1,9 +1,9 @@ -package eventDemo.business.command.action +package eventDemo.domain.command.action -import eventDemo.business.command.CommandException -import eventDemo.business.command.command.IWantToJoinTheGameCommand -import eventDemo.business.event.event.NewPlayerEvent -import eventDemo.business.event.projection.GameStateRepository +import eventDemo.domain.command.CommandException +import eventDemo.domain.command.command.IWantToJoinTheGameCommand +import eventDemo.domain.event.event.NewPlayerEvent +import eventDemo.domain.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/domain/command/action/IWantToPlayCard.kt similarity index 77% rename from src/main/kotlin/eventDemo/business/command/action/IWantToPlayCard.kt rename to src/main/kotlin/eventDemo/domain/command/action/IWantToPlayCard.kt index 50c3aa1..25b27f5 100644 --- a/src/main/kotlin/eventDemo/business/command/action/IWantToPlayCard.kt +++ b/src/main/kotlin/eventDemo/domain/command/action/IWantToPlayCard.kt @@ -1,9 +1,9 @@ -package eventDemo.business.command.action +package eventDemo.domain.command.action -import eventDemo.business.command.CommandException -import eventDemo.business.command.command.IWantToPlayCardCommand -import eventDemo.business.event.event.CardIsPlayedEvent -import eventDemo.business.event.projection.GameStateRepository +import eventDemo.domain.command.CommandException +import eventDemo.domain.command.command.IWantToPlayCardCommand +import eventDemo.domain.event.event.CardIsPlayedEvent +import eventDemo.domain.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/domain/command/action/IamReadyToPlay.kt similarity index 79% rename from src/main/kotlin/eventDemo/business/command/action/IamReadyToPlay.kt rename to src/main/kotlin/eventDemo/domain/command/action/IamReadyToPlay.kt index f148632..5bc4c9d 100644 --- a/src/main/kotlin/eventDemo/business/command/action/IamReadyToPlay.kt +++ b/src/main/kotlin/eventDemo/domain/command/action/IamReadyToPlay.kt @@ -1,9 +1,9 @@ -package eventDemo.business.command.action +package eventDemo.domain.command.action -import eventDemo.business.command.CommandException -import eventDemo.business.command.command.IamReadyToPlayCommand -import eventDemo.business.event.event.PlayerReadyEvent -import eventDemo.business.event.projection.GameStateRepository +import eventDemo.domain.command.CommandException +import eventDemo.domain.command.command.IamReadyToPlayCommand +import eventDemo.domain.event.event.PlayerReadyEvent +import eventDemo.domain.event.projection.GameStateRepository /** * A command to set as ready to play diff --git a/src/main/kotlin/eventDemo/business/command/command/GameCommand.kt b/src/main/kotlin/eventDemo/domain/command/command/GameCommand.kt similarity index 68% rename from src/main/kotlin/eventDemo/business/command/command/GameCommand.kt rename to src/main/kotlin/eventDemo/domain/command/command/GameCommand.kt index 4387f83..a919392 100644 --- a/src/main/kotlin/eventDemo/business/command/command/GameCommand.kt +++ b/src/main/kotlin/eventDemo/domain/command/command/GameCommand.kt @@ -1,7 +1,7 @@ -package eventDemo.business.command.command +package eventDemo.domain.command.command -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.libs.command.Command import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/eventDemo/business/command/command/ICantPlayCommand.kt b/src/main/kotlin/eventDemo/domain/command/command/ICantPlayCommand.kt similarity index 77% rename from src/main/kotlin/eventDemo/business/command/command/ICantPlayCommand.kt rename to src/main/kotlin/eventDemo/domain/command/command/ICantPlayCommand.kt index d01588e..b70d8a6 100644 --- a/src/main/kotlin/eventDemo/business/command/command/ICantPlayCommand.kt +++ b/src/main/kotlin/eventDemo/domain/command/command/ICantPlayCommand.kt @@ -1,7 +1,7 @@ -package eventDemo.business.command.command +package eventDemo.domain.command.command -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.libs.command.CommandId import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/eventDemo/business/command/command/IWantToJoinTheGameCommand.kt b/src/main/kotlin/eventDemo/domain/command/command/IWantToJoinTheGameCommand.kt similarity index 77% rename from src/main/kotlin/eventDemo/business/command/command/IWantToJoinTheGameCommand.kt rename to src/main/kotlin/eventDemo/domain/command/command/IWantToJoinTheGameCommand.kt index e5495d1..cbf49d0 100644 --- a/src/main/kotlin/eventDemo/business/command/command/IWantToJoinTheGameCommand.kt +++ b/src/main/kotlin/eventDemo/domain/command/command/IWantToJoinTheGameCommand.kt @@ -1,7 +1,7 @@ -package eventDemo.business.command.command +package eventDemo.domain.command.command -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.libs.command.CommandId import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/eventDemo/business/command/command/IWantToPlayCardCommand.kt b/src/main/kotlin/eventDemo/domain/command/command/IWantToPlayCardCommand.kt similarity index 73% rename from src/main/kotlin/eventDemo/business/command/command/IWantToPlayCardCommand.kt rename to src/main/kotlin/eventDemo/domain/command/command/IWantToPlayCardCommand.kt index 3f1ee52..5f92f27 100644 --- a/src/main/kotlin/eventDemo/business/command/command/IWantToPlayCardCommand.kt +++ b/src/main/kotlin/eventDemo/domain/command/command/IWantToPlayCardCommand.kt @@ -1,8 +1,8 @@ -package eventDemo.business.command.command +package eventDemo.domain.command.command -import eventDemo.business.entity.Card -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Card +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.libs.command.CommandId import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/eventDemo/business/command/command/IamReadyToPlayCommand.kt b/src/main/kotlin/eventDemo/domain/command/command/IamReadyToPlayCommand.kt similarity index 76% rename from src/main/kotlin/eventDemo/business/command/command/IamReadyToPlayCommand.kt rename to src/main/kotlin/eventDemo/domain/command/command/IamReadyToPlayCommand.kt index 467712a..dbc1b75 100644 --- a/src/main/kotlin/eventDemo/business/command/command/IamReadyToPlayCommand.kt +++ b/src/main/kotlin/eventDemo/domain/command/command/IamReadyToPlayCommand.kt @@ -1,7 +1,7 @@ -package eventDemo.business.command.command +package eventDemo.domain.command.command -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.libs.command.CommandId import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/eventDemo/business/entity/Card.kt b/src/main/kotlin/eventDemo/domain/entity/Card.kt similarity index 98% rename from src/main/kotlin/eventDemo/business/entity/Card.kt rename to src/main/kotlin/eventDemo/domain/entity/Card.kt index 4c3f160..b6048b6 100644 --- a/src/main/kotlin/eventDemo/business/entity/Card.kt +++ b/src/main/kotlin/eventDemo/domain/entity/Card.kt @@ -1,4 +1,4 @@ -package eventDemo.business.entity +package eventDemo.domain.entity import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.serialization.SerialName diff --git a/src/main/kotlin/eventDemo/business/entity/Deck.kt b/src/main/kotlin/eventDemo/domain/entity/Deck.kt similarity index 99% rename from src/main/kotlin/eventDemo/business/entity/Deck.kt rename to src/main/kotlin/eventDemo/domain/entity/Deck.kt index a282dcf..b0dfe17 100644 --- a/src/main/kotlin/eventDemo/business/entity/Deck.kt +++ b/src/main/kotlin/eventDemo/domain/entity/Deck.kt @@ -1,4 +1,4 @@ -package eventDemo.business.entity +package eventDemo.domain.entity import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/eventDemo/business/entity/GameId.kt b/src/main/kotlin/eventDemo/domain/entity/GameId.kt similarity index 92% rename from src/main/kotlin/eventDemo/business/entity/GameId.kt rename to src/main/kotlin/eventDemo/domain/entity/GameId.kt index e87d311..4b364dc 100644 --- a/src/main/kotlin/eventDemo/business/entity/GameId.kt +++ b/src/main/kotlin/eventDemo/domain/entity/GameId.kt @@ -1,4 +1,4 @@ -package eventDemo.business.entity +package eventDemo.domain.entity import eventDemo.configuration.serializer.GameIdSerializer import eventDemo.libs.event.AggregateId diff --git a/src/main/kotlin/eventDemo/business/entity/Player.kt b/src/main/kotlin/eventDemo/domain/entity/Player.kt similarity index 95% rename from src/main/kotlin/eventDemo/business/entity/Player.kt rename to src/main/kotlin/eventDemo/domain/entity/Player.kt index fccb8f2..6f1c3ed 100644 --- a/src/main/kotlin/eventDemo/business/entity/Player.kt +++ b/src/main/kotlin/eventDemo/domain/entity/Player.kt @@ -1,4 +1,4 @@ -package eventDemo.business.entity +package eventDemo.domain.entity import eventDemo.configuration.serializer.PlayerIdSerializer import eventDemo.configuration.serializer.UUIDSerializer diff --git a/src/main/kotlin/eventDemo/business/entity/PlayersHands.kt b/src/main/kotlin/eventDemo/domain/entity/PlayersHands.kt similarity index 97% rename from src/main/kotlin/eventDemo/business/entity/PlayersHands.kt rename to src/main/kotlin/eventDemo/domain/entity/PlayersHands.kt index bf39119..9884627 100644 --- a/src/main/kotlin/eventDemo/business/entity/PlayersHands.kt +++ b/src/main/kotlin/eventDemo/domain/entity/PlayersHands.kt @@ -1,4 +1,4 @@ -package eventDemo.business.entity +package eventDemo.domain.entity import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/eventDemo/domain/event/GameEventBus.kt b/src/main/kotlin/eventDemo/domain/event/GameEventBus.kt new file mode 100644 index 0000000..995ad14 --- /dev/null +++ b/src/main/kotlin/eventDemo/domain/event/GameEventBus.kt @@ -0,0 +1,6 @@ +package eventDemo.domain.event + +import eventDemo.domain.event.event.GameEvent +import eventDemo.libs.bus.Bus + +interface GameEventBus : Bus diff --git a/src/main/kotlin/eventDemo/business/event/GameEventHandler.kt b/src/main/kotlin/eventDemo/domain/event/GameEventHandler.kt similarity index 79% rename from src/main/kotlin/eventDemo/business/event/GameEventHandler.kt rename to src/main/kotlin/eventDemo/domain/event/GameEventHandler.kt index ee2f1d1..3f46a67 100644 --- a/src/main/kotlin/eventDemo/business/event/GameEventHandler.kt +++ b/src/main/kotlin/eventDemo/domain/event/GameEventHandler.kt @@ -1,7 +1,7 @@ -package eventDemo.business.event +package eventDemo.domain.event -import eventDemo.business.entity.GameId -import eventDemo.business.event.event.GameEvent +import eventDemo.domain.entity.GameId +import eventDemo.domain.event.event.GameEvent import eventDemo.libs.event.EventHandler import eventDemo.libs.event.EventHandlerImpl import eventDemo.libs.event.VersionBuilder diff --git a/src/main/kotlin/eventDemo/domain/event/GameEventStore.kt b/src/main/kotlin/eventDemo/domain/event/GameEventStore.kt new file mode 100644 index 0000000..fbef71f --- /dev/null +++ b/src/main/kotlin/eventDemo/domain/event/GameEventStore.kt @@ -0,0 +1,7 @@ +package eventDemo.domain.event + +import eventDemo.domain.entity.GameId +import eventDemo.domain.event.event.GameEvent +import eventDemo.libs.event.EventStore + +interface GameEventStore : EventStore diff --git a/src/main/kotlin/eventDemo/business/event/event/CardIsPlayedEvent.kt b/src/main/kotlin/eventDemo/domain/event/event/CardIsPlayedEvent.kt similarity index 78% rename from src/main/kotlin/eventDemo/business/event/event/CardIsPlayedEvent.kt rename to src/main/kotlin/eventDemo/domain/event/event/CardIsPlayedEvent.kt index 206eb67..d50df11 100644 --- a/src/main/kotlin/eventDemo/business/event/event/CardIsPlayedEvent.kt +++ b/src/main/kotlin/eventDemo/domain/event/event/CardIsPlayedEvent.kt @@ -1,8 +1,8 @@ -package eventDemo.business.event.event +package eventDemo.domain.event.event -import eventDemo.business.entity.Card -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Card +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.datetime.Clock import kotlinx.datetime.Instant diff --git a/src/main/kotlin/eventDemo/business/event/event/GameEvent.kt b/src/main/kotlin/eventDemo/domain/event/event/GameEvent.kt similarity index 78% rename from src/main/kotlin/eventDemo/business/event/event/GameEvent.kt rename to src/main/kotlin/eventDemo/domain/event/event/GameEvent.kt index 39fb2bb..58fe98c 100644 --- a/src/main/kotlin/eventDemo/business/event/event/GameEvent.kt +++ b/src/main/kotlin/eventDemo/domain/event/event/GameEvent.kt @@ -1,6 +1,6 @@ -package eventDemo.business.event.event +package eventDemo.domain.event.event -import eventDemo.business.entity.GameId +import eventDemo.domain.entity.GameId import eventDemo.libs.event.Event import kotlinx.serialization.Serializable import java.util.UUID diff --git a/src/main/kotlin/eventDemo/business/event/event/GameStartedEvent.kt b/src/main/kotlin/eventDemo/domain/event/event/GameStartedEvent.kt similarity index 85% rename from src/main/kotlin/eventDemo/business/event/event/GameStartedEvent.kt rename to src/main/kotlin/eventDemo/domain/event/event/GameStartedEvent.kt index 7ce22a1..5bdcb04 100644 --- a/src/main/kotlin/eventDemo/business/event/event/GameStartedEvent.kt +++ b/src/main/kotlin/eventDemo/domain/event/event/GameStartedEvent.kt @@ -1,9 +1,9 @@ -package eventDemo.business.event.event +package eventDemo.domain.event.event -import eventDemo.business.entity.Deck -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.entity.initHands +import eventDemo.domain.entity.Deck +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.entity.initHands import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.datetime.Clock import kotlinx.datetime.Instant diff --git a/src/main/kotlin/eventDemo/business/event/event/NewPlayerEvent.kt b/src/main/kotlin/eventDemo/domain/event/event/NewPlayerEvent.kt similarity index 82% rename from src/main/kotlin/eventDemo/business/event/event/NewPlayerEvent.kt rename to src/main/kotlin/eventDemo/domain/event/event/NewPlayerEvent.kt index 5b5baac..5affe01 100644 --- a/src/main/kotlin/eventDemo/business/event/event/NewPlayerEvent.kt +++ b/src/main/kotlin/eventDemo/domain/event/event/NewPlayerEvent.kt @@ -1,7 +1,7 @@ -package eventDemo.business.event.event +package eventDemo.domain.event.event -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.datetime.Clock import kotlinx.datetime.Instant diff --git a/src/main/kotlin/eventDemo/business/event/event/PlayerActionEvent.kt b/src/main/kotlin/eventDemo/domain/event/event/PlayerActionEvent.kt similarity index 62% rename from src/main/kotlin/eventDemo/business/event/event/PlayerActionEvent.kt rename to src/main/kotlin/eventDemo/domain/event/event/PlayerActionEvent.kt index 78f707e..2f7eda8 100644 --- a/src/main/kotlin/eventDemo/business/event/event/PlayerActionEvent.kt +++ b/src/main/kotlin/eventDemo/domain/event/event/PlayerActionEvent.kt @@ -1,6 +1,6 @@ -package eventDemo.business.event.event +package eventDemo.domain.event.event -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Player import kotlinx.serialization.Serializable @Serializable diff --git a/src/main/kotlin/eventDemo/business/event/event/PlayerChoseColorEvent.kt b/src/main/kotlin/eventDemo/domain/event/event/PlayerChoseColorEvent.kt similarity index 79% rename from src/main/kotlin/eventDemo/business/event/event/PlayerChoseColorEvent.kt rename to src/main/kotlin/eventDemo/domain/event/event/PlayerChoseColorEvent.kt index 34ada14..4477e2a 100644 --- a/src/main/kotlin/eventDemo/business/event/event/PlayerChoseColorEvent.kt +++ b/src/main/kotlin/eventDemo/domain/event/event/PlayerChoseColorEvent.kt @@ -1,8 +1,8 @@ -package eventDemo.business.event.event +package eventDemo.domain.event.event -import eventDemo.business.entity.Card -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Card +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.datetime.Clock import kotlinx.datetime.Instant diff --git a/src/main/kotlin/eventDemo/business/event/event/PlayerHavePassEvent.kt b/src/main/kotlin/eventDemo/domain/event/event/PlayerHavePassEvent.kt similarity index 79% rename from src/main/kotlin/eventDemo/business/event/event/PlayerHavePassEvent.kt rename to src/main/kotlin/eventDemo/domain/event/event/PlayerHavePassEvent.kt index bcdd50a..e646128 100644 --- a/src/main/kotlin/eventDemo/business/event/event/PlayerHavePassEvent.kt +++ b/src/main/kotlin/eventDemo/domain/event/event/PlayerHavePassEvent.kt @@ -1,8 +1,8 @@ -package eventDemo.business.event.event +package eventDemo.domain.event.event -import eventDemo.business.entity.Card -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Card +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.datetime.Clock import kotlinx.datetime.Instant diff --git a/src/main/kotlin/eventDemo/business/event/event/PlayerReadyEvent.kt b/src/main/kotlin/eventDemo/domain/event/event/PlayerReadyEvent.kt similarity index 82% rename from src/main/kotlin/eventDemo/business/event/event/PlayerReadyEvent.kt rename to src/main/kotlin/eventDemo/domain/event/event/PlayerReadyEvent.kt index 20f451a..8f0afed 100644 --- a/src/main/kotlin/eventDemo/business/event/event/PlayerReadyEvent.kt +++ b/src/main/kotlin/eventDemo/domain/event/event/PlayerReadyEvent.kt @@ -1,7 +1,7 @@ -package eventDemo.business.event.event +package eventDemo.domain.event.event -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.datetime.Clock import kotlinx.datetime.Instant diff --git a/src/main/kotlin/eventDemo/business/event/event/PlayerWinEvent.kt b/src/main/kotlin/eventDemo/domain/event/event/PlayerWinEvent.kt similarity index 81% rename from src/main/kotlin/eventDemo/business/event/event/PlayerWinEvent.kt rename to src/main/kotlin/eventDemo/domain/event/event/PlayerWinEvent.kt index 4540b46..96d73f7 100644 --- a/src/main/kotlin/eventDemo/business/event/event/PlayerWinEvent.kt +++ b/src/main/kotlin/eventDemo/domain/event/event/PlayerWinEvent.kt @@ -1,7 +1,7 @@ -package eventDemo.business.event.event +package eventDemo.domain.event.event -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.datetime.Clock import kotlinx.datetime.Instant diff --git a/src/main/kotlin/eventDemo/business/event/projection/GameProjection.kt b/src/main/kotlin/eventDemo/domain/event/projection/GameProjection.kt similarity index 65% rename from src/main/kotlin/eventDemo/business/event/projection/GameProjection.kt rename to src/main/kotlin/eventDemo/domain/event/projection/GameProjection.kt index 61db589..636aa54 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/GameProjection.kt +++ b/src/main/kotlin/eventDemo/domain/event/projection/GameProjection.kt @@ -1,6 +1,6 @@ -package eventDemo.business.event.projection +package eventDemo.domain.event.projection -import eventDemo.business.entity.GameId +import eventDemo.domain.entity.GameId import eventDemo.libs.event.projection.Projection import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/eventDemo/business/event/projection/GameProjectionBus.kt b/src/main/kotlin/eventDemo/domain/event/projection/GameProjectionBus.kt similarity index 65% rename from src/main/kotlin/eventDemo/business/event/projection/GameProjectionBus.kt rename to src/main/kotlin/eventDemo/domain/event/projection/GameProjectionBus.kt index 323bd5e..e8bbe80 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/GameProjectionBus.kt +++ b/src/main/kotlin/eventDemo/domain/event/projection/GameProjectionBus.kt @@ -1,4 +1,4 @@ -package eventDemo.business.event.projection +package eventDemo.domain.event.projection import eventDemo.libs.bus.Bus diff --git a/src/main/kotlin/eventDemo/business/event/projection/gameList/GameList.kt b/src/main/kotlin/eventDemo/domain/event/projection/gameList/GameList.kt similarity index 80% rename from src/main/kotlin/eventDemo/business/event/projection/gameList/GameList.kt rename to src/main/kotlin/eventDemo/domain/event/projection/gameList/GameList.kt index 983bc9a..1b31a2f 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/gameList/GameList.kt +++ b/src/main/kotlin/eventDemo/domain/event/projection/gameList/GameList.kt @@ -1,7 +1,7 @@ -package eventDemo.business.event.projection +package eventDemo.domain.event.projection -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player import eventDemo.libs.event.projection.Projection import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/eventDemo/business/event/projection/gameList/GameListBuilder.kt b/src/main/kotlin/eventDemo/domain/event/projection/gameList/GameListBuilder.kt similarity index 58% rename from src/main/kotlin/eventDemo/business/event/projection/gameList/GameListBuilder.kt rename to src/main/kotlin/eventDemo/domain/event/projection/gameList/GameListBuilder.kt index ab3491d..0ae729b 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/gameList/GameListBuilder.kt +++ b/src/main/kotlin/eventDemo/domain/event/projection/gameList/GameListBuilder.kt @@ -1,13 +1,13 @@ -package eventDemo.business.event.projection +package eventDemo.domain.event.projection -import eventDemo.business.event.event.CardIsPlayedEvent -import eventDemo.business.event.event.GameEvent -import eventDemo.business.event.event.GameStartedEvent -import eventDemo.business.event.event.NewPlayerEvent -import eventDemo.business.event.event.PlayerChoseColorEvent -import eventDemo.business.event.event.PlayerHavePassEvent -import eventDemo.business.event.event.PlayerReadyEvent -import eventDemo.business.event.event.PlayerWinEvent +import eventDemo.domain.event.event.CardIsPlayedEvent +import eventDemo.domain.event.event.GameEvent +import eventDemo.domain.event.event.GameStartedEvent +import eventDemo.domain.event.event.NewPlayerEvent +import eventDemo.domain.event.event.PlayerChoseColorEvent +import eventDemo.domain.event.event.PlayerHavePassEvent +import eventDemo.domain.event.event.PlayerReadyEvent +import eventDemo.domain.event.event.PlayerWinEvent fun GameList.apply(event: GameEvent): GameList = when (event) { diff --git a/src/main/kotlin/eventDemo/business/event/projection/gameList/GameListRepository.kt b/src/main/kotlin/eventDemo/domain/event/projection/gameList/GameListRepository.kt similarity index 60% rename from src/main/kotlin/eventDemo/business/event/projection/gameList/GameListRepository.kt rename to src/main/kotlin/eventDemo/domain/event/projection/gameList/GameListRepository.kt index 8a4e3eb..89aef32 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/gameList/GameListRepository.kt +++ b/src/main/kotlin/eventDemo/domain/event/projection/gameList/GameListRepository.kt @@ -1,4 +1,4 @@ -package eventDemo.business.event.projection +package eventDemo.domain.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/domain/event/projection/gameState/GameState.kt similarity index 94% rename from src/main/kotlin/eventDemo/business/event/projection/gameState/GameState.kt rename to src/main/kotlin/eventDemo/domain/event/projection/gameState/GameState.kt index bcf9ce5..914ee43 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/gameState/GameState.kt +++ b/src/main/kotlin/eventDemo/domain/event/projection/gameState/GameState.kt @@ -1,10 +1,10 @@ -package eventDemo.business.event.projection +package eventDemo.domain.event.projection -import eventDemo.business.entity.Card -import eventDemo.business.entity.Deck -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.event.event.GameEvent +import eventDemo.domain.entity.Card +import eventDemo.domain.entity.Deck +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.event.event.GameEvent import eventDemo.libs.event.projection.Projection import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateBuilder.kt b/src/main/kotlin/eventDemo/domain/event/projection/gameState/GameStateBuilder.kt similarity index 83% rename from src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateBuilder.kt rename to src/main/kotlin/eventDemo/domain/event/projection/gameState/GameStateBuilder.kt index 425d3cb..3b29dda 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/gameState/GameStateBuilder.kt +++ b/src/main/kotlin/eventDemo/domain/event/projection/gameState/GameStateBuilder.kt @@ -1,15 +1,15 @@ -package eventDemo.business.event.projection +package eventDemo.domain.event.projection -import eventDemo.business.entity.Card -import eventDemo.business.event.event.CardIsPlayedEvent -import eventDemo.business.event.event.GameEvent -import eventDemo.business.event.event.GameStartedEvent -import eventDemo.business.event.event.NewPlayerEvent -import eventDemo.business.event.event.PlayerActionEvent -import eventDemo.business.event.event.PlayerChoseColorEvent -import eventDemo.business.event.event.PlayerHavePassEvent -import eventDemo.business.event.event.PlayerReadyEvent -import eventDemo.business.event.event.PlayerWinEvent +import eventDemo.domain.entity.Card +import eventDemo.domain.event.event.CardIsPlayedEvent +import eventDemo.domain.event.event.GameEvent +import eventDemo.domain.event.event.GameStartedEvent +import eventDemo.domain.event.event.NewPlayerEvent +import eventDemo.domain.event.event.PlayerActionEvent +import eventDemo.domain.event.event.PlayerChoseColorEvent +import eventDemo.domain.event.event.PlayerHavePassEvent +import eventDemo.domain.event.event.PlayerReadyEvent +import eventDemo.domain.event.event.PlayerWinEvent import io.github.oshai.kotlinlogging.KotlinLogging fun GameState.apply(event: GameEvent): GameState = diff --git a/src/main/kotlin/eventDemo/domain/event/projection/gameState/GameStateRepository.kt b/src/main/kotlin/eventDemo/domain/event/projection/gameState/GameStateRepository.kt new file mode 100644 index 0000000..1d1d8c6 --- /dev/null +++ b/src/main/kotlin/eventDemo/domain/event/projection/gameState/GameStateRepository.kt @@ -0,0 +1,7 @@ +package eventDemo.domain.event.projection + +import eventDemo.domain.entity.GameId + +interface GameStateRepository { + fun get(gameId: GameId): GameState +} diff --git a/src/main/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListener.kt b/src/main/kotlin/eventDemo/domain/event/projection/projectionListener/PlayerNotificationListener.kt similarity index 73% rename from src/main/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListener.kt rename to src/main/kotlin/eventDemo/domain/event/projection/projectionListener/PlayerNotificationListener.kt index f1314e9..bc13f91 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListener.kt +++ b/src/main/kotlin/eventDemo/domain/event/projection/projectionListener/PlayerNotificationListener.kt @@ -1,28 +1,28 @@ -package eventDemo.business.event.projection.projectionListener +package eventDemo.domain.event.projection.projectionListener -import eventDemo.business.entity.Card -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.event.event.CardIsPlayedEvent -import eventDemo.business.event.event.GameStartedEvent -import eventDemo.business.event.event.NewPlayerEvent -import eventDemo.business.event.event.PlayerChoseColorEvent -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 -import eventDemo.business.notification.ItsTheTurnOfNotification -import eventDemo.business.notification.Notification -import eventDemo.business.notification.PlayerAsJoinTheGameNotification -import eventDemo.business.notification.PlayerAsPlayACardNotification -import eventDemo.business.notification.PlayerHavePassNotification -import eventDemo.business.notification.PlayerWasChoseTheCardColorNotification -import eventDemo.business.notification.PlayerWasReadyNotification -import eventDemo.business.notification.PlayerWinNotification -import eventDemo.business.notification.TheGameWasStartedNotification -import eventDemo.business.notification.WelcomeToTheGameNotification -import eventDemo.business.notification.YourNewCardNotification +import eventDemo.domain.entity.Card +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.event.event.CardIsPlayedEvent +import eventDemo.domain.event.event.GameStartedEvent +import eventDemo.domain.event.event.NewPlayerEvent +import eventDemo.domain.event.event.PlayerChoseColorEvent +import eventDemo.domain.event.event.PlayerHavePassEvent +import eventDemo.domain.event.event.PlayerReadyEvent +import eventDemo.domain.event.event.PlayerWinEvent +import eventDemo.domain.event.projection.GameProjectionBus +import eventDemo.domain.event.projection.GameState +import eventDemo.domain.notification.ItsTheTurnOfNotification +import eventDemo.domain.notification.Notification +import eventDemo.domain.notification.PlayerAsJoinTheGameNotification +import eventDemo.domain.notification.PlayerAsPlayACardNotification +import eventDemo.domain.notification.PlayerHavePassNotification +import eventDemo.domain.notification.PlayerWasChoseTheCardColorNotification +import eventDemo.domain.notification.PlayerWasReadyNotification +import eventDemo.domain.notification.PlayerWinNotification +import eventDemo.domain.notification.TheGameWasStartedNotification +import eventDemo.domain.notification.WelcomeToTheGameNotification +import eventDemo.domain.notification.YourNewCardNotification import io.github.oshai.kotlinlogging.KotlinLogging import io.github.oshai.kotlinlogging.withLoggingContext diff --git a/src/main/kotlin/eventDemo/business/event/projection/projectionListener/ReactionListener.kt b/src/main/kotlin/eventDemo/domain/event/projection/projectionListener/ReactionListener.kt similarity index 83% rename from src/main/kotlin/eventDemo/business/event/projection/projectionListener/ReactionListener.kt rename to src/main/kotlin/eventDemo/domain/event/projection/projectionListener/ReactionListener.kt index 3479463..c437132 100644 --- a/src/main/kotlin/eventDemo/business/event/projection/projectionListener/ReactionListener.kt +++ b/src/main/kotlin/eventDemo/domain/event/projection/projectionListener/ReactionListener.kt @@ -1,11 +1,11 @@ -package eventDemo.business.event.projection.projectionListener +package eventDemo.domain.event.projection.projectionListener -import eventDemo.business.entity.GameId -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 +import eventDemo.domain.entity.GameId +import eventDemo.domain.event.GameEventHandler +import eventDemo.domain.event.event.GameStartedEvent +import eventDemo.domain.event.event.PlayerWinEvent +import eventDemo.domain.event.projection.GameProjectionBus +import eventDemo.domain.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/business/notification/CommandErrorNotification.kt b/src/main/kotlin/eventDemo/domain/notification/CommandErrorNotification.kt similarity index 90% rename from src/main/kotlin/eventDemo/business/notification/CommandErrorNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/CommandErrorNotification.kt index 507e26a..3385315 100644 --- a/src/main/kotlin/eventDemo/business/notification/CommandErrorNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/CommandErrorNotification.kt @@ -1,4 +1,4 @@ -package eventDemo.business.notification +package eventDemo.domain.notification import eventDemo.configuration.serializer.UUIDSerializer import eventDemo.libs.command.Command diff --git a/src/main/kotlin/eventDemo/business/notification/CommandNotification.kt b/src/main/kotlin/eventDemo/domain/notification/CommandNotification.kt similarity index 56% rename from src/main/kotlin/eventDemo/business/notification/CommandNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/CommandNotification.kt index 86778fc..5d8462f 100644 --- a/src/main/kotlin/eventDemo/business/notification/CommandNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/CommandNotification.kt @@ -1,3 +1,3 @@ -package eventDemo.business.notification +package eventDemo.domain.notification sealed interface CommandNotification : Notification diff --git a/src/main/kotlin/eventDemo/business/notification/CommandSuccessNotification.kt b/src/main/kotlin/eventDemo/domain/notification/CommandSuccessNotification.kt similarity index 90% rename from src/main/kotlin/eventDemo/business/notification/CommandSuccessNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/CommandSuccessNotification.kt index 44132c2..252774a 100644 --- a/src/main/kotlin/eventDemo/business/notification/CommandSuccessNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/CommandSuccessNotification.kt @@ -1,4 +1,4 @@ -package eventDemo.business.notification +package eventDemo.domain.notification import eventDemo.configuration.serializer.UUIDSerializer import eventDemo.libs.command.CommandId diff --git a/src/main/kotlin/eventDemo/business/notification/ItsTheTurnOfNotification.kt b/src/main/kotlin/eventDemo/domain/notification/ItsTheTurnOfNotification.kt similarity index 79% rename from src/main/kotlin/eventDemo/business/notification/ItsTheTurnOfNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/ItsTheTurnOfNotification.kt index 554134b..97fb00d 100644 --- a/src/main/kotlin/eventDemo/business/notification/ItsTheTurnOfNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/ItsTheTurnOfNotification.kt @@ -1,6 +1,6 @@ -package eventDemo.business.notification +package eventDemo.domain.notification -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.serialization.Serializable import java.util.UUID diff --git a/src/main/kotlin/eventDemo/business/notification/Notification.kt b/src/main/kotlin/eventDemo/domain/notification/Notification.kt similarity index 85% rename from src/main/kotlin/eventDemo/business/notification/Notification.kt rename to src/main/kotlin/eventDemo/domain/notification/Notification.kt index aa1dc3b..258fb8d 100644 --- a/src/main/kotlin/eventDemo/business/notification/Notification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/Notification.kt @@ -1,4 +1,4 @@ -package eventDemo.business.notification +package eventDemo.domain.notification import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/eventDemo/business/notification/PlayerAsJoinTheGameNotification.kt b/src/main/kotlin/eventDemo/domain/notification/PlayerAsJoinTheGameNotification.kt similarity index 79% rename from src/main/kotlin/eventDemo/business/notification/PlayerAsJoinTheGameNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/PlayerAsJoinTheGameNotification.kt index fd58427..c12291b 100644 --- a/src/main/kotlin/eventDemo/business/notification/PlayerAsJoinTheGameNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/PlayerAsJoinTheGameNotification.kt @@ -1,6 +1,6 @@ -package eventDemo.business.notification +package eventDemo.domain.notification -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.serialization.Serializable import java.util.UUID diff --git a/src/main/kotlin/eventDemo/business/notification/PlayerAsPlayACardNotification.kt b/src/main/kotlin/eventDemo/domain/notification/PlayerAsPlayACardNotification.kt similarity index 73% rename from src/main/kotlin/eventDemo/business/notification/PlayerAsPlayACardNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/PlayerAsPlayACardNotification.kt index 8305681..20b61e1 100644 --- a/src/main/kotlin/eventDemo/business/notification/PlayerAsPlayACardNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/PlayerAsPlayACardNotification.kt @@ -1,7 +1,7 @@ -package eventDemo.business.notification +package eventDemo.domain.notification -import eventDemo.business.entity.Card -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Card +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.serialization.Serializable import java.util.UUID diff --git a/src/main/kotlin/eventDemo/business/notification/PlayerHavePassNotification.kt b/src/main/kotlin/eventDemo/domain/notification/PlayerHavePassNotification.kt similarity index 79% rename from src/main/kotlin/eventDemo/business/notification/PlayerHavePassNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/PlayerHavePassNotification.kt index 0c826bf..87328e2 100644 --- a/src/main/kotlin/eventDemo/business/notification/PlayerHavePassNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/PlayerHavePassNotification.kt @@ -1,6 +1,6 @@ -package eventDemo.business.notification +package eventDemo.domain.notification -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.serialization.Serializable import java.util.UUID diff --git a/src/main/kotlin/eventDemo/business/notification/PlayerWasChoseTheCardColorNotification.kt b/src/main/kotlin/eventDemo/domain/notification/PlayerWasChoseTheCardColorNotification.kt similarity index 74% rename from src/main/kotlin/eventDemo/business/notification/PlayerWasChoseTheCardColorNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/PlayerWasChoseTheCardColorNotification.kt index 0d1e7f8..ef5d0b0 100644 --- a/src/main/kotlin/eventDemo/business/notification/PlayerWasChoseTheCardColorNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/PlayerWasChoseTheCardColorNotification.kt @@ -1,7 +1,7 @@ -package eventDemo.business.notification +package eventDemo.domain.notification -import eventDemo.business.entity.Card -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Card +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.serialization.Serializable import java.util.UUID diff --git a/src/main/kotlin/eventDemo/business/notification/PlayerWasReadyNotification.kt b/src/main/kotlin/eventDemo/domain/notification/PlayerWasReadyNotification.kt similarity index 79% rename from src/main/kotlin/eventDemo/business/notification/PlayerWasReadyNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/PlayerWasReadyNotification.kt index 764d221..d25b02d 100644 --- a/src/main/kotlin/eventDemo/business/notification/PlayerWasReadyNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/PlayerWasReadyNotification.kt @@ -1,6 +1,6 @@ -package eventDemo.business.notification +package eventDemo.domain.notification -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.serialization.Serializable import java.util.UUID diff --git a/src/main/kotlin/eventDemo/business/notification/PlayerWinNotification.kt b/src/main/kotlin/eventDemo/domain/notification/PlayerWinNotification.kt similarity index 79% rename from src/main/kotlin/eventDemo/business/notification/PlayerWinNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/PlayerWinNotification.kt index 91783a1..bb6f86b 100644 --- a/src/main/kotlin/eventDemo/business/notification/PlayerWinNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/PlayerWinNotification.kt @@ -1,6 +1,6 @@ -package eventDemo.business.notification +package eventDemo.domain.notification -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.serialization.Serializable import java.util.UUID diff --git a/src/main/kotlin/eventDemo/business/notification/TheGameWasStartedNotification.kt b/src/main/kotlin/eventDemo/domain/notification/TheGameWasStartedNotification.kt similarity index 79% rename from src/main/kotlin/eventDemo/business/notification/TheGameWasStartedNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/TheGameWasStartedNotification.kt index 4d650ac..bf1508f 100644 --- a/src/main/kotlin/eventDemo/business/notification/TheGameWasStartedNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/TheGameWasStartedNotification.kt @@ -1,6 +1,6 @@ -package eventDemo.business.notification +package eventDemo.domain.notification -import eventDemo.business.entity.Card +import eventDemo.domain.entity.Card import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.serialization.Serializable import java.util.UUID diff --git a/src/main/kotlin/eventDemo/business/notification/WelcomeToTheGameNotification.kt b/src/main/kotlin/eventDemo/domain/notification/WelcomeToTheGameNotification.kt similarity index 79% rename from src/main/kotlin/eventDemo/business/notification/WelcomeToTheGameNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/WelcomeToTheGameNotification.kt index edd7809..e9b1c30 100644 --- a/src/main/kotlin/eventDemo/business/notification/WelcomeToTheGameNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/WelcomeToTheGameNotification.kt @@ -1,6 +1,6 @@ -package eventDemo.business.notification +package eventDemo.domain.notification -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Player import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.serialization.Serializable import java.util.UUID diff --git a/src/main/kotlin/eventDemo/business/notification/YourNewCardNotification.kt b/src/main/kotlin/eventDemo/domain/notification/YourNewCardNotification.kt similarity index 79% rename from src/main/kotlin/eventDemo/business/notification/YourNewCardNotification.kt rename to src/main/kotlin/eventDemo/domain/notification/YourNewCardNotification.kt index 640e9e5..328a4b0 100644 --- a/src/main/kotlin/eventDemo/business/notification/YourNewCardNotification.kt +++ b/src/main/kotlin/eventDemo/domain/notification/YourNewCardNotification.kt @@ -1,6 +1,6 @@ -package eventDemo.business.notification +package eventDemo.domain.notification -import eventDemo.business.entity.Card +import eventDemo.domain.entity.Card import eventDemo.configuration.serializer.UUIDSerializer import kotlinx.serialization.Serializable import java.util.UUID diff --git a/src/main/kotlin/eventDemo/libs/command/CommandHandler.kt b/src/main/kotlin/eventDemo/libs/command/CommandHandler.kt index 3ddda75..d192ea5 100644 --- a/src/main/kotlin/eventDemo/libs/command/CommandHandler.kt +++ b/src/main/kotlin/eventDemo/libs/command/CommandHandler.kt @@ -1,8 +1,8 @@ package eventDemo.libs.command -import eventDemo.business.command.CommandException -import eventDemo.business.command.command.GameCommand -import eventDemo.business.event.event.GameEvent +import eventDemo.domain.command.CommandException +import eventDemo.domain.command.command.GameCommand +import eventDemo.domain.event.event.GameEvent import eventDemo.libs.bus.Bus import eventDemo.libs.event.AggregateId import eventDemo.libs.event.Event diff --git a/src/test/kotlin/eventDemo/Helpers.kt b/src/test/kotlin/eventDemo/Helpers.kt index 20dfe96..e9ba836 100644 --- a/src/test/kotlin/eventDemo/Helpers.kt +++ b/src/test/kotlin/eventDemo/Helpers.kt @@ -1,9 +1,9 @@ package eventDemo import com.zaxxer.hikari.HikariDataSource -import eventDemo.business.entity.Card -import eventDemo.business.entity.Deck -import eventDemo.configuration.business.configureGameListener +import eventDemo.domain.entity.Card +import eventDemo.domain.entity.Deck +import eventDemo.configuration.domain.configureGameListener import eventDemo.configuration.injection.appKoinModule import eventDemo.configuration.ktor.configuration import io.github.oshai.kotlinlogging.KotlinLogging diff --git a/src/test/kotlin/eventDemo/adapter/infrastructureLayer/GameEventBusInRabbitMQTest.kt b/src/test/kotlin/eventDemo/adapter/infrastructure/event/GameEventBusInRabbitMQTest.kt similarity index 75% rename from src/test/kotlin/eventDemo/adapter/infrastructureLayer/GameEventBusInRabbitMQTest.kt rename to src/test/kotlin/eventDemo/adapter/infrastructure/event/GameEventBusInRabbitMQTest.kt index c9c0d26..32f2246 100644 --- a/src/test/kotlin/eventDemo/adapter/infrastructureLayer/GameEventBusInRabbitMQTest.kt +++ b/src/test/kotlin/eventDemo/adapter/infrastructure/event/GameEventBusInRabbitMQTest.kt @@ -1,12 +1,10 @@ -package eventDemo.adapter.infrastructureLayer +package eventDemo.adapter.infrastructure.event import com.rabbitmq.client.ConnectionFactory -import eventDemo.adapter.infrastructureLayer.event.GameEventBusInMemory -import eventDemo.adapter.infrastructureLayer.event.GameEventBusInRabbinMQ -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.event.GameEventBus -import eventDemo.business.event.event.NewPlayerEvent +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.event.GameEventBus +import eventDemo.domain.event.event.NewPlayerEvent import eventDemo.testKoinApplicationWithConfig import io.kotest.assertions.nondeterministic.eventually import io.kotest.core.spec.style.FunSpec @@ -15,6 +13,7 @@ import io.kotest.matchers.equals.shouldBeEqual import io.mockk.mockk import io.mockk.spyk import io.mockk.verify +import java.util.function.Function import kotlin.time.Duration.Companion.seconds class GameEventBusInRabbitMQTest : @@ -28,7 +27,7 @@ class GameEventBusInRabbitMQTest : ) withData(busListToTest) { bus -> - val spy = spyk(mockk<() -> Unit>()) + val spy = spyk<() -> Unit>() val aggregateId = GameId() val player1 = Player(name = "Tesla") val player2 = Player(name = "Einstein") diff --git a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/AuthHelper.kt b/src/test/kotlin/eventDemo/adapter/presenter/query/AuthHelper.kt similarity index 74% rename from src/test/kotlin/eventDemo/adapter/interfaceLayer/query/AuthHelper.kt rename to src/test/kotlin/eventDemo/adapter/presenter/query/AuthHelper.kt index 540057c..55d8823 100644 --- a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/AuthHelper.kt +++ b/src/test/kotlin/eventDemo/adapter/presenter/query/AuthHelper.kt @@ -1,6 +1,6 @@ -package eventDemo.adapter.interfaceLayer.query +package eventDemo.adapter.presenter.query -import eventDemo.business.entity.Player +import eventDemo.domain.entity.Player import eventDemo.configuration.ktor.makeJwt import io.ktor.client.request.HttpRequestBuilder import io.ktor.client.request.header diff --git a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameListRouteTest.kt b/src/test/kotlin/eventDemo/adapter/presenter/query/GameListRouteTest.kt similarity index 90% rename from src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameListRouteTest.kt rename to src/test/kotlin/eventDemo/adapter/presenter/query/GameListRouteTest.kt index 2a7fdbc..4c50d65 100644 --- a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameListRouteTest.kt +++ b/src/test/kotlin/eventDemo/adapter/presenter/query/GameListRouteTest.kt @@ -1,12 +1,12 @@ -package eventDemo.adapter.interfaceLayer.query +package eventDemo.adapter.presenter.query -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -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 +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.event.GameEventHandler +import eventDemo.domain.event.event.GameStartedEvent +import eventDemo.domain.event.event.NewPlayerEvent +import eventDemo.domain.event.event.PlayerReadyEvent +import eventDemo.domain.event.projection.GameList import eventDemo.testApplicationWithConfig import io.github.oshai.kotlinlogging.KotlinLogging import io.kotest.assertions.nondeterministic.eventually diff --git a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameSimulationTest.kt b/src/test/kotlin/eventDemo/adapter/presenter/query/GameSimulationTest.kt similarity index 86% rename from src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameSimulationTest.kt rename to src/test/kotlin/eventDemo/adapter/presenter/query/GameSimulationTest.kt index 88fc3b8..6efdcfe 100644 --- a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameSimulationTest.kt +++ b/src/test/kotlin/eventDemo/adapter/presenter/query/GameSimulationTest.kt @@ -1,26 +1,26 @@ -package eventDemo.adapter.interfaceLayer.query +package eventDemo.adapter.presenter.query import eventDemo.Tag -import eventDemo.business.command.GameCommandHandler -import eventDemo.business.command.command.GameCommand -import eventDemo.business.command.command.IWantToJoinTheGameCommand -import eventDemo.business.command.command.IWantToPlayCardCommand -import eventDemo.business.command.command.IamReadyToPlayCommand -import eventDemo.business.entity.Card -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.event.event.disableShuffleDeck -import eventDemo.business.event.projection.GameState -import eventDemo.business.event.projection.GameStateRepository -import eventDemo.business.event.projection.projectionListener.PlayerNotificationListener -import eventDemo.business.notification.CommandSuccessNotification -import eventDemo.business.notification.ItsTheTurnOfNotification -import eventDemo.business.notification.Notification -import eventDemo.business.notification.PlayerAsJoinTheGameNotification -import eventDemo.business.notification.PlayerAsPlayACardNotification -import eventDemo.business.notification.PlayerWasReadyNotification -import eventDemo.business.notification.TheGameWasStartedNotification -import eventDemo.business.notification.WelcomeToTheGameNotification +import eventDemo.domain.command.GameCommandHandler +import eventDemo.domain.command.command.GameCommand +import eventDemo.domain.command.command.IWantToJoinTheGameCommand +import eventDemo.domain.command.command.IWantToPlayCardCommand +import eventDemo.domain.command.command.IamReadyToPlayCommand +import eventDemo.domain.entity.Card +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.event.event.disableShuffleDeck +import eventDemo.domain.event.projection.GameState +import eventDemo.domain.event.projection.GameStateRepository +import eventDemo.domain.event.projection.projectionListener.PlayerNotificationListener +import eventDemo.domain.notification.CommandSuccessNotification +import eventDemo.domain.notification.ItsTheTurnOfNotification +import eventDemo.domain.notification.Notification +import eventDemo.domain.notification.PlayerAsJoinTheGameNotification +import eventDemo.domain.notification.PlayerAsPlayACardNotification +import eventDemo.domain.notification.PlayerWasReadyNotification +import eventDemo.domain.notification.TheGameWasStartedNotification +import eventDemo.domain.notification.WelcomeToTheGameNotification import eventDemo.testKoinApplicationWithConfig import io.kotest.assertions.nondeterministic.eventually import io.kotest.assertions.nondeterministic.until diff --git a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameStateRouteTest.kt b/src/test/kotlin/eventDemo/adapter/presenter/query/GameStateRouteTest.kt similarity index 90% rename from src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameStateRouteTest.kt rename to src/test/kotlin/eventDemo/adapter/presenter/query/GameStateRouteTest.kt index 8e0b175..60298ab 100644 --- a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/GameStateRouteTest.kt +++ b/src/test/kotlin/eventDemo/adapter/presenter/query/GameStateRouteTest.kt @@ -1,15 +1,15 @@ -package eventDemo.adapter.interfaceLayer.query +package eventDemo.adapter.presenter.query -import eventDemo.business.entity.Card -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.event.GameEventHandler -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 -import eventDemo.business.event.projection.GameStateRepository +import eventDemo.domain.entity.Card +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.event.GameEventHandler +import eventDemo.domain.event.event.CardIsPlayedEvent +import eventDemo.domain.event.event.NewPlayerEvent +import eventDemo.domain.event.event.PlayerReadyEvent +import eventDemo.domain.event.event.disableShuffleDeck +import eventDemo.domain.event.projection.GameState +import eventDemo.domain.event.projection.GameStateRepository import eventDemo.testApplicationWithConfig import io.kotest.assertions.nondeterministic.eventually import io.kotest.assertions.nondeterministic.until diff --git a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/TestHttpClient.kt b/src/test/kotlin/eventDemo/adapter/presenter/query/TestHttpClient.kt similarity index 90% rename from src/test/kotlin/eventDemo/adapter/interfaceLayer/query/TestHttpClient.kt rename to src/test/kotlin/eventDemo/adapter/presenter/query/TestHttpClient.kt index a2940de..95ef09d 100644 --- a/src/test/kotlin/eventDemo/adapter/interfaceLayer/query/TestHttpClient.kt +++ b/src/test/kotlin/eventDemo/adapter/presenter/query/TestHttpClient.kt @@ -1,4 +1,4 @@ -package eventDemo.adapter.interfaceLayer.query +package eventDemo.adapter.presenter.query import eventDemo.configuration.ktor.defaultJsonSerializer import io.ktor.client.HttpClient import io.ktor.client.plugins.contentnegotiation.ContentNegotiation diff --git a/src/test/kotlin/eventDemo/business/command/GameCommandHandlerTest.kt b/src/test/kotlin/eventDemo/domain/command/GameCommandHandlerTest.kt similarity index 79% rename from src/test/kotlin/eventDemo/business/command/GameCommandHandlerTest.kt rename to src/test/kotlin/eventDemo/domain/command/GameCommandHandlerTest.kt index 8dab3cc..0e4085b 100644 --- a/src/test/kotlin/eventDemo/business/command/GameCommandHandlerTest.kt +++ b/src/test/kotlin/eventDemo/domain/command/GameCommandHandlerTest.kt @@ -1,14 +1,14 @@ -package eventDemo.business.command +package eventDemo.domain.command import eventDemo.Tag -import eventDemo.business.command.command.GameCommand -import eventDemo.business.command.command.IWantToJoinTheGameCommand -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.event.projection.projectionListener.PlayerNotificationListener -import eventDemo.business.notification.CommandSuccessNotification -import eventDemo.business.notification.Notification -import eventDemo.business.notification.WelcomeToTheGameNotification +import eventDemo.domain.command.command.GameCommand +import eventDemo.domain.command.command.IWantToJoinTheGameCommand +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.event.projection.projectionListener.PlayerNotificationListener +import eventDemo.domain.notification.CommandSuccessNotification +import eventDemo.domain.notification.Notification +import eventDemo.domain.notification.WelcomeToTheGameNotification import eventDemo.testKoinApplicationWithConfig import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.collections.shouldContain diff --git a/src/test/kotlin/eventDemo/business/command/GameCommandRunnerTest.kt b/src/test/kotlin/eventDemo/domain/command/GameCommandRunnerTest.kt similarity index 80% rename from src/test/kotlin/eventDemo/business/command/GameCommandRunnerTest.kt rename to src/test/kotlin/eventDemo/domain/command/GameCommandRunnerTest.kt index 3e5b0dd..3e77fd2 100644 --- a/src/test/kotlin/eventDemo/business/command/GameCommandRunnerTest.kt +++ b/src/test/kotlin/eventDemo/domain/command/GameCommandRunnerTest.kt @@ -1,4 +1,4 @@ -package eventDemo.business.command +package eventDemo.domain.command import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/eventDemo/business/command/command/ICantPlayCommandTest.kt b/src/test/kotlin/eventDemo/domain/command/command/ICantPlayCommandTest.kt similarity index 75% rename from src/test/kotlin/eventDemo/business/command/command/ICantPlayCommandTest.kt rename to src/test/kotlin/eventDemo/domain/command/command/ICantPlayCommandTest.kt index 6b82afb..6764e95 100644 --- a/src/test/kotlin/eventDemo/business/command/command/ICantPlayCommandTest.kt +++ b/src/test/kotlin/eventDemo/domain/command/command/ICantPlayCommandTest.kt @@ -1,4 +1,4 @@ -package eventDemo.business.command.command +package eventDemo.domain.command.command import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/eventDemo/business/command/command/IWantToJoinTheGameCommandTest.kt b/src/test/kotlin/eventDemo/domain/command/command/IWantToJoinTheGameCommandTest.kt similarity index 77% rename from src/test/kotlin/eventDemo/business/command/command/IWantToJoinTheGameCommandTest.kt rename to src/test/kotlin/eventDemo/domain/command/command/IWantToJoinTheGameCommandTest.kt index 89e6009..6f9647f 100644 --- a/src/test/kotlin/eventDemo/business/command/command/IWantToJoinTheGameCommandTest.kt +++ b/src/test/kotlin/eventDemo/domain/command/command/IWantToJoinTheGameCommandTest.kt @@ -1,4 +1,4 @@ -package eventDemo.business.command.command +package eventDemo.domain.command.command import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/eventDemo/business/command/command/IWantToPlayCardCommandTest.kt b/src/test/kotlin/eventDemo/domain/command/command/IWantToPlayCardCommandTest.kt similarity index 76% rename from src/test/kotlin/eventDemo/business/command/command/IWantToPlayCardCommandTest.kt rename to src/test/kotlin/eventDemo/domain/command/command/IWantToPlayCardCommandTest.kt index c3e77f4..7c79599 100644 --- a/src/test/kotlin/eventDemo/business/command/command/IWantToPlayCardCommandTest.kt +++ b/src/test/kotlin/eventDemo/domain/command/command/IWantToPlayCardCommandTest.kt @@ -1,4 +1,4 @@ -package eventDemo.business.command.command +package eventDemo.domain.command.command import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/eventDemo/business/command/command/IamReadyToPlayCommandTest.kt b/src/test/kotlin/eventDemo/domain/command/command/IamReadyToPlayCommandTest.kt similarity index 76% rename from src/test/kotlin/eventDemo/business/command/command/IamReadyToPlayCommandTest.kt rename to src/test/kotlin/eventDemo/domain/command/command/IamReadyToPlayCommandTest.kt index 495b834..3c10ab9 100644 --- a/src/test/kotlin/eventDemo/business/command/command/IamReadyToPlayCommandTest.kt +++ b/src/test/kotlin/eventDemo/domain/command/command/IamReadyToPlayCommandTest.kt @@ -1,4 +1,4 @@ -package eventDemo.business.command.command +package eventDemo.domain.command.command import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/eventDemo/business/entity/DeckTest.kt b/src/test/kotlin/eventDemo/domain/entity/DeckTest.kt similarity index 99% rename from src/test/kotlin/eventDemo/business/entity/DeckTest.kt rename to src/test/kotlin/eventDemo/domain/entity/DeckTest.kt index 9636634..134e083 100644 --- a/src/test/kotlin/eventDemo/business/entity/DeckTest.kt +++ b/src/test/kotlin/eventDemo/domain/entity/DeckTest.kt @@ -1,4 +1,4 @@ -package eventDemo.business.entity +package eventDemo.domain.entity import eventDemo.allCardCount import eventDemo.allCards diff --git a/src/test/kotlin/eventDemo/business/entity/PlayerHandKtTest.kt b/src/test/kotlin/eventDemo/domain/entity/PlayerHandKtTest.kt similarity index 97% rename from src/test/kotlin/eventDemo/business/entity/PlayerHandKtTest.kt rename to src/test/kotlin/eventDemo/domain/entity/PlayerHandKtTest.kt index e826ab3..c5febed 100644 --- a/src/test/kotlin/eventDemo/business/entity/PlayerHandKtTest.kt +++ b/src/test/kotlin/eventDemo/domain/entity/PlayerHandKtTest.kt @@ -1,4 +1,4 @@ -package eventDemo.business.entity +package eventDemo.domain.entity import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.ints.shouldBeExactly diff --git a/src/test/kotlin/eventDemo/business/entity/PlayersHandsTest.kt b/src/test/kotlin/eventDemo/domain/entity/PlayersHandsTest.kt similarity index 90% rename from src/test/kotlin/eventDemo/business/entity/PlayersHandsTest.kt rename to src/test/kotlin/eventDemo/domain/entity/PlayersHandsTest.kt index d81f700..72b4128 100644 --- a/src/test/kotlin/eventDemo/business/entity/PlayersHandsTest.kt +++ b/src/test/kotlin/eventDemo/domain/entity/PlayersHandsTest.kt @@ -1,4 +1,4 @@ -package eventDemo.business.entity +package eventDemo.domain.entity import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/eventDemo/business/event/GameEventHandlerTest.kt b/src/test/kotlin/eventDemo/domain/event/GameEventHandlerTest.kt similarity index 88% rename from src/test/kotlin/eventDemo/business/event/GameEventHandlerTest.kt rename to src/test/kotlin/eventDemo/domain/event/GameEventHandlerTest.kt index 19e3ac9..5c221a5 100644 --- a/src/test/kotlin/eventDemo/business/event/GameEventHandlerTest.kt +++ b/src/test/kotlin/eventDemo/domain/event/GameEventHandlerTest.kt @@ -1,11 +1,11 @@ -package eventDemo.business.event +package eventDemo.domain.event -import eventDemo.adapter.infrastructureLayer.event.GameEventBusInMemory -import eventDemo.adapter.infrastructureLayer.event.GameEventStoreInMemory -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.event.event.GameEvent -import eventDemo.business.event.event.NewPlayerEvent +import eventDemo.adapter.infrastructure.event.GameEventBusInMemory +import eventDemo.adapter.infrastructure.event.GameEventStoreInMemory +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.event.event.GameEvent +import eventDemo.domain.event.event.NewPlayerEvent import eventDemo.libs.event.VersionBuilderLocal import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.collections.shouldHaveSize @@ -63,7 +63,7 @@ class GameEventHandlerTest : // When var event: GameEvent? = null - val spy = spyk(mockk<() -> Unit>()) + val spy = spyk<() -> Unit>() eventBus.subscribe { spy() event = it diff --git a/src/test/kotlin/eventDemo/business/event/projection/GameStateBuilderTest.kt b/src/test/kotlin/eventDemo/domain/event/projection/GameStateBuilderTest.kt similarity index 90% rename from src/test/kotlin/eventDemo/business/event/projection/GameStateBuilderTest.kt rename to src/test/kotlin/eventDemo/domain/event/projection/GameStateBuilderTest.kt index fc5ae82..2dba9ae 100644 --- a/src/test/kotlin/eventDemo/business/event/projection/GameStateBuilderTest.kt +++ b/src/test/kotlin/eventDemo/domain/event/projection/GameStateBuilderTest.kt @@ -1,13 +1,13 @@ -package eventDemo.business.event.projection +package eventDemo.domain.event.projection -import eventDemo.business.entity.Card -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.event.event.CardIsPlayedEvent -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.domain.entity.Card +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.event.event.CardIsPlayedEvent +import eventDemo.domain.event.event.GameStartedEvent +import eventDemo.domain.event.event.NewPlayerEvent +import eventDemo.domain.event.event.PlayerReadyEvent +import eventDemo.domain.event.event.disableShuffleDeck 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/domain/event/projection/GameStateRepositoryTest.kt similarity index 93% rename from src/test/kotlin/eventDemo/business/event/projection/GameStateRepositoryTest.kt rename to src/test/kotlin/eventDemo/domain/event/projection/GameStateRepositoryTest.kt index 7dccd07..e2ea216 100644 --- a/src/test/kotlin/eventDemo/business/event/projection/GameStateRepositoryTest.kt +++ b/src/test/kotlin/eventDemo/domain/event/projection/GameStateRepositoryTest.kt @@ -1,13 +1,13 @@ -package eventDemo.business.event.projection +package eventDemo.domain.event.projection import ch.qos.logback.classic.Level import com.rabbitmq.client.impl.ForgivingExceptionHandler import eventDemo.Tag -import eventDemo.business.command.GameCommandHandler -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.event.GameEventHandler -import eventDemo.business.event.event.NewPlayerEvent +import eventDemo.domain.command.GameCommandHandler +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.event.GameEventHandler +import eventDemo.domain.event.event.NewPlayerEvent 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/domain/event/projection/GameStateTest.kt similarity index 93% rename from src/test/kotlin/eventDemo/business/event/projection/GameStateTest.kt rename to src/test/kotlin/eventDemo/domain/event/projection/GameStateTest.kt index 52d7f4c..22c30f8 100644 --- a/src/test/kotlin/eventDemo/business/event/projection/GameStateTest.kt +++ b/src/test/kotlin/eventDemo/domain/event/projection/GameStateTest.kt @@ -1,11 +1,11 @@ -package eventDemo.business.event.projection +package eventDemo.domain.event.projection -import eventDemo.business.entity.Card -import eventDemo.business.entity.Deck -import eventDemo.business.entity.Discard -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.entity.PlayersHands +import eventDemo.domain.entity.Card +import eventDemo.domain.entity.Deck +import eventDemo.domain.entity.Discard +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.entity.PlayersHands 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/domain/event/projection/projectionListener/PlayerNotificationListenerTest.kt similarity index 57% rename from src/test/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListenerTest.kt rename to src/test/kotlin/eventDemo/domain/event/projection/projectionListener/PlayerNotificationListenerTest.kt index c752ede..8d52556 100644 --- a/src/test/kotlin/eventDemo/business/event/projection/projectionListener/PlayerNotificationListenerTest.kt +++ b/src/test/kotlin/eventDemo/domain/event/projection/projectionListener/PlayerNotificationListenerTest.kt @@ -1,13 +1,14 @@ -package eventDemo.business.event.projection.projectionListener +package eventDemo.domain.event.projection.projectionListener -import eventDemo.adapter.infrastructureLayer.event.projection.GameProjectionBusInMemory -import eventDemo.business.entity.GameId -import eventDemo.business.entity.Player -import eventDemo.business.event.event.NewPlayerEvent -import eventDemo.business.event.projection.GameState -import eventDemo.business.notification.WelcomeToTheGameNotification +import eventDemo.adapter.infrastructure.event.projection.GameProjectionBusInMemory +import eventDemo.domain.entity.GameId +import eventDemo.domain.entity.Player +import eventDemo.domain.event.event.NewPlayerEvent +import eventDemo.domain.event.projection.GameState +import eventDemo.domain.notification.WelcomeToTheGameNotification import io.kotest.core.spec.style.FunSpec import io.mockk.mockk +import io.mockk.spyk import io.mockk.verify import kotlin.test.assertIs @@ -24,13 +25,13 @@ class PlayerNotificationListenerTest : lastEvent = NewPlayerEvent(gameId, player, 1), players = setOf(player), ) - val spyCall: () -> Unit = mockk(relaxed = true) + val spy = spyk<() -> Unit>() PlayerNotificationListener(bus).startListening(player, gameId) { assertIs(it) - spyCall() + spy() } bus.publish(state) - verify(exactly = 1) { spyCall() } + verify(exactly = 1) { spy() } } }) diff --git a/src/test/kotlin/eventDemo/externalServices/RabbitMQTest.kt b/src/test/kotlin/eventDemo/externalServices/RabbitMQTest.kt index 4f21cc7..f833593 100644 --- a/src/test/kotlin/eventDemo/externalServices/RabbitMQTest.kt +++ b/src/test/kotlin/eventDemo/externalServices/RabbitMQTest.kt @@ -26,7 +26,7 @@ class RabbitMQTest : val exchangeName = "test_" + UUID.randomUUID() - val spy = spyk(mockk<() -> Unit>()) + val spy = spyk<() -> Unit>() factory.newConnection().use { connection -> connection diff --git a/src/test/kotlin/eventDemo/libs/bus/BusTest.kt b/src/test/kotlin/eventDemo/libs/bus/BusTest.kt index 608fddc..70392aa 100644 --- a/src/test/kotlin/eventDemo/libs/bus/BusTest.kt +++ b/src/test/kotlin/eventDemo/libs/bus/BusTest.kt @@ -38,7 +38,7 @@ class BusTest : ) withData(list) { bus -> - val spy = spyk(mockk<() -> Unit>()) + val spy = spyk<() -> Unit>() bus.subscribe { obj -> spy() diff --git a/src/test/kotlin/eventDemo/libs/command/CommandStreamChannelTest.kt b/src/test/kotlin/eventDemo/libs/command/CommandStreamChannelTest.kt index 1956e5f..fd1d43f 100644 --- a/src/test/kotlin/eventDemo/libs/command/CommandStreamChannelTest.kt +++ b/src/test/kotlin/eventDemo/libs/command/CommandStreamChannelTest.kt @@ -3,6 +3,7 @@ package eventDemo.libs.command import io.kotest.assertions.nondeterministic.eventually import io.kotest.core.spec.style.FunSpec import io.mockk.mockk +import io.mockk.spyk import io.mockk.verify import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.GlobalScope @@ -26,19 +27,19 @@ class CommandStreamChannelTest : val channel = Channel() val stream = CommandStreamChannel(CommandRunnerController()) - val spyCall: () -> Unit = mockk(relaxed = true) + val spy = spyk<() -> Unit>() GlobalScope.launch { stream.process(channel) { println("In action ${it.id}") - spyCall() + spy() } } channel.send(command) eventually(3.seconds) { - verify(exactly = 1) { spyCall() } + verify(exactly = 1) { spy() } } } })