Browse code

BM-15102 Fix: support for remove attribute without EQUALITY definition

Anthony Prades authored on 06/08/2019 16:45:09
Showing 2 changed files
... ...
@@ -75,8 +75,7 @@ public class LdapObjectsTest extends LdapObjects {
75 75
 
76 76
 		assertEquals(ModificationOperation.REMOVE_ATTRIBUTE, mod.getOperation());
77 77
 		assertEquals("cn", mod.getAttribute().getId());
78
-		assertTrue(mod.getAttribute().contains("val1"));
79
-		assertTrue(mod.getAttribute().contains("val2"));
78
+		assertEquals(0, mod.getAttribute().size());
80 79
 	}
81 80
 
82 81
 	@Test
... ...
@@ -20,6 +20,7 @@ package net.bluemind.system.ldap.export.objects;
20 20
 import java.util.Iterator;
21 21
 
22 22
 import org.apache.directory.api.ldap.model.entry.Attribute;
23
+import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
23 24
 import org.apache.directory.api.ldap.model.entry.Entry;
24 25
 import org.apache.directory.api.ldap.model.entry.Value;
25 26
 import org.apache.directory.api.ldap.model.message.ModifyRequest;
... ...
@@ -51,7 +52,7 @@ public abstract class LdapObjects {
51 52
 		}
52 53
 
53 54
 		if (currentAttribute != null && attribute == null) {
54
-			return modifyRequest.remove(currentAttribute);
55
+			return modifyRequest.remove(new DefaultAttribute(attributeName));
55 56
 		}
56 57
 
57 58
 		if (currentAttribute.size() != attribute.size()) {