From 0551d7eac6c37b47aafea294a95ae30ecc5e7d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez?= Date: Sun, 21 Feb 2016 10:53:24 +1000 Subject: [PATCH] Add documentation for Testing See gh-321 --- src/docs/asciidoc/index.adoc | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/docs/asciidoc/index.adoc b/src/docs/asciidoc/index.adoc index 30b117fd..1064ab46 100644 --- a/src/docs/asciidoc/index.adoc +++ b/src/docs/asciidoc/index.adoc @@ -2359,3 +2359,70 @@ Attributes attrs = DefaultIncrementalAttributeMapper.lookupAttributes(ldapTempla ---- This will parse any returned attribute range markers and make repeated requests as necessary until all values for all requested attributes have been retrieved. + +== Testing + +==== Using Embedded Server + +`spring-ldap-test` bring an embedded ldap server based on ApacheDS. + +NOTE: `spring-ldap-test` is compatible with ApacheDS 1.5.5. New versions of ApacheDS are not supported. + +Download the dependency below: + +Maven: +[source,xml] +---- + + org.springframework.ldap + spring-ldap-test + ${version} + +---- + +Gradle: +[source,groovy] +[subs="verbatim,quotes"] +---- +testCompile "org.springframework.ldap:spring-ldap-test:$version" +---- + +An embedded ldap server is created using the bean below: + +[source,xml] +---- + + + + + +---- + +`spring-ldap-test` provided a mechanism to populate the ldap server using `org.springframework.ldap.test.LdifPopulator`. Create the bean as follow: + +[source,xml] +---- + + + + + + + +---- + +Another way to work against an embedded ldap server is using `org.springframework.ldap.test.TestContextSourceFactoryBean` which allow to use and populate it. + +[source,xml] +---- + + + + + + + + +---- + +Also, `org.springframework.ldap.test.LdapTestUtils` provide methods to work with embedded ldap server programmatically. \ No newline at end of file