| | |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2023-2026 3A Systems, LLC |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | * Tests whether the synchronization provider fails over when it loses |
| | | * the heartbeat from the replication server. |
| | | */ |
| | | @Test(groups = "slow") |
| | | @Test |
| | | public void lostHeartbeatFailover() throws Exception |
| | | { |
| | | testSetUp("lostHeartbeatFailover"); |
| | |
| | | * It then uses this session to simulate conflicts and therefore |
| | | * test the modify conflict resolution code. |
| | | */ |
| | | @Test(enabled=true, groups="slow") |
| | | @Test(enabled=true) |
| | | public void modifyConflicts() throws Exception |
| | | { |
| | | testSetUp("modifyConflicts"); |
| | |
| | | attrs = entry.getAllAttributes(attrType); |
| | | |
| | | // there should not be a value (delete at time t2) |
| | | assertNull(attrs); |
| | | Assertions.assertThat(attrs).isEmpty(); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | } |
| | | finally |
| | |
| | | } |
| | | |
| | | /** |
| | | * Waits for the replay thread to update the monitored counter: reading the |
| | | * monitor immediately after publishing a message races with the replay. |
| | | */ |
| | | private void waitForMonitorDelta(final long expectedDelta) throws Exception |
| | | { |
| | | final long[] total = { 0 }; |
| | | TestTimer timer = new TestTimer.Builder() |
| | | .maxSleep(30, SECONDS) |
| | | .sleepTimes(100, MILLISECONDS) |
| | | .toTimer(); |
| | | timer.repeatUntilSuccess(new CallableVoid() |
| | | { |
| | | @Override |
| | | public void call() throws Exception |
| | | { |
| | | total[0] += getMonitorDelta(); |
| | | assertEquals(total[0], expectedDelta); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * Tests the naming conflict resolution code. |
| | | * In this test, the local server act both as an LDAP server and |
| | | * a replicationServer that are inter-connected. |
| | |
| | | * It then uses this session to simulate conflicts and therefore |
| | | * test the naming conflict resolution code. |
| | | */ |
| | | @Test(enabled=true, groups="slow") |
| | | @Test(enabled=true) |
| | | public void namingConflicts() throws Exception |
| | | { |
| | | testSetUp("namingConflicts"); |
| | |
| | | // check that the delete operation has not been applied |
| | | assertNotNull(getEntry(newPersonDN, 10000, true), |
| | | "The DELETE replication message was replayed when it should not"); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | // The entry already exists, so the getEntry() call above does not wait |
| | | // for the replay: poll the monitor until the replay thread has resolved |
| | | // the conflict. |
| | | waitForMonitorDelta(1); |
| | | assertConflictAutomaticallyResolved(alertCount); |
| | | |
| | | |