From c2b0d538def2d11f03b28ab7f0dc37a2d4665936 Mon Sep 17 00:00:00 2001 From: Ulrik Sandberg Date: Sun, 13 Jan 2008 21:45:38 +0000 Subject: [PATCH] Got rid of annoying javadoc warnings for "unmappable character". Removed unused import. Change LdapServerManager to be BaseLdapPathAware. --- .../ldap/LdapServerManager.java | 20 +++++++++++-------- .../samples/person/options/CompanyOption.java | 6 +++--- .../samples/person/options/CountryOption.java | 4 ++-- .../person/service/PersonServiceImplTest.java | 1 - 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/spring-ldap-person/src/main/java/org/springframework/ldap/LdapServerManager.java b/spring-ldap-person/src/main/java/org/springframework/ldap/LdapServerManager.java index af41c78e..8e815eea 100644 --- a/spring-ldap-person/src/main/java/org/springframework/ldap/LdapServerManager.java +++ b/spring-ldap-person/src/main/java/org/springframework/ldap/LdapServerManager.java @@ -29,15 +29,14 @@ import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.directory.DirContext; -import org.springframework.ldap.core.ContextSource; -import org.springframework.ldap.core.DistinguishedName; -import org.springframework.ldap.core.support.DefaultDirObjectFactory; - import org.apache.directory.server.core.configuration.ShutdownConfiguration; import org.apache.directory.server.jndi.ServerContextFactory; import org.apache.directory.server.protocol.shared.store.LdifFileLoader; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; +import org.springframework.ldap.core.ContextSource; +import org.springframework.ldap.core.DistinguishedName; +import org.springframework.ldap.core.support.BaseLdapPathAware; /** * Utility class to initialize the apache directory server. This means clearing @@ -45,11 +44,13 @@ import org.springframework.beans.factory.InitializingBean; * * @author Mattias Arthursson */ -public class LdapServerManager implements InitializingBean, DisposableBean { +public class LdapServerManager implements InitializingBean, DisposableBean, BaseLdapPathAware { private ContextSource contextSource; private String ldifFile; + + private DistinguishedName baseLdapPath; public void setContextSource(ContextSource contextSource) { this.contextSource = contextSource; @@ -59,6 +60,10 @@ public class LdapServerManager implements InitializingBean, DisposableBean { this.ldifFile = ldifFile; } + public void setBaseLdapPath(DistinguishedName baseLdapPath) { + this.baseLdapPath = baseLdapPath; + } + public void destroy() throws Exception { Properties env = new Properties(); env.setProperty(Context.INITIAL_CONTEXT_FACTORY, @@ -81,11 +86,10 @@ public class LdapServerManager implements InitializingBean, 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 { diff --git a/spring-ldap-person/src/main/java/org/springframework/ldap/samples/person/options/CompanyOption.java b/spring-ldap-person/src/main/java/org/springframework/ldap/samples/person/options/CompanyOption.java index a62fa49e..096617f0 100644 --- a/spring-ldap-person/src/main/java/org/springframework/ldap/samples/person/options/CompanyOption.java +++ b/spring-ldap-person/src/main/java/org/springframework/ldap/samples/person/options/CompanyOption.java @@ -53,9 +53,9 @@ public class CompanyOption extends AbstractChainedOption { */ protected void initChainedOption() { super.initChainedOption(); - Assert.notNull(companyDao, "Property ÕcompanyDaoÕ must be set"); - Assert.notNull(countryProperty, "Property ÕcountryPropertyÕ must be set"); - Assert.notNull(getConverter(), "Property ÕconverterÕ must be set"); + Assert.notNull(companyDao, "Property 'companyDao' must be set"); + Assert.notNull(countryProperty, "Property 'countryProperty' must be set"); + Assert.notNull(getConverter(), "Property 'converter' must be set"); } public void setCompanyDao(CompanyDao companyDao) { diff --git a/spring-ldap-person/src/main/java/org/springframework/ldap/samples/person/options/CountryOption.java b/spring-ldap-person/src/main/java/org/springframework/ldap/samples/person/options/CountryOption.java index 350c017b..9a9ee781 100644 --- a/spring-ldap-person/src/main/java/org/springframework/ldap/samples/person/options/CountryOption.java +++ b/spring-ldap-person/src/main/java/org/springframework/ldap/samples/person/options/CountryOption.java @@ -50,8 +50,8 @@ public class CountryOption extends AbstractChainedOption { */ protected void initChainedOption() { super.initChainedOption(); - Assert.notNull(countryDao, "Property ÕcountryDaoÕ must be set"); - Assert.notNull(getConverter(), "Property ÕconverterÕ must be set"); + Assert.notNull(countryDao, "Property 'countryDao' must be set"); + Assert.notNull(getConverter(), "Property 'converter' must be set"); } public void setCountryDao(CountryDao countryDao) { diff --git a/spring-ldap-person/src/test/java/org/springframework/ldap/samples/person/service/PersonServiceImplTest.java b/spring-ldap-person/src/test/java/org/springframework/ldap/samples/person/service/PersonServiceImplTest.java index 7e76bd65..fae7b594 100644 --- a/spring-ldap-person/src/test/java/org/springframework/ldap/samples/person/service/PersonServiceImplTest.java +++ b/spring-ldap-person/src/test/java/org/springframework/ldap/samples/person/service/PersonServiceImplTest.java @@ -21,7 +21,6 @@ import java.util.List; import junit.framework.TestCase; import org.easymock.MockControl; -import org.springframework.ldap.samples.person.dao.GroupDao; import org.springframework.ldap.samples.person.dao.PersonDao; import org.springframework.ldap.samples.person.domain.Person; import org.springframework.ldap.samples.person.domain.SearchCriteria;