diff --git a/james-project b/james-project index 4c71ca2384..7761e48b02 160000 --- a/james-project +++ b/james-project @@ -1 +1 @@ -Subproject commit 4c71ca23844907353b61ce5c121e91fb15ccd4e1 +Subproject commit 7761e48b02056c486bd6253a231953e2505fa786 diff --git a/tmail-backend/combined-identity/src/test/java/com/linagora/tmail/combined/identity/CombinedUsersRepositoryTest.java b/tmail-backend/combined-identity/src/test/java/com/linagora/tmail/combined/identity/CombinedUsersRepositoryTest.java index 00c8f6a278..72ce8c76c6 100644 --- a/tmail-backend/combined-identity/src/test/java/com/linagora/tmail/combined/identity/CombinedUsersRepositoryTest.java +++ b/tmail-backend/combined-identity/src/test/java/com/linagora/tmail/combined/identity/CombinedUsersRepositoryTest.java @@ -5,6 +5,7 @@ import static org.apache.james.user.ldap.DockerLdapSingleton.ADMIN_PASSWORD; import java.util.Optional; +import java.util.Set; import org.apache.commons.configuration2.BaseHierarchicalConfiguration; import org.apache.commons.configuration2.HierarchicalConfiguration; @@ -84,6 +85,11 @@ public UsersRepository testee(Optional administrator) throws Exception return getUsersRepository(new CombinedUserDAO(readOnlyLDAPUsersDAO, cassandraUsersDAO), testSystem.getDomainList(), extension.isSupportVirtualHosting(), administrator); } + @Override + public UsersRepository testee(Set administrators) throws Exception { + return getUsersRepository(new CombinedUserDAO(readOnlyLDAPUsersDAO, cassandraUsersDAO), testSystem.getDomainList(), extension.isSupportVirtualHosting(), administrators); + } + @Override public CassandraUsersDAO cassandraUsersDAO() { return cassandraUsersDAO; @@ -127,6 +133,11 @@ public UsersRepository testee(Optional administrator) throws Exception return getUsersRepository(new CombinedUserDAO(readOnlyLDAPUsersDAO, cassandraUsersDAO), testSystem.getDomainList(), extension.isSupportVirtualHosting(), administrator); } + @Override + public UsersRepository testee(Set administrators) throws Exception { + return getUsersRepository(new CombinedUserDAO(readOnlyLDAPUsersDAO, cassandraUsersDAO), testSystem.getDomainList(), extension.isSupportVirtualHosting(), administrators); + } + @Override public CassandraUsersDAO cassandraUsersDAO() { return cassandraUsersDAO; @@ -145,6 +156,18 @@ private static CombinedUsersRepository getUsersRepository(CombinedUserDAO combin return repository; } + private static CombinedUsersRepository getUsersRepository(CombinedUserDAO combinedUserDAO, + DomainList domainList, + boolean enableVirtualHosting, + Set administrators) throws Exception { + CombinedUsersRepository repository = new CombinedUsersRepository(domainList, combinedUserDAO); + BaseHierarchicalConfiguration configuration = new BaseHierarchicalConfiguration(); + configuration.addProperty("enableVirtualHosting", String.valueOf(enableVirtualHosting)); + administrators.forEach(admin -> configuration.addProperty("administratorIds.administratorId", admin.asString())); + repository.configure(configuration); + return repository; + } + static HierarchicalConfiguration ldapRepositoryConfiguration(LdapGenericContainer ldapContainer, boolean enableVirtualHosting) { PropertyListConfiguration configuration = baseConfiguration(ldapContainer); if (enableVirtualHosting) {