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;
Clock clock,
ObjectMapper mapper)
{
- return new FileStorageStrategy(
+ return new FilesStorageStrategy(
Paths.get(properties.getStorageDirectory()),
clock,
properties.getChatroomBufferSize(),
-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;
@RequiredArgsConstructor
@Slf4j
-public class FileStorageStrategy implements StorageStrategy
+public class FilesStorageStrategy implements StorageStrategy
{
public static final String CHATROOMS_FILENAME = "chatrooms.json";
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;
@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,