| | |
| | | private Entry personWithSecondUniqueID; |
| | | |
| | | private Entry user3Entry; |
| | | private String user3dn; |
| | | private DN user3dn; |
| | | private String user3UUID; |
| | | |
| | | private String baseUUID; |
| | | |
| | | private String user1dn; |
| | | private DN user1dn; |
| | | private String user1entrysecondUUID; |
| | | private String user1entryUUID; |
| | | |
| | |
| | | private String domain1uid; |
| | | private String domain2uid; |
| | | private String domain3uid; |
| | | private String domain1dn; |
| | | private String domain2dn; |
| | | private String domain3dn; |
| | | private DN domain1dn; |
| | | private DN domain2dn; |
| | | private DN domain3dn; |
| | | private Entry domain1; |
| | | private Entry domain2; |
| | | private Entry domain3; |
| | |
| | | */ |
| | | user1entryUUID = "33333333-3333-3333-3333-333333333333"; |
| | | user1entrysecondUUID = "22222222-2222-2222-2222-222222222222"; |
| | | user1dn = "uid=user1,ou=People," + TEST_ROOT_DN_STRING; |
| | | user1dn = DN.decode("uid=user1,ou=People," + TEST_ROOT_DN_STRING); |
| | | String entryWithUUIDldif = "dn: "+ user1dn + "\n" |
| | | + "objectClass: top\n" + "objectClass: person\n" |
| | | + "objectClass: organizationalPerson\n" |
| | |
| | | TestCaseUtils.entryFromLdifString(entryWithSecondUUID); |
| | | |
| | | user3UUID = "44444444-4444-4444-4444-444444444444"; |
| | | user3dn = "uid=user3,ou=People," + TEST_ROOT_DN_STRING; |
| | | user3dn = DN.decode("uid=user3,ou=People," + TEST_ROOT_DN_STRING); |
| | | String user3LDIFEntry = "dn: "+ user3dn + "\n" |
| | | + "objectClass: top\n" + "objectClass: person\n" |
| | | + "objectClass: organizationalPerson\n" |
| | |
| | | + "entryUUID: " + user3UUID + "\n"; |
| | | user3Entry = TestCaseUtils.entryFromLdifString(user3LDIFEntry); |
| | | |
| | | domain1dn = "dc=domain1,ou=People," + TEST_ROOT_DN_STRING; |
| | | domain2dn = "dc=domain2,dc=domain1,ou=People," + TEST_ROOT_DN_STRING; |
| | | domain3dn = "dc=domain3,dc=domain1,ou=People," + TEST_ROOT_DN_STRING; |
| | | domain1dn = DN.decode("dc=domain1,ou=People," + TEST_ROOT_DN_STRING); |
| | | domain2dn = DN.decode("dc=domain2,dc=domain1,ou=People," + TEST_ROOT_DN_STRING); |
| | | domain3dn = DN.decode("dc=domain3,dc=domain1,ou=People," + TEST_ROOT_DN_STRING); |
| | | domain1 = TestCaseUtils.entryFromLdifString( |
| | | "dn:" + domain1dn + "\n" |
| | | + "objectClass:domain\n" |
| | |
| | | // Clean replication server database from previous run |
| | | cleanUpReplicationServersDB(); |
| | | |
| | | final DN baseDn = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | |
| | | /* |
| | | * Open a session to the replicationServer using the broker API. |
| | | * This must use a different serverId to that of the directory server. |
| | | */ |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDn, 2, 100, replServerPort, 1000, true); |
| | | |
| | | openReplicationSession(baseDN, 2, 100, replServerPort, 1000, true); |
| | | |
| | | try |
| | | { |
| | |
| | | |
| | | |
| | | // Disable the directory server receive status. |
| | | setReceiveStatus(synchroServerEntry.getDN().toString(), false); |
| | | setReceiveStatus(synchroServerEntry.getDN(), false); |
| | | |
| | | |
| | | // Create and publish an update message to add an entry. |
| | | AddMsg addMsg = new AddMsg(gen.newCSN(), |
| | | personWithUUIDEntry.getDN().toString(), |
| | | personWithUUIDEntry.getDN(), |
| | | user1entryUUID, |
| | | baseUUID, |
| | | personWithUUIDEntry.getObjectClassAttribute(), |
| | |
| | | + "receive status was disabled"); |
| | | |
| | | // Enable the directory server receive status. |
| | | setReceiveStatus(synchroServerEntry.getDN().toString(), true); |
| | | setReceiveStatus(synchroServerEntry.getDN(), true); |
| | | |
| | | // Create and publish another update message to add an entry. |
| | | addMsg = new AddMsg(gen.newCSN(), |
| | | personWithUUIDEntry.getDN().toString(), |
| | | personWithUUIDEntry.getDN(), |
| | | user1entryUUID, |
| | | baseUUID, |
| | | personWithUUIDEntry.getObjectClassAttribute(), |
| | |
| | | |
| | | // Delete the entries to clean the database. |
| | | DeleteMsg delMsg = |
| | | new DeleteMsg(personWithUUIDEntry.getDN().toString(), |
| | | new DeleteMsg(personWithUUIDEntry.getDN(), |
| | | gen.newCSN(), user1entryUUID); |
| | | broker.publish(delMsg); |
| | | resultEntry = getEntry(personWithUUIDEntry.getDN(), 10000, false); |
| | |
| | | // Clean replication server database from previous run |
| | | cleanUpReplicationServersDB(); |
| | | |
| | | final DN baseDn = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | |
| | | /* |
| | | * Open a session to the replicationServer using the broker API. |
| | | * This must use a different serverId to that of the directory server. |
| | | */ |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDn, 2, 100, replServerPort, 1000, true); |
| | | openReplicationSession(baseDN, 2, 100, replServerPort, 1000, true); |
| | | |
| | | try |
| | | { |
| | |
| | | |
| | | // Create and publish an update message to add an entry. |
| | | AddMsg addMsg = new AddMsg(gen.newCSN(), |
| | | personWithUUIDEntry.getDN().toString(), |
| | | personWithUUIDEntry.getDN(), |
| | | user1entryUUID, |
| | | baseUUID, |
| | | personWithUUIDEntry.getObjectClassAttribute(), |
| | |
| | | } |
| | | |
| | | // Delete the entries to clean the database. |
| | | DeleteMsg delMsg = |
| | | new DeleteMsg(personWithUUIDEntry.getDN().toString(), |
| | | gen.newCSN(), user1entryUUID); |
| | | DeleteMsg delMsg = new DeleteMsg(personWithUUIDEntry.getDN(), gen.newCSN(), user1entryUUID); |
| | | broker.publish(delMsg); |
| | | resultEntry = getEntry(personWithUUIDEntry.getDN(), 10000, false); |
| | | |
| | |
| | | public void modifyConflicts() |
| | | throws Exception |
| | | { |
| | | final DN baseDn = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | final DN dn1 = DN.decode("cn=test1," + baseDn.toString()); |
| | | final DN baseDN = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | final DN dn1 = DN.decode("cn=test1," + baseDN.toString()); |
| | | final AttributeType attrType = |
| | | DirectoryServer.getAttributeType("displayname"); |
| | | final AttributeType entryuuidType = |
| | |
| | | * This must use a different serverId to that of the directory server. |
| | | */ |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDn, 2, 100, replServerPort, 1000, true); |
| | | openReplicationSession(baseDN, 2, 100, replServerPort, 1000, true); |
| | | |
| | | try |
| | | { |
| | | // Add the first test entry. |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=test1," + baseDn.toString(), |
| | | "dn: cn=test1," + baseDN.toString(), |
| | | "displayname: Test1", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | CSN t2 = new CSN(changeTime, 0, 4); |
| | | |
| | | // Simulate the ordering t2:replace:B followed by t1:add:A that |
| | | updateMonitorCount(baseDn, monitorAttr); |
| | | updateMonitorCount(baseDN, monitorAttr); |
| | | |
| | | // Replay a replace of a value B at time t2 on a second server. |
| | | Attribute attr = Attributes.create(attrType, "B"); |
| | |
| | | t2 = new CSN(changeTime, 0, 4); |
| | | |
| | | // Simulate the ordering t2:delete:displayname followed by t1:replace:A |
| | | updateMonitorCount(baseDn, monitorAttr); |
| | | updateMonitorCount(baseDN, monitorAttr); |
| | | |
| | | // Replay an delete of attribute displayname at time t2 on a second server. |
| | | attr = Attributes.empty(attrType); |
| | |
| | | logError(Message.raw(Category.SYNC, Severity.INFORMATION, |
| | | "Starting replication test : namingConflicts")); |
| | | |
| | | final DN baseDn = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | String resolvedMonitorAttr = "resolved-naming-conflicts"; |
| | | String unresolvedMonitorAttr = "unresolved-naming-conflicts"; |
| | | |
| | |
| | | * This must use a serverId different from the LDAP server ID |
| | | */ |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDn, 2, 100, replServerPort, 1000, true); |
| | | openReplicationSession(baseDN, 2, 100, replServerPort, 1000, true); |
| | | |
| | | try |
| | | { |
| | |
| | | */ |
| | | // create the entry with a given DN |
| | | AddMsg addMsg = new AddMsg(gen.newCSN(), |
| | | personWithUUIDEntry.getDN().toString(), |
| | | personWithUUIDEntry.getDN(), |
| | | user1entryUUID, |
| | | baseUUID, |
| | | personWithUUIDEntry.getObjectClassAttribute(), |
| | |
| | | ModifyMsg modMsg = new ModifyMsg(gen.newCSN(), |
| | | DN.decode("cn=something,ou=People," + TEST_ROOT_DN_STRING), mods, |
| | | user1entryUUID); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | int AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modMsg); |
| | | |
| | |
| | | personWithUUIDEntry.getDN(), mods, |
| | | user1entryUUID); |
| | | |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modMsg); |
| | | |
| | |
| | | |
| | | // create the entry with a given DN and unique ID |
| | | addMsg = new AddMsg(gen.newCSN(), |
| | | personWithUUIDEntry.getDN().toString(), |
| | | personWithUUIDEntry.getDN(), |
| | | user1entryUUID, baseUUID, |
| | | personWithUUIDEntry.getObjectClassAttribute(), |
| | | personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>()); |
| | |
| | | // send a modify operation with a wrong unique ID but the same DN |
| | | mods = generatemods("telephonenumber", "02 01 03 05"); |
| | | modMsg = new ModifyMsg(gen.newCSN(), |
| | | DN.decode(user1dn), mods, "10000000-9abc-def0-1234-1234567890ab"); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | user1dn, mods, "10000000-9abc-def0-1234-1234567890ab"); |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modMsg); |
| | | |
| | |
| | | */ |
| | | // send a delete operation with a wrong dn but the unique ID of the entry |
| | | // used above |
| | | DeleteMsg delMsg = |
| | | new DeleteMsg("cn=anotherdn,ou=People," + TEST_ROOT_DN_STRING, |
| | | gen.newCSN(), user1entryUUID); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | DN delDN = DN.decode("cn=anotherdn,ou=People," + TEST_ROOT_DN_STRING); |
| | | DeleteMsg delMsg = new DeleteMsg(delDN, gen.newCSN(), user1entryUUID); |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(delMsg); |
| | | |
| | |
| | | |
| | | // create an entry with a given DN and unique ID |
| | | addMsg = new AddMsg(gen.newCSN(), |
| | | personWithUUIDEntry.getDN().toString(), |
| | | personWithUUIDEntry.getDN(), |
| | | user1entryUUID, baseUUID, |
| | | personWithUUIDEntry.getObjectClassAttribute(), |
| | | personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>()); |
| | |
| | | |
| | | // create an entry with the same DN and another unique ID |
| | | addMsg = new AddMsg(gen.newCSN(), |
| | | personWithSecondUniqueID.getDN().toString(), |
| | | personWithSecondUniqueID.getDN(), |
| | | user1entrysecondUUID, baseUUID, |
| | | personWithSecondUniqueID.getObjectClassAttribute(), |
| | | personWithSecondUniqueID.getAttributes(), new ArrayList<Attribute>()); |
| | | updateMonitorCount(baseDn, unresolvedMonitorAttr); |
| | | updateMonitorCount(baseDN, unresolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(addMsg); |
| | | |
| | |
| | | |
| | | |
| | | // delete the entries to clean the database. |
| | | delMsg = |
| | | new DeleteMsg(personWithUUIDEntry.getDN().toString(), |
| | | gen.newCSN(), user1entryUUID); |
| | | delMsg = new DeleteMsg(personWithUUIDEntry.getDN(), gen.newCSN(), user1entryUUID); |
| | | broker.publish(delMsg); |
| | | delMsg = |
| | | new DeleteMsg(personWithSecondUniqueID.getDN().toString(), |
| | | gen.newCSN(), user1entrysecondUUID); |
| | | delMsg = new DeleteMsg(personWithSecondUniqueID.getDN(), gen.newCSN(), user1entrysecondUUID); |
| | | broker.publish(delMsg); |
| | | resultEntry = getEntry(personWithUUIDEntry.getDN(), 10000, false); |
| | | resultEntry = getEntry(personWithSecondUniqueID.getDN(), 10000, false); |
| | |
| | | * Simulate this by trying to add an entry below a DN that does not |
| | | * exist but with a parent ID that exist. |
| | | */ |
| | | String addDN = "uid=new person,o=nothere,o=below,ou=People," + TEST_ROOT_DN_STRING; |
| | | addMsg = new AddMsg(gen.newCSN(), |
| | | "uid=new person,o=nothere,o=below,ou=People," + TEST_ROOT_DN_STRING, |
| | | DN.decode(addDN), |
| | | user1entryUUID, |
| | | baseUUID, |
| | | personWithUUIDEntry.getObjectClassAttribute(), |
| | | personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>()); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(addMsg); |
| | | |
| | | // Check that the entry has been created in the local DS. |
| | | resultEntry = getEntry( |
| | | DN.decode("uid=new person,ou=People," + TEST_ROOT_DN_STRING), 10000, true); |
| | | DN newPersonDN = DN.decode("uid=new person,ou=People," + TEST_ROOT_DN_STRING); |
| | | resultEntry = getEntry(newPersonDN, 10000, true); |
| | | assertNotNull(resultEntry, |
| | | "The ADD replication message was not applied"); |
| | | assertEquals(getMonitorDelta(), 1); |
| | |
| | | * To achieve this send a delete operation with a correct DN |
| | | * but a wrong unique ID. |
| | | */ |
| | | |
| | | delMsg = |
| | | new DeleteMsg("uid=new person,ou=People," + TEST_ROOT_DN_STRING, |
| | | gen.newCSN(), "11111111-9abc-def0-1234-1234567890ab"); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | delMsg = new DeleteMsg(newPersonDN, gen.newCSN(), "11111111-9abc-def0-1234-1234567890ab"); |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(delMsg); |
| | | resultEntry = getEntry( |
| | | DN.decode("uid=new person,ou=People," + TEST_ROOT_DN_STRING), 10000, true); |
| | | resultEntry = getEntry(newPersonDN, 10000, true); |
| | | |
| | | // check that the delete operation has not been applied |
| | | assertNotNull(resultEntry, |
| | |
| | | */ |
| | | |
| | | ModifyDNMsg modDnMsg = new ModifyDNMsg( |
| | | "uid=new person,ou=People," + TEST_ROOT_DN_STRING, gen.newCSN(), |
| | | newPersonDN, gen.newCSN(), |
| | | user1entryUUID, baseUUID, false, |
| | | "uid=wrong, ou=people," + TEST_ROOT_DN_STRING, |
| | | "uid=newrdn"); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modDnMsg); |
| | | |
| | |
| | | * same test but by giving a bad entry DN |
| | | */ |
| | | |
| | | modDnMsg = new ModifyDNMsg( |
| | | "uid=wrong,ou=People," + TEST_ROOT_DN_STRING, gen.newCSN(), |
| | | DN modDN = DN.decode("uid=wrong,ou=People," + TEST_ROOT_DN_STRING); |
| | | modDnMsg = new ModifyDNMsg(modDN, gen.newCSN(), |
| | | user1entryUUID, null, false, null, "uid=reallynewrdn"); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modDnMsg); |
| | | |
| | | resultEntry = getEntry( |
| | | DN.decode("uid=reallynewrdn,ou=People," + TEST_ROOT_DN_STRING), 10000, true); |
| | | DN reallyNewDN = DN.decode("uid=reallynewrdn,ou=People," + TEST_ROOT_DN_STRING); |
| | | resultEntry = getEntry(reallyNewDN, 10000, true); |
| | | |
| | | // check that the operation has been correctly relayed |
| | | assertNotNull(resultEntry, |
| | |
| | | broker.publish(addMsg); |
| | | |
| | | // check that the second entry has been added |
| | | resultEntry = getEntry(DN.decode(user1dn), 10000, true); |
| | | resultEntry = getEntry(user1dn, 10000, true); |
| | | |
| | | // check that the add operation has been applied |
| | | assertNotNull(resultEntry, "The add operation was not replayed"); |
| | |
| | | // try to rename the first entry |
| | | modDnMsg = new ModifyDNMsg(user1dn, gen.newCSN(), |
| | | user1entrysecondUUID, baseUUID, false, |
| | | baseDn.toString(), "uid=reallynewrdn"); |
| | | updateMonitorCount(baseDn, unresolvedMonitorAttr); |
| | | baseDN.toString(), "uid=reallynewrdn"); |
| | | updateMonitorCount(baseDN, unresolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modDnMsg); |
| | | |
| | |
| | | |
| | | |
| | | // delete the entries to clean the database |
| | | delMsg = |
| | | new DeleteMsg("entryUUID = " + user1entrysecondUUID + "+" + |
| | | DN.decode(user1dn).getRDN().toString() + |
| | | ",ou=People," + TEST_ROOT_DN_STRING, |
| | | gen.newCSN(), user1entrysecondUUID); |
| | | DN delDN2 = DN.decode("entryUUID = " + user1entrysecondUUID + "+" |
| | | + user1dn.getRDN() + ",ou=People," + TEST_ROOT_DN_STRING); |
| | | delMsg = new DeleteMsg(delDN2, gen.newCSN(), user1entrysecondUUID); |
| | | broker.publish(delMsg); |
| | | resultEntry = getEntry( |
| | | DN.decode("entryUUID = " + user1entrysecondUUID + "+" + |
| | | DN.decode(user1dn).getRDN().toString() + |
| | | ",ou=People," + TEST_ROOT_DN_STRING), 10000, false); |
| | | resultEntry = getEntry(delDN2, 10000, false); |
| | | |
| | | // check that the delete operation has been applied |
| | | assertNull(resultEntry, |
| | | "The DELETE replication message was not replayed"); |
| | | |
| | | delMsg = |
| | | new DeleteMsg("uid=reallynewrdn,ou=People," + TEST_ROOT_DN_STRING, |
| | | gen.newCSN(), user1entryUUID); |
| | | delMsg = new DeleteMsg(reallyNewDN, gen.newCSN(), user1entryUUID); |
| | | broker.publish(delMsg); |
| | | resultEntry = getEntry( |
| | | DN.decode("uid=reallynewrdn,ou=People," + TEST_ROOT_DN_STRING), 10000, false); |
| | | resultEntry = getEntry(reallyNewDN, 10000, false); |
| | | |
| | | // check that the delete operation has been applied |
| | | assertNull(resultEntry, |
| | |
| | | */ |
| | | |
| | | // - create parent entry 1 with baseDn1 |
| | | String[] topEntries = new String[1]; |
| | | topEntries[0] = "dn: ou=baseDn1,"+baseDn+"\n" + "objectClass: top\n" |
| | | String[] topEntries = new String[]{ |
| | | "dn: ou=baseDn1,"+baseDN+"\n" + "objectClass: top\n" |
| | | + "objectClass: organizationalUnit\n" |
| | | + "entryUUID: 55555555-5555-5555-5555-555555555555\n"; |
| | | Entry entry; |
| | | + "entryUUID: 55555555-5555-5555-5555-555555555555\n"}; |
| | | for (String entryStr : topEntries) |
| | | { |
| | | entry = TestCaseUtils.entryFromLdifString(entryStr); |
| | | Entry entry = TestCaseUtils.entryFromLdifString(entryStr); |
| | | AddOperationBasis addOp = new AddOperationBasis(connection, |
| | | InternalClientConnection.nextOperationID(), InternalClientConnection |
| | | .nextMessageID(), null, entry.getDN(), entry.getObjectClasses(), |
| | |
| | | addOp.setInternalOperation(true); |
| | | addOp.run(); |
| | | } |
| | | resultEntry = getEntry( |
| | | DN.decode("ou=baseDn1,"+baseDn), 10000, true); |
| | | assertNotNull(resultEntry, |
| | | "Entry not added: ou=baseDn1,"+baseDn); |
| | | resultEntry = getEntry(DN.decode("ou=baseDn1," + baseDN), 10000, true); |
| | | assertNotNull(resultEntry, "Entry not added: ou=baseDn1," + baseDN); |
| | | |
| | | // - create Add Msg for user1 with parent entry 1 UUID |
| | | DN newPersonDN2 = DN.decode("uid=new person,ou=baseDn1," + baseDN); |
| | | addMsg = new AddMsg(gen.newCSN(), |
| | | "uid=new person,ou=baseDn1,"+baseDn, |
| | | newPersonDN2, |
| | | user1entryUUID, |
| | | getEntryUUID(DN.decode("ou=baseDn1,"+baseDn)), |
| | | getEntryUUID(DN.decode("ou=baseDn1," + baseDN)), |
| | | personWithUUIDEntry.getObjectClassAttribute(), |
| | | personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>()); |
| | | |
| | |
| | | ModifyDNOperationBasis modDNOp = new ModifyDNOperationBasis(connection, |
| | | InternalClientConnection.nextOperationID(), InternalClientConnection |
| | | .nextMessageID(), null, |
| | | DN.decode("ou=baseDn1,"+baseDn), |
| | | DN.decode("ou=baseDN1," + baseDN), |
| | | RDN.decode("ou=baseDn2"), true, |
| | | baseDn); |
| | | baseDN); |
| | | modDNOp.run(); |
| | | |
| | | resultEntry = getEntry( |
| | | DN.decode("ou=baseDn2,"+baseDn), 10000, true); |
| | | resultEntry = getEntry(DN.decode("ou=baseDn2," + baseDN), 10000, true); |
| | | assertNotNull(resultEntry, |
| | | "Entry not moved from ou=baseDn1,"+baseDn+" to ou=baseDn2,"+baseDn); |
| | | "Entry not moved from ou=baseDn1,"+baseDN+" to ou=baseDn2,"+baseDN); |
| | | |
| | | // - add new parent entry 2 with baseDn1 |
| | | String p2 = "dn: ou=baseDn1,"+baseDn+"\n" + "objectClass: top\n" |
| | | String p2 = "dn: ou=baseDn1,"+baseDN+"\n" + "objectClass: top\n" |
| | | + "objectClass: organizationalUnit\n" |
| | | + "entryUUID: 66666666-6666-6666-6666-666666666666\n"; |
| | | entry = TestCaseUtils.entryFromLdifString(p2); |
| | | Entry entry = TestCaseUtils.entryFromLdifString(p2); |
| | | AddOperationBasis addOp = new AddOperationBasis(connection, |
| | | InternalClientConnection.nextOperationID(), InternalClientConnection |
| | | .nextMessageID(), null, entry.getDN(), entry.getObjectClasses(), |
| | |
| | | |
| | | |
| | | // - publish msg |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(addMsg); |
| | | |
| | | // - check that the DN has been changed to baseDn2 |
| | | resultEntry = getEntry( |
| | | DN.decode("uid=new person,ou=baseDn1,"+baseDn), 10000, false); |
| | | assertNull(resultEntry, |
| | | "The ADD replication message was applied under ou=baseDn1,"+baseDn); |
| | | resultEntry = getEntry(newPersonDN2, 10000, false); |
| | | assertNull(resultEntry, "The ADD replication message was applied under ou=baseDn1," + baseDN); |
| | | |
| | | resultEntry = getEntry( |
| | | DN.decode("uid=new person,ou=baseDn2,"+baseDn), 10000, true); |
| | | assertNotNull(resultEntry, |
| | | "The ADD replication message was NOT applied under ou=baseDn2,"+baseDn); |
| | | resultEntry = getEntry(DN.decode("uid=new person,ou=baseDn2," + baseDN), 10000, true); |
| | | assertNotNull(resultEntry, "The ADD replication message was NOT applied under ou=baseDn2," + baseDN); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | |
| | | // Check that there was no administrative alert generated |
| | |
| | | addEntry(domain1); |
| | | CSN olderCSN = gen.newCSN(); |
| | | Thread.sleep(1000); |
| | | domain1uid = getEntryUUID(DN.decode(domain1dn)); |
| | | domain1uid = getEntryUUID(domain1dn); |
| | | addEntry(domain2); |
| | | domain2uid = getEntryUUID(DN.decode(domain2dn)); |
| | | domain2uid = getEntryUUID(domain2dn); |
| | | addEntry(domain3); |
| | | domain3uid = getEntryUUID(DN.decode(domain3dn)); |
| | | domain3uid = getEntryUUID(domain3dn); |
| | | DN conflictDomain2dn = DN.decode( |
| | | "entryUUID = " + domain2uid + "+dc=domain2,ou=people," + TEST_ROOT_DN_STRING); |
| | | DN conflictDomain3dn = DN.decode( |
| | | "entryUUID = " + domain3uid + "+dc=domain3,ou=people," + TEST_ROOT_DN_STRING); |
| | | |
| | | updateMonitorCount(baseDn, unresolvedMonitorAttr); |
| | | updateMonitorCount(baseDN, unresolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | |
| | | // delete domain1 |
| | |
| | | broker.publish(delMsg); |
| | | |
| | | // check that the domain1 has correctly been deleted |
| | | assertNull(getEntry(DN.decode(domain1dn), 10000, false), |
| | | assertNull(getEntry(domain1dn, 10000, false), |
| | | "The DELETE replication message was not replayed"); |
| | | |
| | | // check that domain2 and domain3 have been renamed |
| | |
| | | |
| | | // check that the 2 conflicting entries have been correctly marked |
| | | assertTrue(checkEntryHasAttribute(conflictDomain2dn, |
| | | LDAPReplicationDomain.DS_SYNC_CONFLICT, domain2dn, 1000, true)); |
| | | LDAPReplicationDomain.DS_SYNC_CONFLICT, domain2dn.toString(), 1000, true)); |
| | | assertTrue(checkEntryHasAttribute(conflictDomain3dn, |
| | | LDAPReplicationDomain.DS_SYNC_CONFLICT, domain3dn, 1000, true)); |
| | | LDAPReplicationDomain.DS_SYNC_CONFLICT, domain3dn.toString(), 1000, true)); |
| | | |
| | | // check that unresolved conflict count has been incremented |
| | | assertEquals(getMonitorDelta(), 1); |
| | |
| | | // |
| | | // add domain1 entry with 2 children : domain2 and domain3 |
| | | addEntry(domain1); |
| | | domain1uid = getEntryUUID(DN.decode(domain1dn)); |
| | | domain1uid = getEntryUUID(domain1dn); |
| | | addEntry(domain2); |
| | | domain2uid = getEntryUUID(DN.decode(domain2dn)); |
| | | domain2uid = getEntryUUID(domain2dn); |
| | | CSN addCSN = addEntry(domain3); |
| | | gen.adjust(addCSN); |
| | | domain3uid = getEntryUUID(DN.decode(domain3dn)); |
| | | domain3uid = getEntryUUID(domain3dn); |
| | | |
| | | updateMonitorCount(baseDn, unresolvedMonitorAttr); |
| | | updateMonitorCount(baseDN, unresolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | |
| | | // delete domain1 |
| | |
| | | broker.publish(delMsg); |
| | | |
| | | // check that the domain1 has correctly been deleted |
| | | assertNull(getEntry(DN.decode(domain1dn), 10000, false), |
| | | assertNull(getEntry(domain1dn, 10000, false), |
| | | "The DELETE replication message was not replayed"); |
| | | |
| | | // check that domain2 and domain3 have been renamed as conflicting |
| | |
| | | |
| | | // check that the entry have been correctly marked as conflicting. |
| | | assertTrue(checkEntryHasAttribute(conflictDomain2dn, |
| | | LDAPReplicationDomain.DS_SYNC_CONFLICT, domain2dn, 1000, true)); |
| | | LDAPReplicationDomain.DS_SYNC_CONFLICT, domain2dn.toString(), 1000, true)); |
| | | |
| | | // check that unresolved conflict count has been incremented |
| | | assertEquals(getMonitorDelta(), 1); |
| | |
| | | // this is correctly detected as a resolved conflict. |
| | | // To simulate this simply try a modifyDN on a non existent uid. |
| | | modDnMsg = new ModifyDNMsg( |
| | | "uid=new person,ou=People," + TEST_ROOT_DN_STRING, gen.newCSN(), |
| | | newPersonDN, gen.newCSN(), |
| | | "33343333-3533-3633-3373-333333833333", baseUUID, false, |
| | | "uid=wrong, ou=people," + TEST_ROOT_DN_STRING, |
| | | "uid=newrdn"); |
| | | updateMonitorCount(baseDn, resolvedMonitorAttr); |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modDnMsg); |
| | | // unfortunately it is difficult to check that the operation |
| | |
| | | * Check that a conflict is detected when an entry is |
| | | * moved below an entry that does not exist. |
| | | */ |
| | | updateMonitorCount(baseDn, unresolvedMonitorAttr); |
| | | updateMonitorCount(baseDN, unresolvedMonitorAttr); |
| | | AlertCount = DummyAlertHandler.getAlertCount(); |
| | | modDnMsg = new ModifyDNMsg( |
| | | "uid=new person,ou=People," + TEST_ROOT_DN_STRING, gen.newCSN(), |
| | | newPersonDN, gen.newCSN(), |
| | | "33333333-3333-3333-3333-333333333333", |
| | | "12343333-3533-3633-3333-333333833333" , false, |
| | | "uid=wrong, ou=people," + TEST_ROOT_DN_STRING, |
| | |
| | | |
| | | // check that the entry have been correctly marked as conflicting. |
| | | assertTrue(checkEntryHasAttribute( |
| | | DN.decode("uid=new person,ou=baseDn2,"+baseDn), |
| | | DN.decode("uid=new person,ou=baseDn2," + baseDN), |
| | | LDAPReplicationDomain.DS_SYNC_CONFLICT, |
| | | "uid=newrdn,ou=baseDn2,ou=People," + TEST_ROOT_DN_STRING, 1000, true)); |
| | | } |
| | |
| | | // Cleanup from previous run |
| | | cleanupTest(); |
| | | |
| | | final DN baseDn = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDn, 27, 100, replServerPort, 2000, true); |
| | | openReplicationSession(baseDN, 27, 100, replServerPort, 2000, true); |
| | | |
| | | try { |
| | | CSNGenerator gen = new CSNGenerator( 27, 0); |
| | |
| | | assertTrue(OperationType.ADD.compareTo(receivedOp.getOperationType()) == 0, |
| | | "The received replication message is not an ADD msg : " + addMsg); |
| | | |
| | | assertEquals(DN.decode(addMsg.getDn()),personEntry.getDN(), |
| | | "The received ADD replication message is not for the excepted DN : " + addMsg); |
| | | assertEquals(addMsg.getDN(), personEntry.getDN(), |
| | | "The received ADD replication message is not for the excepted DN : " + addMsg); |
| | | } |
| | | |
| | | // Modify the entry |
| | |
| | | ModifyMsg modMsg = (ModifyMsg) msg; |
| | | |
| | | modMsg.createOperation(connection); |
| | | assertTrue(DN.decode(modMsg.getDn()).compareTo(personEntry.getDN()) == 0, |
| | | assertEquals(modMsg.getDN(), personEntry.getDN(), |
| | | "The received MODIFY replication message is not for the excepted DN : " + modMsg); |
| | | |
| | | // Modify the entry DN |
| | | DN newDN = DN.decode("uid= new person,ou=People," + TEST_ROOT_DN_STRING) ; |
| | | DN newDN = DN.decode("uid= new person,ou=People," + TEST_ROOT_DN_STRING); |
| | | ModifyDNOperationBasis modDNOp = new ModifyDNOperationBasis(connection, |
| | | InternalClientConnection.nextOperationID(), InternalClientConnection |
| | | .nextMessageID(), null, personEntry.getDN(), RDN |
| | |
| | | ModifyDNMsg moddnMsg = (ModifyDNMsg) msg; |
| | | moddnMsg.createOperation(connection); |
| | | |
| | | assertTrue(DN.decode(moddnMsg.getDn()).compareTo(personEntry.getDN()) == 0, |
| | | assertEquals(moddnMsg.getDN(), personEntry.getDN(), |
| | | "The received MODIFY_DN message is not for the excepted DN : " + moddnMsg); |
| | | |
| | | // Delete the entry |
| | | DeleteOperationBasis delOp = new DeleteOperationBasis(connection, |
| | | InternalClientConnection.nextOperationID(), InternalClientConnection |
| | | .nextMessageID(), null, DN |
| | | .decode("uid= new person,ou=People," + TEST_ROOT_DN_STRING)); |
| | | .nextMessageID(), null, newDN); |
| | | delOp.run(); |
| | | assertFalse(DirectoryServer.entryExists(newDN), |
| | | "Unable to delete the new person Entry"); |
| | |
| | | "The received replication message is not a MODIFY DN msg : " + msg); |
| | | DeleteMsg delMsg = (DeleteMsg) msg; |
| | | delMsg.createOperation(connection); |
| | | assertTrue(DN.decode(delMsg.getDn()).compareTo(DN |
| | | .decode("uid= new person,ou=People," + TEST_ROOT_DN_STRING)) == 0, |
| | | assertEquals(delMsg.getDN(), newDN, |
| | | "The received DELETE message is not for the excepted DN : " + delMsg); |
| | | |
| | | /* |
| | |
| | | * Start by testing the Add message reception |
| | | */ |
| | | AddMsg addMsg = new AddMsg(gen.newCSN(), |
| | | personWithUUIDEntry.getDN().toString(), |
| | | personWithUUIDEntry.getDN(), |
| | | user1entryUUID, baseUUID, |
| | | personWithUUIDEntry.getObjectClassAttribute(), |
| | | personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>()); |
| | |
| | | /* |
| | | * Test the Reception of Modify Dn Msg |
| | | */ |
| | | moddnMsg = new ModifyDNMsg(personWithUUIDEntry.getDN().toString(), |
| | | moddnMsg = new ModifyDNMsg(personWithUUIDEntry.getDN(), |
| | | gen.newCSN(), |
| | | user1entryUUID, null, |
| | | true, null, "uid= new person"); |
| | |
| | | moddnMsg.setAssured(true); |
| | | broker.publish(moddnMsg); |
| | | |
| | | resultEntry = getEntry( |
| | | DN.decode("uid= new person,ou=People," + TEST_ROOT_DN_STRING), 10000, true); |
| | | resultEntry = getEntry(newDN, 10000, true); |
| | | |
| | | assertNotNull(resultEntry, |
| | | "The modify DN replication message was not applied"); |
| | |
| | | /* |
| | | * Test the Reception of Delete Msg |
| | | */ |
| | | delMsg = new DeleteMsg("uid= new person,ou=People," + TEST_ROOT_DN_STRING, |
| | | gen.newCSN(), user1entryUUID); |
| | | delMsg = new DeleteMsg(newDN, gen.newCSN(), user1entryUUID); |
| | | if (assured) |
| | | delMsg.setAssured(true); |
| | | broker.publish(delMsg); |
| | | resultEntry = getEntry( |
| | | DN.decode("uid= new person,ou=People," + TEST_ROOT_DN_STRING), 10000, false); |
| | | resultEntry = getEntry(newDN, 10000, false); |
| | | |
| | | assertNull(resultEntry, |
| | | "The DELETE replication message was not replayed"); |
| | |
| | | logError(Message.raw(Category.SYNC, Severity.INFORMATION, |
| | | "Starting replication test : infiniteReplayLoop")); |
| | | |
| | | final DN baseDn = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | |
| | | // Clean replication server database from previous run |
| | | cleanUpReplicationServersDB(); |
| | | |
| | | Thread.sleep(2000); |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDn, 11, 100, replServerPort, 1000, true); |
| | | openReplicationSession(baseDN, 11, 100, replServerPort, 1000, true); |
| | | try |
| | | { |
| | | CSNGenerator gen = new CSNGenerator( 11, 0); |
| | |
| | | addOp.run(); |
| | | assertEquals(addOp.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | long initialCount = getMonitorAttrValue(baseDn, "replayed-updates"); |
| | | long initialCount = getMonitorAttrValue(baseDN, "replayed-updates"); |
| | | |
| | | // Get the UUID of the test entry. |
| | | Entry resultEntry = getEntry(tmp.getDN(), 1, true); |
| | |
| | | try |
| | | { |
| | | // Publish a delete message for this test entry. |
| | | DeleteMsg delMsg = new DeleteMsg(tmp.getDN().toString(), |
| | | gen.newCSN(), |
| | | uuid); |
| | | DeleteMsg delMsg = new DeleteMsg(tmp.getDN(), gen.newCSN(), uuid); |
| | | broker.publish(delMsg); |
| | | |
| | | // Wait for the operation to be replayed. |
| | | long endTime = System.currentTimeMillis() + 5000; |
| | | while (getMonitorAttrValue(baseDn, "replayed-updates") == initialCount && |
| | | while (getMonitorAttrValue(baseDN, "replayed-updates") == initialCount && |
| | | System.currentTimeMillis() < endTime) |
| | | { |
| | | Thread.sleep(100); |
| | |
| | | |
| | | // If the replication replay loop was detected and broken then the |
| | | // counter will still be updated even though the replay was unsuccessful. |
| | | if (getMonitorAttrValue(baseDn, "replayed-updates") == initialCount) |
| | | if (getMonitorAttrValue(baseDN, "replayed-updates") == initialCount) |
| | | { |
| | | fail("Operation was not replayed"); |
| | | } |
| | |
| | | * @param enable Specifies whether the receive status should be enabled |
| | | * or disabled. |
| | | */ |
| | | private static void setReceiveStatus(String syncConfigDN, boolean enable) |
| | | private static void setReceiveStatus(DN syncConfigDN, boolean enable) |
| | | { |
| | | ArrayList<ByteString> valueList = new ArrayList<ByteString>(1); |
| | | if (enable) |
| | | { |
| | | valueList.add(ByteString.valueOf("TRUE")); |
| | | } |
| | | else |
| | | { |
| | | valueList.add(ByteString.valueOf("FALSE")); |
| | | } |
| | | valueList.add(ByteString.valueOf(enable ? "TRUE" : "FALSE")); |
| | | LDAPAttribute a = new LDAPAttribute("ds-cfg-receive-status", valueList); |
| | | |
| | | LDAPModification m = new LDAPModification(ModificationType.REPLACE, a); |
| | | |
| | | ArrayList<RawModification> modList = new ArrayList<RawModification>(1); |
| | | List<RawModification> modList = new ArrayList<RawModification>(1); |
| | | modList.add(m); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ByteString rawEntryDN = |
| | | ByteString.valueOf(syncConfigDN); |
| | | InternalClientConnection conn = InternalClientConnection.getRootConnection(); |
| | | ByteString rawEntryDN = ByteString.valueOf(syncConfigDN.toString()); |
| | | ModifyOperation internalModify = conn.processModify(rawEntryDN, modList); |
| | | |
| | | ResultCode resultCode = internalModify.getResultCode(); |
| | |
| | | logError(Message.raw(Category.SYNC, Severity.INFORMATION, |
| | | "Starting synchronization test : CSNGeneratorAdjust")); |
| | | |
| | | final DN baseDn = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | |
| | | // Clean replication server database from previous run |
| | | cleanUpReplicationServersDB(); |
| | |
| | | * This must use a different serverId to that of the directory server. |
| | | */ |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDn, serverId, 100, replServerPort, 1000, true); |
| | | openReplicationSession(baseDN, serverId, 100, replServerPort, 1000, true); |
| | | |
| | | try |
| | | { |
| | |
| | | // Create and publish an update message to add an entry. |
| | | AddMsg addMsg = new AddMsg( |
| | | gen.newCSN(), |
| | | user3dn.toString(), |
| | | user3dn, |
| | | user3UUID, |
| | | baseUUID, |
| | | user3Entry.getObjectClassAttribute(), |
| | |
| | | "The MOD timestamp should have been adjusted to the ADD one"); |
| | | |
| | | // Delete the entries to clean the database. |
| | | DeleteMsg delMsg = |
| | | new DeleteMsg( |
| | | user3Entry.getDN().toString(), |
| | | gen.newCSN(), |
| | | user3UUID); |
| | | DeleteMsg delMsg = new DeleteMsg(user3Entry.getDN(), gen.newCSN(), user3UUID); |
| | | broker.publish(delMsg); |
| | | |
| | | // Check that the delete operation has been applied. |