SEC-2162: ApacheDSContainer throws RuntimeException on failure to start

This commit is contained in:
Rob Winch
2013-04-25 11:11:26 -05:00
parent c0921b9ede
commit dd554e1842
2 changed files with 40 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
package org.springframework.security.ldap.server;
import static junit.framework.Assert.fail;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.junit.Test;
@@ -23,4 +25,25 @@ public class ApacheDSContainerTests {
//
// server.stop();
}
// SEC-2162
@Test
public void failsToStartThrowsException() throws Exception {
ApacheDSContainer server1 = new ApacheDSContainer("dc=springframework,dc=org", "classpath:test-server.ldif");
ApacheDSContainer server2 = new ApacheDSContainer("dc=springframework,dc=org", "classpath:test-server.ldif");
try {
server1.afterPropertiesSet();
try {
server2.afterPropertiesSet();
fail("Expected Exception");
} catch(RuntimeException success) {}
} finally {
try {
server1.destroy();
}catch(Throwable t) {}
try {
server2.destroy();
}catch(Throwable t) {}
}
}
}