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
| | |
| | | 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)); |
| | |
| | | * 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; |
| | |
| | | "replace: description", |
| | | "description: to"); |
| | | // @formatter:on |
| | | assertEquals(diffEntries(from, to, diffOptions().alwaysReplaceAttributes()), expected); |
| | | assertEquals(diffEntries(from, to, diffOptions().replaceSingleValuedAttributes()), expected); |
| | | } |
| | | |
| | | @Test |