-
Notifications
You must be signed in to change notification settings - Fork 22
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
Create a separate Guice module for OpenPaaS communication #1261
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
fbea4a5
Create OpenPaasModule
HoussemNasri 0a093a6
Fix typo
HoussemNasri eef7eef
Fix guice dependency resolution
HoussemNasri 44cd3b9
Selectively load the openpaas module in the DistributedServer
HoussemNasri 88dba77
Selectively load the openpaas module in the MemoryServer
HoussemNasri 4006390
The OpenPaas admin username, password, and API URL are now mandatory …
HoussemNasri e59884f
Propagate exception
HoussemNasri 1dda9ee
Implement equals/hashcode for AmqpUri
HoussemNasri a5bf07b
Test OpenPaasConfiguration
HoussemNasri 71364c4
Refactor
HoussemNasri 7e6daf8
Add integration tests
HoussemNasri 2e1e303
Minor cleanup
HoussemNasri 7e3db77
Refactor AmqpUri
HoussemNasri 4c1cc72
Test AmqpUri
HoussemNasri 0bdc974
Reuse the existing RabbitMQ instance for testing OpenPaas
HoussemNasri 0d23e8f
Fix minor issues
HoussemNasri 6bdc105
Fix equals/hashcode contract test for OpenPaasConfiguration
HoussemNasri 8352fdd
Sort pom dependencies
HoussemNasri 6b37164
Throw an exception when RabbitMQ URI not configured in openpaas.prope…
HoussemNasri b34b577
Unload redundant guice module in tests
HoussemNasri 11f2dc8
Configure maven to resolve tmail-openpaas version implicitly
HoussemNasri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...ava/com/linagora/tmail/james/app/DistributedServerWithOpenPaasRabbitMqConfiguredTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.linagora.tmail.james.app; | ||
|
||
import org.apache.james.JamesServerBuilder; | ||
import org.apache.james.JamesServerExtension; | ||
import org.apache.james.SearchConfiguration; | ||
import org.apache.james.backends.redis.RedisExtension; | ||
import org.apache.james.utils.GuiceProbe; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import com.google.inject.multibindings.Multibinder; | ||
|
||
import com.linagora.tmail.OpenPaasModuleChooserConfiguration; | ||
import com.linagora.tmail.combined.identity.LdapExtension; | ||
import com.linagora.tmail.combined.identity.UsersRepositoryClassProbe; | ||
import com.linagora.tmail.combined.identity.UsersRepositoryModuleChooser; | ||
|
||
public class DistributedServerWithOpenPaasRabbitMqConfiguredTest { | ||
@RegisterExtension | ||
static JamesServerExtension | ||
testExtension = new JamesServerBuilder<DistributedJamesConfiguration>(tmpDir -> | ||
DistributedJamesConfiguration.builder() | ||
.workingDirectory(tmpDir) | ||
.configurationFromClasspath() | ||
.searchConfiguration(SearchConfiguration.openSearch()) | ||
.usersRepository(UsersRepositoryModuleChooser.Implementation.COMBINED) | ||
.eventBusKeysChoice(EventBusKeysChoice.REDIS) | ||
.openPassModuleChooserConfiguration(OpenPaasModuleChooserConfiguration.ENABLED) | ||
.build()) | ||
.server(configuration -> DistributedServer.createServer(configuration) | ||
.overrideWith(binder -> Multibinder.newSetBinder(binder, GuiceProbe.class).addBinding().to(UsersRepositoryClassProbe.class))) | ||
.extension(new DockerOpenSearchExtension()) | ||
.extension(new CassandraExtension()) | ||
.extension(new RabbitMQExtension()) | ||
.extension(new LdapExtension()) | ||
.extension(new RedisExtension()) | ||
.lifeCycle(JamesServerExtension.Lifecycle.PER_CLASS) | ||
.build(); | ||
|
||
@Test | ||
void serverShouldStartWithOpenPaasRabbitMqConfigured() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...est/java/com/linagora/tmail/james/app/MemoryServerWithOpenPaasRabbitMqConfiguredTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.linagora.tmail.james.app; | ||
|
||
import static org.apache.james.data.UsersRepositoryModuleChooser.Implementation.DEFAULT; | ||
|
||
import org.apache.james.JamesServerBuilder; | ||
import org.apache.james.JamesServerExtension; | ||
import org.apache.james.modules.queue.rabbitmq.RabbitMQModule; | ||
import org.apache.james.utils.GuiceProbe; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import com.google.inject.multibindings.Multibinder; | ||
import com.linagora.tmail.OpenPaasModuleChooserConfiguration; | ||
import com.linagora.tmail.encrypted.MailboxConfiguration; | ||
import com.linagora.tmail.encrypted.MailboxManagerClassProbe; | ||
import com.linagora.tmail.module.LinagoraTestJMAPServerModule; | ||
|
||
class MemoryServerWithOpenPaasRabbitMqConfiguredTest { | ||
@RegisterExtension | ||
static JamesServerExtension jamesServerExtension = new JamesServerBuilder<MemoryConfiguration>(tmpDir -> | ||
MemoryConfiguration.builder() | ||
.workingDirectory(tmpDir) | ||
.configurationFromClasspath() | ||
.mailbox(new MailboxConfiguration(false)) | ||
.usersRepository(DEFAULT) | ||
.openPaasModuleChooserConfiguration(OpenPaasModuleChooserConfiguration.ENABLED) | ||
.build()) | ||
.server(configuration -> MemoryServer.createServer(configuration) | ||
.overrideWith(new LinagoraTestJMAPServerModule()) | ||
.overrideWith(binder -> Multibinder.newSetBinder(binder, GuiceProbe.class).addBinding().to(MailboxManagerClassProbe.class)) | ||
.overrideWith(new RabbitMQModule())) | ||
.extension(new RabbitMQExtension()) | ||
.build(); | ||
|
||
@Test | ||
public void serverShouldStartWithOpenPaasRabbitMqConfigured() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this module override needed?
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.
Probably not, we don't use jmap in this test. The test passes even after removing the module. It is hard to tell for sure which modules or extensions are needed and which are not.
I removed it.