|
|
|
@ -16,11 +16,10 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.security.ldap.server; |
|
|
|
package org.springframework.security.ldap.server; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PreDestroy; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.junit.After; |
|
|
|
import org.junit.After; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.DisposableBean; |
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext; |
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
@ -92,7 +91,7 @@ public class UnboundIdContainerLdifTests { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
static class CustomLdifConfig { |
|
|
|
static class CustomLdifConfig implements DisposableBean { |
|
|
|
|
|
|
|
|
|
|
|
private UnboundIdContainer container = new UnboundIdContainer("dc=springframework,dc=org", |
|
|
|
private UnboundIdContainer container = new UnboundIdContainer("dc=springframework,dc=org", |
|
|
|
"classpath:test-server.ldif"); |
|
|
|
"classpath:test-server.ldif"); |
|
|
|
@ -109,15 +108,15 @@ public class UnboundIdContainerLdifTests { |
|
|
|
"ldap://127.0.0.1:" + container.getPort() + "/dc=springframework,dc=org"); |
|
|
|
"ldap://127.0.0.1:" + container.getPort() + "/dc=springframework,dc=org"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PreDestroy |
|
|
|
@Override |
|
|
|
void shutdown() { |
|
|
|
public void destroy() throws Exception { |
|
|
|
this.container.stop(); |
|
|
|
this.container.stop(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
static class WildcardLdifConfig { |
|
|
|
static class WildcardLdifConfig implements DisposableBean { |
|
|
|
|
|
|
|
|
|
|
|
private UnboundIdContainer container = new UnboundIdContainer("dc=springframework,dc=org", |
|
|
|
private UnboundIdContainer container = new UnboundIdContainer("dc=springframework,dc=org", |
|
|
|
"classpath*:test-server.ldif"); |
|
|
|
"classpath*:test-server.ldif"); |
|
|
|
@ -134,15 +133,15 @@ public class UnboundIdContainerLdifTests { |
|
|
|
"ldap://127.0.0.1:" + container.getPort() + "/dc=springframework,dc=org"); |
|
|
|
"ldap://127.0.0.1:" + container.getPort() + "/dc=springframework,dc=org"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PreDestroy |
|
|
|
@Override |
|
|
|
void shutdown() { |
|
|
|
public void destroy() throws Exception { |
|
|
|
this.container.stop(); |
|
|
|
this.container.stop(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
static class MalformedLdifConfig { |
|
|
|
static class MalformedLdifConfig implements DisposableBean { |
|
|
|
|
|
|
|
|
|
|
|
private UnboundIdContainer container = new UnboundIdContainer("dc=springframework,dc=org", |
|
|
|
private UnboundIdContainer container = new UnboundIdContainer("dc=springframework,dc=org", |
|
|
|
"classpath:test-server-malformed.txt"); |
|
|
|
"classpath:test-server-malformed.txt"); |
|
|
|
@ -153,15 +152,15 @@ public class UnboundIdContainerLdifTests { |
|
|
|
return this.container; |
|
|
|
return this.container; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PreDestroy |
|
|
|
@Override |
|
|
|
void shutdown() { |
|
|
|
public void destroy() throws Exception { |
|
|
|
this.container.stop(); |
|
|
|
this.container.stop(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
static class MissingLdifConfig { |
|
|
|
static class MissingLdifConfig implements DisposableBean { |
|
|
|
|
|
|
|
|
|
|
|
private UnboundIdContainer container = new UnboundIdContainer("dc=springframework,dc=org", |
|
|
|
private UnboundIdContainer container = new UnboundIdContainer("dc=springframework,dc=org", |
|
|
|
"classpath:does-not-exist.ldif"); |
|
|
|
"classpath:does-not-exist.ldif"); |
|
|
|
@ -172,15 +171,15 @@ public class UnboundIdContainerLdifTests { |
|
|
|
return this.container; |
|
|
|
return this.container; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PreDestroy |
|
|
|
@Override |
|
|
|
void shutdown() { |
|
|
|
public void destroy() throws Exception { |
|
|
|
this.container.stop(); |
|
|
|
this.container.stop(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
static class WildcardNoLdifConfig { |
|
|
|
static class WildcardNoLdifConfig implements DisposableBean { |
|
|
|
|
|
|
|
|
|
|
|
private UnboundIdContainer container = new UnboundIdContainer("dc=springframework,dc=org", |
|
|
|
private UnboundIdContainer container = new UnboundIdContainer("dc=springframework,dc=org", |
|
|
|
"classpath*:*.test.ldif"); |
|
|
|
"classpath*:*.test.ldif"); |
|
|
|
@ -191,8 +190,8 @@ public class UnboundIdContainerLdifTests { |
|
|
|
return this.container; |
|
|
|
return this.container; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PreDestroy |
|
|
|
@Override |
|
|
|
void shutdown() { |
|
|
|
public void destroy() throws Exception { |
|
|
|
this.container.stop(); |
|
|
|
this.container.stop(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|