LDAP-232: starting upgrade to apache directory server.

This commit is contained in:
Mattias Hellborg Arthursson
2013-08-13 15:34:51 +02:00
parent 0e496203ef
commit cb360c38ac
7 changed files with 172 additions and 96 deletions

View File

@@ -23,11 +23,13 @@ import org.springframework.core.io.Resource;
import org.springframework.ldap.core.ContextSource;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.test.LdapTestUtils;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
import javax.naming.NamingException;
import java.io.IOException;
@DirtiesContext
public abstract class AbstractLdapTemplateIntegrationTest extends AbstractJUnit4SpringContextTests {
@Autowired

View File

@@ -16,16 +16,6 @@
package org.springframework.ldap;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.ModificationItem;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -36,6 +26,16 @@ import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.test.context.ContextConfiguration;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.ModificationItem;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;
/**
* Tests the modification methods (rebind and modifyAttributes) of LdapTemplate.
* It also illustrates the use of DirContextAdapter as a means of getting
@@ -169,8 +169,11 @@ public class LdapTemplateModifyITest extends AbstractLdapTemplateIntegrationTest
String upperCasedName = "CN=Some Person,OU=company1,C=Sweden,DC=jayway,DC=se";
DirContextOperations ctx = tested.lookupContext(dn);
ctx.removeAttributeValue("uniqueMember", lowerCasedName);
tested.modifyAttributes(ctx);
ctx = tested.lookupContext(dn);
ctx.addAttributeValue("uniqueMember", upperCasedName);
tested.modifyAttributes(ctx);
tested.modifyAttributes(ctx);
// without this, the member added above will not be removed and the test fails
System.setProperty(DistinguishedName.KEY_CASE_FOLD_PROPERTY, DistinguishedName.KEY_CASE_FOLD_NONE);