Package org.waveprotocol.box.common

Examples of org.waveprotocol.box.common.DeltaSequence


    removeAlexOp.apply(waveletData);
    TransformedWaveletDelta deltaRemove = new TransformedWaveletDelta(ALEX, V3, 0L,
        Arrays.asList(removeAlexOp));

    DeltaSequence deltas = DeltaSequence.of(deltaAdd, deltaRemove);
    wavelet.appendDeltas(waveletData, deltas);
  }
View Full Code Here


    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 {
      wavelet.appendDeltas(waveletData, deltas);
      fail("Expected exception because deltas aren't contiguous");
    } catch (IllegalArgumentException e) {
View Full Code Here

        eq(V0), isNullMarker(), any(String.class));
    verifyMarker(listener, WAVE_ID);

    TransformedWaveletDelta delta = TransformedWaveletDelta.cloneOperations(USER, V2, 1234567890L,
        Arrays.asList(UTIL.noOp()));
    DeltaSequence deltas = DeltaSequence.of(delta);
    clientFrontend.waveletUpdate(snapshot.snapshot, deltas);
    verify(listener).onUpdate(eq(WN1), isNullSnapshot(), eq(deltas),
        isNullVersion(), isNullMarker(), anyString());
  }
View Full Code Here

    verifyChannelId(listener);
    verifyMarker(listener, INDEX_WAVE_ID);

    HashedVersion v1 = HashedVersion.unsigned(1L);
    TransformedWaveletDelta delta = makeDelta(USER, v1, 0L, UTIL.noOp());
    DeltaSequence deltas = DeltaSequence.of(delta);

    WaveletData wavelet = WaveletDataUtil.createEmptyWavelet(WN1, USER, V0, 1234567890L);
    clientFrontend.waveletUpdate(wavelet, deltas);

    WaveletName dummyWaveletName = ClientFrontendImpl.createDummyWaveletName(INDEX_WAVE_ID);
View Full Code Here

  private static List<TransformedWaveletDelta> isDeltasStartingAt(final long version) {
    return argThat(new ArgumentMatcher<List<TransformedWaveletDelta>>() {
      @Override
      public boolean matches(Object sequence) {
        if (sequence != null) {
          DeltaSequence s = (DeltaSequence) sequence;
          return (s.size() > 0) && (s.getStartVersion() == version);
        }
        return false;
      }
    });
  }
View Full Code Here

    dispatcher = new PerUserWaveViewDistpatcher();
    dispatcher.addListener(listener);
  }

  public void testOnAddParticipantEvent() {
    DeltaSequence POJO_DELTAS = DeltaSequence.of(CoreWaveletOperationSerializer
        .deserialize(ADD_DELTA, END_VERSION, 0L));
    long dummyCreationTime = System.currentTimeMillis();
    WaveletData wavelet =
        WaveletDataUtil.createEmptyWavelet(WAVELET_NAME, PARTICIPANT, BEGIN_VERSION,
            dummyCreationTime);
View Full Code Here

    dispatcher.waveletUpdate(wavelet, POJO_DELTAS);
    verify(listener).onParticipantAdded(WAVELET_NAME, PARTICIPANT);
  }

  public void testOnRemoveParticipantEvent() {
    DeltaSequence POJO_DELTAS = DeltaSequence.of(CoreWaveletOperationSerializer
        .deserialize(REMOVE_DELTA, END_VERSION, 0L));
    long dummyCreationTime = System.currentTimeMillis();
    WaveletData wavelet =
        WaveletDataUtil.createEmptyWavelet(WAVELET_NAME, PARTICIPANT, BEGIN_VERSION,
            dummyCreationTime);
View Full Code Here

    TransformedWaveletDelta delta2 = UTIL.noOpDelta(V2.getVersion());

    OpenListener listener = mock(OpenListener.class);
    m.subscribe(W1, IdFilters.ALL_IDS, "ch1", listener);

    DeltaSequence bothDeltas =  DeltaSequence.of(DELTA, delta2);
    m.onUpdate(W1A, bothDeltas);
    verify(listener).onUpdate(W1A, null, bothDeltas, null, null, "ch1");

    // Also succeeds when sending the two deltas via separate onUpdates()
    DeltaSequence delta2Sequence = DeltaSequence.of(delta2);
    m.subscribe(W2, IdFilters.ALL_IDS, "ch2", listener);
    m.onUpdate(W2A, DELTAS);
    m.onUpdate(W2A, DeltaSequence.of(delta2));
    verify(listener).onUpdate(W2A, null, DELTAS, null, null, "ch2");
    verify(listener).onUpdate(W2A, null, delta2Sequence, null, null, "ch2");
View Full Code Here

    HashedVersion targetVersion = submittedDelta.getTargetVersion();
    HashedVersion currentVersion = getCurrentVersion();
    Preconditions.checkArgument(!targetVersion.equals(currentVersion));
    ListReceiver<TransformedWaveletDelta> receiver = new ListReceiver<TransformedWaveletDelta>();
    waveletState.getTransformedDeltaHistory(targetVersion, currentVersion, receiver);
    DeltaSequence serverDeltas = DeltaSequence.of(receiver);
    Preconditions.checkState(!serverDeltas.isEmpty(),
        "No deltas between valid versions %s and %s", targetVersion, currentVersion);

    ParticipantId clientAuthor = submittedDelta.getAuthor();
    // TODO(anorth): remove this copy somehow; currently, it's necessary to
    // ensure that clientOps.equals() works correctly below (because
View Full Code Here

  }

  @Override
  public void waveletUpdate(ReadableWaveletData wavelet, ImmutableList<WaveletDeltaRecord> deltas,
      ImmutableSet<String> domainsToNotify) {
    DeltaSequence sequence = DeltaSequence.of(transformedDeltasOf(deltas));
    for (WaveBus.Subscriber s : subscribers) {
      try {
        s.waveletUpdate(wavelet, sequence);
      } catch (RuntimeException e) {
        LOG.severe("Runtime exception in update to wave bus subscriber " + s, e);
View Full Code Here

TOP

Related Classes of org.waveprotocol.box.common.DeltaSequence

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.