This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 4694658d3d70628b5b606824a0b1ed6c676ea86a Author: Rene Cordier <[email protected]> AuthorDate: Mon Mar 18 17:53:52 2019 +0700 JAMES-2666 Refactoring web admin configuration for integration tests jmap server --- .../org/apache/james/CassandraJmapTestRule.java | 2 ++ .../integration/AuthorizedEndpointsTest.java | 3 +- .../integration/CassandraJmapExtension.java | 3 +- .../EventDeadLettersIntegrationTest.java | 1 - .../integration/JwtFilterIntegrationTest.java | 3 +- .../integration/WebAdminConfigurationModule.java | 33 ---------------------- .../integration/WebAdminServerIntegrationTest.java | 3 +- 7 files changed, 7 insertions(+), 41 deletions(-) diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java index 120ed3b..b0a3ef5 100644 --- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java +++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java @@ -28,6 +28,7 @@ import org.apache.james.mailbox.store.search.PDFTextExtractor; import org.apache.james.modules.TestESMetricReporterModule; import org.apache.james.modules.TestJMAPServerModule; import org.apache.james.server.core.configuration.Configuration; +import org.apache.james.webadmin.WebAdminConfiguration; import org.junit.rules.TemporaryFolder; import org.junit.rules.TestRule; import org.junit.runner.Description; @@ -68,6 +69,7 @@ public class CassandraJmapTestRule implements TestRule { .overrideWith(new TestESMetricReporterModule()) .overrideWith(guiceModuleTestRule.getModule()) .overrideWith((binder -> binder.bind(CleanupTasksPerformer.class).asEagerSingleton())) + .overrideWith(binder -> binder.bind(WebAdminConfiguration.class).toInstance(WebAdminConfiguration.TEST_CONFIGURATION)) .overrideWith(additionals); } diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/AuthorizedEndpointsTest.java b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/AuthorizedEndpointsTest.java index be23463..ef0d5a0 100644 --- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/AuthorizedEndpointsTest.java +++ b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/AuthorizedEndpointsTest.java @@ -49,8 +49,7 @@ public class AuthorizedEndpointsTest { @Before public void setUp() throws Exception { - guiceJamesServer = cassandraJmapTestRule.jmapServer(cassandra.getModule(), new UnauthorizedModule()) - .overrideWith(new WebAdminConfigurationModule()); + guiceJamesServer = cassandraJmapTestRule.jmapServer(cassandra.getModule(), new UnauthorizedModule()); guiceJamesServer.start(); WebAdminGuiceProbe webAdminGuiceProbe = guiceJamesServer.getProbe(WebAdminGuiceProbe.class); diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/CassandraJmapExtension.java b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/CassandraJmapExtension.java index 56ea367..3451c21 100644 --- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/CassandraJmapExtension.java +++ b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/CassandraJmapExtension.java @@ -33,6 +33,7 @@ import org.apache.james.modules.TestElasticSearchModule; import org.apache.james.modules.TestJMAPServerModule; import org.apache.james.server.core.configuration.Configuration; import org.apache.james.util.Runnables; +import org.apache.james.webadmin.WebAdminConfiguration; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeAllCallback; @@ -70,7 +71,7 @@ public class CassandraJmapExtension implements BeforeAllCallback, AfterAllCallba .overrideWith(new TestESMetricReporterModule()) .overrideWith(cassandra.getModule()) .overrideWith(new TestElasticSearchModule(elasticSearch)) - .overrideWith(new WebAdminConfigurationModule()) + .overrideWith(binder -> binder.bind(WebAdminConfiguration.class).toInstance(WebAdminConfiguration.TEST_CONFIGURATION)) .overrideWith(new UnauthorizedModule()) .overrideWith((binder -> binder.bind(CleanupTasksPerformer.class).asEagerSingleton())); } diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/EventDeadLettersIntegrationTest.java b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/EventDeadLettersIntegrationTest.java index cb1d8e0..a78aa92 100644 --- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/EventDeadLettersIntegrationTest.java +++ b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/EventDeadLettersIntegrationTest.java @@ -140,7 +140,6 @@ public class EventDeadLettersIntegrationTest { public void setUp() throws Exception { retryEventsListener = new RetryEventsListener(); guiceJamesServer = cassandraJmapTestRule.jmapServer(cassandra.getModule()) - .overrideWith(new WebAdminConfigurationModule()) .overrideWith(binder -> Multibinder.newSetBinder(binder, MailboxListener.GroupMailboxListener.class).addBinding().toInstance(retryEventsListener)); guiceJamesServer.start(); diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java index fc3a958..55420e4 100644 --- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java +++ b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java @@ -76,8 +76,7 @@ public class JwtFilterIntegrationTest { Optional.of(ClassLoaderUtils.getSystemResourceAsString("jwt_publickey"))); guiceJamesServer = cassandraJmapTestRule.jmapServer(cassandra.getModule()) - .overrideWith(new WebAdminConfigurationModule(), - binder -> binder.bind(AuthenticationFilter.class).to(JwtFilter.class), + .overrideWith(binder -> binder.bind(AuthenticationFilter.class).to(JwtFilter.class), binder -> binder.bind(JwtConfiguration.class).toInstance(jwtConfiguration)); guiceJamesServer.start(); dataProbe = guiceJamesServer.getProbe(DataProbeImpl.class); diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminConfigurationModule.java b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminConfigurationModule.java deleted file mode 100644 index f84810b..0000000 --- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminConfigurationModule.java +++ /dev/null @@ -1,33 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.webadmin.integration; - -import org.apache.james.webadmin.WebAdminConfiguration; - -import com.google.inject.AbstractModule; - -public class WebAdminConfigurationModule extends AbstractModule { - - @Override - protected void configure() { - bind(WebAdminConfiguration.class).toInstance(WebAdminConfiguration.TEST_CONFIGURATION); - } - -} diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java index 4ccd742..3a68272 100644 --- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java +++ b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java @@ -89,8 +89,7 @@ public class WebAdminServerIntegrationTest { @Before public void setUp() throws Exception { - guiceJamesServer = cassandraJmapTestRule.jmapServer(cassandra.getModule()) - .overrideWith(new WebAdminConfigurationModule()); + guiceJamesServer = cassandraJmapTestRule.jmapServer(cassandra.getModule()); guiceJamesServer.start(); dataProbe = guiceJamesServer.getProbe(DataProbeImpl.class); WebAdminGuiceProbe webAdminGuiceProbe = guiceJamesServer.getProbe(WebAdminGuiceProbe.class); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
