From 9521c9be1fbad74e4835525863bc1ad935a1f8a4 Mon Sep 17 00:00:00 2001 From: Ulrik Sandberg Date: Sun, 13 Jan 2008 21:47:08 +0000 Subject: [PATCH] Change LdapServerManager to be BaseLdapPathAware. --- .../springframework/ldap/LdapServerManager.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/spring-ldap/src/itest/java/org/springframework/ldap/LdapServerManager.java b/spring-ldap/src/itest/java/org/springframework/ldap/LdapServerManager.java index 937e14fe..19b82ad9 100644 --- a/spring-ldap/src/itest/java/org/springframework/ldap/LdapServerManager.java +++ b/spring-ldap/src/itest/java/org/springframework/ldap/LdapServerManager.java @@ -35,7 +35,7 @@ import org.apache.directory.server.protocol.shared.store.LdifFileLoader; import org.springframework.beans.factory.DisposableBean; import org.springframework.ldap.core.ContextSource; import org.springframework.ldap.core.DistinguishedName; -import org.springframework.ldap.core.support.DefaultDirObjectFactory; +import org.springframework.ldap.core.support.BaseLdapPathAware; /** * Utility class to initialize the apache directory server for use in the @@ -44,15 +44,21 @@ import org.springframework.ldap.core.support.DefaultDirObjectFactory; * @author Mattias Arthursson * */ -public class LdapServerManager implements DisposableBean { +public class LdapServerManager implements DisposableBean, BaseLdapPathAware { private static Log log = LogFactory.getLog(LdapServerManager.class); private ContextSource contextSource; + private DistinguishedName baseLdapPath; + public void setContextSource(ContextSource contextSource) { this.contextSource = contextSource; } + public void setBaseLdapPath(DistinguishedName baseLdapPath) { + this.baseLdapPath = baseLdapPath; + } + public void destroy() throws Exception { Properties env = new Properties(); env.setProperty(Context.INITIAL_CONTEXT_FACTORY, @@ -75,11 +81,10 @@ public class LdapServerManager implements DisposableBean { // Different test cases have different base paths. This means that the // starting point will be different. - if (ctx.getEnvironment().get( - DefaultDirObjectFactory.JNDI_ENV_BASE_PATH_KEY) != null) { + if (baseLdapPath.size() != 0) { startingPoint = DistinguishedName.EMPTY_PATH; } else { - startingPoint = new DistinguishedName("dc=jayway,dc=se"); + startingPoint = new DistinguishedName(baseLdapPath); } try {