Examples of WaveletData


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

  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);

    dispatcher.waveletUpdate(wavelet, POJO_DELTAS);
    verify(listener).onParticipantAdded(WAVELET_NAME, PARTICIPANT);
View Full Code Here

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

  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);

    dispatcher.waveletUpdate(wavelet, POJO_DELTAS);
    verify(listener).onParticipantRemoved(WAVELET_NAME, PARTICIPANT);
View Full Code Here

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

      new IdURIEncoderDecoder(new JavaUrlCodec());

  private static final HashedVersionFactory HASH_FACTORY = new HashedVersionFactoryImpl(URI_CODEC);

  public void testWaveletRoundtrip() throws Exception {
    WaveletData expected = TestDataUtil.createSimpleWaveletData();
    WaveletName name = WaveletName.of(expected.getWaveId(), expected.getWaveletId());
    HashedVersion version = HASH_FACTORY.createVersionZero(name);

    WaveletSnapshot snapshot = SnapshotSerializer.serializeWavelet(expected, version);
    WaveletData actual = SnapshotSerializer.deserializeWavelet(snapshot, expected.getWaveId());

    TestDataUtil.checkSerializedWavelet(expected, actual);
  }
View Full Code Here

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

  }

  public void testDisallowedUserReturnsForbidden() throws Exception {
    waveletProvider.setAllowsAccess(false);

    WaveletData wavelet = waveletProvider.getHostedWavelet();
    WaveRef waveref = WaveRef.of(wavelet.getWaveId(), wavelet.getWaveletId());
    verifyServletReturnsForbiddenForWaveref(waveref);
  }
View Full Code Here

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

  private ObservableWaveletData build(TransformedWaveletDelta... deltas) throws OperationException {
    return WaveletDataUtil.buildWaveletFromDeltas(WAVELET_NAME, Arrays.asList(deltas).iterator());
  }

  public void testBuildWaveletFromOneDelta() throws Exception {
    WaveletData wavelet = build(
        delta(addParticipant(CREATOR, 1093L, HashedVersion.unsigned(1)))
    );
    assertEquals(WAVELET_NAME, WaveletDataUtil.waveletNameOf(wavelet));
    assertEquals(CREATOR, wavelet.getCreator());
    assertEquals(1093L, wavelet.getCreationTime());
    assertEquals(1093L, wavelet.getLastModifiedTime());
    assertEquals(HashedVersion.unsigned(1), wavelet.getHashedVersion());
    assertEquals(ImmutableSet.of(), wavelet.getDocumentIds());
    assertEquals(ImmutableSet.of(CREATOR), wavelet.getParticipants());
  }
View Full Code Here

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

    WaveRef waveref = WaveRef.of(wavelet.getWaveId(), wavelet.getWaveletId());
    verifyServletReturnsForbiddenForWaveref(waveref);
  }

  public void testGetMissingDataReturnsForbidden() throws Exception {
    WaveletData wavelet = waveletProvider.getHostedWavelet();
    WaveId waveId = wavelet.getWaveId();
    WaveletId waveletId = wavelet.getWaveletId();

    WaveRef unknownWave = WaveRef.of(WaveId.of(waveId.getDomain(), waveId.getId() + "junk"));
    verifyServletReturnsForbiddenForWaveref(unknownWave);
    WaveRef unknownWavelet = WaveRef.of(waveId, WaveletId.of(waveletId.getDomain(), waveletId.getId() + "junk"));
    verifyServletReturnsForbiddenForWaveref(unknownWavelet);
View Full Code Here

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

   * Round-trip a wavelet and make sure all the fields match.
   * We only check the fields that WaveletSnapshot serializes.
   * @throws Exception
   */
  public void testGetWavelet() throws Exception {
    WaveletData wavelet = waveletProvider.getHostedWavelet();

    WaveRef waveref = WaveRef.of(wavelet.getWaveId(), wavelet.getWaveletId());
    WaveletSnapshot snapshot = fetchWaverRefAndParse(waveref, WaveletSnapshot.class);
    WaveletData roundtripped = SnapshotSerializer.deserializeWavelet(snapshot, waveref.getWaveId());

    // We have just round-tripped wavelet through the servlet. wavelet and
    // roundtripped should be identical in all the fields that get serialized.
    TestDataUtil.checkSerializedWavelet(wavelet, roundtripped);

View Full Code Here

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

    assertEquals(ImmutableSet.of(), wavelet.getDocumentIds());
    assertEquals(ImmutableSet.of(CREATOR), wavelet.getParticipants());
  }

  public void testBuildWaveletFromThreeDeltas() throws Exception {
    WaveletData wavelet = build(
        delta(addParticipant(CREATOR, 1093L, HashedVersion.unsigned(1))),
        delta(addParticipant(JOE, 1492L, HashedVersion.unsigned(2))),
        delta(addBlip("blipid", 2010L, HashedVersion.unsigned(3)))
    );
    assertEquals(WAVELET_NAME, WaveletDataUtil.waveletNameOf(wavelet));
    assertEquals(CREATOR, wavelet.getCreator());
    assertEquals(1093L, wavelet.getCreationTime());
    assertEquals(2010L, wavelet.getLastModifiedTime());
    assertEquals(HashedVersion.unsigned(3), wavelet.getHashedVersion());
    assertEquals(ImmutableSet.of("blipid"), wavelet.getDocumentIds());
    assertEquals(ImmutableSet.of(CREATOR, JOE), wavelet.getParticipants());
  }
View Full Code Here

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

   * (/fetch/domain/waveid/domain/waveletid/docid).
   *
   * @throws Exception
   */
  public void testGetDocument() throws Exception {
    WaveletData wavelet = waveletProvider.getHostedWavelet();
    for (String docId : wavelet.getDocumentIds()) {
      // We currently have no way to deserialize a document. Instead, we'll
      // serialize the expected document and compare with what we get from the
      // fetch servlet.
      StringWriter writer = new StringWriter();
      BlipData expectedDoc = wavelet.getDocument(docId);
      writer.append("" + protoSerializer.toJson(SnapshotSerializer.serializeDocument(expectedDoc)));
      String expectedResult = writer.toString();

      WaveRef waveref = WaveRef.of(wavelet.getWaveId(), wavelet.getWaveletId(), docId);
      String actualResult = fetchWaveRef(waveref);

      assertEquals(expectedResult, actualResult);
    }
  }
View Full Code Here

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

    WaveletName name = WaveletName.of(
        WaveId.of("example.com", "w+abc123"), WaveletId.of("example.com", "conv+root"));
    ParticipantId creator = ParticipantId.ofUnsafe("sam@example.com");
    long time = 1234567890;

    WaveletData wavelet = WaveletDataUtil.createEmptyWavelet(name, creator,
        HashedVersion.unsigned(0), time);

    DocInitialization content = new DocInitializationBuilder().characters("Hello there").build();
    wavelet.createDocument(
        "b+abc123", creator, Collections.<ParticipantId> emptySet(), content, time, 0);

    return wavelet;
  }
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.