WIP:refactor: Refined channel-states, introduced `ChannelState` -- ALIGN
[demos/kafka/chat] / src / test / java / de / juplo / kafka / chat / backend / implementation / inmemory / SimpleChatHomeServiceTest.java
index fd5a83b..09369cb 100644 (file)
@@ -1,50 +1,13 @@
-package de.juplo.kafka.chat.backend.persistence.inmemory;
+package de.juplo.kafka.chat.backend.implementation.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.storage.files.FilesStorageStrategy;
-import org.springframework.boot.test.context.TestConfiguration;
-import org.springframework.context.annotation.Bean;
-
-import java.nio.file.Paths;
-import java.time.Clock;
+import org.springframework.test.context.TestPropertySource;
 
 
+@TestPropertySource(properties = {
+    "chat.backend.inmemory.sharding-strategy=none",
+    "chat.backend.inmemory.storage-strategy=files",
+    "chat.backend.inmemory.storage-directory=target/test-classes/data/files" })
 public class SimpleChatHomeServiceTest extends ChatHomeServiceTest
 {
-  @TestConfiguration
-  static class Configuration
-  {
-    @Bean
-    SimpleChatHomeService chatHome(
-        StorageStrategy storageStrategy,
-        Clock clock)
-    {
-      return new SimpleChatHomeService(
-          storageStrategy,
-          clock,
-          bufferSize());
-    }
-
-    @Bean
-    public FilesStorageStrategy storageStrategy(Clock clock)
-    {
-      return new FilesStorageStrategy(
-          Paths.get("target", "test-classes", "data", "files"),
-          chatRoomId -> 0,
-          new ObjectMapper());
-    }
-
-    @Bean
-    Clock clock()
-    {
-      return Clock.systemDefaultZone();
-    }
-
-    int bufferSize()
-    {
-      return 8;
-    }
-  }
 }