Added test case on LdapContextSource with multiple urls.

This commit is contained in:
Mattias Arthursson
2008-05-28 06:35:27 +00:00
parent 70a147b21e
commit cfe2174bdc

View File

@@ -112,6 +112,15 @@ public class LdapContextSourceTest extends TestCase {
assertNull(env.get(DefaultDirObjectFactory.JNDI_ENV_BASE_PATH_KEY));
}
public void testGetAnonymousEnvWithMultipleUrlsAndBaseSet() throws Exception {
tested.setUrls(new String[] { "ldap://ldap.example.com:389", "ldap://ldap2.example.com:389" });
tested.setBase("dc=example, dc=com");
tested.afterPropertiesSet();
Hashtable env = tested.getAnonymousEnv();
String providerUrl = (String) env.get(Context.PROVIDER_URL);
assertEquals("ldap://ldap.example.com:389/dc=example,dc=com ldap://ldap2.example.com:389/dc=example,dc=com", providerUrl);
}
public void testGetAnonymousEnvWithBaseEnvironment() throws Exception {
tested.setUrl("ldap://ldap.example.com:389");
HashMap map = new HashMap();