From 65f9f1f34f34f37ffd10979b993af3e9be10e5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Chicchiricc=C3=B2?= Date: Thu, 2 May 2024 11:33:12 +0200 Subject: [PATCH] Dummy bean for cachingAttributeRepository too --- .../syncope/wa/starter/AbstractTest.java | 78 ++++++++++--------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/wa/starter/src/test/java/org/apache/syncope/wa/starter/AbstractTest.java b/wa/starter/src/test/java/org/apache/syncope/wa/starter/AbstractTest.java index 776907f8e4..52f2eebe16 100644 --- a/wa/starter/src/test/java/org/apache/syncope/wa/starter/AbstractTest.java +++ b/wa/starter/src/test/java/org/apache/syncope/wa/starter/AbstractTest.java @@ -35,15 +35,14 @@ import org.apereo.cas.authentication.attribute.AttributeDefinitionResolutionContext; import org.apereo.cas.authentication.attribute.AttributeDefinitionStore; import org.apereo.cas.authentication.principal.Principal; +import org.apereo.cas.authentication.principal.PrincipalResolver; import org.apereo.cas.authentication.principal.Service; import org.apereo.cas.services.RegisteredService; import org.apereo.services.persondir.IPersonAttributeDao; import org.apereo.services.persondir.IPersonAttributeDaoFilter; import org.apereo.services.persondir.IPersonAttributes; -import org.apereo.services.persondir.support.merger.IAttributeMerger; import org.junit.jupiter.api.BeforeEach; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.test.web.server.LocalServerPort; @@ -68,6 +67,37 @@ @ContextConfiguration(initializers = ZookeeperTestingServer.class) public abstract class AbstractTest { + private static class DummyIPersonAttributeDao implements IPersonAttributeDao { + + @Override + public IPersonAttributes getPerson( + final String string, + final Set set, + final IPersonAttributeDaoFilter ipadf) { + + return null; + } + + @Override + public Set getPeople( + final Map map, + final IPersonAttributeDaoFilter ipadf, + final Set set) { + + return Set.of(); + } + + @Override + public Map getTags() { + return Map.of(); + } + + @Override + public int compareTo(final IPersonAttributeDao o) { + return 0; + } + } + protected static String getUUIDString() { return UUID.randomUUID().toString().substring(0, 8); } @@ -81,7 +111,7 @@ public SyncopeCoreTestingServer syncopeCoreTestingServer() { return new SyncopeCoreTestingServer(); } - // This bean definition allows MacOS builds to complete successfully + // The following bean definitions allow for MacOS builds to complete successfully @Bean(name = AttributeDefinitionStore.BEAN_NAME) @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT) public AttributeDefinitionStore attributeDefinitionStore() { @@ -173,42 +203,16 @@ public AttributeDefinitionStore importStore(final AttributeDefinitionStore defin }; } - @Bean(name = "aggregatingAttributeRepository") + @Bean(name = { "cachingAttributeRepository", PrincipalResolver.BEAN_NAME_ATTRIBUTE_REPOSITORY }) @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT) - public IPersonAttributeDao aggregatingAttributeRepository( - @Qualifier("attributeRepositoryAttributeMerger") - final IAttributeMerger attributeRepositoryAttributeMerger) { - - return new IPersonAttributeDao() { - - @Override - public IPersonAttributes getPerson( - final String string, - final Set set, - final IPersonAttributeDaoFilter ipadf) { - - return null; - } - - @Override - public Set getPeople( - final Map map, - final IPersonAttributeDaoFilter ipadf, - final Set set) { - - return Set.of(); - } - - @Override - public Map getTags() { - return Map.of(); - } + public IPersonAttributeDao cachingAttributeRepository() { + return new DummyIPersonAttributeDao(); + } - @Override - public int compareTo(final IPersonAttributeDao o) { - return 0; - } - }; + @Bean(name = "aggregatingAttributeRepository") + @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT) + public IPersonAttributeDao aggregatingAttributeRepository() { + return new DummyIPersonAttributeDao(); } }