Package org.waveprotocol.wave.model.wave.data

Examples of org.waveprotocol.wave.model.wave.data.ReadableWaveletData


    addCarolOp = new AddParticipant(new WaveletOperationContext(ALEX, 0L, 1, V2), CAROL);
    removeAlexOp = new RemoveParticipant(new WaveletOperationContext(ALEX, 0L, 1, V3), ALEX);
  }

  public void testgetSnapshotBeforeDeltas() throws Exception {
    ReadableWaveletData firstSnapshot = wavelet.getSnapshotBeforeDeltas();
    assertFalse("The operation to add bob should have been rolled back",
        firstSnapshot.getParticipants().contains(BOB));
    assertTrue("Operations should have been rolled back, together with the version",
        firstSnapshot.getVersion() == 0);
  }
View Full Code Here


    assertTrue("Operations should have been rolled back, together with the version",
        firstSnapshot.getVersion() == 0);
  }

  public void testgetSnapshotAfterDeltas() throws Exception {
    ReadableWaveletData latestSnapshot = wavelet.getSnapshotAfterDeltas();
    assertNotSame("A copy of the waveletdata must be made", waveletData, latestSnapshot);
    assertTrue("Bob should be a participant", latestSnapshot.getParticipants().contains(BOB));
    assertTrue(latestSnapshot.getVersion() == 1);
  }
View Full Code Here

    TransformedWaveletDelta delta = new TransformedWaveletDelta(ALEX, hashedVersionTwo, 0L,
      Arrays.asList(addCarolOp));
    wavelet.appendDeltas(waveletData, DeltaSequence.of(delta));

    ReadableWaveletData firstSnapshot = wavelet.getSnapshotBeforeDeltas();
    assertFalse("Bob should not be a participant", firstSnapshot.getParticipants().contains(BOB));
    assertEquals(hashedVersionTwo, wavelet.getVersionAfterDeltas());

    ReadableWaveletData latestSnapshot = wavelet.getSnapshotAfterDeltas();
    assertNotSame("A copy of the waveletdata must be made", waveletData, latestSnapshot);

    Collection<ParticipantId> participants =
        Collections.unmodifiableCollection(Arrays.asList(BOB, CAROL));
    assertTrue("Bob and Carol should be participating",
        latestSnapshot.getParticipants().containsAll(participants));
  }
View Full Code Here

  public void testUnsubscribedSnapshotNotRecieved() throws Exception {
    OpenListener listener = openWave(IdFilter.ofPrefixes("non-existing"));
    verifyChannelId(listener);
    verifyMarker(listener, WAVE_ID);

    ReadableWaveletData wavelet = provideWavelet(WN1).snapshot;
    clientFrontend.waveletUpdate(wavelet, DELTAS);
    verify(listener, Mockito.never()).onUpdate(eq(WN1),
        any(CommittedWaveletSnapshot.class), Matchers.anyList(),
        any(HashedVersion.class), isNullMarker(), anyString());
  }
View Full Code Here

  public void testSnapshotMetadataReflectsDeltas() throws Exception {
    HashedVersion v2 = d1.getResultingVersion();
    appendDeltas(d1);

    assertEquals(v2, target.getCurrentVersion());
    ReadableWaveletData snapshot = target.getSnapshot();
    assertEquals(AUTHOR, snapshot.getCreator());
    assertEquals(v2, snapshot.getHashedVersion());
    assertEquals(TS, snapshot.getCreationTime());
    assertEquals(TS, snapshot.getLastModifiedTime());
    assertEquals(2, snapshot.getVersion());

    HashedVersion v4 = d2.getResultingVersion();
    appendDeltas(d2);

    assertEquals(v4, target.getCurrentVersion());
    snapshot = target.getSnapshot();
    assertEquals(v4, snapshot.getHashedVersion());
    assertEquals(4, snapshot.getVersion());
    // Last-modified-time doesn't change due to unworthiness.
  }
View Full Code Here

    if (account.getCapabilities() == null) {
      try {
        LOG.info(robotName + ": Initializing capabilities");
        gateway.updateRobotAccount(this);
      } catch (CapabilityFetchException e) {
        ReadableWaveletData snapshot = wavelet.getSnapshotAfterDeltas();
        LOG.info(
            "Couldn't initialize the capabilities of robot(" + robotName
                + "), dropping its wavelet(" + WaveletDataUtil.waveletNameOf(snapshot)
                + ") at version " + wavelet.getVersionAfterDeltas(), e);
        return;
      } catch (PersistenceException e) {
        ReadableWaveletData snapshot = wavelet.getSnapshotAfterDeltas();
        LOG.info(
            "Couldn't initialize the capabilities of robot(" + robotName
                + "), dropping its wavelet(" + WaveletDataUtil.waveletNameOf(snapshot)
                + ") at version " + wavelet.getVersionAfterDeltas(), e);
        return;
View Full Code Here

    ListenableFutureTask<Void> task = ListenableFutureTask.<Void>create(new Callable<Void>() {

      @Override
      public Void call() throws Exception {
        ReadableWaveletData waveletData;
        try {
          waveletData = waveletProvider.getReadableWaveletData(waveletName);
          updateIndex(waveletData);
        } catch (WaveServerException e) {
          LOG.log(Level.SEVERE, "Failed to update index for " + waveletName, e);
View Full Code Here

    ListenableFutureTask<Void> task = ListenableFutureTask.<Void>create(new Callable<Void>() {

      @Override
      public Void call() throws Exception {
        ReadableWaveletData waveletData;
        try {
          waveletData = waveletProvider.getReadableWaveletData(waveletName);
          try {
            removeParticipantfromIndex(waveletData, participant, nrtManager);
          } catch (CorruptIndexException e) {
View Full Code Here

    ListenableFutureTask<Void> task = ListenableFutureTask.<Void>create(new Callable<Void>() {

      @Override
      public Void call() throws Exception {
        ReadableWaveletData waveletData;
        try {
          waveletData = waveletProvider.getReadableWaveletData(waveletName);
          updateIndex(waveletData);
        } catch (WaveServerException e) {
          LOG.log(Level.SEVERE, "Failed to initialize index for " + waveletName, e);
View Full Code Here

  private static ReadableWaveletData buildWaveletFromDeltaReader(WaveletDeltaRecordReader reader)
      throws PersistenceException {
    try {
      // TODO(soren): better error handling of IllegalStateExceptions and
      // OperationExceptions thrown from here
      ReadableWaveletData wavelet =
          WaveletDataUtil.buildWaveletFromDeltas(reader.getWaveletName(),
              new TransformedWaveletDeltaIterator(reader));
      Preconditions.checkState(wavelet.getHashedVersion().equals(reader.getEndVersion()));
      return wavelet;
    } catch (OperationException e) {
      throw new PersistenceException(e);
    } catch (RuntimeIOException e) {
      throw new PersistenceException(e.getIOException());
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.wave.data.ReadableWaveletData

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.