Skip to content

Commit

Permalink
Fixup LinagoraTestJMAPServerModule - should respect jmap configuratio…
Browse files Browse the repository at this point in the history
…n file when present
  • Loading branch information
vttranlina authored and Arsnael committed Nov 4, 2024
1 parent ee920bc commit 5c71c97
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package com.linagora.tmail.module;

import java.io.FileNotFoundException;

import jakarta.inject.Singleton;

import org.apache.commons.configuration2.Configuration;
import org.apache.commons.configuration2.PropertiesConfiguration;
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.james.modules.TestJMAPServerModule;
import org.apache.james.utils.PropertiesProvider;

import com.google.inject.Provides;
import com.google.inject.name.Named;
Expand All @@ -13,10 +17,15 @@ public class LinagoraTestJMAPServerModule extends TestJMAPServerModule {
@Provides
@Singleton
@Named("jmap")
Configuration provideConfiguration() {
Configuration configuration = new PropertiesConfiguration();
configuration.addProperty("calendarEvent.reply.mailTemplateLocation", "classpath://eml/");
configuration.addProperty("url.prefix", "http://localhost:8000");
return configuration;
Configuration provideConfiguration(PropertiesProvider propertiesProvider) throws ConfigurationException {
try {
return propertiesProvider.getConfiguration("jmap");
} catch (FileNotFoundException e) {
// return a default configuration for the test
Configuration configuration = new PropertiesConfiguration();
configuration.addProperty("calendarEvent.reply.mailTemplateLocation", "classpath://eml/");
configuration.addProperty("url.prefix", "http://localhost:8000");
return configuration;
}
}
}

0 comments on commit 5c71c97

Please sign in to comment.