-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71364c4
commit 7e6daf8
Showing
8 changed files
with
207 additions
and
11 deletions.
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
48 changes: 48 additions & 0 deletions
48
...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,48 @@ | ||
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.OpenPaasRabbitMQExtension; | ||
import com.linagora.tmail.combined.identity.LdapExtension; | ||
import com.linagora.tmail.combined.identity.UsersRepositoryClassProbe; | ||
import com.linagora.tmail.combined.identity.UsersRepositoryModuleChooser; | ||
import com.linagora.tmail.module.LinagoraTestJMAPServerModule; | ||
|
||
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(new LinagoraTestJMAPServerModule()) | ||
.overrideWith(binder -> Multibinder.newSetBinder(binder, GuiceProbe.class).addBinding().to(UsersRepositoryClassProbe.class))) | ||
.extension(new DockerOpenSearchExtension()) | ||
.extension(new CassandraExtension()) | ||
.extension(new RabbitMQExtension()) | ||
.extension(new OpenPaasRabbitMQExtension()) | ||
.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
38 changes: 38 additions & 0 deletions
38
...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,38 @@ | ||
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.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.OpenPaasRabbitMQExtension; | ||
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))) | ||
.extension(new OpenPaasRabbitMQExtension()) | ||
.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
43 changes: 43 additions & 0 deletions
43
...mail-third-party/openpaas/src/test/java/com/linagora/tmail/OpenPaasRabbitMQExtension.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,43 @@ | ||
package com.linagora.tmail; | ||
|
||
import org.apache.james.GuiceModuleTestExtension; | ||
import org.apache.james.backends.rabbitmq.DockerRabbitMQ; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
import org.junit.jupiter.api.extension.ParameterContext; | ||
import org.junit.jupiter.api.extension.ParameterResolutionException; | ||
|
||
import com.google.inject.Module; | ||
|
||
public class OpenPaasRabbitMQExtension implements GuiceModuleTestExtension { | ||
private final DockerRabbitMQ dockerRabbitMQ = DockerRabbitMQ.withoutCookie(); | ||
|
||
@Override | ||
public void afterAll(ExtensionContext extensionContext) { | ||
dockerRabbitMQ.stop(); | ||
} | ||
|
||
@Override | ||
public void beforeAll(ExtensionContext extensionContext) { | ||
dockerRabbitMQ.start(); | ||
} | ||
|
||
@Override | ||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws | ||
ParameterResolutionException { | ||
return parameterContext.getParameter().getType() == DockerRabbitMQ.class; | ||
} | ||
|
||
@Override | ||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { | ||
return dockerRabbitMQ; | ||
} | ||
|
||
@Override | ||
public Module getModule() { | ||
return new TestOpenPaasRabbitMQModule(dockerRabbitMQ); | ||
} | ||
|
||
public DockerRabbitMQ dockerRabbitMQ() { | ||
return dockerRabbitMQ; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...ail-third-party/openpaas/src/test/java/com/linagora/tmail/TestOpenPaasRabbitMQModule.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,31 @@ | ||
package com.linagora.tmail; | ||
|
||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
|
||
import jakarta.inject.Singleton; | ||
|
||
import org.apache.james.backends.rabbitmq.DockerRabbitMQ; | ||
|
||
import com.google.inject.AbstractModule; | ||
import com.google.inject.Provides; | ||
import com.linagora.tmail.configuration.OpenPaasConfiguration; | ||
|
||
public class TestOpenPaasRabbitMQModule extends AbstractModule { | ||
private final DockerRabbitMQ dockerRabbitMQ; | ||
|
||
public TestOpenPaasRabbitMQModule(DockerRabbitMQ dockerRabbitMQ) { | ||
this.dockerRabbitMQ = dockerRabbitMQ; | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
public OpenPaasConfiguration provideOpenPaasConfiguration() throws URISyntaxException { | ||
return new OpenPaasConfiguration( | ||
AmqpUri.from(dockerRabbitMQ.amqpUri()).asOptional(), | ||
URI.create("http://localhost:8081"), | ||
"user", | ||
"password" | ||
); | ||
} | ||
} |