refactor: Moved `FilesStorageStrategy` in its own package -- Rename
authorKai Moritz <kai@juplo.de>
Mon, 9 Jan 2023 21:42:37 +0000 (22:42 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 15 Jan 2023 18:37:26 +0000 (19:37 +0100)
src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/ChatRoomServiceFactory.java
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/FilesStorageStrategy.java
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/JsonFilePublisher.java
src/test/java/de/juplo/kafka/chat/backend/persistence/InMemoryWithFilesStorageStrategyIT.java

index 33734a7..dcf2d9f 100644 (file)
@@ -4,7 +4,7 @@ import de.juplo.kafka.chat.backend.domain.ChatHome;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import de.juplo.kafka.chat.backend.domain.ChatHomeService;
 import de.juplo.kafka.chat.backend.persistence.inmemory.InMemoryChatHomeService;
-import de.juplo.kafka.chat.backend.persistence.filestorage.FileStorageStrategy;
+import de.juplo.kafka.chat.backend.persistence.storage.files.FilesStorageStrategy;
 import de.juplo.kafka.chat.backend.persistence.StorageStrategy;
 import de.juplo.kafka.chat.backend.persistence.inmemory.InMemoryChatRoomService;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -43,7 +43,7 @@ public class ChatBackendConfiguration
       Clock clock,
       ObjectMapper mapper)
   {
-    return new FileStorageStrategy(
+    return new FilesStorageStrategy(
         Paths.get(properties.getStorageDirectory()),
         clock,
         properties.getChatroomBufferSize(),
index 42c000b..d06c8f9 100644 (file)
@@ -1,4 +1,4 @@
-package de.juplo.kafka.chat.backend.persistence.filestorage;
+package de.juplo.kafka.chat.backend.persistence.storage.files;
 
 import de.juplo.kafka.chat.backend.domain.ChatRoomService;
 import de.juplo.kafka.chat.backend.domain.Message;
index 9952117..e670970 100644 (file)
@@ -1,4 +1,4 @@
-package de.juplo.kafka.chat.backend.persistence.filestorage;
+package de.juplo.kafka.chat.backend.persistence.storage.files;
 
 import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.databind.JavaType;
@@ -23,7 +23,7 @@ import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
 
 @RequiredArgsConstructor
 @Slf4j
-public class FileStorageStrategy implements StorageStrategy
+public class FilesStorageStrategy implements StorageStrategy
 {
   public static final String CHATROOMS_FILENAME = "chatrooms.json";
 
index 3824898..aec8b36 100644 (file)
@@ -1,4 +1,4 @@
-package de.juplo.kafka.chat.backend.persistence.filestorage;
+package de.juplo.kafka.chat.backend.persistence.storage.files;
 
 import com.fasterxml.jackson.core.JsonParser;
 import com.fasterxml.jackson.core.JsonToken;
index e10aae0..f182c82 100644 (file)
@@ -4,7 +4,7 @@ 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.domain.ChatHomeService;
-import de.juplo.kafka.chat.backend.persistence.filestorage.FileStorageStrategy;
+import de.juplo.kafka.chat.backend.persistence.storage.files.FilesStorageStrategy;
 import de.juplo.kafka.chat.backend.persistence.inmemory.InMemoryChatHomeService;
 import de.juplo.kafka.chat.backend.persistence.inmemory.InMemoryChatRoomService;
 import lombok.extern.slf4j.Slf4j;
@@ -19,22 +19,22 @@ import java.util.function.Supplier;
 
 
 @Slf4j
-public class InMemoryWithFileStorageStrategyIT extends AbstractStorageStrategyIT
+public class InMemoryWithFilesStorageStrategyIT extends AbstractStorageStrategyIT
 {
   final static Path path = Paths.get("target","local-json-files");
 
   final Clock clock;
   final ObjectMapper mapper;
-  final FileStorageStrategy storageStrategy;
+  final FilesStorageStrategy storageStrategy;
 
 
-  public InMemoryWithFileStorageStrategyIT()
+  public InMemoryWithFilesStorageStrategyIT()
   {
     clock = Clock.systemDefaultZone();
     mapper = new ObjectMapper();
     mapper.registerModule(new JavaTimeModule());
     mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
-    storageStrategy = new FileStorageStrategy(
+    storageStrategy = new FilesStorageStrategy(
         path,
         clock,
         8,