| | |
| | | import org.opends.server.core.ModifyDNOperationBasis; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | | import org.opends.server.extensions.DummyAlertHandler; |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | import org.opends.server.types.RDN; |
| | | import org.opends.server.types.RawModification; |
| | | import org.opends.server.types.ResultCode; |
| | | import org.opends.server.util.TimeThread; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | |
| | | DN.decode("cn=something,ou=People,dc=example,dc=com"), mods, |
| | | user1entryUUID); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | int AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modMsg); |
| | | |
| | | // check that the modify has been applied as if the entry had been renamed. |
| | |
| | | fail("The modification has not been correctly replayed."); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | |
| | | // check that there was no administrative alert generated |
| | | // because the conflict has been automatically resolved. |
| | | assertEquals(DummyAlertHandler.getAlertCount(), AlertCount, |
| | | "An alert was incorrectly generated when resolving conflicts"); |
| | | |
| | | /* |
| | | * Test that the conflict resolution code is able to detect |
| | | * that and entry have been renamed and that a new entry has |
| | |
| | | modMsg = new ModifyMsg(gen.newChangeNumber(), |
| | | DN.decode(user1dn), mods, "10000000-9abc-def0-1234-1234567890ab"); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modMsg); |
| | | |
| | | // check that the modify has not been applied |
| | | TimeThread.sleep(2000); |
| | | found = checkEntryHasAttribute(personWithUUIDEntry.getDN(), |
| | | "telephonenumber", "02 01 03 05", 10000, false); |
| | | if (found == true) |
| | | fail("The modification has been replayed while it should not."); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | |
| | | // Check that there was no administrative alert generated |
| | | // because the conflict has been automatically resolved. |
| | | assertEquals(DummyAlertHandler.getAlertCount(), AlertCount, |
| | | "An alert was incorrectly generated when resolving conflicts"); |
| | | |
| | | |
| | | |
| | | /* |
| | | * Test that the conflict resolution code is able to find entries |
| | |
| | | new DeleteMsg("cn=anotherdn,ou=People,dc=example,dc=com", |
| | | gen.newChangeNumber(), user1entryUUID); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(delMsg); |
| | | |
| | | // check that the delete operation has been applied |
| | |
| | | assertNull(resultEntry, |
| | | "The DELETE replication message was not replayed"); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | // Check that there was no administrative alert generated |
| | | // because the conflict has been automatically resolved. |
| | | assertEquals(DummyAlertHandler.getAlertCount(), AlertCount, |
| | | "An alert was incorrectly generated when resolving conflicts"); |
| | | |
| | | /* |
| | | * Test that two adds with the same DN but a different unique ID result |
| | |
| | | personWithSecondUniqueID.getObjectClassAttribute(), |
| | | personWithSecondUniqueID.getAttributes(), new ArrayList<Attribute>()); |
| | | updateMonitorCount(baseDn, unresolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(addMsg); |
| | | |
| | | // Check that the entry has been renamed and created in the local DS. |
| | |
| | | "The ADD replication message was not applied"); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | assertConflictAttribute(resultEntry); |
| | | // Check that there was an administrative alert generated |
| | | // because the conflict has not been automatically resolved. |
| | | assertEquals(DummyAlertHandler.getAlertCount(), AlertCount+1, |
| | | "An alert was not generated when resolving conflicts"); |
| | | |
| | | |
| | | // delete the entries to clean the database. |
| | | delMsg = |
| | |
| | | personWithUUIDEntry.getObjectClassAttribute(), |
| | | personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>()); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(addMsg); |
| | | |
| | | // Check that the entry has been renamed and created in the local DS. |
| | |
| | | assertNotNull(resultEntry, |
| | | "The ADD replication message was not applied"); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | // Check that there was no administrative alert generated |
| | | // because the conflict has been automatically resolved. |
| | | assertEquals(DummyAlertHandler.getAlertCount(), AlertCount, |
| | | "An alert was incorrectly generated when resolving conflicts"); |
| | | |
| | | |
| | | /* |
| | | * Check that when replaying delete the naming conflict code |
| | |
| | | new DeleteMsg("uid=new person,ou=People,dc=example,dc=com", |
| | | gen.newChangeNumber(), "11111111-9abc-def0-1234-1234567890ab"); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(delMsg); |
| | | resultEntry = getEntry( |
| | | DN.decode("uid=new person,ou=People,dc=example,dc=com"), 10000, true); |
| | |
| | | "The DELETE replication message was replayed when it should not"); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | |
| | | // Check that there was no administrative alert generated |
| | | // because the conflict has been automatically resolved. |
| | | assertEquals(DummyAlertHandler.getAlertCount(), AlertCount, |
| | | "An alert was incorrectly generated when resolving conflicts"); |
| | | |
| | | |
| | | /* |
| | | * Check that when replaying modify dn operations, the conflict |
| | |
| | | "uid=wrong, ou=people,dc=example,dc=com", |
| | | "uid=newrdn"); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modDnMsg); |
| | | |
| | | resultEntry = getEntry( |
| | |
| | | "The modify dn was not or badly replayed"); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | |
| | | // Check that there was no administrative alert generated |
| | | // because the conflict has been automatically resolved. |
| | | assertEquals(DummyAlertHandler.getAlertCount(), AlertCount, |
| | | "An alert was incorrectly generated when resolving conflicts"); |
| | | |
| | | |
| | | /* |
| | | * same test but by giving a bad entry DN |
| | | */ |
| | |
| | | "uid=wrong,ou=People,dc=example,dc=com", gen.newChangeNumber(), |
| | | user1entryUUID, baseUUID, false, null, "uid=reallynewrdn"); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modDnMsg); |
| | | |
| | | resultEntry = getEntry( |
| | |
| | | "The modify dn was not or badly replayed"); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | |
| | | // Check that there was no administrative alert generated |
| | | // because the conflict has been automatically resolved. |
| | | assertEquals(DummyAlertHandler.getAlertCount(), AlertCount, |
| | | "An alert was incorrectly generated when resolving conflicts"); |
| | | |
| | | |
| | | /* |
| | | * Check that conflicting entries are renamed when a |
| | | * modifyDN is done with the same DN as an entry added on another server. |
| | |
| | | user1entrysecondUUID, baseUUID, false, |
| | | baseDn.toString(), "uid=reallynewrdn"); |
| | | updateMonitorCount(baseDn, unresolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modDnMsg); |
| | | |
| | | // check that the second entry has been renamed |
| | |
| | | assertEquals(getMonitorDelta(), 1); |
| | | assertConflictAttribute(resultEntry); |
| | | |
| | | // Check that there was no administrative alert generated |
| | | // because the conflict has been automatically resolved. |
| | | assertEquals(DummyAlertHandler.getAlertCount(), AlertCount+1, |
| | | "An alert was not generated when resolving conflicts"); |
| | | |
| | | |
| | | // delete the entries to clean the database |
| | | delMsg = |
| | | new DeleteMsg("uid=reallynewrdn,ou=People,dc=example,dc=com", |
| | |
| | | |
| | | // - publish msg |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(addMsg); |
| | | |
| | | // - check that the Dn has been changed to baseDn2 |
| | |
| | | entryList.add(resultEntry.getDN()); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | |
| | | // Check that there was no administrative alert generated |
| | | // because the conflict has been automatically resolved. |
| | | assertEquals(DummyAlertHandler.getAlertCount(), AlertCount, |
| | | "An alert was incorrectly generated when resolving conflicts"); |
| | | |
| | | |
| | | // |
| | | // Check that when a delete is conflicting with Add of some entries |
| | | // below the deleted entries, the child entry that have been added |
| | |
| | | "entryUUID = " + domain3uid + "+dc=domain3,ou=people,dc=example,dc=com"); |
| | | |
| | | updateMonitorCount(baseDn, unresolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | |
| | | // delete domain1 |
| | | delMsg = new DeleteMsg(domain1dn, gen.newChangeNumber(), domain1uid); |
| | |
| | | // check that unresolved conflict count has been incremented |
| | | assertEquals(getMonitorDelta(), 1); |
| | | |
| | | // Check that an administrative alert was generated |
| | | // because the conflict has not been automatically resolved. |
| | | assertEquals(DummyAlertHandler.getAlertCount(), AlertCount+2, |
| | | "An alert was incorrectly generated when resolving conflicts"); |
| | | |
| | | |
| | | // delete the resulting entries for the next test |
| | | delEntry(conflictDomain2dn); |
| | | delEntry(conflictDomain3dn); |
| | |
| | | "uid=wrong, ou=people,dc=example,dc=com", |
| | | "uid=newrdn"); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modDnMsg); |
| | | // unfortunately it is difficult to check that the operation |
| | | // did not do anything. |
| | |
| | | // has correctly been incremented. |
| | | assertEquals(getMonitorDelta(), 1); |
| | | |
| | | // Check that there was no administrative alert generated |
| | | // because the conflict has been automatically resolved. |
| | | assertEquals(DummyAlertHandler.getAlertCount(), AlertCount, |
| | | "An alert was incorrectly generated when resolving conflicts"); |
| | | |
| | | |
| | | broker.stop(); |
| | | } |
| | | |