Examples of WaveletOperationContext


Examples of org.waveprotocol.wave.model.operation.wave.WaveletOperationContext

    operationChannel.onAck(1, signature);

    // Listener should receive a version update op.
    listener.checkOpsReceived(1);
    WaveletOperation op = operationChannel.receive();
    WaveletOperationContext context = op.getContext();
    assertEquals(1, context.getVersionIncrement());
    assertEquals(signature, context.getHashedVersion());
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.operation.wave.WaveletOperationContext

    transformer = new MockDeltaTransformer();
    queue = new OperationQueue(transformer);
  }

  private static WaveletOperationContext makeContext(ParticipantId participant, long timestamp) {
    return new WaveletOperationContext(participant, timestamp, 1);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.operation.wave.WaveletOperationContext

  public void doInsert(int offset, String chars) throws OperationException {
    Nindo nindo = Nindo.insertCharacters(offset, chars);
    DocOp op = doc.consumeAndReturnInvertible(nindo);

    BlipContentOperation blipOp = new BlipContentOperation(
        new WaveletOperationContext(participantId, 0L, 1), op);
    WaveletBlipOperation wop = new WaveletBlipOperation("blip id", blipOp);
    clientOperations.add(wop);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.operation.wave.WaveletOperationContext

  private static final ParticipantId BOB = new ParticipantId("bob@google.com");
  private static final WaveletOperation ONE = new NoOp(createContext());
  private static final WaveletOperation TWO = new NoOp(createContext());

  private static WaveletOperationContext createContext() {
    return new WaveletOperationContext(BOB, 1L, 1L);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.operation.wave.WaveletOperationContext

  @Override
  public OpBasedBlip createBlip(String id) {
    // Optimistically create the blip assuming this author submits the
    // first operation.
    WaveletOperationContext context = createContext();
    BlipData newBlip = wavelet.createDocument(id, context.getCreator(),
        Collections.singleton(context.getCreator()), EmptyDocument.EMPTY_DOCUMENT,
        Constants.NO_TIMESTAMP, Constants.NO_VERSION);
    return adapt(newBlip);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.operation.wave.WaveletOperationContext

  /**
   * Inverts an operation.
   */
  static WaveletOperation invert(WaveletOperation op) {
    WaveletOperationContext forwardContext = op.getContext();
    WaveletOperationContext reverseContext = new WaveletOperationContext( //
        forwardContext.getCreator(),
        // Lie, and keep the same modification time.
        forwardContext.getTimestamp(),
        // Correctly invert the version increment.
        -forwardContext.getVersionIncrement(),
View Full Code Here

Examples of org.waveprotocol.wave.model.operation.wave.WaveletOperationContext

    }

    ArrayList<DocOp> docOps = CollectionUtils.newArrayList();
    List<WaveletOperation> oldOperations = CollectionUtils.newArrayList(this);
    String currentId = null;
    WaveletOperationContext lastOperationContext = null;
    this.clear();

    for (WaveletOperation waveletOp : oldOperations) {
      if (waveletOp instanceof WaveletBlipOperation) {
        WaveletBlipOperation waveletBlipOp = ((WaveletBlipOperation) waveletOp);
View Full Code Here

Examples of org.waveprotocol.wave.model.operation.wave.WaveletOperationContext

  public static final ParticipantId JOE = new ParticipantId("joe@example.com");
  public static final WaveletName WAVELET_NAME =
      WaveletName.of(WaveId.of("example.com", "w+wave"), WaveletId.of("example.com", "wavelet"));

  private WaveletOperationContext opContext(long timestamp, HashedVersion version) {
    return new WaveletOperationContext(CREATOR, timestamp, 1L, version);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.operation.wave.WaveletOperationContext

        new BlipContentOperation(opContext(time, version), new DocOpBuilder().build()));
  }

  private TransformedWaveletDelta delta(WaveletOperation... ops) {
    WaveletOperation last = ops[ops.length - 1];
    WaveletOperationContext ctx = last.getContext();
    return new TransformedWaveletDelta(
        ctx.getCreator(), ctx.getHashedVersion(), ctx.getTimestamp(), Arrays.asList(ops));
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.operation.wave.WaveletOperationContext

   */
  public static TransformedWaveletDelta deserialize(final ProtocolWaveletDelta protocolDelta,
      HashedVersion postVersion) {
    // TODO(anorth): include the application timestamp when it's plumbed
    // through correctly.
    WaveletOperationContext dummy = new WaveletOperationContext(null, 0L, 0L);
    List<WaveletOperation> ops = new ArrayList<WaveletOperation>();
    for (ProtocolWaveletOperation protocolOp : protocolDelta.getOperation()) {
      ops.add(deserialize(protocolOp, dummy));
    }
    // This involves an unnecessary copy of the ops, but avoids repeating
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.