-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restructure relevant JMAP calendar tests to cover CalDavEventAttendanceRepository #1554
base: master
Are you sure you want to change the base?
Restructure relevant JMAP calendar tests to cover CalDavEventAttendanceRepository #1554
Conversation
…a dockerized openpaas setup successfully
- It would ping the servers occasionally resulting in verbose logs, making it hard to know which logs are triggered by tests and which were triggered by healthcheck
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>tmail-openpaas</artifactId> | ||
<scope>test</scope> | ||
</dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a normal world this dependency is not needed
import com.linagora.tmail.module.LinagoraTestJMAPServerModule; | ||
|
||
|
||
public class DavMemoryLinagoraCalendarEventAcceptMethodTest implements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entire point of a module chooser is to easily turn on/off modules without the kind of ceremony in this class.
private static Module provideDavConfiguration() { | ||
return new AbstractModule() { | ||
@Provides | ||
@Singleton | ||
public DavConfiguration provideDavConfiguration() { | ||
return new DavConfiguration( | ||
new UsernamePasswordCredentials("admin", "secret123"), | ||
Throwing.supplier(() -> URI.create("http://%s:80".formatted(dockerOpenPaasExtension.getDavServerIpAddress()))).sneakyThrow().get(), | ||
Optional.empty(), | ||
Optional.empty()); | ||
} | ||
}; | ||
} | ||
|
||
private static Module provideEventAttendanceRepository() { | ||
return new AbstractModule() { | ||
@Provides | ||
public EventAttendanceRepository provideCalDavEventAttendanceRepository(DavClient davClient, | ||
SessionProvider sessionProvider, MessageId.Factory messageIdFactory, | ||
MessageIdManager messageIdManager, | ||
DavUserProvider davUserProvider) { | ||
return new CalDavEventAttendanceRepository(davClient, sessionProvider, messageIdFactory, messageIdManager, davUserProvider); | ||
} | ||
}; | ||
} | ||
|
||
private static Module provideDavUserProvider() { | ||
return new AbstractModule() { | ||
@Provides | ||
public DavUserProvider provideDavUserProvider(OpenPaasRestClient openPaasClient) { | ||
return new OpenPaasDavUserProvider(openPaasClient); | ||
} | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have proper guice modules defined, and use a module chooser
@@ -0,0 +1,179 @@ | |||
<?xml version="1.0"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need a custom mailet container when OpenPaaS?
Is it really needed?
return calendarData.getValue() | ||
.lines() | ||
.map(String::trim) | ||
.filter(Predicate.not(String::isBlank)) | ||
.collect(Collectors.joining("\n")); | ||
return calendarData.getValue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rationals for this change?
Closes #1545