[java-identity-provider] branch main updated: JSSH-5 ServiceableComponent should implement AutoClose

Rod Widdowson rdw at steadingsoftware.com
Fri Nov 25 14:57:19 UTC 2022


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=1c6ecd6fa7b4231760206a87bb94a3cd731503b4

The following commit(s) were added to refs/heads/main by this push:
     new 1c6ecd6fa JSSH-5 ServiceableComponent should implement AutoClose
1c6ecd6fa is described below

commit 1c6ecd6fa7b4231760206a87bb94a3cd731503b4
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Nov 25 14:56:50 2022 +0000

    JSSH-5 ServiceableComponent should implement AutoClose
    
    https://shibboleth.atlassian.net/browse/JSSH-5
    
    Change tests to reflect that AttributeResolverImpl is no
    longer a ServiceableComponent
---
 .../impl/BaseAttributeDefinitionParserTest.java    | 22 +++++++++++++---------
 .../idp/profile/impl/ResolveAttributesTest.java    |  1 -
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/context/impl/BaseAttributeDefinitionParserTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/context/impl/BaseAttributeDefinitionParserTest.java
index e5dd5a0e3..659ae2a7a 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/context/impl/BaseAttributeDefinitionParserTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/context/impl/BaseAttributeDefinitionParserTest.java
@@ -31,6 +31,7 @@ import org.springframework.context.support.GenericApplicationContext;
 import org.testng.annotations.AfterMethod;
 
 import net.shibboleth.idp.attribute.resolver.AttributeDefinition;
+import net.shibboleth.idp.attribute.resolver.AttributeResolver;
 import net.shibboleth.idp.attribute.resolver.DataConnector;
 import net.shibboleth.idp.attribute.resolver.impl.AttributeResolverImpl;
 import net.shibboleth.idp.attribute.resolver.spring.ad.BaseAttributeDefinitionParser;
@@ -43,6 +44,7 @@ import net.shibboleth.shared.spring.config.StringToIPRangeConverter;
 import net.shibboleth.shared.spring.config.StringToResourceConverter;
 import net.shibboleth.shared.spring.context.FilesystemGenericApplicationContext;
 import net.shibboleth.shared.spring.custom.SchemaTypeAwareXMLBeanDefinitionReader;
+import net.shibboleth.shared.spring.service.impl.SpringServiceableComponent;
 
 /**
  * Base class for tests for {@link SimpleAttributeDefinitionParser} and by extension {@link BaseAttributeDefinitionParser}.
@@ -189,15 +191,17 @@ public abstract class BaseAttributeDefinitionParserTest extends OpenSAMLInitBase
         return getBean(DATACONNECTOR_FILE_PATH + fileName, claz, context, supressValid);
     }
 
-    static public AttributeResolverImpl getResolver(final ApplicationContext appCtx) {
-        final AttributeResolverServiceStrategy strategy = new AttributeResolverServiceStrategy();
-        strategy.setId("testResolver");
-        try {
-            strategy.initialize();
-        } catch (final ComponentInitializationException e) {
-            return null;
-        }
-        return (AttributeResolverImpl) strategy.apply(appCtx);
+    static public AttributeResolverImpl getResolver(final ApplicationContext appContext) throws ComponentInitializationException {
+        final Collection<AttributeDefinition> definitions =
+                appContext.getBeansOfType(AttributeDefinition.class).values();
+
+        final Collection<DataConnector> connectors = appContext.getBeansOfType(DataConnector.class).values();
+        final AttributeResolverImpl resolver = new AttributeResolverImpl();
+        resolver.setAttributeDefinitions(definitions);
+        resolver.setDataConnectors(connectors);
+        resolver.setId("testResolver");
+        resolver.initialize();
+        return resolver;
     }
 
 }
diff --git a/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/ResolveAttributesTest.java b/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/ResolveAttributesTest.java
index 393d1fefa..53bad73b0 100644
--- a/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/ResolveAttributesTest.java
+++ b/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/ResolveAttributesTest.java
@@ -220,7 +220,6 @@ public class ResolveAttributesTest {
         
         result.setAttributeDefinitions(definitions == null ? Collections.EMPTY_LIST : definitions);
         result.setDataConnectors(connectors == null ? Collections.EMPTY_LIST : connectors);
-        result.setApplicationContext(new MockApplicationContext());
         return result;
     }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list