Fix to OPENDJ-274, resolve remaining nightly unit test failure with modifications of single valued attributes.
Tidy up some of the unit-tests around that area, adding more controls, making sure tests stop services on failure and reducing time to run.
| | |
| | | break; |
| | | |
| | | case REPLACE: |
| | | if ((changeNumber.older(deleteTime)) |
| | | && ((addTime == null) || (changeNumber.older(addTime)))) |
| | | if (changeNumber.older(deleteTime)) |
| | | { |
| | | conflict = true; |
| | | modsIterator.remove(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.replication; |
| | |
| | | openReplicationSession(baseDn, 2, 100, replServerPort, 1000, true); |
| | | |
| | | |
| | | try |
| | | { |
| | | /* |
| | | * Create a Change number generator to generate new changenumbers |
| | | * when we need to send operation messages to the replicationServer. |
| | |
| | | // Check that the entry has not been created in the directory server. |
| | | resultEntry = getEntry(personWithUUIDEntry.getDN(), 1000, true); |
| | | assertNull(resultEntry, |
| | | "The replication message was replayed while the server " + |
| | | "receive status was disabled"); |
| | | "The replication message was replayed while the server " |
| | | + "receive status was disabled"); |
| | | |
| | | // Enable the directory server receive status. |
| | | setReceiveStatus(synchroServerEntry.getDN().toString(), true); |
| | |
| | | // Check that the entry has been created in the directory server. |
| | | resultEntry = getEntry(personWithUUIDEntry.getDN(), 10000, true); |
| | | assertNotNull(resultEntry, |
| | | "The replication message was not replayed after the server " + |
| | | "receive status was enabled"); |
| | | "The replication message was not replayed after the server " |
| | | + "receive status was enabled"); |
| | | |
| | | // Delete the entries to clean the database. |
| | | DeleteMsg delMsg = |
| | |
| | | // Check that the delete operation has been applied. |
| | | assertNull(resultEntry, |
| | | "The DELETE replication message was not replayed"); |
| | | } |
| | | finally |
| | | { |
| | | broker.stop(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Tests whether the synchronization provider fails over when it loses |
| | |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDn, 2, 100, replServerPort, 1000, true); |
| | | |
| | | |
| | | try |
| | | { |
| | | /* |
| | | * Create a Change number generator to generate new changenumbers |
| | | * when we need to send operation messages to the replicationServer. |
| | |
| | | // Check that the delete operation has been applied. |
| | | assertNull(resultEntry, |
| | | "The DELETE replication message was not replayed"); |
| | | } |
| | | finally |
| | | { |
| | | broker.stop(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Tests the modify conflict resolution code. |
| | |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDn, 2, 100, replServerPort, 1000, true); |
| | | |
| | | try |
| | | { |
| | | // Add the first test entry. |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=test1," + baseDn.toString(), |
| | |
| | | "objectClass: organizationalPerson", |
| | | "objectClass: inetOrgPerson", |
| | | "cn: test1", |
| | | "sn: test" |
| | | ); |
| | | "sn: test"); |
| | | |
| | | // Read the entry back to get its UUID. |
| | | Entry entry = DirectoryServer.getEntry(dn1); |
| | |
| | | entry = DirectoryServer.getEntry(dn1); |
| | | attrs = entry.getAttribute(attrType); |
| | | |
| | | // there should not be a value (delete at time t1) |
| | | // there should not be a value (delete at time t2) |
| | | assertNull(attrs); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | |
| | | } |
| | | finally |
| | | { |
| | | broker.stop(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDn, 2, 100, replServerPort, 1000, true); |
| | | |
| | | try |
| | | { |
| | | /* |
| | | * Create a Change number generator to generate new changenumbers |
| | | * when we need to send operations messages to the replicationServer. |
| | |
| | | DN.decode("uid=new person,ou=baseDn2,"+baseDn), |
| | | LDAPReplicationDomain.DS_SYNC_CONFLICT, |
| | | "uid=newrdn,ou=baseDn2,ou=People," + TEST_ROOT_DN_STRING, 1000, true)); |
| | | |
| | | } |
| | | finally |
| | | { |
| | | broker.stop(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Check that the given entry does contain the attribute that mark the |
| | |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDn, serverId, 100, replServerPort, 1000, true); |
| | | |
| | | try |
| | | { |
| | | /* |
| | | * Create a Change number generator to generate new changenumbers |
| | | * when we need to send operation messages to the replicationServer. |
| | |
| | | resultEntry = getEntry(user3Entry.getDN(), 10000, false); |
| | | assertNull(resultEntry, |
| | | "The DELETE replication message was not replayed"); |
| | | } |
| | | finally |
| | | { |
| | | broker.stop(); |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.replication.plugin; |
| | |
| | | mod = new Modification(ModificationType.ADD, attr); |
| | | publishModify(broker, t2, dn1, entryuuid, mod); |
| | | |
| | | Thread.sleep(2000); |
| | | |
| | | // Simulate the reverse ordering t2:add:B followed by t1:add:A that |
| | | // would happen on the other server. |
| | | |
| | |
| | | |
| | | addEntriesWithHistorical(1, entryCnt); |
| | | |
| | | /* |
| | | // every entry should have its hist |
| | | try |
| | | { |
| | | // Search for matching entries in config backend |
| | | InternalSearchOperation op = connection.processSearch( |
| | | ByteString.valueOf(TEST_ROOT_DN_STRING), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | LDAPFilter.decode("(ds-sync-hist=*)")); |
| | | assertEquals(op.getResultCode(), ResultCode.SUCCESS, |
| | | op.getErrorMessage().toString()); |
| | | |
| | | // Check that no entries have been found |
| | | LinkedList<SearchResultEntry> entries = op.getSearchEntries(); |
| | | assertTrue(entries != null); |
| | | assertEquals(entries.size(), entryCnt); |
| | | } catch (Exception e) |
| | | { |
| | | fail("assertNoConfigEntriesWithFilter: could not search config backend" + e.getMessage()); |
| | | } |
| | | */ |
| | | |
| | | // set the purge delay to 1 sec |
| | | TestCaseUtils.dsconfig( |
| | | "set-replication-domain-prop", |
| | | "--provider-name","Multimaster Synchronization", |
| | | "--domain-name",testName, |
| | | "--set","conflicts-historical-purge-delay:1m"); |
| | | "--set","conflicts-historical-purge-delay:1s"); |
| | | |
| | | Thread.sleep(60*1000); |
| | | Thread.sleep(2*1000); |
| | | |
| | | // launch the purge |
| | | Entry taskInit = TestCaseUtils.makeEntry( |
| | |
| | | "objectclass: ds-task-purge-conflicts-historical", |
| | | "ds-task-class-name: org.opends.server.tasks.PurgeConflictsHistoricalTask", |
| | | "ds-task-purge-conflicts-historical-domain-dn: "+TEST_ROOT_DN_STRING, |
| | | "ds-task-purge-conflicts-historical-maximum-duration: 1000"); // 1000 sec |
| | | "ds-task-purge-conflicts-historical-maximum-duration: 120"); // 120 sec |
| | | |
| | | addTask(taskInit, ResultCode.SUCCESS, null); |
| | | |
| | |
| | | testModify(entry, hist, DISPLAYNAME, ModificationType.ADD, "new value", |
| | | 11, false); |
| | | |
| | | List<Attribute> attrs = entry.getAttribute(DISPLAYNAME); |
| | | Attribute attr = attrs.get(0); |
| | | assertEquals(1, attr.size()); |
| | | attr.contains(AttributeValues.create(attr.getAttributeType(), "init value")); |
| | | } |
| | | |
| | | /** |
| | |
| | | testModify(entry, hist, DISPLAYNAME, ModificationType.REPLACE, |
| | | "older value", 1, true); |
| | | |
| | | List<Attribute> attrs = entry.getAttribute(DISPLAYNAME); |
| | | Attribute attr = attrs.get(0); |
| | | assertEquals(1, attr.size()); |
| | | attr.contains(AttributeValues.create(attr.getAttributeType(), "older value")); |
| | | |
| | | /* |
| | | * Now simulate a replace at a later date. |
| | | * Conflict resolution should keept it. |
| | | */ |
| | | testModify(entry, hist, DISPLAYNAME, ModificationType.REPLACE, |
| | | "older value", 3, true); |
| | | "newer value", 3, true); |
| | | |
| | | attrs = entry.getAttribute(DISPLAYNAME); |
| | | attr = attrs.get(0); |
| | | assertEquals(1, attr.size()); |
| | | attr.contains(AttributeValues.create(attr.getAttributeType(), "newer value")); |
| | | |
| | | } |
| | | |