Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ldap mock: using random port instead of hardcoded one #11140

Merged
merged 1 commit into from
Aug 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class LdapServerTestResource implements QuarkusTestResourceLifecycleManag

public LdapServerTestResource() throws LDAPException {
InMemoryListenerConfig listenerConfig = new InMemoryListenerConfig("listener", InetAddress.getLoopbackAddress(),
10389, null, null, null);
0, null, null, null);
InMemoryDirectoryServerConfig inMemoryDirectoryServerConfig = new InMemoryDirectoryServerConfig("dc=quarkus,dc=io");
inMemoryDirectoryServerConfig.setListenerConfigs(listenerConfig);
inMemoryDirectoryServerConfig.addAdditionalBindCredentials("uid=admin,ou=system", "secret");
Expand All @@ -30,12 +30,15 @@ public LdapServerTestResource() throws LDAPException {
public Map<String, String> start() {
try {
ldapServer.startListening();
System.out.println("[INFO] LDAP server started");
System.out.println(
"[INFO] LDAP server started on " + InetAddress.getLoopbackAddress().getHostAddress() + ":"
+ ldapServer.getListenPort());
} catch (Exception e) {
throw new RuntimeException(e);
}

return Collections.emptyMap();
return Collections.singletonMap("quarkus.security.ldap.dir-context.url",
"ldap://" + InetAddress.getLoopbackAddress().getHostAddress() + ":" + ldapServer.getListenPort());
}

@Override
Expand Down