This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/master by this push:
new c0960827ab Aligning Spring Boot version on CAS (#702)
c0960827ab is described below
commit c0960827ab3d89cf3f0a69a2a8b307d1fd89f6ae
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Thu May 2 12:51:19 2024 +0200
Aligning Spring Boot version on CAS (#702)
---
.../main/resources/archetype-resources/wa/pom.xml | 7 +
fit/wa-reference/pom.xml | 7 +
wa/pom.xml | 7 +
.../apache/syncope/wa/starter/AbstractTest.java | 166 +++++++++++++++++++++
4 files changed, 187 insertions(+)
diff --git a/archetype/src/main/resources/archetype-resources/wa/pom.xml
b/archetype/src/main/resources/archetype-resources/wa/pom.xml
index 49caf5ed88..f5c257d88a 100644
--- a/archetype/src/main/resources/archetype-resources/wa/pom.xml
+++ b/archetype/src/main/resources/archetype-resources/wa/pom.xml
@@ -34,6 +34,13 @@ under the License.
<dependencyManagement>
<dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring-boot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-bom</artifactId>
diff --git a/fit/wa-reference/pom.xml b/fit/wa-reference/pom.xml
index ecf6fd0d13..10b1408067 100644
--- a/fit/wa-reference/pom.xml
+++ b/fit/wa-reference/pom.xml
@@ -41,6 +41,13 @@ under the License.
<dependencyManagement>
<dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring-boot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-bom</artifactId>
diff --git a/wa/pom.xml b/wa/pom.xml
index 865c4eaef7..d9c12d70cc 100644
--- a/wa/pom.xml
+++ b/wa/pom.xml
@@ -38,6 +38,13 @@ under the License.
<dependencyManagement>
<dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring-boot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-bom</artifactId>
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 7b9e69d9ef..226d6545e4 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
@@ -20,16 +20,37 @@ package org.apache.syncope.wa.starter;
import static org.awaitility.Awaitility.await;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.wa.bootstrap.WARestClient;
+import org.apereo.cas.authentication.attribute.AttributeDefinition;
+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.junit.jupiter.api.BeforeEach;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.test.web.server.LocalServerPort;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.ScopedProxyMode;
+import org.springframework.core.io.Resource;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
@@ -46,6 +67,47 @@ import org.springframework.test.context.TestPropertySource;
@ContextConfiguration(initializers = ZookeeperTestingServer.class)
public abstract class AbstractTest {
+ private static class DummyIPersonAttributeDao implements
IPersonAttributeDao {
+
+ @Override
+ public IPersonAttributes getPerson(
+ final String string,
+ final Set<IPersonAttributes> set,
+ final IPersonAttributeDaoFilter ipadf) {
+
+ return null;
+ }
+
+ @Override
+ public Set<IPersonAttributes> getPeople(
+ final Map<String, Object> map,
+ final IPersonAttributeDaoFilter ipadf,
+ final Set<IPersonAttributes> set) {
+
+ return Set.of();
+ }
+
+ @Override
+ public Map<String, Object> getTags() {
+ return Map.of();
+ }
+
+ @Override
+ public int compareTo(final IPersonAttributeDao o) {
+ return 0;
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return obj instanceof IPersonAttributeDao;
+ }
+ }
+
protected static String getUUIDString() {
return UUID.randomUUID().toString().substring(0, 8);
}
@@ -58,6 +120,110 @@ public abstract class AbstractTest {
public SyncopeCoreTestingServer syncopeCoreTestingServer() {
return new SyncopeCoreTestingServer();
}
+
+ // The following bean definitions allow for MacOS builds to complete
successfully
+ @Bean(name = AttributeDefinitionStore.BEAN_NAME)
+ @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
+ public AttributeDefinitionStore attributeDefinitionStore() {
+ return new AttributeDefinitionStore() {
+
+ @Override
+ public AttributeDefinitionStore
registerAttributeDefinition(final AttributeDefinition defn) {
+ return this;
+ }
+
+ @Override
+ public AttributeDefinitionStore registerAttributeDefinition(
+ final String key, final AttributeDefinition defn) {
+
+ return this;
+ }
+
+ @Override
+ public Optional<AttributeDefinition>
locateAttributeDefinitionByName(final String name) {
+ return Optional.empty();
+ }
+
+ @Override
+ public AttributeDefinitionStore
removeAttributeDefinition(final String key) {
+ return this;
+ }
+
+ @Override
+ public Optional<AttributeDefinition>
locateAttributeDefinition(final String key) {
+ return Optional.empty();
+ }
+
+ @Override
+ public <T extends AttributeDefinition> Optional<T>
locateAttributeDefinition(
+ final String key, final Class<T> clazz) {
+
+ return Optional.empty();
+ }
+
+ @Override
+ public <T extends AttributeDefinition> Optional<T>
locateAttributeDefinition(
+ final Predicate<AttributeDefinition> predicate) {
+
+ return Optional.empty();
+ }
+
+ @Override
+ public Collection<AttributeDefinition>
getAttributeDefinitions() {
+ return Set.of();
+ }
+
+ @Override
+ public <T extends AttributeDefinition> Stream<T>
getAttributeDefinitionsBy(final Class<T> type) {
+ return Stream.empty();
+ }
+
+ @Override
+ public Optional<Pair<AttributeDefinition, List<Object>>>
resolveAttributeValues(
+ final String key, final
AttributeDefinitionResolutionContext context) {
+
+ return Optional.empty();
+ }
+
+ @Override
+ public Map<String, List<Object>> resolveAttributeValues(
+ final Collection<String> attributeDefinitions,
+ final Map<String, List<Object>> availableAttributes,
+ final Principal principal,
+ final RegisteredService registeredService,
+ final Service service) {
+
+ return Map.of();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return true;
+ }
+
+ @Override
+ public AttributeDefinitionStore store(final Resource resource)
{
+ return this;
+ }
+
+ @Override
+ public AttributeDefinitionStore importStore(final
AttributeDefinitionStore definitionStore) {
+ return this;
+ }
+ };
+ }
+
+ @Bean(name = { "cachingAttributeRepository",
PrincipalResolver.BEAN_NAME_ATTRIBUTE_REPOSITORY })
+ @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
+ public IPersonAttributeDao cachingAttributeRepository() {
+ return new DummyIPersonAttributeDao();
+ }
+
+ @Bean(name = "aggregatingAttributeRepository")
+ @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
+ public IPersonAttributeDao aggregatingAttributeRepository() {
+ return new DummyIPersonAttributeDao();
+ }
}
@LocalServerPort