Package org.waveprotocol.wave.model.conversation

Examples of org.waveprotocol.wave.model.conversation.ObservableConversationView


   * Tests that events from a robot delta are filtered, after events from a
   * human delta are received.
   */
  public void testRobotSelfEventsFilteredAfterHuman() throws Exception {
    // Robot receives two deltas, it is participant in wavelet before deltas.
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);
    // Delta1 start events: event #1.
    ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip();
    // Delta1 event #2.
    XmlStringBuilder builder = XmlStringBuilder.createText("some random content by alex");
    LineContainers.appendToLastLine(newBlip.getContent(), builder);

    List<WaveletOperation> ops1 = Lists.newArrayList(output.getOps());
    HashedVersion endVersion = HashedVersion.unsigned(waveletData.getVersion());
    TransformedWaveletDelta delta1 = makeDeltaFromCapturedOps(ALEX, ops1, endVersion, 0L);
    output.clear();

    // Delta2 event #1.
    conversation = conversationUtil.buildConversation(wavelet);
    newBlip = conversation.getRoot().getRootThread().appendBlip();
    // Delta2 event #2.
    wavelet.addParticipant(BOB);
    // Delta2 event #3.
    builder = XmlStringBuilder.createText("some random content by robot");
    LineContainers.appendToLastLine(newBlip.getContent(), builder);
View Full Code Here


   * Tests that events from a robot delta are filtered, before events from a
   * human delta are received.
   */
  public void testRobotSelfEventsFilteredBeforeHuman() throws Exception {
    // Robot receives two deltas, it is participant in wavelet before deltas.
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);
    // Delta1 start events: event #1.
    ObservableConversationBlip rootBlip = conversation.getRoot().getRootThread().getFirstBlip();
    // Delta1 event #2.
    XmlStringBuilder builder = XmlStringBuilder.createText("some random content by robot");
    LineContainers.appendToLastLine(rootBlip.getContent(), builder);
    // Delta1 event #3.
    wavelet.addParticipant(BOB);

    List<WaveletOperation> ops1 = Lists.newArrayList(output.getOps());
    HashedVersion endVersion = HashedVersion.unsigned(waveletData.getVersion());
    TransformedWaveletDelta delta1 = makeDeltaFromCapturedOps(ROBOT, ops1, endVersion, 0L);
    output.clear();

    // Delta2 event #1.
    conversation = conversationUtil.buildConversation(wavelet);
    ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip();
    // Delta2 event #2.
    builder = XmlStringBuilder.createText("some random content by alex");
    LineContainers.appendToLastLine(newBlip.getContent(), builder);

    List<WaveletOperation> ops2 = Lists.newArrayList(output.getOps());
View Full Code Here

    EventMessageBundle messages = generateEventsFromDeltas(delta1, delta2);
    assertEquals("Expected two events", 2, messages.getEvents().size());
  }

  public void testGenerateWaveletBlipCreatedEvent() throws Exception {
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);
    ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip();
    EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_BLIP_CREATED);
    assertEquals("Expected one event", 1, messages.getEvents().size());
    WaveletBlipCreatedEvent event = WaveletBlipCreatedEvent.as(messages.getEvents().get(0));
    assertEquals("Expected the same id as the new blip", newBlip.getId(), event.getNewBlipId());
  }
View Full Code Here

    List<WaveletOperation> ops1 = Lists.newArrayList(output.getOps());
    TransformedWaveletDelta delta1 = makeDeltaFromCapturedOps(ALEX, ops1, endVersion, 0L);
    output.clear();

    // Delta2 event #1.
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);
    ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip();
    XmlStringBuilder builder = XmlStringBuilder.createText("some random content");
    // Delta2 event #2.
    LineContainers.appendToLastLine(newBlip.getContent(), builder);
    // Delta2 event #3.
    XmlStringBuilder.createText("some more random content by robot");
View Full Code Here

    List<WaveletOperation> ops1 = Lists.newArrayList(output.getOps());
    TransformedWaveletDelta delta1 = makeDeltaFromCapturedOps(ROBOT, ops1, endVersion, 0L);
    output.clear();

    // Delta2 event #1.
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);
    ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip();

    XmlStringBuilder builder = XmlStringBuilder.createText("some random content");
    // Delta2 event #2.
    LineContainers.appendToLastLine(newBlip.getContent(), builder);
    // Delta2 event #3.
View Full Code Here

    List<WaveletOperation> ops = output.getOps();
    HashedVersion endVersion = HashedVersion.unsigned(waveletData.getVersion());
    TransformedWaveletDelta delta1 = makeDeltaFromCapturedOps(ALEX, ops, endVersion, 0L);
    output.clear();

    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);
    // Delta2 event #1.
    ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip();
    // Delta2 event #2.
    wavelet.removeParticipant(ROBOT);
    // Delta2 event #3 - should be filtered.
    XmlStringBuilder builder = XmlStringBuilder.createText("some random content");
    LineContainers.appendToLastLine(newBlip.getContent(), builder);
View Full Code Here

  public void testWaveletWithNoBlipsResultsInEmptyTitleAndNoBlips() {
    TestingWaveletData data =
        new TestingWaveletData(WAVE_ID, CONVERSATION_WAVELET_ID, PARTICIPANT, true);
    ObservableWaveletData observableWaveletData = data.copyWaveletData().get(0);
    ObservableWavelet wavelet = OpBasedWavelet.createReadOnly(observableWaveletData);
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);

    SupplementedWave supplement = mock(SupplementedWave.class);
    when(supplement.isUnread(any(ConversationBlip.class))).thenReturn(true);

    Digest digest = digester.generateDigest(conversation, supplement, observableWaveletData);
View Full Code Here

        new TestingWaveletData(WAVE_ID, CONVERSATION_WAVELET_ID, PARTICIPANT, true);
    String title = "title";
    data.appendBlipWithText(title);
    ObservableWaveletData observableWaveletData = data.copyWaveletData().get(0);
    ObservableWavelet wavelet = OpBasedWavelet.createReadOnly(observableWaveletData);
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);

    SupplementedWave supplement = mock(SupplementedWave.class);
    when(supplement.isUnread(any(ConversationBlip.class))).thenReturn(true);

    Digest digest = digester.generateDigest(conversation, supplement, observableWaveletData);
View Full Code Here

    data.appendBlipWithText("blip number 1");
    data.appendBlipWithText("blip number 2");
    data.appendBlipWithText("blip number 3");
    ObservableWaveletData observableWaveletData = data.copyWaveletData().get(0);
    ObservableWavelet wavelet = OpBasedWavelet.createReadOnly(observableWaveletData);
    ObservableConversationView conversation = conversationUtil.buildConversation(wavelet);

    SupplementedWave supplement = mock(SupplementedWave.class);
    when(supplement.isUnread(any(ConversationBlip.class))).thenReturn(true, true, false);
    Digest digest = digester.generateDigest(conversation, supplement, observableWaveletData);
View Full Code Here

  @Override
  public void execute(
      OperationRequest operation, OperationContext context, ParticipantId participant)
      throws InvalidRequestException {
    OpBasedWavelet wavelet = context.openWavelet(operation, participant);
    ObservableConversationView conversationView = context.openConversation(operation, participant);

    String waveletId = OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVELET_ID);
    String conversationId;

    try {
      // TODO(anorth): Remove this round-trip when the API instead talks about
      // opaque conversation ids, and doesn't use legacy id serialization.
      conversationId = WaveletBasedConversation.idFor(
          ApiIdSerializer.instance().deserialiseWaveletId(waveletId));
    } catch (InvalidIdException e) {
      throw new InvalidRequestException("Invalid conversation id", operation, e);
    }
    ObservableConversation conversation = conversationView.getConversation(conversationId);

    OperationType type = OperationUtil.getOperationType(operation);
    switch (type) {
      case BLIP_CONTINUE_THREAD:
        continueThread(operation, context, participant, conversation);
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.conversation.ObservableConversationView

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.