mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

ian.packer
14.18.2016 ab8c1e1f21dab0f29d66431933a794f05430fe30
OPENDJSDK-92 Update diffEntries to ensure DiffOptions replaceSingleValuedAttributes() has the expected effect

This commit fixes the usage of 'useReplaceMaxValues' to match its description and amends the unit test for testDiffEntriesReplaceSingleValue
2 files modified
6 ■■■■ changed files
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/Entries.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/Entries.java
@@ -571,7 +571,7 @@
            final int cmp = adfrom.compareTo(adto);
            if (cmp == 0) {
                /* Attribute is in both entries so compute the differences between the old and new. */
                if (options.useReplaceMaxValues > ato.size()) {
                if (options.useReplaceMaxValues >= ato.size()) {
                    // This attribute is a candidate for replacing.
                    if (diffAttributeNeedsReplacing(afrom, ato, options)) {
                        request.addModification(new Modification(ModificationType.REPLACE, ato));
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java
@@ -12,7 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2009-2010 Sun Microsystems, Inc.
 * Portions copyright 2014 ForgeRock AS.
 * Portions copyright 2014-2016 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -424,7 +424,7 @@
            "replace: description",
            "description: to");
        // @formatter:on
        assertEquals(diffEntries(from, to, diffOptions().alwaysReplaceAttributes()), expected);
        assertEquals(diffEntries(from, to, diffOptions().replaceSingleValuedAttributes()), expected);
    }
    @Test