Package org.waveprotocol.wave.model.operation.wave

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


    DeltaSequence deltas = DeltaSequence.of(deltaAdd, deltaRemove);
    wavelet.appendDeltas(waveletData, deltas);
  }

  public void testNonContiguousDeltas() throws Exception {
    TransformedWaveletDelta deltaAdd = new TransformedWaveletDelta(ALEX, V1, 0L,
        Arrays.asList(new NoOp(new WaveletOperationContext(ALEX, 0L, 1, V1))));
    TransformedWaveletDelta deltaRemove = new TransformedWaveletDelta(ALEX, V2, 0L,
        Arrays.asList(new NoOp(new WaveletOperationContext(ALEX, 0L, 1, V2))));

    DeltaSequence deltas = DeltaSequence.of(deltaAdd, deltaRemove);

    try {
View Full Code Here


        .onSuccess(HashedVersion.of(1L, sig(111)), 1, null, ResponseCode.OK);

    DeltaTestUtil util = new DeltaTestUtil(USER_ID);

    // Receive an operation from the server that doesn't affect the document.
    TransformedWaveletDelta delta1 =
        util.delta(1L, util.addParticipant(new ParticipantId("reuben@example.com")));
    openCallback.onUpdate(new FakeWaveViewServiceUpdate()
        .setWaveletId(GENERATED_WAVELET_ID).addDelta(delta1));

    assertEquals(2, createdWavelet.getParticipantIds().size());

    // create an empty blip edit (i.e. implicit creation) and expect flush
    TransformedWaveletDelta delta2 = util.delta(2L, util.noOpDocOp(GENERATED_BLIP_ID));
    openCallback.onUpdate(new FakeWaveViewServiceUpdate()
        .setWaveletId(GENERATED_WAVELET_ID).addDelta(delta2));
    doc.expectedCall(MockCcDocument.MethodCall.FLUSH);
    doc.expectedCall(MockCcDocument.MethodCall.CONSUME);
    doc.expectedNothing();

    // now hold back flush on another server op
    doc.flush_return = false;
    TransformedWaveletDelta delta3 = util.delta(3L, util.noOpDocOp(GENERATED_BLIP_ID));
    openCallback.onUpdate(new FakeWaveViewServiceUpdate()
        .setWaveletId(GENERATED_WAVELET_ID).addDelta(delta3));
    MockCcDocument.MethodCallContext callContext =
        doc.expectedCall(MockCcDocument.MethodCall.FLUSH);
    doc.expectedNothing();
View Full Code Here

     * @throws OperationException
     * @throws TransformException
     */
    public TestConfig serverDoInsert(int startVersion, int insertionPoint, String content,
        int remaining) throws OperationException, TransformException {
      TransformedWaveletDelta d = TransformedWaveletDelta.cloneOperations(SERVER_UTIL.getAuthor(),
          genSignature(startVersion + 1), 0L, Arrays.asList(
              SERVER_UTIL.insert(insertionPoint, content, remaining, null)));
      serverConnectionMock.triggerServerDeltas(Collections.singletonList(d));
      return this;
    }
View Full Code Here

     */
    public TestConfig serverDoOps(int startVersion, int numOps)
        throws TransformException, OperationException {
      ArrayList<TransformedWaveletDelta> deltas = CollectionUtils.newArrayList();
      for (int i = 0; i < numOps; i++) {
        TransformedWaveletDelta d = TransformedWaveletDelta.cloneOperations(
            SERVER_UTIL.getAuthor(), genSignature(startVersion + i + 1), 0L,
            Arrays.asList(SERVER_UTIL.noOp()));
        deltas.add(d);
      }
      serverConnectionMock.triggerServerDeltas(deltas);
View Full Code Here

    /**
     * Pretend the server echos back client's operation. Timestamp default to 0L.
     */
    public TestConfig serverDoEchoBackDocOp(int startVersion, String blipId)
        throws TransformException, OperationException {
      TransformedWaveletDelta d = TransformedWaveletDelta.cloneOperations(
          clientMock.getParticipantId(), genSignature(startVersion + 1), 0L,
          Arrays.asList(noOpDocOp(blipId)));
      serverConnectionMock.triggerServerDeltas(Collections.singletonList(d));
      return this;
    }
View Full Code Here

    /**
     * Pretend the server echos back client's operation.
     */
    public TestConfig serverDoEchoBack(int startVersion, long timestamp)
        throws TransformException, OperationException {
      TransformedWaveletDelta d = TransformedWaveletDelta.cloneOperations(
          clientMock.getParticipantId(), genSignature(startVersion + 1), timestamp,
          Arrays.asList(SERVER_UTIL.noOp()));
      serverConnectionMock.triggerServerDeltas(Collections.singletonList(d));
      return this;
    }
View Full Code Here

   */
  private void respondWithEmptyUpdate(WaveletId waveletId) {
    waveViewService.lastOpen().callback.onUpdate(new FakeWaveViewServiceUpdate()
        .setWaveletId(waveletId)
        .setLastCommittedVersion(HashedVersion.unsigned(0))
        .addDelta(new TransformedWaveletDelta(null, HashedVersion.unsigned(0), 0L,
            Arrays.<WaveletOperation> asList())));
  }
View Full Code Here

    operationChannel.onCommit(43); // Causes cc to remove old operations from memory
    reconnectChannel(43, SIG2);

    // Receive next delta.
    TransformedWaveletDelta delta = createRandomTransformedDelta(43, 1, SIG3);
    operationChannel.onDelta(delta);
    listener.checkOpsReceived(1);
    assertNotNull(operationChannel.receive());
    assertNull(operationChannel.receive());
    checkExpectationsSatisfied();
View Full Code Here

    final long afterVersion = 44;
    final byte[] afterSignature = SIG3;
    reconnectChannel(initialVersion, initialSignature, afterVersion, afterSignature, null);

    // Receive delta that is the client's own un-acked op.
    TransformedWaveletDelta serverDelta =
        TransformedWaveletDelta.cloneOperations(HashedVersion.of(43, SIG2), 0L, delta);
    operationChannel.onDelta(serverDelta);

    // It should implicitly cause an ack, so read that fake op
    // to update version info, plus a VersionUpdateOp.
    listener.checkOpsReceived(2);
    assertNotNull(operationChannel.receive());
    listener.clear();

    // Receive another op
    TransformedWaveletDelta rdelta = createRandomTransformedDelta(43, 1, SIG4);
    operationChannel.onDelta(rdelta);
    // Recovery should be complete since the client has caught up with the
    // server, and there should be one readable delta.
    listener.checkOpsReceived(1);
    assertNotNull(operationChannel.receive());
View Full Code Here

    // Reconnect at 43.
    reconnectChannel(43, signature43, 44, SIG3, null);

    // Now receive a different delta to the un-acked delta1.
    TransformedWaveletDelta delta2 = createRandomTransformedDelta(43, 1, SIG4);
    operationChannel.onDelta(delta2);
    listener.checkOpsReceived(1);
    assertNotNull(operationChannel.receive());
    listener.clear();
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.operation.wave.TransformedWaveletDelta

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.