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

gbellato
11.37.2006 7238fabbda067ee75b8d4f6162059e8c2d63ba1c
add tests for the limited assured replication that is currently implemented
1 files modified
31 ■■■■ changed files
opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/UpdateOperationTest.java 31 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/UpdateOperationTest.java
@@ -56,6 +56,7 @@
import org.opends.server.types.RDN;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
@@ -627,14 +628,21 @@
    broker.stop();
  }
  @DataProvider(name="assured")
  public Object[][] getAssuredFlag()
  {
    return new Object[][] { { false }, {true} };
  }
  /**
   * Tests done using directly the ChangelogBroker interface.
   */
  @Test(enabled=true)
  public void updateOperations() throws Exception
  @Test(enabled=true, dataProvider="assured")
  public void updateOperations(boolean assured) throws Exception
  {
    final DN baseDn = DN.decode("ou=People,dc=example,dc=com");
    cleanEntries();
    ChangelogBroker broker = openChangelogSession(baseDn, (short) 3);
    ChangeNumberGenerator gen = new ChangeNumberGenerator((short) 3, 0);
@@ -642,7 +650,7 @@
     * loop receiving update until there is nothing left
     * to make sure that message from previous tests have been consumed.
     */
    broker.setSoTimeout(100);
    // broker.setSoTimeout(100);
    try
    {
      while (true)
@@ -652,7 +660,7 @@
     }
    catch (Exception e)
    {
      broker.setSoTimeout(1000);
     // broker.setSoTimeout(1000);
    }
    /*
     * Test that operations done on this server are sent to the
@@ -660,11 +668,12 @@
     */
    // Create an Entry (add operation)
    Entry tmp = personEntry.duplicate();
    AddOperation addOp = new AddOperation(connection,
        InternalClientConnection.nextOperationID(), InternalClientConnection
        .nextMessageID(), null, personEntry.getDN(), personEntry
        .getObjectClasses(), personEntry.getUserAttributes(), personEntry
        .getOperationalAttributes());
        .nextMessageID(), null, tmp.getDN(),
        tmp.getObjectClasses(), tmp.getUserAttributes(),
        tmp.getOperationalAttributes());
    addOp.run();
    entryList.add(personEntry);
    assertNotNull(DirectoryServer.getEntry(personEntry.getDN()),
@@ -758,6 +767,8 @@
        user1entryUUID, baseUUID,
        personWithUUIDEntry.getObjectClassAttribute(),
        personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>());
    if (assured)
      addMsg.setAssured();
    broker.publish(addMsg);
    /*
@@ -773,6 +784,8 @@
     */
    modMsg = new ModifyMsg(gen.NewChangeNumber(), personWithUUIDEntry.getDN(),
                           mods, user1entryUUID);
    if (assured)
      modMsg.setAssured();
    broker.publish(modMsg);
    boolean found = checkEntryHasAttribute(personWithUUIDEntry.getDN(),
@@ -788,6 +801,8 @@
                           gen.NewChangeNumber(),
                           user1entryUUID, null,
                           true, null, "uid= new person");
    if (assured)
      moddnMsg.setAssured();
    broker.publish(moddnMsg);
    resultEntry = getEntry(
@@ -801,6 +816,8 @@
     */
    delMsg = new DeleteMsg("uid= new person,ou=People,dc=example,dc=com",
                           gen.NewChangeNumber(), user1entryUUID);
    if (assured)
      delMsg.setAssured();
    broker.publish(delMsg);
    resultEntry = getEntry(
          DN.decode("uid= new person,ou=People,dc=example,dc=com"), 1000, false);