[java-identity-provider COMMIT] in /trunk/idp-attribute-resolver-spring/src: main/java/net/shibboleth/idp/attribute/r...

noreply at shibboleth.net noreply at shibboleth.net
Sun Nov 24 08:47:15 EST 2013


Author: rdw
Date: Sun Nov 24 08:47:14 2013
New Revision: 4962

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4962&view=rev
Log:
IDP-338 Work around a bug in Spring Framework.  Add a canary test which will fail when the bug is fixed and this can be reverted.

Added:
    trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/IdP338.java   (with props)
    trunk/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/IdP338.xml   (with props)
Modified:
    trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/AbstractDataConnectorParser.java
    trunk/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/ldap/LdapDataConnectorParserTest.java
    trunk/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/ldap/ldap-attribute-resolver-spring.xml
    trunk/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/rdbms/rdbms-attribute-resolver-spring.xml

Modified: trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/AbstractDataConnectorParser.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/AbstractDataConnectorParser.java?rev=4962&r1=4961&r2=4962&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/AbstractDataConnectorParser.java (original)
+++ trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/AbstractDataConnectorParser.java Sun Nov 24 08:47:14 2013
@@ -120,6 +120,13 @@
         final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
         SerializeSupport.writeNode(springBeans, outputStream);
         definitionReader.loadBeanDefinitions(new InputSource(new ByteArrayInputStream(outputStream.toByteArray())));
+        
+        //
+        // Needed to work around https://jira.springsource.org/browse/SPR-11112
+        // See https://issues.shibboleth.net/jira/browse/IDP-338
+        //
+        @SuppressWarnings("unused")
+        final Object l = beanFactory.getBean("IDP338");
         return beanFactory;
     }
 

Modified: trunk/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/ldap/LdapDataConnectorParserTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/ldap/LdapDataConnectorParserTest.java?rev=4962&r1=4961&r2=4962&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/ldap/LdapDataConnectorParserTest.java (original)
+++ trunk/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/ldap/LdapDataConnectorParserTest.java Sun Nov 24 08:47:14 2013
@@ -53,6 +53,7 @@
 import org.testng.annotations.Test;
 
 import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
 import com.unboundid.ldap.listener.InMemoryDirectoryServer;
 import com.unboundid.ldap.listener.InMemoryDirectoryServerConfig;
 import com.unboundid.ldap.listener.InMemoryListenerConfig;
@@ -126,6 +127,40 @@
         Assert.assertNotNull(attrs);
     }
 
+    /**
+     * This test will fail when it is time to revert the fixes put in for
+     * https://issues.shibboleth.net/jira/browse/IDP-338.
+     * @return 
+     */
+    @Test public void IdP338Canary() {
+        GenericApplicationContext context = new GenericApplicationContext();
+        context.setDisplayName("ApplicationContext: " + LdapDataConnectorParserTest.class);
+
+        XmlBeanDefinitionReader configReader = new XmlBeanDefinitionReader(context);
+
+        configReader.loadBeanDefinitions("net/shibboleth/idp/attribute/resolver/spring/dc/IdP338.xml");
+        
+        Object cbc,cc=null,cb,c;
+        
+        cbc = context.getBean(CacheBuilder.class);
+        try {
+            cc = context.getBean(Cache.class);
+            Assert.fail("The Spring bug described in https://issues.shibboleth.net/jira/browse/IDP-338 has been fixed");
+        } catch (Exception e) {
+            // OK - the bug is that this throws.  The fix is when it doesn't.
+        }
+        cb = context.getBean("cacheBuilder");
+        c = context.getBean("cache");
+        Object ccc = context.getBean(Cache.class);
+        
+        Assert.assertNotNull(cb);        
+        Assert.assertNotNull(c);        
+        Assert.assertNotNull(cbc);        
+        Assert.assertNotNull(ccc);        
+        Assert.assertNull(cc, "The Spring bug described in https://issues.shibboleth.net/jira/browse/IDP-338 has been fixed"); 
+
+    }
+

[... 233 lines stripped ...]


More information about the commits mailing list