From bc09c95cbde22a3fece63aba778802842e815656 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 23 Feb 2024 11:39:26 +0100 Subject: [PATCH] TMP --- .../MongoDbStorageNotActiveConfiguration.java | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 src/test/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageNotActiveConfiguration.java diff --git a/src/test/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageNotActiveConfiguration.java b/src/test/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageNotActiveConfiguration.java new file mode 100644 index 00000000..b3d69edb --- /dev/null +++ b/src/test/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageNotActiveConfiguration.java @@ -0,0 +1,148 @@ +package de.juplo.kafka.chat.backend.storage.mongodb; + +import com.mongodb.ClientSessionOptions; +import com.mongodb.connection.ClusterDescription; +import com.mongodb.reactivestreams.client.*; +import de.juplo.kafka.chat.backend.ChatBackendProperties; +import de.juplo.kafka.chat.backend.implementation.StorageStrategy; +import org.bson.Document; +import org.bson.conversions.Bson; +import org.reactivestreams.Publisher; +import org.springframework.boot.autoconfigure.AutoConfigureBefore; +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.List; + + +@AutoConfigureBefore(MongoReactiveAutoConfiguration.class) +@ConditionalOnExpression("#{${chat.backend.inmemory.storage-strategy} != 'mongodb'}") +@Configuration +public class MongoDbStorageNotActiveConfiguration +{ + @Bean + public MongoClient dummyClient() + { + return new MongoClient() { + @Override + public MongoDatabase getDatabase(String s) + { + return null; + } + + @Override + public void close() + { + + } + + @Override + public Publisher listDatabaseNames() + { + return null; + } + + @Override + public Publisher listDatabaseNames(ClientSession clientSession) + { + return null; + } + + @Override + public ListDatabasesPublisher listDatabases() + { + return null; + } + + @Override + public ListDatabasesPublisher listDatabases(Class aClass) + { + return null; + } + + @Override + public ListDatabasesPublisher listDatabases(ClientSession clientSession) + { + return null; + } + + @Override + public ListDatabasesPublisher listDatabases(ClientSession clientSession, Class aClass) + { + return null; + } + + @Override + public ChangeStreamPublisher watch() + { + return null; + } + + @Override + public ChangeStreamPublisher watch(Class aClass) + { + return null; + } + + @Override + public ChangeStreamPublisher watch(List list) + { + return null; + } + + @Override + public ChangeStreamPublisher watch(List list, Class aClass) + { + return null; + } + + @Override + public ChangeStreamPublisher watch(ClientSession clientSession) + { + return null; + } + + @Override + public ChangeStreamPublisher watch(ClientSession clientSession, Class aClass) + { + return null; + } + + @Override + public ChangeStreamPublisher watch(ClientSession clientSession, List list) + { + return null; + } + + @Override + public ChangeStreamPublisher watch( + ClientSession clientSession, + List list, + Class aClass) + { + return null; + } + + @Override + public Publisher startSession() + { + return null; + } + + @Override + public Publisher startSession(ClientSessionOptions clientSessionOptions) + { + return null; + } + + @Override + public ClusterDescription getClusterDescription() + { + return null; + } + }; + } +} -- 2.20.1