Polish "Add slice test annotation for LDAP"

Closes gh-8536
This commit is contained in:
Stephane Nicoll
2017-04-14 10:51:43 +02:00
parent 2830bef95c
commit 04ee374e7f
2 changed files with 55 additions and 52 deletions

View File

@@ -5702,55 +5702,6 @@ A list of the auto-configuration that is enabled by `@JdbcTest` can be
[[boot-features-testing-spring-boot-applications-testing-autoconfigured-ldap-test]]
==== Auto-configured Data LDAP tests
`@DataLdapTest` can be used if you want to test LDAP applications. By default, it will
configure an in-memory embedded LDAP (if available), configure a `LdapTemplate`, scan
for `@Entry` classes and configure Spring Data LDAP repositories. Regular
`@Component` beans will not be loaded into the `ApplicationContext`:
[source,java,indent=0]
----
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.data.ldap.DataLdapTest;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@DataLdapTest
public class ExampleDataLdapTests {
@Autowired
private LdapTemplate ldapTemplate;
//
}
----
In-memory embedded LDAP generally works well for tests since it is fast and doesn't
require any developer installation. If, however, you prefer to run tests against a real
LDAP server you should exclude the embedded LDAP auto-configuration:
[source,java,indent=0]
----
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration;
import org.springframework.boot.test.autoconfigure.data.ldap.DataLdapTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@DataLdapTest(excludeAutoConfiguration = EmbeddedLdapAutoConfiguration.class)
public class ExampleDataLdapNonEmbeddedTests {
}
----
A list of the auto-configuration that is enabled by `@DataLdapTest` can be
<<appendix-test-auto-configuration#test-auto-configuration,found in the appendix>>.
[[boot-features-testing-spring-boot-applications-testing-autoconfigured-mongo-test]]
==== Auto-configured Data MongoDB tests
`@DataMongoTest` can be used if you want to test MongoDB applications. By default, it will
@@ -5853,6 +5804,55 @@ A list of the auto-configuration that is enabled by `@DataNeo4jTest` can be
[[boot-features-testing-spring-boot-applications-testing-autoconfigured-ldap-test]]
==== Auto-configured Data LDAP tests
`@DataLdapTest` can be used if you want to test LDAP applications. By default, it will
configure an in-memory embedded LDAP (if available), a `LdapTemplate`, scan for `@Entry`
classes and configure Spring Data LDAP repositories. Regular `@Component` beans will not
be loaded into the `ApplicationContext`:
[source,java,indent=0]
----
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.data.ldap.DataLdapTest;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@DataLdapTest
public class ExampleDataLdapTests {
@Autowired
private LdapTemplate ldapTemplate;
//
}
----
In-memory embedded LDAP generally works well for tests since it is fast and doesn't
require any developer installation. If, however, you prefer to run tests against a real
LDAP server you should exclude the embedded LDAP auto-configuration:
[source,java,indent=0]
----
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration;
import org.springframework.boot.test.autoconfigure.data.ldap.DataLdapTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@DataLdapTest(excludeAutoConfiguration = EmbeddedLdapAutoConfiguration.class)
public class ExampleDataLdapNonEmbeddedTests {
}
----
A list of the auto-configuration that is enabled by `@DataLdapTest` can be
<<appendix-test-auto-configuration#test-auto-configuration,found in the appendix>>.
[[boot-features-testing-spring-boot-applications-testing-autoconfigured-rest-client]]
==== Auto-configured REST clients
The `@RestClientTest` annotation can be used if you want to test REST clients. By default