[java-identity-provider COMMIT] /trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingpart...

noreply at shibboleth.net noreply at shibboleth.net
Wed Dec 10 15:57:51 EST 2014


Author: putmanb
Date: Wed Dec 10 15:57:50 2014
New Revision: 7062

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7062&view=rev
Log:
Refactor test base class to expose ApplicationContext for testing more low-level Spring parsing things.

Modified:
    trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/AbstractMetadataParserTest.java

Modified: trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/AbstractMetadataParserTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/AbstractMetadataParserTest.java?rev=7062&r1=7061&r2=7062&view=diff
==============================================================================
--- trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/AbstractMetadataParserTest.java (original)
+++ trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/AbstractMetadataParserTest.java Wed Dec 10 15:57:50 2014
@@ -32,6 +32,7 @@
 import org.opensaml.core.OpenSAMLInitBaseTestCase;
 import org.opensaml.core.criterion.EntityIdCriterion;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ConversionServiceFactoryBean;
 import org.springframework.context.support.GenericApplicationContext;
 import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@@ -112,8 +113,8 @@
         context.addBeanFactoryPostProcessor(placeholderConfig);
 
     }
-
-    protected <T> T getBean(Class<T> claz, String... files) throws IOException {
+    
+    protected ApplicationContext getApplicationContext(String contextName, String... files) throws IOException {
         final Resource[] resources = new Resource[files.length];
 
         for (int i = 0; i < files.length; i++) {
@@ -125,7 +126,7 @@
         setDirectoryPlaceholder(context);
 
         ConversionServiceFactoryBean service = new ConversionServiceFactoryBean();
-        context.setDisplayName("ApplicationContext: " + claz);
+        context.setDisplayName("ApplicationContext: " + contextName);
         service.setConverters(Sets.newHashSet(new DurationToLongConverter(), new StringToIPRangeConverter()));
         service.afterPropertiesSet();
 
@@ -137,6 +138,12 @@
 
         configReader.loadBeanDefinitions(resources);
         context.refresh();
+        
+        return context;
+    }
+
+    protected <T> T getBean(Class<T> claz, String... files) throws IOException {
+        ApplicationContext context = getApplicationContext(claz.getCanonicalName(), files);
 
         if (context.containsBean("shibboleth.ParserPool")) {
             parserPool = context.getBean("shibboleth.ParserPool");



More information about the commits mailing list