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

gbellato
14.25.2007 e309a1a31f3493fd553b4633cc751d0bbca5a117
Fix small problems in the unit tests where 
- port number was wrong
- return values were not tested before they were used leading to occasional failure of tests.
2 files modified
36 ■■■■■ changed files
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java 32 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java 4 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
@@ -70,6 +70,7 @@
import org.opends.server.types.LockManager;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeValue;
import org.opends.server.util.TimeThread;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
@@ -362,13 +363,23 @@
  protected long getReplayedUpdatesCount(DN syncDN) throws Exception
  {
    String monitorFilter =
         "(&(cn=synchronization*)(base-dn=" + syncDN + "))";
         "(&(cn=replication*)(base-dn=" + syncDN + "))";
    InternalSearchOperation op;
    op = connection.processSearch(
         ByteStringFactory.create("cn=monitor"),
         SearchScope.SINGLE_LEVEL,
         LDAPFilter.decode(monitorFilter));
    int count = 0;
    do
    {
      if (count++>0)
        TimeThread.sleep(100);
      op = connection.processSearch(
                                    ByteStringFactory.create("cn=monitor"),
                                    SearchScope.SINGLE_LEVEL,
                                    LDAPFilter.decode(monitorFilter));
    }
    while (op.getSearchEntries().isEmpty() && (count<100));
    if (op.getSearchEntries().isEmpty())
      throw new Exception("Could not read monitoring information");
    SearchResultEntry entry = op.getSearchEntries().getFirst();
    AttributeType attrType =
@@ -414,11 +425,14 @@
        if (newEntry != null)
        {
          List<Attribute> tmpAttrList = newEntry.getAttribute(attrTypeStr);
          Attribute tmpAttr = tmpAttrList.get(0);
          if ((tmpAttrList != null) && (!tmpAttrList.isEmpty()))
          {
            Attribute tmpAttr = tmpAttrList.get(0);
          AttributeType attrType =
            DirectoryServer.getAttributeType(attrTypeStr, true);
          found = tmpAttr.hasValue(new AttributeValue(attrType, valueString));
            AttributeType attrType =
              DirectoryServer.getAttributeType(attrTypeStr, true);
            found = tmpAttr.hasValue(new AttributeValue(attrType, valueString));
          }
        }
      }
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java
@@ -829,7 +829,7 @@
    cleanRealEntries();
    ReplicationBroker broker =
      openReplicationSession(baseDn, (short) 27, 100, 8989, 1000, true);
      openReplicationSession(baseDn, (short) 27, 100, replServerPort, 1000, true);
    try {
      ChangeNumberGenerator gen = new ChangeNumberGenerator((short) 27, 0);
@@ -1100,7 +1100,7 @@
    Thread.sleep(2000);
    ReplicationBroker broker =
      openReplicationSession(baseDn, (short) 11, 100, 8989, 1000, true);
      openReplicationSession(baseDn, (short) 11, 100, replServerPort, 1000, true);
    try
    {
      ChangeNumberGenerator gen = new ChangeNumberGenerator((short) 11, 0);