package de.juplo.kafka.chat.backend;
-import de.juplo.kafka.chat.backend.domain.ChatHomeService;
-import de.juplo.kafka.chat.backend.persistence.inmemory.SimpleChatHomeService;
-import lombok.RequiredArgsConstructor;
+import de.juplo.kafka.chat.backend.implementation.inmemory.InMemoryTestUtils;
+import de.juplo.kafka.chat.backend.implementation.inmemory.SimpleChatHomeService;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
-import java.time.Clock;
-
-@RequiredArgsConstructor
+@ContextConfiguration(classes = InMemoryTestUtils.class)
@Slf4j
public abstract class AbstractInMemoryStorageIT extends AbstractStorageStrategyIT
{
- final Clock clock;
+ @Autowired
+ InMemoryTestUtils testUtils;
+ @Autowired
+ SimpleChatHomeService simpleChatHomeService;
@Override
- protected StorageStrategyITConfig getConfig()
+ void restore()
{
- return new StorageStrategyITConfig()
- {
- int bufferSize = 8;
-
- SimpleChatHomeService simpleChatHome = new SimpleChatHomeService(
- getStorageStrategy(),
- clock,
- bufferSize);
-
- @Override
- public ChatHomeService getChatHome()
- {
- return simpleChatHome;
- }
- };
+ testUtils.restore(simpleChatHomeService).block();
}
}