Skip to content
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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

HoussemNasri
Copy link
Member

Closes #1545

- 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
Comment on lines +102 to +106
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>tmail-openpaas</artifactId>
<scope>test</scope>
</dependency>
Copy link
Member

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
Copy link
Member

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.

Comment on lines +130 to +163
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);
}
};
}
Copy link
Member

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"?>
Copy link
Member

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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rationals for this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restructure relevant JMAP tests to cover CalDavEventAttendanceRepository
2 participants