EmbeddedLdapServer builder

Closes #938

Signed-off-by: Emanuel Trandafir <emanueltrandafir1993@gmail.com>
Signed-off-by: etrandafir93 <emanueltrandafir1993@gmail.com>
This commit is contained in:
Emanuel Trandafir
2025-02-17 09:45:26 +02:00
committed by Josh Cummings
parent f154e64760
commit 8d44ee31a8
5 changed files with 230 additions and 27 deletions

View File

@@ -182,17 +182,19 @@ testCompile "com.unboundid:unboundid-ldapsdk:3.1.1"
The following bean definition creates an embedded LDAP server:
====
[source,xml]
[source,java]
----
<bean id="embeddedLdapServer" class="org.springframework.ldap.test.unboundid.EmbeddedLdapServerFactoryBean">
<property name="partitionName" value="example"/>
<property name="partitionSuffix" value="dc=261consulting,dc=com" />
<property name="port" value="9321" />
</bean>
@Bean
EmbeddedLdapServer embeddedLdapServer() {
return EmbeddedLdapServer.withPartitionSuffix("dc=jayway,dc=se")
.partitionName("jayway")
.port(18881)
.configurationCustomizer((config) -> config.setCodeLogDetails(tempLogFile, true))
.build();
}
----
====
`spring-ldap-test` provides a way to populate the LDAP server by using `org.springframework.ldap.test.unboundid.LdifPopulator`. To use it, create a bean similar to the following:
Alternatively, you can use the `org.springframework.ldap.test.unboundid.LdifPopulator` to create and populate the LDAP server. To use it, create a bean similar to the following:
====
[source,xml]