LDAP-267: BaseLdapPath support with namespace configuration.

This commit is contained in:
Mattias Hellborg Arthursson
2013-10-09 07:41:02 +02:00
parent a16646ca2c
commit e43233fd86
9 changed files with 243 additions and 27 deletions

View File

@@ -22,6 +22,8 @@ import org.springframework.context.ApplicationContext;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.support.LdapUtils;
import java.util.HashMap;
import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@@ -118,8 +120,12 @@ public class BaseLdapPathBeanPostProcessorTest {
public void testGetAbstractContextSourceFromApplicationContext() throws Exception {
when(applicationContextMock.getBeanNamesForType(BaseLdapPathSource.class))
.thenReturn(new String[]{"contextSource"});
LdapContextSource expectedContextSource = new LdapContextSource();
when(applicationContextMock.getBean("contextSource")).thenReturn(expectedContextSource);
final LdapContextSource expectedContextSource = new LdapContextSource();
HashMap<String, BaseLdapPathSource> expectedBeans = new HashMap<String, BaseLdapPathSource>() {{
put("dummy", expectedContextSource);
}};
when(applicationContextMock.getBeansOfType(BaseLdapPathSource.class)).thenReturn(expectedBeans);
BaseLdapPathSource result = tested.getBaseLdapPathSourceFromApplicationContext();