Package org.nasutekds.server.replication.common

Examples of org.nasutekds.server.replication.common.ChangeNumber


        replicationServer.getReplicationServerDomain(TEST_ROOT_DN_STRING, false);

      // The replication changelog is empty
      long count = rsdtest.getEligibleCount(
          new ServerState(),
          new ChangeNumber(TimeThread.getTime(), 1, 1201));
      assertEquals(count, 0);

      // Creates broker on o=test
      ReplicationBroker server01 = openReplicationSession(
          DN.decode(TEST_ROOT_DN_STRING)1201,
          1000, replicationServerPort,
          brokerSessionTimeout, true);

      // Publish one first message
      ChangeNumber cn1 = new ChangeNumber(TimeThread.getTime(), 1, 1201);
      DeleteMsg delMsg =
        new DeleteMsg("uid="+tn+"1," + TEST_ROOT_DN_STRING, cn1,
            user1entryUUID);
      server01.publish(delMsg);
      debugInfo(tn, " publishes " + delMsg.getChangeNumber());
      sleep(300);

      // From begin to now : 1 change
      count = rsdtest.getEligibleCount(
          new ServerState(),
          new ChangeNumber(TimeThread.getTime(), 1, 1201));
      assertEquals(count, 1);

      // Publish one second message
      ChangeNumber cn2 = new ChangeNumber(TimeThread.getTime(), 2, 1201);
      delMsg =
        new DeleteMsg("uid="+tn+"1," + TEST_ROOT_DN_STRING, cn2,
            user1entryUUID);
      server01.publish(delMsg);
      debugInfo(tn, " publishes " + delMsg.getChangeNumber());
      sleep(300);

      // From begin to now : 2 changes
      count = rsdtest.getEligibleCount(
          new ServerState(),
          new ChangeNumber(TimeThread.getTime(), 1, 1201));
      assertEquals(count, 2);

      // From begin to first change (inclusive) : 1 change = cn1
      count = rsdtest.getEligibleCount(
          new ServerState(),  cn1);
      assertEquals(count, 1);

      ServerState ss = new ServerState();
      ss.update(cn1);
     
      // From state/cn1(exclusive) to cn1 (inclusive) : 0 change
      count = rsdtest.getEligibleCount(ss, cn1);
      assertEquals(count, 0);

      // From state/cn1(exclusive) to cn2 (inclusive) : 1 change = cn2
      count = rsdtest.getEligibleCount(ss, cn2);
      assertEquals(count, 1);

      ss.update(cn2);

      // From state/cn2(exclusive) to now (inclusive) : 0 change
      count = rsdtest.getEligibleCount(ss,
          new ChangeNumber(TimeThread.getTime(), 4, 1201));
      assertEquals(count, 0);

      // Publish one third message
      ChangeNumber cn3 = new ChangeNumber(TimeThread.getTime(), 3, 1201);
      delMsg =
        new DeleteMsg("uid="+tn+"1," + TEST_ROOT_DN_STRING, cn3,
            user1entryUUID);
      server01.publish(delMsg);
      debugInfo(tn, " publishes " + delMsg.getChangeNumber());
      sleep(300);

      ss.update(cn2);

      // From state/cn2(exclusive) to now : 1 change = cn3
      count = rsdtest.getEligibleCount(ss,
          new ChangeNumber(TimeThread.getTime(), 4, 1201));
      assertEquals(count, 1);

      boolean perfs=false;
      if (perfs)
      {
     
      // number of msgs used by the test
      int maxMsg = 999999;

      // We need an RS configured with a window size bigger than the number
      // of msg used by the test.
      assertTrue(maxMsg<maxWindow);
      debugInfo(tn, "Perf test in compat mode - will generate " + maxMsg + " msgs.");
      for (int i=4; i<=maxMsg; i++)
      {
        ChangeNumber cnx = new ChangeNumber(TimeThread.getTime(), i, 1201);
        delMsg =
          new DeleteMsg("uid="+tn+i+"," + TEST_ROOT_DN_STRING, cnx,
              user1entryUUID);
        server01.publish(delMsg)
      }
View Full Code Here


      TestCaseUtils.addEntry(entry);
      String entryUUID = getEntryUUID(entry.getDN());

      // generate two consecutive ChangeNumber that will be used in backward order
      ChangeNumber cn1 = gen.newChangeNumber();
      ChangeNumber cn2 = gen.newChangeNumber();

      ModifyDNMsg  modDnMsg = new ModifyDNMsg(
          entry.getDN().toNormalizedString(), cn2,
          entryUUID, parentUUID, false,
          TEST_ROOT_DN_STRING,
View Full Code Here

      // Add the first entry
      TestCaseUtils.addEntry(entry);
      String parentUUID = getEntryUUID(DN.decode(TEST_ROOT_DN_STRING));

      ChangeNumber cn1 = gen.newChangeNumber();

      // Now try to add the same entry with same DN but a different
      // unique ID though the replication
      AddMsg  addMsg =
        new AddMsg(cn1,
View Full Code Here

      // Add the first entry
      TestCaseUtils.addEntry(entry);
      String parentUUID = getEntryUUID(DN.decode(TEST_ROOT_DN_STRING));

      ChangeNumber cn1 = gen.newChangeNumber();

      // Now try to add the same entry with same DN but a different
      // unique ID though the replication
      AddMsg  addMsg =
        new AddMsg(cn1,
View Full Code Here

      TestCaseUtils.addEntry(parentEntry);
      TestCaseUtils.addEntry(childEntry);

      String parentUUID = getEntryUUID(parentEntry.getDN());

      ChangeNumber cn2 = gen.newChangeNumber();

      DeleteMsg  delMsg = new DeleteMsg(
          parentEntry.getDN().toNormalizedString(),
          cn2,
          parentUUID);
View Full Code Here

      "Child  entry expected to be exist.");

      String parentUUID = getEntryUUID(parentEntry.getDN());
      String childUUID = getEntryUUID(childEntry.getDN());

      ChangeNumber cn2 = gen.newChangeNumber();

      DeleteMsg  delMsg = new DeleteMsg(
          parentEntry.getDN().toNormalizedString(),
          cn2,
          parentUUID);
View Full Code Here

      TestCaseUtils.addEntry(parentEntry);
      String parentUUID = getEntryUUID(parentEntry.getDN());
      TestCaseUtils.deleteEntry(parentEntry);

      ChangeNumber cn1 = gen.newChangeNumber();

      // Create and publish an update message to add the child entry.
      String childUUID = "44444444-4444-4444-4444-444444444444";
      AddMsg addMsg = new AddMsg(
          cn1,
View Full Code Here

  /**
   * Build some data for the ModifyMsg test below.
   */
  @DataProvider(name = "createModifyData")
  public Object[][] createModifyData() {
    ChangeNumber cn1 = new ChangeNumber(101);
    ChangeNumber cn2 = new ChangeNumber(TimeThread.getTime(), 12345);
    ChangeNumber cn3 = new ChangeNumber(TimeThread.getTime(), 6789412345678);

    AttributeType type = DirectoryServer.getAttributeType("description");

    Attribute attr1 = Attributes.create("description", "new value");
    Modification mod1 = new Modification(ModificationType.REPLACE, attr1);
View Full Code Here

    if (subtree)
    {
      opBasis.addRequestControl(new SubtreeDeleteControl(false));
    }
    LocalBackendDeleteOperation op = new LocalBackendDeleteOperation(opBasis);
    ChangeNumber cn = new ChangeNumber(TimeThread.getTime(),12345);
    op.setAttachment(SYNCHROCONTEXT, new DeleteContext(cn, "uniqueid"));
    DeleteMsg msg = new DeleteMsg(op);
    assertTrue((msg.isSubtreeDelete()==subtree));
    // Set ECL entry attributes
    if (entryAttrList != null)
View Full Code Here

    ModifyDNOperationBasis op =
      new ModifyDNOperationBasis(connection, 1, 1, null,
                  DN.decode(rawDN), RDN.decode(newRdn), deleteOldRdn,
                  (newSuperior.length() != 0 ? DN.decode(newSuperior) : null));

    ChangeNumber cn = new ChangeNumber(TimeThread.getTime(), 12345);
    op.setAttachment(SYNCHROCONTEXT,
        new ModifyDnContext(cn, "uniqueid", "newparentId"));
    LocalBackendModifyDNOperation localOp =
      new LocalBackendModifyDNOperation(op);
    for (Modification mod : mods)
View Full Code Here

TOP

Related Classes of org.nasutekds.server.replication.common.ChangeNumber

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.