From 9d65a1cf82374db8da172b4f495b669786311568 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 10 Jan 2023 20:57:44 +0100 Subject: [PATCH] WIP --- pom.xml | 1 + .../chat/backend/persistence/storage/mongodb/ChatRoomTo.java | 2 ++ .../chat/backend/persistence/storage/mongodb/MessageTo.java | 2 ++ .../persistence/InMemoryWithMongoDbStorageStrategyIT.java | 4 ---- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 7b32556f..27a6236f 100644 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,7 @@ 17 1.0.8 + 4.7.2 diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/ChatRoomTo.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/ChatRoomTo.java index f4f3ac65..bc3863b3 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/ChatRoomTo.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/ChatRoomTo.java @@ -4,6 +4,7 @@ import de.juplo.kafka.chat.backend.domain.ChatRoom; import lombok.*; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.DBRef; +import org.springframework.data.mongodb.core.mapping.Document; import java.util.List; @@ -14,6 +15,7 @@ import java.util.List; @Setter(AccessLevel.PACKAGE) @EqualsAndHashCode(of = { "id" }) @ToString(of = { "id", "name" }) +@Document public class ChatRoomTo { @Id diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/MessageTo.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/MessageTo.java index 8e37166e..7a45799b 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/MessageTo.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/MessageTo.java @@ -2,6 +2,7 @@ package de.juplo.kafka.chat.backend.persistence.storage.mongodb; import de.juplo.kafka.chat.backend.domain.Message; import lombok.*; +import org.springframework.data.mongodb.core.mapping.Document; import java.time.LocalDateTime; import java.util.regex.Matcher; @@ -14,6 +15,7 @@ import java.util.regex.Pattern; @Setter(AccessLevel.PACKAGE) @EqualsAndHashCode(of = { "user", "id" }) @ToString(of = { "user", "id" }) +@Document class MessageTo { final static Pattern SPLIT_ID = Pattern.compile("^([a-z-]+)--([0-9]+)$"); diff --git a/src/test/java/de/juplo/kafka/chat/backend/persistence/InMemoryWithMongoDbStorageStrategyIT.java b/src/test/java/de/juplo/kafka/chat/backend/persistence/InMemoryWithMongoDbStorageStrategyIT.java index 66f06d42..d3d0c56b 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/persistence/InMemoryWithMongoDbStorageStrategyIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/persistence/InMemoryWithMongoDbStorageStrategyIT.java @@ -81,8 +81,6 @@ public class InMemoryWithMongoDbStorageStrategyIT extends AbstractStorageStrateg @Container private static final GenericContainer CONTAINER = new GenericContainer("mongo:6") - .withEnv("MONGO_INITDB_ROOT_USERNAME", "mongo") - .withEnv("MONGO_INITDB_ROOT_PASSWORD", "mongo") .withEnv("MONGO_INITDB_DATABASE", "test") .withExposedPorts(MONGODB_PORT); @@ -96,8 +94,6 @@ public class InMemoryWithMongoDbStorageStrategyIT extends AbstractStorageStrateg applicationContext, "spring.data.mongodb.host=localhost", "spring.data.mongodb.port=" + CONTAINER.getMappedPort(MONGODB_PORT), - "spring.data.mongodb.username=mongo", - "spring.data.mongodb.password=mongo", "spring.data.mongodb.database=test"); Slf4jLogConsumer logConsumer = new Slf4jLogConsumer(log); -- 2.20.1