[java-shib-attribute] branch main updated: Test cleanup.

Scott Cantor cantor.2 at osu.edu
Wed Jun 14 17:08:45 UTC 2023


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

scantor pushed a commit to branch main
in repository java-shib-attribute.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-attribute.git;a=commit;h=897067d7869ca31118f1d35cc55336971e7306f9

The following commit(s) were added to refs/heads/main by this push:
     new 897067d78 Test cleanup.
897067d78 is described below

commit 897067d7869ca31118f1d35cc55336971e7306f9
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Jun 14 13:08:42 2023 -0400

    Test cleanup.
---
 .../dc/impl/ComputedIdDataConnectorParserTest.java | 36 +++++-----------------
 .../idp/attribute/resolver/spring/customBean.xml   |  4 ---
 .../attribute/resolver/spring/externalBeans.xml    |  4 ---
 3 files changed, 8 insertions(+), 36 deletions(-)

diff --git a/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/ComputedIdDataConnectorParserTest.java b/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/ComputedIdDataConnectorParserTest.java
index bb5560f0c..c5cb0e802 100644
--- a/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/ComputedIdDataConnectorParserTest.java
+++ b/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/ComputedIdDataConnectorParserTest.java
@@ -23,9 +23,6 @@ import static org.testng.Assert.assertTrue;
 import java.util.Collection;
 
 import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
-import org.springframework.core.env.MutablePropertySources;
-import org.springframework.core.env.StandardEnvironment;
 import org.springframework.mock.env.MockPropertySource;
 import org.testng.annotations.Test;
 
@@ -33,9 +30,9 @@ import net.shibboleth.idp.attribute.impl.ComputedPairwiseIdStore;
 import net.shibboleth.idp.attribute.impl.ComputedPairwiseIdStore.Encoding;
 import net.shibboleth.idp.attribute.resolver.dc.impl.PairwiseIdDataConnector;
 import net.shibboleth.idp.attribute.resolver.spring.testing.BaseAttributeDefinitionParserTest;
+import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.spring.context.FilesystemGenericApplicationContext;
-import net.shibboleth.shared.spring.custom.SchemaTypeAwareXMLBeanDefinitionReader;
+import net.shibboleth.shared.spring.util.ApplicationContextBuilder;
 
 /**
  * Test for {@link ComputedIdDataConnectorParser}.
@@ -89,29 +86,12 @@ public class ComputedIdDataConnectorParserTest extends BaseAttributeDefinitionPa
         final MockPropertySource mockEnvVars = new MockPropertySource();
         mockEnvVars.setProperty("the.ComputedIDDataConnector.salt", salt);
 
-        final GenericApplicationContext context = new FilesystemGenericApplicationContext() ;
-        setTestContext(context);
-        context.setDisplayName("ApplicationContext");
-
-        final MutablePropertySources propertySources = context.getEnvironment().getPropertySources();
-        propertySources.replace(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, mockEnvVars);
-
-        final PropertySourcesPlaceholderConfigurer placeholderConfig = new PropertySourcesPlaceholderConfigurer();
-        placeholderConfig.setPlaceholderPrefix("%{");
-        placeholderConfig.setPlaceholderSuffix("}");
-        placeholderConfig.setPropertySources(propertySources);
-
-        context.addBeanFactoryPostProcessor(placeholderConfig);
-
-        final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
-                new SchemaTypeAwareXMLBeanDefinitionReader(context);
-
-        beanDefinitionReader.loadBeanDefinitions(DATACONNECTOR_FILE_PATH + "resolver/computedProperty.xml");
-
+        final ApplicationContextBuilder builder = new ApplicationContextBuilder();
+        builder.setPropertySources(CollectionSupport.singletonList(mockEnvVars));
+        builder.setUnresolvedServiceConfigurations(CollectionSupport.singletonList(DATACONNECTOR_FILE_PATH + "resolver/computedProperty.xml"));
+        final GenericApplicationContext context = builder.build();
         
-        beanDefinitionReader.setValidating(true);
-
-        context.refresh();
+        setTestContext(context);
        
         final PairwiseIdDataConnector connector =  context.getBean(PairwiseIdDataConnector.class);
         final ComputedPairwiseIdStore store = (ComputedPairwiseIdStore) connector.getPairwiseIdStore();
@@ -121,4 +101,4 @@ public class ComputedIdDataConnectorParserTest extends BaseAttributeDefinitionPa
         assertTrue(connector.isInitialized());
     }
 
-}
+}
\ No newline at end of file
diff --git a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/customBean.xml b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/customBean.xml
index d38448f1d..d6e60d387 100644
--- a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/customBean.xml
+++ b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/customBean.xml
@@ -21,10 +21,6 @@
     
     <bean id="shibboleth.Predicate" destroy-method=""
         class="net.shibboleth.shared.logic.PredicateSupport" factory-method="alwaysFalse"/>
-    
-    <bean id="shibboleth.PropertySourcesPlaceholderConfigurer" destroy-method=""
-        class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"
-        p:placeholderPrefix="%{" p:placeholderSuffix="}" />
 
     <bean class="net.shibboleth.idp.attribute.resolver.spring.testing.MockScriptContextExtender" />
 
diff --git a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/externalBeans.xml b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/externalBeans.xml
index 7ea70c9b2..b02aed51b 100644
--- a/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/externalBeans.xml
+++ b/shib-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/externalBeans.xml
@@ -37,10 +37,6 @@
                 p:updateInterval="PT0S" />
         </property>
     </bean>
-   
-    <bean id="shibboleth.PropertySourcesPlaceholderConfigurer" destroy-method=""
-        class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"
-        p:placeholderPrefix="%{" p:placeholderSuffix="}" />
 
     <bean id="cacheBuilderExternal" destroy-method=""
             class="com.google.common.cache.CacheBuilder" factory-method="from">

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


More information about the commits mailing list