Java Code Examples for org.springframework.ldap.test.LdapTestUtils#shutdownEmbeddedServer()

The following examples show how to use org.springframework.ldap.test.LdapTestUtils#shutdownEmbeddedServer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestSchemaToJava.java    From spring-ldap with Apache License 2.0 5 votes vote down vote up
@After
public void tearDown() throws Exception {
    LdapTestUtils.shutdownEmbeddedServer();

    contextSource=null;
    converterManager=null;
}
 
Example 2
Source File: LdapTemplatePooledITest.java    From spring-ldap with Apache License 2.0 5 votes vote down vote up
/**
 * This method depends on a DirObjectFactory (
 * {@link org.springframework.ldap.core.support.DefaultDirObjectFactory})
 * being set in the ContextSource.
 */
@Test
public void verifyThatInvalidConnectionIsAutomaticallyPurged() throws Exception {
       LdapTestUtils.startEmbeddedServer(1888, "dc=261consulting,dc=com", "jayway");
       LdapTestUtils.cleanAndSetup(contextSource, LdapUtils.emptyLdapName(), new ClassPathResource("/setup_data.ldif"));

	DirContextOperations result = tested.lookupContext("cn=Some Person2, ou=company1,ou=Sweden");
       assertThat(result.getStringAttribute("cn")).isEqualTo("Some Person2");
       assertThat(result.getStringAttribute("sn")).isEqualTo("Person2");
       assertThat(result.getStringAttribute("description")).isEqualTo("Sweden, Company1, Some Person2");

       // Shutdown server and kill all existing connections
       LdapTestUtils.shutdownEmbeddedServer();
       LdapTestUtils.startEmbeddedServer(1888, "dc=261consulting,dc=com", "jayway");

       try {
           tested.lookup("cn=Some Person2, ou=company1,ou=Sweden");
           fail("Exception expected");
       } catch (Exception expected) {
           // This should fail because the target connection was closed
           assertThat(true).isTrue();
       }

       LdapTestUtils.cleanAndSetup(contextSource, LdapUtils.emptyLdapName(), new ClassPathResource("/setup_data.ldif"));
       // But this should be OK, because the dirty connection should have been automatically purged.
       tested.lookup("cn=Some Person2, ou=company1,ou=Sweden");
   }
 
Example 3
Source File: BaseDAOTest.java    From geofence with GNU General Public License v2.0 4 votes vote down vote up
@AfterClass
public static void tearDownClass() throws Exception
{
    LdapTestUtils.shutdownEmbeddedServer();
}
 
Example 4
Source File: TestSchemaViewer.java    From spring-ldap with Apache License 2.0 4 votes vote down vote up
@AfterClass
public static void tearDownClass() throws Exception {
    LdapTestUtils.shutdownEmbeddedServer();
}
 
Example 5
Source File: TestSchemaToJava.java    From spring-ldap with Apache License 2.0 4 votes vote down vote up
@AfterClass
public static void tearDownClass() throws Exception {
    // Stop the in process LDAP server
    LdapTestUtils.shutdownEmbeddedServer();
}
 
Example 6
Source File: TestLdap.java    From spring-ldap with Apache License 2.0 4 votes vote down vote up
@AfterClass
public static void tearDownClass() throws Exception {
    LdapTestUtils.shutdownEmbeddedServer();
}
 
Example 7
Source File: LdapTemplatePooledITest.java    From spring-ldap with Apache License 2.0 4 votes vote down vote up
@After
public void cleanup() throws Exception {
    LdapTestUtils.shutdownEmbeddedServer();
}