- @TestConfiguration
- static class Configuration
- {
- @Bean
- SimpleChatHomeService chatHome(
- StorageStrategy storageStrategy,
- Clock clock)
- {
- return new SimpleChatHomeService(
- storageStrategy,
- clock,
- bufferSize());
- }
-
- @Bean
- FilesStorageStrategy storageStrategy(
- Clock clock,
- ObjectMapper objectMapper)
- {
- return new FilesStorageStrategy(
- Paths.get("target", "test-classes", "data", "files"),
- chatRoomId -> 0,
- objectMapper,
- Level.FINE,
- true);
- }
-
- @Bean
- ObjectMapper objectMapper()
- {
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.registerModule(new JavaTimeModule());
- return objectMapper;
- }
-
- @Bean
- Clock clock()
- {
- return Clock.systemDefaultZone();
- }
-
- int bufferSize()
- {
- return 8;
- }
- }