Package org.nasutekds.server.replication.common

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


        throw new DataFormatException("byte[] is not a valid CT_HEARTBEAT msg");
      }
      int pos = 1;
      int length = getNextLength(in, pos);
      String changenumberStr = new String(in, pos, length, "UTF-8");
      changeNumber = new ChangeNumber(changenumberStr);
    }
    catch (UnsupportedEncodingException e)
    {
      throw new DataFormatException("UTF-8 is not supported by this jvm.");
    }
View Full Code Here


    AttributeValue att1 = AttributeValues.create(type, "string");
    AttributeValue att2 = AttributeValues.create(type, "value");
    AttributeValue att3 = AttributeValues.create(type, "again");

    ChangeNumber del1 = new ChangeNumber(101);
    ChangeNumber del2 = new ChangeNumber(111);
    ChangeNumber del3 = new ChangeNumber(102);

    ChangeNumber upd1 = new ChangeNumber(TimeThread.getTime(), 123, 45);
    ChangeNumber upd2 = new ChangeNumber(TimeThread.getTime() + 1000, 12345);
    ChangeNumber upd3 = new ChangeNumber(TimeThread.getTime(), 321, 54);

    return new Object[][]
    {
    { att1, del1, upd1 },
    { att2, del2, upd2 },
View Full Code Here

    ChangeNumberGenerator gen1 =
      new ChangeNumberGenerator( 1, origState);
    ChangeNumberGenerator gen2 =
      new ChangeNumberGenerator( 2, origState);

    ChangeNumber cn1 = gen1.newChangeNumber();
    ChangeNumber cn2 = gen2.newChangeNumber();

    assertEquals(state.update(cn1), true);
    assertEquals(state.update(cn2), true);

    state.save();

    PersistentServerState stateSaved = new PersistentServerState(baseDn,  1);
    ChangeNumber cn1Saved = stateSaved.getMaxChangeNumber( 1);
    ChangeNumber cn2Saved = stateSaved.getMaxChangeNumber( 2);

    assertEquals(cn1Saved, cn1,
        "cn1 has not been saved or loaded correctly for " + dn);
    assertEquals(cn2Saved, cn2,
        "cn2 has not been saved or loaded correctly for " + dn);
View Full Code Here

      // Then check serverSate and GenId
      assertTrue(replDomain.getGenerationID() == 1225361491);

      ServerState state = replDomain.getServerState();
      assertTrue(state.getMaxChangeNumber( 1).
          compareTo(new ChangeNumber("0000011d4d42b240000100000000")) == 0);
      assertTrue(state.getMaxChangeNumber( 3).
          compareTo(new ChangeNumber("0000011d9a991110000300000000")) == 0);

    }
    finally
    {
      if (replDomain != null)
View Full Code Here

  private void replayModifies(
      Entry entry, EntryHistorical hist, List<Modification> mods, int date)
  {
    InternalClientConnection connection =
      InternalClientConnection.getRootConnection();
    ChangeNumber t = new ChangeNumber(date, 0, 0);

    ModifyOperationBasis modOpBasis =
      new ModifyOperationBasis(connection, 1, 1, null, entry.getDN(), mods);
    LocalBackendModifyOperation modOp = new LocalBackendModifyOperation(modOpBasis);
    ModifyContext ctx = new ModifyContext(t, "uniqueId");
View Full Code Here

      DirectoryServer.getSchema().getAttributeType(
          EntryHistorical.HISTORICALATTRIBUTENAME);

    InternalClientConnection connection =
      InternalClientConnection.getRootConnection();
    ChangeNumber t = new ChangeNumber(date, 0, 0);

    List<Modification> mods = new ArrayList<Modification>();
    mods.add(mod);

    ModifyOperationBasis modOpBasis =
View Full Code Here

      String serviceID1 = "serviceID1";
      String serviceID2 = "serviceID2";
      String serviceID3 = "serviceID3";

      ChangeNumberGenerator gen = new ChangeNumberGenerator( 1, 0);
      ChangeNumber changeNumber1 = gen.newChangeNumber();
      ChangeNumber changeNumber2 = gen.newChangeNumber();
      ChangeNumber changeNumber3 = gen.newChangeNumber();

      // Add records
      handler.add(sn1, value1, serviceID1, changeNumber1);
      handler.add(sn2, value2, serviceID2, changeNumber2);
      handler.add(sn3, value3, serviceID3, changeNumber3);
View Full Code Here

      String serviceID1 = "serviceID1";
      String serviceID2 = "serviceID2";
      String serviceID3 = "serviceID3";

      ChangeNumberGenerator gen = new ChangeNumberGenerator( 1, 0);
      ChangeNumber changeNumber1 = gen.newChangeNumber();
      ChangeNumber changeNumber2 = gen.newChangeNumber();
      ChangeNumber changeNumber3 = gen.newChangeNumber();

      // Add records
      handler.add(sn1, value1, serviceID1, changeNumber1);
      handler.add(sn2, value2, serviceID2, changeNumber2);
      handler.add(sn3, value3, serviceID3, changeNumber3);
View Full Code Here

    String entryuuid2 =
         attrs.get(0).iterator().next().getValue().toString();

    long now = System.currentTimeMillis();
    // A change on a first server.
    ChangeNumber t1 = new ChangeNumber(now,  03);

    // A change on a second server.
    ChangeNumber t2 = new ChangeNumber(now+104);

    // Simulate the ordering t1:add:A followed by t2:add:B that would
    // happen on one server.

    // Replay an add of a value A at time t1 on a first server.
    Attribute attr = Attributes.create(attrType.getNormalizedPrimaryName(), "A");
    Modification mod = new Modification(ModificationType.ADD, attr);
    publishModify(broker, t1, dn1, entryuuid, mod);

    // It would be nice to avoid these sleeps.
    // We need to preserve the replay order but the order could be changed
    // due to the multi-threaded nature of the replication replay.
    // Putting a sentinel value in the modification is not foolproof since
    // the operation might not get replayed at all.
    Thread.sleep(2000);

    // Replay an add of a value B at time t2 on a second server.
    attr = Attributes.create(attrType.getNormalizedPrimaryName(), "B");
    mod = new Modification(ModificationType.ADD, attr);
    publishModify(broker, t2, dn1, entryuuid, mod);

    Thread.sleep(2000);

    // Simulate the reverse ordering t2:add:B followed by t1:add:A that
    // would happen on the other server.

    t1 = new ChangeNumber(now+303);
    t2 = new ChangeNumber(now+404);

    // Replay an add of a value B at time t2 on a second server.
    attr = Attributes.create(attrType.getNormalizedPrimaryName(), "B");
    mod = new Modification(ModificationType.ADD, attr);
    publishModify(broker, t2, dn2, entryuuid2, mod);
View Full Code Here

  {
    // Creates a rule
    HistoricalCsnOrderingMatchingRule r =
      new HistoricalCsnOrderingMatchingRule();

    ChangeNumber del1 = new ChangeNumber(101);
    ChangeNumber del2 = new ChangeNumber(111);

    ByteString v1 = ByteString.valueOf("a"+":"+del1.toString());
    ByteString v2 = ByteString.valueOf("a"+":"+del2.toString());

    int cmp = r.compareValues(v1, v1);
    assertTrue(cmp == 0);

    cmp = r.compareValues(v1, v2);
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.