refactor: Renamed `ChatRoom` into `ChatRoomData` - Aligned Code
authorKai Moritz <kai@juplo.de>
Sun, 3 Sep 2023 17:54:46 +0000 (19:54 +0200)
committerKai Moritz <kai@juplo.de>
Sun, 3 Sep 2023 17:54:46 +0000 (19:54 +0200)
17 files changed:
src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendController.java
src/main/java/de/juplo/kafka/chat/backend/domain/ChatHome.java
src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoomData.java
src/main/java/de/juplo/kafka/chat/backend/persistence/StorageStrategy.java
src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/ShardedChatHome.java
src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/SimpleChatHome.java
src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatRoomChannel.java
src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHome.java
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/FilesStorageStrategy.java
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/ChatRoomTo.java
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/MongoDbStorageStrategy.java
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/nostorage/NoStorageStorageConfiguration.java
src/test/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerTest.java
src/test/java/de/juplo/kafka/chat/backend/domain/ChatHomeTest.java
src/test/java/de/juplo/kafka/chat/backend/domain/ChatHomeWithShardsTest.java
src/test/java/de/juplo/kafka/chat/backend/domain/ChatRoomDataTest.java
src/test/java/de/juplo/kafka/chat/backend/persistence/AbstractStorageStrategyIT.java

index f41f45f..a400119 100644 (file)
@@ -1,7 +1,7 @@
 package de.juplo.kafka.chat.backend.api;
 
 import de.juplo.kafka.chat.backend.domain.ChatHome;
-import de.juplo.kafka.chat.backend.domain.ChatRoom;
+import de.juplo.kafka.chat.backend.domain.ChatRoomData;
 import de.juplo.kafka.chat.backend.persistence.StorageStrategy;
 import lombok.RequiredArgsConstructor;
 import org.springframework.http.codec.ServerSentEvent;
@@ -69,7 +69,7 @@ public class ChatBackendController
   }
 
   private Mono<MessageTo> put(
-      ChatRoom chatroom,
+      ChatRoomData chatroom,
       String username,
       Long messageId,
       String text)
@@ -96,7 +96,7 @@ public class ChatBackendController
   }
 
   private Mono<MessageTo> get(
-      ChatRoom chatroom,
+      ChatRoomData chatroom,
       String username,
       Long messageId)
   {
@@ -114,7 +114,7 @@ public class ChatBackendController
         .flatMapMany(chatroom -> listen(chatroom));
   }
 
-  private Flux<ServerSentEvent<MessageTo>> listen(ChatRoom chatroom)
+  private Flux<ServerSentEvent<MessageTo>> listen(ChatRoomData chatroom)
   {
     return chatroom
         .listen()
index e4d92db..7b97d55 100644 (file)
@@ -10,7 +10,7 @@ public interface ChatHome
 {
   Mono<ChatRoomInfo> createChatRoom(UUID id, String name);
 
-  Mono<ChatRoom> getChatRoom(UUID id);
+  Mono<ChatRoomData> getChatRoom(UUID id);
 
-  Flux<ChatRoom> getChatRooms();
+  Flux<ChatRoomData> getChatRooms();
 }
index 873e58e..a5667c1 100644 (file)
@@ -13,7 +13,7 @@ import java.util.regex.Pattern;
 
 
 @Slf4j
-public class ChatRoom
+public class ChatRoomData
 {
   public final static Pattern VALID_USER = Pattern.compile("^[a-z0-9-]{2,}$");
 
@@ -23,7 +23,7 @@ public class ChatRoom
   private Sinks.Many<Message> sink;
 
 
-  public ChatRoom(
+  public ChatRoomData(
       Clock clock,
       ChatRoomService service,
       int bufferSize)
index bedd0aa..96d1eb7 100644 (file)
@@ -1,11 +1,11 @@
 package de.juplo.kafka.chat.backend.persistence;
 
-import de.juplo.kafka.chat.backend.domain.ChatRoom;
+import de.juplo.kafka.chat.backend.domain.ChatRoomData;
 import reactor.core.publisher.Flux;
 
 
 public interface StorageStrategy
 {
-  void write(Flux<ChatRoom> chatroomFlux);
-  Flux<ChatRoom> read();
+  void write(Flux<ChatRoomData> chatroomFlux);
+  Flux<ChatRoomData> read();
 }
index c6aff1e..653c64a 100644 (file)
@@ -48,7 +48,7 @@ public class ShardedChatHome implements ChatHome
   }
 
   @Override
-  public Mono<ChatRoom> getChatRoom(UUID id)
+  public Mono<ChatRoomData> getChatRoom(UUID id)
   {
     int shard = selectShard(id);
     return chatHomes[shard] == null
@@ -64,7 +64,7 @@ public class ShardedChatHome implements ChatHome
   }
 
   @Override
-  public Flux<ChatRoom> getChatRooms()
+  public Flux<ChatRoomData> getChatRooms()
   {
     return Flux
         .fromIterable(ownedShards)
index c2d25b2..9112fb9 100644 (file)
@@ -13,14 +13,14 @@ import java.util.*;
 public class SimpleChatHome implements ChatHome
 {
   private final Integer shard;
-  private final Map<UUID, ChatRoom> chatRooms;
+  private final Map<UUID, ChatRoomData> chatRooms;
   private final Clock clock;
   private final int bufferSize;
 
 
 
   public SimpleChatHome(
-      Flux<ChatRoom> chatroomFlux,
+      Flux<ChatRoomData> chatroomFlux,
       Clock clock,
       int bufferSize)
   {
@@ -29,7 +29,7 @@ public class SimpleChatHome implements ChatHome
 
   public SimpleChatHome(
       Integer shard,
-      Flux<ChatRoom> chatroomFlux,
+      Flux<ChatRoomData> chatroomFlux,
       Clock clock,
       int bufferSize)
   {
@@ -65,13 +65,13 @@ public class SimpleChatHome implements ChatHome
   {
     log.info("Creating ChatRoom with buffer-size {}", bufferSize);
     ChatRoomService service = new InMemoryChatRoomService(Flux.empty());
-    ChatRoom chatRoom = new ChatRoom(id, name, shard, clock, service, bufferSize);
-    chatRooms.put(id, chatRoom);
-    return Mono.just(chatRoom);
+    ChatRoomData chatRoomData = new ChatRoomData(id, name, shard, clock, service, bufferSize);
+    chatRooms.put(id, chatRoomData);
+    return Mono.just(chatRoomData);
   }
 
   @Override
-  public Mono<ChatRoom> getChatRoom(UUID id)
+  public Mono<ChatRoomData> getChatRoom(UUID id)
   {
     return Mono
         .justOrEmpty(chatRooms.get(id))
@@ -79,7 +79,7 @@ public class SimpleChatHome implements ChatHome
   }
 
   @Override
-  public Flux<ChatRoom> getChatRooms()
+  public Flux<ChatRoomData> getChatRooms()
   {
     return Flux.fromIterable(chatRooms.values());
   }
index 234554e..6ce85d1 100644 (file)
@@ -35,7 +35,7 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener
   private final boolean[] isShardOwned;
   private final long[] currentOffset;
   private final long[] nextOffset;
-  private final Map<UUID, ChatRoom>[] chatrooms;
+  private final Map<UUID, ChatRoomData>[] chatrooms;
 
   private boolean running;
   @Getter
@@ -281,14 +281,14 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener
   {
     log.info("Loading ChatRoom {} with buffer-size {}", chatRoomId, bufferSize);
     KafkaChatRoomService service = new KafkaChatRoomService(this, chatRoomId);
-    ChatRoom chatRoom = new ChatRoom(
+    ChatRoomData chatRoomData = new ChatRoomData(
         chatRoomId,
         createChatRoomRequestTo.getName(),
         partition,
         clock,
         service,
         bufferSize);
-    putChatRoom(chatRoom);
+    putChatRoom(chatRoomData);
   }
 
 
@@ -299,8 +299,8 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener
     int shard = chatRoomInfo.getShard();
     log.info("Creating ChatRoom {} with buffer-size {}", id, bufferSize);
     KafkaChatRoomService service = new KafkaChatRoomService(this, id);
-    ChatRoom chatRoom = new ChatRoom(id, name, shard, clock, service, bufferSize);
-    putChatRoom(chatRoom);
+    ChatRoomData chatRoomData = new ChatRoomData(id, name, shard, clock, service, bufferSize);
+    putChatRoom(chatRoomData);
   }
 
   private void loadChatMessage(
@@ -313,9 +313,9 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener
     Message.MessageKey key = Message.MessageKey.of(chatMessageTo.getUser(), chatMessageTo.getId());
     Message message = new Message(key, offset, timestamp, chatMessageTo.getText());
 
-    ChatRoom chatRoom = chatrooms[partition].get(chatRoomId);
+    ChatRoomData chatRoomData = chatrooms[partition].get(chatRoomId);
     KafkaChatRoomService kafkaChatRoomService =
-        (KafkaChatRoomService) chatRoom.getChatRoomService();
+        (KafkaChatRoomService) chatRoomData.getChatRoomService();
 
     kafkaChatRoomService.persistMessage(message);
   }
@@ -338,22 +338,22 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener
   }
 
 
-  private void putChatRoom(ChatRoom chatRoom)
+  private void putChatRoom(ChatRoomData chatRoomData)
   {
-    Integer partition = chatRoom.getShard();
-    UUID chatRoomId = chatRoom.getId();
+    Integer partition = chatRoomData.getShard();
+    UUID chatRoomId = chatRoomData.getId();
     if (chatrooms[partition].containsKey(chatRoomId))
     {
-      log.warn("Ignoring existing chat-room: " + chatRoom);
+      log.warn("Ignoring existing chat-room: " + chatRoomData);
     }
     else
     {
       log.info(
           "Adding new chat-room to partition {}: {}",
           partition,
-          chatRoom);
+          chatRoomData);
 
-      chatrooms[partition].put(chatRoomId, chatRoom);
+      chatrooms[partition].put(chatRoomId, chatRoomData);
     }
   }
 
@@ -365,7 +365,7 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener
         .toArray();
   }
 
-  Mono<ChatRoom> getChatRoom(int shard, UUID id)
+  Mono<ChatRoomData> getChatRoom(int shard, UUID id)
   {
     if (loadInProgress)
     {
@@ -380,7 +380,7 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener
     return Mono.justOrEmpty(chatrooms[shard].get(id));
   }
 
-  Flux<ChatRoom> getChatRooms()
+  Flux<ChatRoomData> getChatRooms()
   {
     return Flux
         .fromStream(IntStream.range(0, numShards).mapToObj(i -> Integer.valueOf(i)))
index 0622839..68cad73 100644 (file)
@@ -1,7 +1,7 @@
 package de.juplo.kafka.chat.backend.persistence.kafka;
 
 import de.juplo.kafka.chat.backend.domain.ChatHome;
-import de.juplo.kafka.chat.backend.domain.ChatRoom;
+import de.juplo.kafka.chat.backend.domain.ChatRoomData;
 import de.juplo.kafka.chat.backend.domain.ChatRoomInfo;
 import de.juplo.kafka.chat.backend.domain.UnknownChatroomException;
 import lombok.RequiredArgsConstructor;
@@ -30,7 +30,7 @@ public class KafkaChatHome implements ChatHome
   }
 
   @Override
-  public Mono<ChatRoom> getChatRoom(UUID id)
+  public Mono<ChatRoomData> getChatRoom(UUID id)
   {
     int shard = selectShard(id);
     return chatRoomChannel
@@ -48,7 +48,7 @@ public class KafkaChatHome implements ChatHome
   }
 
   @Override
-  public Flux<ChatRoom> getChatRooms()
+  public Flux<ChatRoomData> getChatRooms()
   {
       return chatRoomChannel.getChatRooms();
   }
index 025e3ae..fb6e344 100644 (file)
@@ -5,8 +5,8 @@ import com.fasterxml.jackson.databind.JavaType;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import de.juplo.kafka.chat.backend.api.ChatRoomInfoTo;
 import de.juplo.kafka.chat.backend.api.MessageTo;
+import de.juplo.kafka.chat.backend.domain.ChatRoomData;
 import de.juplo.kafka.chat.backend.persistence.inmemory.ShardingStrategy;
-import de.juplo.kafka.chat.backend.domain.ChatRoom;
 import de.juplo.kafka.chat.backend.domain.Message;
 import de.juplo.kafka.chat.backend.persistence.StorageStrategy;
 import lombok.RequiredArgsConstructor;
@@ -39,7 +39,7 @@ public class FilesStorageStrategy implements StorageStrategy
 
 
   @Override
-  public void write(Flux<ChatRoom> chatroomFlux)
+  public void write(Flux<ChatRoomData> chatroomFlux)
   {
     Path path = chatroomsPath();
     log.info("Writing chatrooms to {}", path);
@@ -99,7 +99,7 @@ public class FilesStorageStrategy implements StorageStrategy
   }
 
   @Override
-  public Flux<ChatRoom> read()
+  public Flux<ChatRoomData> read()
   {
     JavaType type = mapper.getTypeFactory().constructType(ChatRoomInfoTo.class);
     return Flux
@@ -109,7 +109,7 @@ public class FilesStorageStrategy implements StorageStrategy
         {
           UUID chatRoomId = infoTo.getId();
           int shard = shardingStrategy.selectShard(chatRoomId);
-          return new ChatRoom(
+          return new ChatRoomData(
               infoTo.getId(),
               infoTo.getName(),
               shard,
index 1ad8d17..6b5ea87 100644 (file)
@@ -1,6 +1,6 @@
 package de.juplo.kafka.chat.backend.persistence.storage.mongodb;
 
-import de.juplo.kafka.chat.backend.domain.ChatRoom;
+import de.juplo.kafka.chat.backend.domain.ChatRoomData;
 import lombok.*;
 import org.springframework.data.annotation.Id;
 import org.springframework.data.mongodb.core.mapping.Document;
@@ -22,7 +22,9 @@ public class ChatRoomTo
   private String name;
   private List<MessageTo> messages;
 
-  public static ChatRoomTo from(ChatRoom chatroom)
+  public static ChatRoomTo from(
+      ChatRoomInfo chatRoomInfo,
+      ChatRoomData chatroom)
   {
     return new ChatRoomTo(
         chatroom.getId().toString(),
index d3a18bc..b9c7fb2 100644 (file)
@@ -1,7 +1,7 @@
 package de.juplo.kafka.chat.backend.persistence.storage.mongodb;
 
+import de.juplo.kafka.chat.backend.domain.ChatRoomData;
 import de.juplo.kafka.chat.backend.persistence.inmemory.ShardingStrategy;
-import de.juplo.kafka.chat.backend.domain.ChatRoom;
 import de.juplo.kafka.chat.backend.persistence.StorageStrategy;
 import de.juplo.kafka.chat.backend.persistence.storage.files.ChatRoomServiceFactory;
 import lombok.RequiredArgsConstructor;
@@ -24,7 +24,7 @@ public class MongoDbStorageStrategy implements StorageStrategy
 
 
   @Override
-  public void write(Flux<ChatRoom> chatroomFlux)
+  public void write(Flux<ChatRoomData> chatroomFlux)
   {
     chatroomFlux
         .map(ChatRoomTo::from)
@@ -32,7 +32,7 @@ public class MongoDbStorageStrategy implements StorageStrategy
   }
 
   @Override
-  public Flux<ChatRoom> read()
+  public Flux<ChatRoomData> read()
   {
     return Flux
         .fromIterable(repository.findAll())
@@ -40,7 +40,7 @@ public class MongoDbStorageStrategy implements StorageStrategy
         {
           UUID chatRoomId = UUID.fromString(chatRoomTo.getId());
           int shard = shardingStrategy.selectShard(chatRoomId);
-          return new ChatRoom(
+          return new ChatRoomData(
               chatRoomId,
               chatRoomTo.getName(),
               shard,
index ffed299..dd2223c 100644 (file)
@@ -1,6 +1,6 @@
 package de.juplo.kafka.chat.backend.persistence.storage.nostorage;
 
-import de.juplo.kafka.chat.backend.domain.ChatRoom;
+import de.juplo.kafka.chat.backend.domain.ChatRoomData;
 import de.juplo.kafka.chat.backend.persistence.StorageStrategy;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -29,10 +29,10 @@ public class NoStorageStorageConfiguration
     return new StorageStrategy()
     {
       @Override
-      public void write(Flux<ChatRoom> chatroomFlux) {}
+      public void write(Flux<ChatRoomData> chatroomFlux) {}
 
       @Override
-      public Flux<ChatRoom> read()
+      public Flux<ChatRoomData> read()
       {
         return Flux.empty();
       }
index 9b8b09f..63ab7d6 100644 (file)
@@ -170,13 +170,13 @@ public class ChatBackendControllerTest
     LocalDateTime timeExistingMessage = LocalDateTime.parse(timeExistingMessageAsString);
     String textExistingMessage = "Existing";
     String textMutatedMessage = "Mutated!";
-    ChatRoom chatRoom = new ChatRoom(
+    ChatRoomData chatRoomData = new ChatRoomData(
         chatroomId,
         "Test-ChatRoom",
         0,
         Clock.systemDefaultZone(),
         chatRoomService, 8);
-    when(chatHome.getChatRoom(eq(chatroomId))).thenReturn(Mono.just(chatRoom));
+    when(chatHome.getChatRoom(eq(chatroomId))).thenReturn(Mono.just(chatRoomData));
     Message existingMessage = new Message(
         key,
         serialNumberExistingMessage,
@@ -222,14 +222,14 @@ public class ChatBackendControllerTest
     Long messageId = 66l;
     Message.MessageKey key = Message.MessageKey.of(user, messageId);
     String textMessage = "Hallo Welt";
-    ChatRoom chatRoom = new ChatRoom(
+    ChatRoomData chatRoomData = new ChatRoomData(
         chatroomId,
         "Test-ChatRoom",
         0,
         Clock.systemDefaultZone(),
         chatRoomService, 8);
     when(chatHome.getChatRoom(any(UUID.class)))
-        .thenReturn(Mono.just(chatRoom));
+        .thenReturn(Mono.just(chatRoomData));
     when(chatRoomService.getMessage(any(Message.MessageKey.class)))
         .thenReturn(Mono.empty());
     // Needed for readable error-reports, in case of a bug that leads to according unwanted call
index 2a995ef..ad7fe95 100644 (file)
@@ -29,7 +29,7 @@ public abstract class ChatHomeTest
     UUID chatRoomId = UUID.fromString("5c73531c-6fc4-426c-adcb-afc5c140a0f7");
 
     // When
-    Mono<ChatRoom> mono = Mono
+    Mono<ChatRoomData> mono = Mono
         .defer(() -> chatHome.getChatRoom(chatRoomId))
         .log("testGetExistingChatroom")
         .retryWhen(Retry
@@ -48,7 +48,7 @@ public abstract class ChatHomeTest
     UUID chatRoomId = UUID.fromString("7f59ec77-832e-4a17-8d22-55ef46242c17");
 
     // When
-    Mono<ChatRoom> mono = Mono
+    Mono<ChatRoomData> mono = Mono
         .defer(() -> chatHome.getChatRoom(chatRoomId))
         .log("testGetNonExistentChatroom")
         .retryWhen(Retry
index eebeea1..6775456 100644 (file)
@@ -26,7 +26,7 @@ public abstract class ChatHomeWithShardsTest extends ChatHomeTest
     UUID chatRoomId = UUID.fromString("4e7246a6-29ae-43ea-b56f-669c3481ac19");
 
     // When
-    Mono<ChatRoom> mono = Mono
+    Mono<ChatRoomData> mono = Mono
         .defer(() -> chatHome.getChatRoom(chatRoomId))
         .log("testGetChatroomForNotOwnedShard")
         .retryWhen(Retry
index 822ffe7..171a9da 100644 (file)
@@ -14,7 +14,7 @@ import static org.mockito.Mockito.*;
 import static pl.rzrz.assertj.reactor.Assertions.assertThat;
 
 
-public class ChatRoomTest
+public class ChatRoomDataTest
 {
   @Test
   @DisplayName("Assert, that Mono emits expected message, if it exists")
@@ -24,7 +24,7 @@ public class ChatRoomTest
     String user = "foo";
     Long messageId = 1l;
     ChatRoomService chatRoomService = mock(ChatRoomService.class);
-    ChatRoom chatRoom = new ChatRoom(
+    ChatRoomData chatRoomData = new ChatRoomData(
         UUID.randomUUID(),
         "Foo",
         0,
@@ -37,7 +37,7 @@ public class ChatRoomTest
     when(chatRoomService.getMessage(any(Message.MessageKey.class))).thenReturn(Mono.just(message));
 
     // When
-    Mono<Message> mono = chatRoom.getMessage(user, messageId);
+    Mono<Message> mono = chatRoomData.getMessage(user, messageId);
 
     // Then
     assertThat(mono).emitsExactly(message);
@@ -51,7 +51,7 @@ public class ChatRoomTest
     String user = "foo";
     Long messageId = 1l;
     ChatRoomService chatRoomService = mock(ChatRoomService.class);
-    ChatRoom chatRoom = new ChatRoom(
+    ChatRoomData chatRoomData = new ChatRoomData(
         UUID.randomUUID(),
         "Foo",
         0,
@@ -61,7 +61,7 @@ public class ChatRoomTest
     when(chatRoomService.getMessage(any(Message.MessageKey.class))).thenReturn(Mono.empty());
 
     // When
-    Mono<Message> mono = chatRoom.getMessage(user, messageId);
+    Mono<Message> mono = chatRoomData.getMessage(user, messageId);
 
     // Then
     assertThat(mono).emitsCount(0);
@@ -75,7 +75,7 @@ public class ChatRoomTest
     String user = "foo";
     Long messageId = 1l;
     ChatRoomService chatRoomService = mock(ChatRoomService.class);
-    ChatRoom chatRoom = new ChatRoom(
+    ChatRoomData chatRoomData = new ChatRoomData(
         UUID.randomUUID(),
         "Foo",
         0,
@@ -91,7 +91,7 @@ public class ChatRoomTest
     when(chatRoomService.persistMessage(any(Message.MessageKey.class), any(LocalDateTime.class), any(String.class))).thenReturn(Mono.just(message));
 
     // When
-    Mono<Message> mono = chatRoom.addMessage(messageId, user, messageText);
+    Mono<Message> mono = chatRoomData.addMessage(messageId, user, messageText);
 
     // Then
     assertThat(mono).emitsExactly(message);
@@ -105,7 +105,7 @@ public class ChatRoomTest
     String user = "foo";
     Long messageId = 1l;
     ChatRoomService chatRoomService = mock(ChatRoomService.class);
-    ChatRoom chatRoom = new ChatRoom(
+    ChatRoomData chatRoomData = new ChatRoomData(
         UUID.randomUUID(),
         "Foo",
         0,
@@ -121,7 +121,7 @@ public class ChatRoomTest
     when(chatRoomService.persistMessage(any(Message.MessageKey.class), any(LocalDateTime.class), any(String.class))).thenReturn(Mono.just(message));
 
     // When
-    Mono<Message> mono = chatRoom.addMessage(messageId, user, messageText);
+    Mono<Message> mono = chatRoomData.addMessage(messageId, user, messageText);
 
     // Then
     assertThat(mono).emitsExactly(message);
@@ -135,7 +135,7 @@ public class ChatRoomTest
     String user = "foo";
     Long messageId = 1l;
     ChatRoomService chatRoomService = mock(ChatRoomService.class);
-    ChatRoom chatRoom = new ChatRoom(
+    ChatRoomData chatRoomData = new ChatRoomData(
         UUID.randomUUID(),
         "Foo",
         0,
@@ -152,7 +152,7 @@ public class ChatRoomTest
     when(chatRoomService.persistMessage(any(Message.MessageKey.class), any(LocalDateTime.class), any(String.class))).thenReturn(Mono.just(message));
 
     // When
-    Mono<Message> mono = chatRoom.addMessage(messageId, user, mutatedText);
+    Mono<Message> mono = chatRoomData.addMessage(messageId, user, mutatedText);
 
     // Then
     assertThat(mono).sendsError();
index 2a42a12..7de5862 100644 (file)
@@ -40,7 +40,7 @@ public abstract class AbstractStorageStrategyIT
     UUID chatRoomId = UUID.fromString("5c73531c-6fc4-426c-adcb-afc5c140a0f7");
     ChatRoomInfo info = chathome.createChatRoom(chatRoomId, "FOO").block();
     log.debug("Created chat-room {}", info);
-    ChatRoom chatroom = chathome.getChatRoom(chatRoomId).block();
+    ChatRoomData chatroom = chathome.getChatRoom(chatRoomId).block();
     Message m1 = chatroom.addMessage(1l,"peter", "Hallo, ich heiße Peter!").block();
     Message m2 = chatroom.addMessage(1l, "ute", "Ich bin Ute...").block();
     Message m3 = chatroom.addMessage(2l, "peter", "Willst du mit mir gehen?").block();
@@ -72,7 +72,7 @@ public abstract class AbstractStorageStrategyIT
     UUID chatRoomAId = UUID.fromString("5c73531c-6fc4-426c-adcb-afc5c140a0f7");
     ChatRoomInfo infoA = chathome.createChatRoom(chatRoomAId, "FOO").block();
     log.debug("Created chat-room {}", infoA);
-    ChatRoom chatroomA = chathome.getChatRoom(chatRoomAId).block();
+    ChatRoomData chatroomA = chathome.getChatRoom(chatRoomAId).block();
     Message ma1 = chatroomA.addMessage(1l,"peter", "Hallo, ich heiße Peter!").block();
     Message ma2 = chatroomA.addMessage(1l, "ute", "Ich bin Ute...").block();
     Message ma3 = chatroomA.addMessage(2l, "peter", "Willst du mit mir gehen?").block();
@@ -81,7 +81,7 @@ public abstract class AbstractStorageStrategyIT
     UUID chatRoomBId = UUID.fromString("8763dfdc-4dda-4a74-bea4-4b389177abea");
     ChatRoomInfo infoB = chathome.createChatRoom(chatRoomBId, "BAR").block();
     log.debug("Created chat-room {}", infoB);
-    ChatRoom chatroomB = chathome.getChatRoom(chatRoomBId).block();
+    ChatRoomData chatroomB = chathome.getChatRoom(chatRoomBId).block();
     Message mb1 = chatroomB.addMessage(1l,"peter", "Hallo, ich heiße Uwe!").block();
     Message mb2 = chatroomB.addMessage(1l, "ute", "Ich bin Ute...").block();
     Message mb3 = chatroomB.addMessage(1l, "klaus", "Willst du mit mir gehen?").block();