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

Jean-Noel Rouvignac
17.50.2013 ab7ae2fd06d636915199bf9ca5804f2a0a41fa66
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/GenerationIdTest.java
@@ -660,7 +660,7 @@
      debugInfo(testCase + " ** TEST ** The part of the topology with the right gen ID should work well");
      // Now create a change that must be replicated
      assertConnectedToReplicationDomain();
      waitConnectionToReplicationDomain(baseDN, 1000);
      addTestEntriesToDB(createEntry(UUID.randomUUID()));
      // Verify that RS1 does contain the change related to this ADD.
@@ -766,7 +766,7 @@
          "Expecting that DS3 with old gen ID is in bad gen id from RS1");
      debugInfo("Add entries to DS1, update should not be sent to DS2 and DS3 that are in bad gen id");
      assertConnectedToReplicationDomain();
      waitConnectionToReplicationDomain(baseDN, 1000);
      addTestEntriesToDB(createEntry(UUID.randomUUID()));
      debugInfo("RS1 must have stored that update.");
@@ -861,11 +861,25 @@
    }
  }
  private void assertConnectedToReplicationDomain()
  /**
   * Waits for the connection from server1 to the replication domain to
   * establish itself up automagically.
   */
  private void waitConnectionToReplicationDomain(DN baseDN, int timeout)
  {
    long start = System.currentTimeMillis();
    while (System.currentTimeMillis() - start <= timeout)
    {
      LDAPReplicationDomain domain = MultimasterReplication.findDomain(baseDN, null);
      if (domain != null && domain.isConnected())
      {
        break;
      }
    }
    assertTrue(MultimasterReplication.findDomain(baseDN, null).isConnected(),
        "The server should be connected to replication domain" + baseDN
            + " at this point");
        "After waiting " + (System.currentTimeMillis() - start)
            + " ms, server should have been connected to replication domain "
            + baseDN);
  }
  private Entry createSetGenerationIdTask(Long genId, String additionalAttribute) throws Exception
@@ -1065,7 +1079,7 @@
      assertEquals(readGenIdFromSuffixRootEntry(), -1,
          "genId attribute should not be retrievable since there are NO entry in the backend");
      assertConnectedToReplicationDomain();
      waitConnectionToReplicationDomain(baseDN, 1000);
      addTestEntriesToDB(updatedEntries);
      assertEquals(readGenIdFromSuffixRootEntry(), EMPTY_DN_GENID,
          "genId attribute should be retrievable since there IS one entry in the backend");