From 2bdf91262eb333d1c260600af0f2d348944a365c Mon Sep 17 00:00:00 2001 From: TungTV Date: Thu, 7 Nov 2024 10:15:07 +0700 Subject: [PATCH] Migrate James - Re-guice binding SearchSnippetGetMethod, Lucene search module --- .../tmail/james/app/DistributedServer.java | 12 +---- .../tmail/james/app/MemoryServer.java | 3 +- ...DistributedSearchSnippetGetMethodTest.java | 45 ------------------- 3 files changed, 2 insertions(+), 58 deletions(-) delete mode 100644 tmail-backend/integration-tests/jmap/distributed-jmap-integration-tests/src/test/java/com/linagora/tmail/james/DistributedSearchSnippetGetMethodTest.java diff --git a/tmail-backend/apps/distributed/src/main/java/com/linagora/tmail/james/app/DistributedServer.java b/tmail-backend/apps/distributed/src/main/java/com/linagora/tmail/james/app/DistributedServer.java index fcbe320125..35931d35ba 100644 --- a/tmail-backend/apps/distributed/src/main/java/com/linagora/tmail/james/app/DistributedServer.java +++ b/tmail-backend/apps/distributed/src/main/java/com/linagora/tmail/james/app/DistributedServer.java @@ -22,8 +22,6 @@ import org.apache.james.eventsourcing.eventstore.EventNestedTypes; import org.apache.james.jmap.InjectionKeys; import org.apache.james.jmap.JMAPListenerModule; -import org.apache.james.jmap.method.Method; -import org.apache.james.jmap.method.SearchSnippetGetMethod; import org.apache.james.json.DTO; import org.apache.james.json.DTOModule; import org.apache.james.mailbox.MailboxManager; @@ -205,13 +203,6 @@ protected void configure() { } } - public static final Module JMAP_DISTRIBUTED_METHOD_SUPPORTED_MODULE = new AbstractModule() { - @Override - protected void configure() { - Multibinder.newSetBinder(binder(), Method.class).addBinding().to(SearchSnippetGetMethod.class); - } - }; - public static final Module WEBADMIN = Modules.combine( new CassandraRoutesModule(), new DataRoutesModules(), @@ -262,8 +253,7 @@ protected void configure() { new WebFingerModule(), new LabelMethodModule(), new JmapSettingsMethodModule(), - new ContactSupportCapabilitiesModule(), - JMAP_DISTRIBUTED_METHOD_SUPPORTED_MODULE) + new ContactSupportCapabilitiesModule()) .with(new CassandraTicketStoreModule(), new TeamMailboxJmapModule()); public static final Module PROTOCOLS = Modules.combine( diff --git a/tmail-backend/apps/memory/src/main/java/com/linagora/tmail/james/app/MemoryServer.java b/tmail-backend/apps/memory/src/main/java/com/linagora/tmail/james/app/MemoryServer.java index b75edcb7d6..b395eb4b42 100644 --- a/tmail-backend/apps/memory/src/main/java/com/linagora/tmail/james/app/MemoryServer.java +++ b/tmail-backend/apps/memory/src/main/java/com/linagora/tmail/james/app/MemoryServer.java @@ -9,7 +9,6 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.configuration2.ex.ConfigurationException; import org.apache.james.ExtraProperties; -import org.apache.james.FakeSearchMailboxModule; import org.apache.james.GuiceJamesServer; import org.apache.james.JamesServerMain; import org.apache.james.data.UsersRepositoryModuleChooser; @@ -172,7 +171,7 @@ public static void main(String[] args) throws Exception { LOGGER.info("Loading configuration {}", configuration.toString()); GuiceJamesServer server = createServer(configuration) - .combineWith(new FakeSearchMailboxModule(), new JMXServerModule()); + .combineWith(new JMXServerModule()); JamesServerMain.main(server); } diff --git a/tmail-backend/integration-tests/jmap/distributed-jmap-integration-tests/src/test/java/com/linagora/tmail/james/DistributedSearchSnippetGetMethodTest.java b/tmail-backend/integration-tests/jmap/distributed-jmap-integration-tests/src/test/java/com/linagora/tmail/james/DistributedSearchSnippetGetMethodTest.java deleted file mode 100644 index c00646cce9..0000000000 --- a/tmail-backend/integration-tests/jmap/distributed-jmap-integration-tests/src/test/java/com/linagora/tmail/james/DistributedSearchSnippetGetMethodTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.linagora.tmail.james; - -import org.apache.james.JamesServerBuilder; -import org.apache.james.JamesServerExtension; -import org.apache.james.backends.redis.RedisExtension; -import org.apache.james.jmap.rfc8621.contract.SearchSnippetGetMethodContract; -import org.apache.james.jmap.rfc8621.contract.probe.DelegationProbeModule; -import org.apache.james.modules.AwsS3BlobStoreExtension; -import org.junit.jupiter.api.extension.RegisterExtension; - -import com.linagora.tmail.blob.guice.BlobStoreConfiguration; -import com.linagora.tmail.james.app.CassandraExtension; -import com.linagora.tmail.james.app.DistributedJamesConfiguration; -import com.linagora.tmail.james.app.DistributedServer; -import com.linagora.tmail.james.app.DockerOpenSearchExtension; -import com.linagora.tmail.james.app.EventBusKeysChoice; -import com.linagora.tmail.james.app.RabbitMQExtension; -import com.linagora.tmail.james.jmap.firebase.FirebaseModuleChooserConfiguration; -import com.linagora.tmail.module.LinagoraTestJMAPServerModule; - -public class DistributedSearchSnippetGetMethodTest implements SearchSnippetGetMethodContract { - @RegisterExtension - static JamesServerExtension testExtension = new JamesServerBuilder(tmpDir -> - DistributedJamesConfiguration.builder() - .workingDirectory(tmpDir) - .configurationFromClasspath() - .blobStore(BlobStoreConfiguration.builder() - .disableCache() - .deduplication() - .noCryptoConfig() - .disableSingleSave() - .noSecondaryS3BlobStore()) - .eventBusKeysChoice(EventBusKeysChoice.REDIS) - .firebaseModuleChooserConfiguration(FirebaseModuleChooserConfiguration.DISABLED) - .build()) - .extension(new DockerOpenSearchExtension()) - .extension(new CassandraExtension()) - .extension(new RabbitMQExtension()) - .extension(new RedisExtension()) - .extension(new AwsS3BlobStoreExtension()) - .server(configuration -> DistributedServer.createServer(configuration) - .overrideWith(new LinagoraTestJMAPServerModule()) - .overrideWith(new DelegationProbeModule())) - .build(); -}