refactor: Moved `ShardingStrategy` into package `persistence` -- ALIGNE
[demos/kafka/chat] / src / test / java / de / juplo / kafka / chat / backend / persistence / inmemory / SimpleChatHomeTest.java
index 761e700..8be3173 100644 (file)
@@ -17,30 +17,34 @@ public class SimpleChatHomeTest extends ChatHomeTest
   static class Configuration
   {
     @Bean
-    SimpleChatHome chatHome(InMemoryChatHomeService chatHomeService)
+    SimpleChatHome chatHome(
+        StorageStrategy storageStrategy,
+        Clock clock)
     {
-      return new SimpleChatHome(chatHomeService);
+      return new SimpleChatHome(
+          storageStrategy,
+          clock,
+          bufferSize());
     }
 
     @Bean
-    InMemoryChatHomeService chatHomeService(StorageStrategy storageStrategy)
-    {
-      return new InMemoryChatHomeService(
-          1,
-          new int[] { 0 },
-          storageStrategy.read());
-    }
-
-    @Bean
-    public FilesStorageStrategy storageStrategy()
+    public FilesStorageStrategy storageStrategy(Clock clock)
     {
       return new FilesStorageStrategy(
           Paths.get("target", "test-classes", "data", "files"),
-          Clock.systemDefaultZone(),
-          8,
           chatRoomId -> 0,
-          messageFlux -> new InMemoryChatRoomService(messageFlux),
           new ObjectMapper());
     }
+
+    @Bean
+    Clock clock()
+    {
+      return Clock.systemDefaultZone();
+    }
+
+    int bufferSize()
+    {
+      return 8;
+    }
   }
 }