vttranlina commented on a change in pull request #781: URL: https://github.com/apache/james-project/pull/781#discussion_r765560937
########## File path: server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/ModularizeJmapDraftAuthenticationStrategyTest.java ########## @@ -0,0 +1,260 @@ +/**************************************************************** + * 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.jmap; + +import static io.restassured.RestAssured.given; +import static org.apache.james.jmap.HttpJmapAuthentication.authenticateJamesUser; +import static org.apache.james.jmap.JMAPTestingConstants.ARGUMENTS; +import static org.apache.james.jmap.JMAPTestingConstants.NAME; +import static org.apache.james.jmap.JMAPTestingConstants.jmapRequestSpecBuilder; +import static org.apache.james.jmap.JmapURIBuilder.baseUri; +import static org.hamcrest.Matchers.both; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.isA; +import static org.hamcrest.Matchers.notNullValue; + +import java.io.IOException; +import java.util.Optional; + +import org.apache.james.GuiceJamesServer; +import org.apache.james.core.Username; +import org.apache.james.jmap.draft.JmapGuiceProbe; +import org.apache.james.jmap.http.AuthenticationStrategy; +import org.apache.james.mailbox.MailboxManager; +import org.apache.james.utils.DataProbeImpl; +import org.hamcrest.CoreMatchers; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import io.restassured.RestAssured; + +public abstract class ModularizeJmapDraftAuthenticationStrategyTest { + public static String DOMAIN = "domain.tld"; + public static Username BOB = Username.of("bob" + "@" + DOMAIN); + public static String BOB_PASSWORD = "123456"; + + private AllowAuthenticationStrategy allowAuthenticationStrategy; + private DenyAuthenticationStrategy denyAuthenticationStrategy; + private GuiceJamesServer jmapServer; + private AccessToken bobAccessToken; + + protected abstract GuiceJamesServer createJmapServerWithAllowAuthenticationStrategy(AllowAuthenticationStrategy authenticationStrategy) throws IOException; + + protected abstract GuiceJamesServer createJmapServerWithDenyAuthenticationStrategy(DenyAuthenticationStrategy authenticationStrategy) throws IOException; + + protected abstract GuiceJamesServer createJmapServerWithDefaultAuthenticationStrategies() throws IOException; + + protected abstract MailboxManager initMailboxManager(); + + @Before + public void setup() { + MailboxManager mailboxManager = initMailboxManager(); + allowAuthenticationStrategy = new AllowAuthenticationStrategy(mailboxManager); + denyAuthenticationStrategy = new DenyAuthenticationStrategy(); Review comment: Your mean is to use `.overrideWith` when starting GuiceJamesServer? If yes, I see it already -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
