quantranhong1999 commented on code in PR #2561: URL: https://github.com/apache/james-project/pull/2561#discussion_r1886127968
########## server/container/guice/protocols/jmap/src/test/java/org/apache/james/modules/TestJMAPServerModule.java: ########## @@ -19,23 +19,51 @@ package org.apache.james.modules; +import static org.apache.james.jmap.core.JmapRfc8621Configuration.LOCALHOST_CONFIGURATION; + import java.io.FileNotFoundException; +import java.util.Map; import java.util.Optional; import jakarta.inject.Named; import jakarta.inject.Singleton; +import org.apache.commons.configuration2.Configuration; import org.apache.commons.configuration2.ex.ConfigurationException; import org.apache.james.jmap.JMAPConfiguration; +import org.apache.james.jmap.core.JmapRfc8621Configuration; import org.apache.james.jwt.JwtConfiguration; import org.apache.james.jwt.JwtTokenVerifier; import org.apache.james.modules.mailbox.FastRetryBackoffModule; +import org.apache.james.utils.PropertiesProvider; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; import com.google.inject.AbstractModule; import com.google.inject.Provides; public class TestJMAPServerModule extends AbstractModule { + static class JmapRfc8621ConfigurationOverrideModule extends AbstractModule { + private final Map<String, Object> overrideJmapProperties; + + JmapRfc8621ConfigurationOverrideModule(Map<String, Object> overrideJmapProperties) { + this.overrideJmapProperties = overrideJmapProperties; + } + + @Provides + @Singleton + JmapRfc8621Configuration provideConfiguration(PropertiesProvider propertiesProvider) throws ConfigurationException { + try { + Configuration configuration = propertiesProvider.getConfiguration("jmap"); + overrideJmapProperties.forEach(configuration::setProperty); + return JmapRfc8621Configuration.from(configuration); Review Comment: Cool trick to override the test resources configuration :D -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org