|
|
|
@ -46,8 +46,7 @@ public class LdapAutoConfigurationTests { |
|
|
|
public void contextSourceWithDefaultUrl() { |
|
|
|
public void contextSourceWithDefaultUrl() { |
|
|
|
this.contextRunner.run((context) -> { |
|
|
|
this.contextRunner.run((context) -> { |
|
|
|
LdapContextSource contextSource = context.getBean(LdapContextSource.class); |
|
|
|
LdapContextSource contextSource = context.getBean(LdapContextSource.class); |
|
|
|
String[] urls = getUrls(contextSource); |
|
|
|
assertThat(contextSource.getUrls()).containsExactly("ldap://localhost:389"); |
|
|
|
assertThat(urls).containsExactly("ldap://localhost:389"); |
|
|
|
|
|
|
|
assertThat(contextSource.isAnonymousReadOnly()).isFalse(); |
|
|
|
assertThat(contextSource.isAnonymousReadOnly()).isFalse(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -58,8 +57,8 @@ public class LdapAutoConfigurationTests { |
|
|
|
.run((context) -> { |
|
|
|
.run((context) -> { |
|
|
|
LdapContextSource contextSource = context |
|
|
|
LdapContextSource contextSource = context |
|
|
|
.getBean(LdapContextSource.class); |
|
|
|
.getBean(LdapContextSource.class); |
|
|
|
String[] urls = getUrls(contextSource); |
|
|
|
assertThat(contextSource.getUrls()) |
|
|
|
assertThat(urls).containsExactly("ldap://localhost:123"); |
|
|
|
.containsExactly("ldap://localhost:123"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -72,9 +71,8 @@ public class LdapAutoConfigurationTests { |
|
|
|
LdapContextSource contextSource = context |
|
|
|
LdapContextSource contextSource = context |
|
|
|
.getBean(LdapContextSource.class); |
|
|
|
.getBean(LdapContextSource.class); |
|
|
|
LdapProperties ldapProperties = context.getBean(LdapProperties.class); |
|
|
|
LdapProperties ldapProperties = context.getBean(LdapProperties.class); |
|
|
|
String[] urls = getUrls(contextSource); |
|
|
|
assertThat(contextSource.getUrls()).containsExactly( |
|
|
|
assertThat(urls).containsExactly("ldap://localhost:123", |
|
|
|
"ldap://localhost:123", "ldap://mycompany:123"); |
|
|
|
"ldap://mycompany:123"); |
|
|
|
|
|
|
|
assertThat(ldapProperties.getUrls()).hasSize(2); |
|
|
|
assertThat(ldapProperties.getUrls()).hasSize(2); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -112,16 +110,12 @@ public class LdapAutoConfigurationTests { |
|
|
|
.run((context) -> { |
|
|
|
.run((context) -> { |
|
|
|
LdapContextSource contextSource = context |
|
|
|
LdapContextSource contextSource = context |
|
|
|
.getBean(LdapContextSource.class); |
|
|
|
.getBean(LdapContextSource.class); |
|
|
|
String[] urls = getUrls(contextSource); |
|
|
|
assertThat(contextSource.getUrls()) |
|
|
|
assertThat(urls).containsExactly("ldap://localhost:389"); |
|
|
|
.containsExactly("ldap://localhost:389"); |
|
|
|
assertThat(contextSource.isAnonymousReadOnly()).isFalse(); |
|
|
|
assertThat(contextSource.isAnonymousReadOnly()).isFalse(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String[] getUrls(LdapContextSource contextSource) { |
|
|
|
|
|
|
|
return contextSource.getUrls(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
static class PooledContextSourceConfig { |
|
|
|
static class PooledContextSourceConfig { |
|
|
|
|
|
|
|
|
|
|
|
|