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

Lee Trujillo
01.50.2015 9990668476c2cfbbdff79eafea5b894bb72fc352
CR-6560 OPENDJ-1909: make diffEntries use delete+add
2 files modified
29 ■■■■ changed files
opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java 14 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java 15 ●●●● patch | view | raw | blame | history
opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2013 ForgeRock AS
 *      Portions copyright 2011-2015 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -422,18 +422,18 @@
                // and removed. We won't replace the attribute because this is
                // not
                // reversible.
                final Attribute addedValues = new LinkedAttribute(ato);
                addedValues.removeAll(afrom);
                if (!addedValues.isEmpty()) {
                    request.addModification(new Modification(ModificationType.ADD, addedValues));
                }
                final Attribute deletedValues = new LinkedAttribute(afrom);
                deletedValues.removeAll(ato);
                if (!deletedValues.isEmpty()) {
                    request.addModification(new Modification(ModificationType.DELETE, deletedValues));
                }
                final Attribute addedValues = new LinkedAttribute(ato);
                addedValues.removeAll(afrom);
                if (!addedValues.isEmpty()) {
                    request.addModification(new Modification(ModificationType.ADD, addedValues));
                }
                afrom = ifrom.hasNext() ? ifrom.next() : null;
                ato = ito.hasNext() ? ito.next() : null;
            } else if (cmp < 0) {
opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java
@@ -22,6 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *       *      Portions copyright 2011-2015 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
@@ -151,24 +152,24 @@
            "bothDifferentAdds: toOnly1",
            "bothDifferentAdds: toOnly2",
            "-",
            "add: bothDifferentAddsAndDeletes",
            "bothDifferentAddsAndDeletes: toOnly",
            "-",
            "delete: bothDifferentAddsAndDeletes",
            "bothDifferentAddsAndDeletes: fromOnly",
            "-",
            "add: bothDifferentAddsAndDeletes",
            "bothDifferentAddsAndDeletes: toOnly",
            "-",
            "delete: bothDifferentDeletes",
            "bothDifferentDeletes: fromOnly1",
            "bothDifferentDeletes: fromOnly2",
            "-",
            "add: bothDifferentReplace",
            "bothDifferentReplace: toOnly1",
            "bothDifferentReplace: toOnly2",
            "-",
            "delete: bothDifferentReplace",
            "bothDifferentReplace: fromOnly1",
            "bothDifferentReplace: fromOnly2",
            "-",
            "add: bothDifferentReplace",
            "bothDifferentReplace: toOnly1",
            "bothDifferentReplace: toOnly2",
             "-",
            "delete: fromOnly",
            "fromOnly: fromOnlyValue",
            "-",