From b7c1936db2375d56e476441e83f7663b3e9924b7 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 6 Sep 2023 23:46:36 +0200 Subject: [PATCH] refactor: `storage` is not a sub-package of `persistence` - Aligned code --- .../storage/files/FilesStorageConfiguration.java | 2 +- .../backend/storage/files/FilesStorageStrategy.java | 2 +- .../chat/backend/storage/files/JsonFilePublisher.java | 2 +- .../backend/storage/mongodb/ChatRoomRepository.java | 2 +- .../chat/backend/storage/mongodb/ChatRoomTo.java | 2 +- .../backend/storage/mongodb/MessageRepository.java | 2 +- .../kafka/chat/backend/storage/mongodb/MessageTo.java | 2 +- .../storage/mongodb/MongoDbStorageConfiguration.java | 2 +- .../storage/mongodb/MongoDbStorageStrategy.java | 2 +- .../nostorage/NoStorageStorageConfiguration.java | 2 +- .../kafka/chat/backend/AbstractInMemoryStorageIT.java | 2 +- .../kafka/chat/backend/AbstractStorageStrategyIT.java | 3 ++- .../chat/backend/InMemoryWithFilesStorageIT.java | 5 +++-- .../chat/backend/InMemoryWithMongoDbStorageIT.java | 11 ++++++----- .../inmemory/ShardedChatHomeServiceTest.java | 2 +- .../inmemory/SimpleChatHomeServiceTest.java | 2 +- src/test/resources/data/mongodb/chatRoomTo.json | 2 +- src/test/resources/data/mongodb/messageTo.json | 8 ++++---- 18 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageConfiguration.java b/src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageConfiguration.java index 3a59acb6..2ed9addb 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageConfiguration.java +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageConfiguration.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.chat.backend.persistence.storage.files; +package de.juplo.kafka.chat.backend.storage.files; import com.fasterxml.jackson.databind.ObjectMapper; import de.juplo.kafka.chat.backend.ChatBackendProperties; diff --git a/src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageStrategy.java b/src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageStrategy.java index 9c791977..887aea24 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageStrategy.java +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageStrategy.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.chat.backend.persistence.storage.files; +package de.juplo.kafka.chat.backend.storage.files; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JavaType; diff --git a/src/main/java/de/juplo/kafka/chat/backend/storage/files/JsonFilePublisher.java b/src/main/java/de/juplo/kafka/chat/backend/storage/files/JsonFilePublisher.java index aec8b367..037451f7 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/files/JsonFilePublisher.java +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/files/JsonFilePublisher.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.chat.backend.persistence.storage.files; +package de.juplo.kafka.chat.backend.storage.files; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; diff --git a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/ChatRoomRepository.java b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/ChatRoomRepository.java index 12e5b968..d9f6a0f5 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/ChatRoomRepository.java +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/ChatRoomRepository.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.chat.backend.persistence.storage.mongodb; +package de.juplo.kafka.chat.backend.storage.mongodb; import org.springframework.data.mongodb.repository.MongoRepository; diff --git a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/ChatRoomTo.java b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/ChatRoomTo.java index 0086053e..8ea9cc23 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/ChatRoomTo.java +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/ChatRoomTo.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.chat.backend.persistence.storage.mongodb; +package de.juplo.kafka.chat.backend.storage.mongodb; import de.juplo.kafka.chat.backend.domain.ChatRoomInfo; import lombok.*; diff --git a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MessageRepository.java b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MessageRepository.java index a429f96e..712f5a4a 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MessageRepository.java +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MessageRepository.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.chat.backend.persistence.storage.mongodb; +package de.juplo.kafka.chat.backend.storage.mongodb; import org.springframework.data.mongodb.repository.MongoRepository; diff --git a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MessageTo.java b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MessageTo.java index f6c6b85d..6b317f9c 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MessageTo.java +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MessageTo.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.chat.backend.persistence.storage.mongodb; +package de.juplo.kafka.chat.backend.storage.mongodb; import de.juplo.kafka.chat.backend.domain.Message; import lombok.*; diff --git a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageConfiguration.java b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageConfiguration.java index e6f71490..52c6ec6e 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageConfiguration.java +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageConfiguration.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.chat.backend.persistence.storage.mongodb; +package de.juplo.kafka.chat.backend.storage.mongodb; import de.juplo.kafka.chat.backend.persistence.ShardingStrategy; import de.juplo.kafka.chat.backend.persistence.StorageStrategy; diff --git a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageStrategy.java b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageStrategy.java index 644ab887..5f46e3c4 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageStrategy.java +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageStrategy.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.chat.backend.persistence.storage.mongodb; +package de.juplo.kafka.chat.backend.storage.mongodb; import de.juplo.kafka.chat.backend.domain.ChatRoomInfo; import de.juplo.kafka.chat.backend.domain.Message; diff --git a/src/main/java/de/juplo/kafka/chat/backend/storage/nostorage/NoStorageStorageConfiguration.java b/src/main/java/de/juplo/kafka/chat/backend/storage/nostorage/NoStorageStorageConfiguration.java index ab24bb8a..5b13be4b 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/nostorage/NoStorageStorageConfiguration.java +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/nostorage/NoStorageStorageConfiguration.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.chat.backend.persistence.storage.nostorage; +package de.juplo.kafka.chat.backend.storage.nostorage; import de.juplo.kafka.chat.backend.domain.ChatRoomInfo; import de.juplo.kafka.chat.backend.domain.Message; diff --git a/src/test/java/de/juplo/kafka/chat/backend/AbstractInMemoryStorageIT.java b/src/test/java/de/juplo/kafka/chat/backend/AbstractInMemoryStorageIT.java index 3d311a4e..703911de 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/AbstractInMemoryStorageIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/AbstractInMemoryStorageIT.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.chat.backend.persistence; +package de.juplo.kafka.chat.backend; import de.juplo.kafka.chat.backend.domain.ChatHomeService; import de.juplo.kafka.chat.backend.persistence.inmemory.SimpleChatHomeService; diff --git a/src/test/java/de/juplo/kafka/chat/backend/AbstractStorageStrategyIT.java b/src/test/java/de/juplo/kafka/chat/backend/AbstractStorageStrategyIT.java index c2149bba..03c3aa45 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/AbstractStorageStrategyIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/AbstractStorageStrategyIT.java @@ -1,6 +1,7 @@ -package de.juplo.kafka.chat.backend.persistence; +package de.juplo.kafka.chat.backend; import de.juplo.kafka.chat.backend.domain.*; +import de.juplo.kafka.chat.backend.persistence.StorageStrategy; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; diff --git a/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithFilesStorageIT.java b/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithFilesStorageIT.java index be40eed2..314ee847 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithFilesStorageIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithFilesStorageIT.java @@ -1,9 +1,10 @@ -package de.juplo.kafka.chat.backend.persistence; +package de.juplo.kafka.chat.backend; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import de.juplo.kafka.chat.backend.persistence.storage.files.FilesStorageStrategy; +import de.juplo.kafka.chat.backend.persistence.StorageStrategy; +import de.juplo.kafka.chat.backend.storage.files.FilesStorageStrategy; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.BeforeEach; diff --git a/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithMongoDbStorageIT.java b/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithMongoDbStorageIT.java index a0dab37c..dbf3334c 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithMongoDbStorageIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/InMemoryWithMongoDbStorageIT.java @@ -1,9 +1,10 @@ -package de.juplo.kafka.chat.backend.persistence; +package de.juplo.kafka.chat.backend; -import de.juplo.kafka.chat.backend.persistence.InMemoryWithMongoDbStorageIT.DataSourceInitializer; -import de.juplo.kafka.chat.backend.persistence.storage.mongodb.ChatRoomRepository; -import de.juplo.kafka.chat.backend.persistence.storage.mongodb.MessageRepository; -import de.juplo.kafka.chat.backend.persistence.storage.mongodb.MongoDbStorageStrategy; +import de.juplo.kafka.chat.backend.InMemoryWithMongoDbStorageIT.DataSourceInitializer; +import de.juplo.kafka.chat.backend.persistence.StorageStrategy; +import de.juplo.kafka.chat.backend.storage.mongodb.ChatRoomRepository; +import de.juplo.kafka.chat.backend.storage.mongodb.MessageRepository; +import de.juplo.kafka.chat.backend.storage.mongodb.MongoDbStorageStrategy; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/src/test/java/de/juplo/kafka/chat/backend/persistence/inmemory/ShardedChatHomeServiceTest.java b/src/test/java/de/juplo/kafka/chat/backend/persistence/inmemory/ShardedChatHomeServiceTest.java index 0363f5dc..4c922ce6 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/persistence/inmemory/ShardedChatHomeServiceTest.java +++ b/src/test/java/de/juplo/kafka/chat/backend/persistence/inmemory/ShardedChatHomeServiceTest.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import de.juplo.kafka.chat.backend.domain.ChatHomeServiceWithShardsTest; import de.juplo.kafka.chat.backend.persistence.ShardingStrategy; import de.juplo.kafka.chat.backend.persistence.StorageStrategy; -import de.juplo.kafka.chat.backend.persistence.storage.files.FilesStorageStrategy; +import de.juplo.kafka.chat.backend.storage.files.FilesStorageStrategy; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; diff --git a/src/test/java/de/juplo/kafka/chat/backend/persistence/inmemory/SimpleChatHomeServiceTest.java b/src/test/java/de/juplo/kafka/chat/backend/persistence/inmemory/SimpleChatHomeServiceTest.java index 3e3311c6..fd5a83b8 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/persistence/inmemory/SimpleChatHomeServiceTest.java +++ b/src/test/java/de/juplo/kafka/chat/backend/persistence/inmemory/SimpleChatHomeServiceTest.java @@ -3,7 +3,7 @@ package de.juplo.kafka.chat.backend.persistence.inmemory; import com.fasterxml.jackson.databind.ObjectMapper; import de.juplo.kafka.chat.backend.domain.ChatHomeServiceTest; import de.juplo.kafka.chat.backend.persistence.StorageStrategy; -import de.juplo.kafka.chat.backend.persistence.storage.files.FilesStorageStrategy; +import de.juplo.kafka.chat.backend.storage.files.FilesStorageStrategy; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; diff --git a/src/test/resources/data/mongodb/chatRoomTo.json b/src/test/resources/data/mongodb/chatRoomTo.json index db26b899..8ce7b7c1 100644 --- a/src/test/resources/data/mongodb/chatRoomTo.json +++ b/src/test/resources/data/mongodb/chatRoomTo.json @@ -2,5 +2,5 @@ "_id": "5c73531c-6fc4-426c-adcb-afc5c140a0f7", "shard": 0, "name": "FOO", - "_class": "de.juplo.kafka.chat.backend.persistence.storage.mongodb.ChatRoomTo" + "_class": "de.juplo.kafka.chat.backend.storage.mongodb.ChatRoomTo" } diff --git a/src/test/resources/data/mongodb/messageTo.json b/src/test/resources/data/mongodb/messageTo.json index 02fed6ff..153e0b4b 100644 --- a/src/test/resources/data/mongodb/messageTo.json +++ b/src/test/resources/data/mongodb/messageTo.json @@ -6,7 +6,7 @@ "serial": 0, "time": "2023-01-13T20:43:16.803382151", "text": "Hallo, ich heiße Peter!", - "_class": "de.juplo.kafka.chat.backend.persistence.storage.mongodb.MessageTo" + "_class": "de.juplo.kafka.chat.backend.storage.mongodb.MessageTo" } { "_id": "64f7952cecf06d750cad4b9d", @@ -16,7 +16,7 @@ "serial": 1, "time": "2023-01-13T20:43:16.804049969", "text": "Ich bin Ute...", - "_class": "de.juplo.kafka.chat.backend.persistence.storage.mongodb.MessageTo" + "_class": "de.juplo.kafka.chat.backend.storage.mongodb.MessageTo" } { "_id": "64f7952cecf06d750cad4b9e", @@ -26,7 +26,7 @@ "serial": 2, "time": "2023-01-13T20:43:16.804092782", "text": "Willst du mit mir gehen?", - "_class": "de.juplo.kafka.chat.backend.persistence.storage.mongodb.MessageTo" + "_class": "de.juplo.kafka.chat.backend.storage.mongodb.MessageTo" } { "_id": "64f7953ddf7a9063e0b1f7dc", @@ -36,5 +36,5 @@ "serial": 3, "time": "2023-01-13T20:43:16.804122604", "text": "Ja? Nein? Vielleicht??", - "_class": "de.juplo.kafka.chat.backend.persistence.storage.mongodb.MessageTo" + "_class": "de.juplo.kafka.chat.backend.storage.mongodb.MessageTo" } -- 2.20.1