From 871e52984047732b1cd4ea5607c3a2e971aab288 Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Fri, 23 May 2008 23:32:57 +0000 Subject: [PATCH] SEC-850: custom-authentication-provider Registering Separate Bean Definitions in App Context and Providers List http://jira.springframework.org/browse/SEC-850. Added extra test. --- ...nProviderBeanDefinitionDecoratorTests.java | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/core/src/test/java/org/springframework/security/config/CustomAuthenticationProviderBeanDefinitionDecoratorTests.java b/core/src/test/java/org/springframework/security/config/CustomAuthenticationProviderBeanDefinitionDecoratorTests.java index 77175ce5d1..047e81aad6 100644 --- a/core/src/test/java/org/springframework/security/config/CustomAuthenticationProviderBeanDefinitionDecoratorTests.java +++ b/core/src/test/java/org/springframework/security/config/CustomAuthenticationProviderBeanDefinitionDecoratorTests.java @@ -8,9 +8,25 @@ import org.springframework.security.util.InMemoryXmlApplicationContext; public class CustomAuthenticationProviderBeanDefinitionDecoratorTests { - + @Test public void decoratedProviderParsesSuccessfully() { + InMemoryXmlApplicationContext ctx = new InMemoryXmlApplicationContext( + "" + + " " + + " " + + "" + + "" + + " " + + "" + ); + ProviderManager authMgr = (ProviderManager) ctx.getBean(BeanIds.AUTHENTICATION_MANAGER); + assertEquals(1, authMgr.getProviders().size()); + } + + + @Test + public void decoratedBeanAndRegisteredProviderAreTheSameObject() { InMemoryXmlApplicationContext ctx = new InMemoryXmlApplicationContext( "" + " " + @@ -18,15 +34,11 @@ public class CustomAuthenticationProviderBeanDefinitionDecoratorTests { "" + "" + " " + - " " + "" - ); - - Object myProvider = ctx.getBean("myProvider"); - + ProviderManager authMgr = (ProviderManager) ctx.getBean(BeanIds.AUTHENTICATION_MANAGER); - - assertSame(myProvider, authMgr.getProviders().get(0)); + assertEquals(1, authMgr.getProviders().size()); + assertSame(ctx.getBean("myProvider"), authMgr.getProviders().get(0)); } }