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

gbellato
08.41.2007 3229ddd0bfacb4e49a48275dce3befb1aab0a535
Fix some synchronization tests so that they don't fail anymore when trying
to add an entry that already exist.

Also suppress a spurious println forgotten in a previous commit.
3 files modified
49 ■■■■■ changed files
opends/src/server/org/opends/server/synchronization/plugin/SynchronizationDomain.java 1 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/StressTest.java 19 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/UpdateOperationTest.java 29 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/synchronization/plugin/SynchronizationDomain.java
@@ -1948,7 +1948,6 @@
                          modifications);
    ChangeNumber cn = generateChangeNumber(op);
    System.out.println("cn is " + cn);
    OperationContext ctx = new ModifyContext(cn, "schema");
    op.setAttachment(SYNCHROCONTEXT, ctx);
    op.setResultCode(ResultCode.SUCCESS);
opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/StressTest.java
@@ -32,12 +32,14 @@
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import org.opends.server.TestCaseUtils;
import org.opends.server.TestErrorLogger;
import org.opends.server.api.MonitorProvider;
import org.opends.server.config.ConfigEntry;
import org.opends.server.config.ConfigException;
@@ -131,19 +133,22 @@
      entryList.add(personEntry.getDN());
      assertTrue(DirectoryServer.entryExists(personEntry.getDN()),
        "The Add Entry operation failed");
      if (ResultCode.SUCCESS == addOp.getResultCode())
      {
        // Check if the client has received the msg
        SynchronizationMessage msg = broker.receive();
      // Check if the client has received the msg
      SynchronizationMessage msg = broker.receive();
      assertTrue(msg instanceof AddMsg,
        assertTrue(msg instanceof AddMsg,
        "The received synchronization message is not an ADD msg");
      AddMsg addMsg =  (AddMsg) msg;
        AddMsg addMsg =  (AddMsg) msg;
      Operation receivedOp = addMsg.createOperation(connection);
      assertTrue(OperationType.ADD.compareTo(receivedOp.getOperationType()) == 0,
        Operation receivedOp = addMsg.createOperation(connection);
        assertTrue(OperationType.ADD.compareTo(receivedOp.getOperationType()) == 0,
        "The received synchronization message is not an ADD msg");
      assertEquals(DN.decode(addMsg.getDn()),personEntry.getDN(),
        assertEquals(DN.decode(addMsg.getDn()),personEntry.getDN(),
        "The received ADD synchronization message is not for the excepted DN");
      }
      reader = new BrokerReader(broker);
      reader.start();
opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/UpdateOperationTest.java
@@ -855,18 +855,21 @@
      assertTrue(DirectoryServer.entryExists(personEntry.getDN()),
      "The Add Entry operation failed");
      // Check if the client has received the msg
      SynchronizationMessage msg = broker.receive();
      assertTrue(msg instanceof AddMsg,
      "The received synchronization message is not an ADD msg");
      AddMsg addMsg =  (AddMsg) msg;
      if (ResultCode.SUCCESS.equals(addOp.getResultCode()))
      {
        // Check if the client has received the msg
        SynchronizationMessage msg = broker.receive();
        assertTrue(msg instanceof AddMsg,
        "The received synchronization message is not an ADD msg");
        AddMsg addMsg =  (AddMsg) msg;
      Operation receivedOp = addMsg.createOperation(connection);
      assertTrue(OperationType.ADD.compareTo(receivedOp.getOperationType()) == 0,
      "The received synchronization message is not an ADD msg");
        Operation receivedOp = addMsg.createOperation(connection);
        assertTrue(OperationType.ADD.compareTo(receivedOp.getOperationType()) == 0,
        "The received synchronization message is not an ADD msg");
      assertEquals(DN.decode(addMsg.getDn()),personEntry.getDN(),
      "The received ADD synchronization message is not for the excepted DN");
        assertEquals(DN.decode(addMsg.getDn()),personEntry.getDN(),
        "The received ADD synchronization message is not for the excepted DN");
      }
      // Modify the entry
      List<Modification> mods = generatemods("telephonenumber", "01 02 45");
@@ -878,12 +881,12 @@
      modOp.run();
      // See if the client has received the msg
      msg = broker.receive();
      SynchronizationMessage msg = broker.receive();
      assertTrue(msg instanceof ModifyMsg,
      "The received synchronization message is not a MODIFY msg");
      ModifyMsg modMsg = (ModifyMsg) msg;
      receivedOp = modMsg.createOperation(connection);
      Operation receivedOp = modMsg.createOperation(connection);
      assertTrue(DN.decode(modMsg.getDn()).compareTo(personEntry.getDN()) == 0,
      "The received MODIFY synchronization message is not for the excepted DN");
@@ -935,7 +938,7 @@
       *
       * Start by testing the Add message reception
       */
      addMsg = new AddMsg(gen.NewChangeNumber(),
      AddMsg addMsg = new AddMsg(gen.NewChangeNumber(),
          personWithUUIDEntry.getDN().toString(),
          user1entryUUID, baseUUID,
          personWithUUIDEntry.getObjectClassAttribute(),