IN PROGRESS - issue LDAP-33: Remove package dependency cycle between ldap.core and ldap.support
http://opensource.atlassian.com/projects/spring/browse/LDAP-33 Remove package dependency cycle
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
<bean id="contextSource2" class="org.springframework.ldap.support.LdapContextSource" >
|
||||
<bean id="contextSource2" class="org.springframework.ldap.core.support.LdapContextSource" >
|
||||
<property name="urls" value="ldap://127.0.0.1:389,ldap://127.0.0.2:389" />
|
||||
<property name="userDn" value="cn=dummy" />
|
||||
<property name="password" value="dummy" />
|
||||
|
||||
@@ -12,15 +12,15 @@
|
||||
</bean>
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.support.LdapContextSource">
|
||||
class="org.springframework.ldap.core.support.LdapContextSource">
|
||||
<property name="urls" value="${urls}" />
|
||||
|
||||
<property name="authenticationSource">
|
||||
<bean
|
||||
class="org.springframework.ldap.support.authentication.AcegiAuthenticationSource" />
|
||||
class="org.springframework.ldap.authentication.AcegiAuthenticationSource" />
|
||||
</property>
|
||||
<property name="dirObjectFactory"
|
||||
value="org.springframework.ldap.support.DefaultDirObjectFactory" />
|
||||
value="org.springframework.ldap.core.DefaultDirObjectFactory" />
|
||||
</bean>
|
||||
|
||||
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
<property name="location" value="classpath:/conf/ldap.properties" />
|
||||
</bean>
|
||||
|
||||
<bean id="contextSource" class="org.springframework.ldap.support.LdapContextSource" >
|
||||
<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource" >
|
||||
<property name="urls" value="${urls}" />
|
||||
<property name="userDn" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="dirObjectFactory" value="org.springframework.ldap.support.DefaultDirObjectFactory" />
|
||||
<property name="dirObjectFactory" value="org.springframework.ldap.core.DefaultDirObjectFactory" />
|
||||
</bean>
|
||||
|
||||
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
<property name="location" value="classpath:/conf/ldap.properties" />
|
||||
</bean>
|
||||
|
||||
<bean id="contextSource" class="org.springframework.ldap.support.LdapContextSource" >
|
||||
<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource" >
|
||||
<property name="urls" value="${urls}" />
|
||||
<property name="userDn" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="base" value="${base}" />
|
||||
<property name="dirObjectFactory" value="org.springframework.ldap.support.DefaultDirObjectFactory" />
|
||||
<property name="dirObjectFactory" value="org.springframework.ldap.core.DefaultDirObjectFactory" />
|
||||
</bean>
|
||||
|
||||
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.ldap;
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.springframework.ldap.core.ContextMapper;
|
||||
import org.springframework.ldap.support.DirContextAdapter;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
|
||||
/**
|
||||
* Dummy ContextMapper for testing purposes to check that the received
|
||||
|
||||
@@ -34,8 +34,8 @@ 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.support.DefaultDirObjectFactory;
|
||||
import org.springframework.ldap.support.DistinguishedName;
|
||||
import org.springframework.ldap.core.DefaultDirObjectFactory;
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
|
||||
/**
|
||||
* Utility class to initialize the apache directory server for use in the
|
||||
|
||||
@@ -21,9 +21,9 @@ import javax.naming.directory.BasicAttribute;
|
||||
import javax.naming.directory.BasicAttributes;
|
||||
|
||||
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.DirContextAdapter;
|
||||
import org.springframework.ldap.support.DistinguishedName;
|
||||
import org.springframework.ldap.support.EntryNotFoundException;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ import javax.naming.NamingException;
|
||||
import javax.naming.directory.DirContext;
|
||||
|
||||
import org.springframework.ldap.core.ContextExecutor;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.DirContextAdapter;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.ldap;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.ldap.core.ContextMapper;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.DirContextAdapter;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
/**
|
||||
@@ -38,7 +38,7 @@ public class LdapTemplateContextMapperITest extends
|
||||
}
|
||||
|
||||
/**
|
||||
* This method depends on a DirObjectFactory ({@link org.springframework.ldap.support.DefaultDirObjectFactory})
|
||||
* This method depends on a DirObjectFactory ({@link org.springframework.ldap.core.DefaultDirObjectFactory})
|
||||
* being set in the ContextSource.
|
||||
*/
|
||||
public void testSearch_ContextMapper() {
|
||||
|
||||
@@ -17,9 +17,9 @@ package org.springframework.ldap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.CountNameClassPairCallbackHandler;
|
||||
import org.springframework.ldap.support.DistinguishedName;
|
||||
import org.springframework.ldap.core.support.CountNameClassPairCallbackHandler;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,9 +21,9 @@ import javax.naming.directory.Attributes;
|
||||
|
||||
import org.springframework.ldap.core.AttributesMapper;
|
||||
import org.springframework.ldap.core.ContextMapper;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.DirContextAdapter;
|
||||
import org.springframework.ldap.support.DistinguishedName;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ public class LdapTemplateLookupITest extends
|
||||
}
|
||||
|
||||
/**
|
||||
* This method depends on a DirObjectFactory ({@link org.springframework.ldap.support.DefaultDirObjectFactory})
|
||||
* This method depends on a DirObjectFactory ({@link org.springframework.ldap.core.DefaultDirObjectFactory})
|
||||
* being set in the ContextSource.
|
||||
*/
|
||||
public void testLookup_Plain() {
|
||||
@@ -134,7 +134,7 @@ public class LdapTemplateLookupITest extends
|
||||
}
|
||||
|
||||
/**
|
||||
* This method depends on a DirObjectFactory ({@link org.springframework.ldap.support.DefaultDirObjectFactory})
|
||||
* This method depends on a DirObjectFactory ({@link org.springframework.ldap.core.DefaultDirObjectFactory})
|
||||
* being set in the ContextSource.
|
||||
*/
|
||||
public void testLookup_ContextMapper() {
|
||||
|
||||
@@ -25,9 +25,9 @@ import javax.naming.directory.ModificationItem;
|
||||
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.DirContextAdapter;
|
||||
import org.springframework.ldap.support.DistinguishedName;
|
||||
import org.springframework.ldap.support.UncategorizedLdapException;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
package org.springframework.ldap;
|
||||
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.CountNameClassPairCallbackHandler;
|
||||
import org.springframework.ldap.support.DirContextAdapter;
|
||||
import org.springframework.ldap.core.support.CountNameClassPairCallbackHandler;
|
||||
import org.springframework.ldap.support.EntryNotFoundException;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class LdapTemplateNoBaseSuffixITest extends
|
||||
}
|
||||
|
||||
/**
|
||||
* This method depends on a DirObjectFactory ({@link org.springframework.ldap.support.DefaultDirObjectFactory})
|
||||
* This method depends on a DirObjectFactory ({@link org.springframework.ldap.core.DefaultDirObjectFactory})
|
||||
* being set in the ContextSource.
|
||||
*/
|
||||
public void testLookup_Plain() {
|
||||
|
||||
@@ -18,9 +18,9 @@ package org.springframework.ldap;
|
||||
|
||||
import javax.naming.Name;
|
||||
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.DirContextAdapter;
|
||||
import org.springframework.ldap.support.DistinguishedName;
|
||||
import org.springframework.ldap.support.EntryNotFoundException;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ package org.springframework.ldap;
|
||||
import javax.naming.Name;
|
||||
|
||||
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.DirContextAdapter;
|
||||
import org.springframework.ldap.support.DistinguishedName;
|
||||
import org.springframework.ldap.support.EntryNotFoundException;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ package org.springframework.ldap;
|
||||
|
||||
|
||||
import org.ddsteps.spring.DDStepsSpringTestCase;
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.CountNameClassPairCallbackHandler;
|
||||
import org.springframework.ldap.support.DistinguishedName;
|
||||
import org.springframework.ldap.core.support.CountNameClassPairCallbackHandler;
|
||||
|
||||
/**
|
||||
* Tests for LdapTemplate's search methods. This test class tests the generic
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.util.List;
|
||||
import javax.naming.Name;
|
||||
import javax.naming.directory.SearchControls;
|
||||
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.DistinguishedName;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.ldap;
|
||||
|
||||
import org.springframework.ldap.core.ContextMapper;
|
||||
import org.springframework.ldap.support.DirContextAdapter;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
|
||||
/**
|
||||
* Dummy implemention of ContextMapper for use in the integration tests and for
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ldap.authentication;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.directory.Attributes;
|
||||
|
||||
|
||||
import org.acegisecurity.Authentication;
|
||||
import org.acegisecurity.context.SecurityContextHolder;
|
||||
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.acegisecurity.providers.ldap.LdapAuthenticationProvider;
|
||||
import org.springframework.ldap.authentication.AcegiAuthenticationSource;
|
||||
import org.springframework.ldap.core.AttributesMapper;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
public class AcegiAuthenticationSourceITest extends
|
||||
AbstractDependencyInjectionSpringContextTests {
|
||||
|
||||
private LdapAuthenticationProvider ldapAuthProvider;
|
||||
|
||||
private LdapTemplate ldapTemplate;
|
||||
|
||||
protected String[] getConfigLocations() {
|
||||
return new String[] { "/conf/ldapTemplateAcegiTestContext.xml" };
|
||||
}
|
||||
|
||||
public void setLdapAuthProvider(LdapAuthenticationProvider ldapAuthProvider) {
|
||||
this.ldapAuthProvider = ldapAuthProvider;
|
||||
}
|
||||
|
||||
public void setLdapTemplate(LdapTemplate ldapTemplate) {
|
||||
this.ldapTemplate = ldapTemplate;
|
||||
}
|
||||
|
||||
public void testGetPrincipalAndCredentials() {
|
||||
Authentication authentication = ldapAuthProvider
|
||||
.authenticate(new UsernamePasswordAuthenticationToken(
|
||||
"Some Person3", "password"));
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
|
||||
AcegiAuthenticationSource tested = new AcegiAuthenticationSource();
|
||||
assertEquals("cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se",
|
||||
tested.getPrincipal());
|
||||
assertEquals("password", tested.getCredentials());
|
||||
}
|
||||
|
||||
public void testSearchIndiviualAuthentication() {
|
||||
Authentication authentication = ldapAuthProvider
|
||||
.authenticate(new UsernamePasswordAuthenticationToken(
|
||||
"Some Person3", "password"));
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
|
||||
List result = ldapTemplate.search("dc=jayway,dc=se",
|
||||
"(objectclass=person)", new AttributesMapper() {
|
||||
public Object mapFromAttributes(Attributes attributes)
|
||||
throws NamingException {
|
||||
return attributes.get("cn");
|
||||
}
|
||||
});
|
||||
assertEquals(5, result.size());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ldap.core;
|
||||
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.clarkware.junitperf.LoadTest;
|
||||
|
||||
/**
|
||||
* Performance test for the {@link DistinguishedName} class.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
*/
|
||||
public class DnParsePerformanceITest extends TestCase {
|
||||
|
||||
public DnParsePerformanceITest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests parsing and toString.
|
||||
*/
|
||||
public void testContains() {
|
||||
|
||||
DistinguishedName migpath = new DistinguishedName("OU=G,OU=I,OU=M");
|
||||
DistinguishedName path1 = new DistinguishedName(
|
||||
"cn=john.doe, OU=Users,OU=SE,OU=G,OU=I,OU=M");
|
||||
DistinguishedName path2 = new DistinguishedName(
|
||||
"cn=john.doe, OU=Users,OU=SE,ou=G,OU=i,OU=M, ou=foo");
|
||||
DistinguishedName path3 = new DistinguishedName(
|
||||
"ou=G,OU=i,OU=M, ou=foo");
|
||||
DistinguishedName path4 = new DistinguishedName("ou=G,OU=i,ou=m");
|
||||
|
||||
DistinguishedName pathE1 = new DistinguishedName(
|
||||
"cn=john.doe, OU=Users,OU=SE,ou=G,OU=L,OU=M, ou=foo");
|
||||
DistinguishedName pathE2 = new DistinguishedName(
|
||||
"cn=john.doe, OU=Users,OU=SE");
|
||||
|
||||
assertTrue("Contains MIG", path1.contains(migpath));
|
||||
assertTrue("Contains MIG", path2.contains(migpath));
|
||||
assertTrue("Contains MIG", path3.contains(migpath));
|
||||
assertTrue("Contains MIG", path4.contains(migpath));
|
||||
|
||||
assertFalse("Does not contain MIG", pathE1.contains(migpath));
|
||||
assertFalse("Does not contain MIG", pathE2.contains(migpath));
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
int users = 2000;
|
||||
Test testCase = new DnParsePerformanceITest("testContains");
|
||||
Test loadTest = new LoadTest(testCase, users);
|
||||
return loadTest;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(suite());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.ldap.core.support;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.directory.DirContext;
|
||||
|
||||
import org.springframework.ldap.core.support.LdapContextSource;
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
/**
|
||||
* Integration tests for ContextSourceImpl.
|
||||
*
|
||||
* @author Mattias Arthursson
|
||||
*/
|
||||
public class LdapContextSourcelITest extends
|
||||
AbstractDependencyInjectionSpringContextTests {
|
||||
|
||||
private LdapContextSource tested;
|
||||
|
||||
protected String[] getConfigLocations() {
|
||||
return new String[] { "/conf/ldapTemplateTestContext.xml" };
|
||||
}
|
||||
|
||||
public void testGetReadOnlyContext() throws NamingException {
|
||||
DirContext ctx = null;
|
||||
|
||||
try {
|
||||
ctx = tested.getReadOnlyContext();
|
||||
assertNotNull(ctx);
|
||||
Hashtable environment = ctx.getEnvironment();
|
||||
assertTrue(environment
|
||||
.containsKey(LdapContextSource.SUN_LDAP_POOLING_FLAG));
|
||||
assertTrue(environment.containsKey(Context.SECURITY_PRINCIPAL));
|
||||
assertTrue(environment.containsKey(Context.SECURITY_CREDENTIALS));
|
||||
} finally {
|
||||
// Always clean up.
|
||||
if (ctx != null) {
|
||||
try {
|
||||
ctx.close();
|
||||
} catch (Exception e) {
|
||||
// Never mind this
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testGetReadWriteContext() throws NamingException {
|
||||
DirContext ctx = null;
|
||||
|
||||
try {
|
||||
ctx = tested.getReadWriteContext();
|
||||
assertNotNull(ctx);
|
||||
// Double check to see that we are authenticated.
|
||||
Hashtable environment = ctx.getEnvironment();
|
||||
assertTrue(environment.containsKey(Context.SECURITY_PRINCIPAL));
|
||||
assertTrue(environment.containsKey(Context.SECURITY_CREDENTIALS));
|
||||
} finally {
|
||||
// Always clean up.
|
||||
if (ctx != null) {
|
||||
try {
|
||||
ctx.close();
|
||||
} catch (Exception e) {
|
||||
// Never mind this
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setTested(LdapContextSource tested) {
|
||||
this.tested = tested;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.ldap.core.support;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
|
||||
/**
|
||||
* Integration tests for ContextSourceImpl.
|
||||
*
|
||||
* @author Mattias Arthursson
|
||||
*/
|
||||
public class LdapContextSourcelMultiServerITest extends
|
||||
AbstractDependencyInjectionSpringContextTests {
|
||||
|
||||
private LdapContextSource tested;
|
||||
|
||||
protected String[] getConfigLocations() {
|
||||
return new String[] { "/conf/ldapContextSourceTestContext.xml" };
|
||||
}
|
||||
|
||||
public void testUrls() throws NamingException {
|
||||
String[] urls = tested.getUrls();
|
||||
String string = tested.assembleProviderUrlString(urls);
|
||||
|
||||
assertEquals("ldap://127.0.0.1:389 ldap://127.0.0.2:389", string);
|
||||
}
|
||||
|
||||
public void setTested(LdapContextSource tested) {
|
||||
this.tested = tested;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user