Package org.waveprotocol.wave.model.conversation

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


  public ConversationBlip getBlip(Conversation conversation, String blipId)
      throws InvalidRequestException {
    // We might need to look up the blip id for new blips.
    String actualBlipId = blipId.startsWith(TEMP_ID_MARKER) ? tempBlipIdMap.get(blipId) : blipId;

    ConversationBlip blip = conversation.getBlip(actualBlipId);
    if (blip == null) {
      throw new InvalidRequestException(
          "Blip with id " + blipId + " does not exist or has been deleted");
    }
View Full Code Here


   * Returns the blip id of the first blip in the root thread.
   *
   * @param conversation the conversation to get the blip id from.
   */
  public static String getRootBlipId(Conversation conversation) {
    ConversationBlip rootBlip = conversation.getRootThread().getFirstBlip();
    return (rootBlip != null) ? rootBlip.getId() : "";
  }
View Full Code Here

    target = new LocalSupplementedWaveImpl(timer, wave, supplement);
    target.init();
  }

  private ConversationBlip mockBlip() {
    ConversationBlip blip = mock(ConversationBlip.class);
    Blip raw = mock(Blip.class);
    when(blip.hackGetRaw()).thenReturn(raw);
    return blip;
  }
View Full Code Here

    timer.tick(LocalSupplementedWaveImpl.REPEAT_MS);
    verify(supplement, never()).markAsRead(blip);
  }

  public void testAutoReadSupportsManyBlips() {
    ConversationBlip blip2 = mockBlip();

    target.markAsRead(blip);
    target.markAsRead(blip2);

    timer.tick(LocalSupplementedWaveImpl.REPEAT_MS);
View Full Code Here

    }
    verify(supplement, times(invocations)).markAsRead(blip);
  }

  public void testMarkAsUnreadClearsAutoReadingButContinuesReadingActiveBlip() {
    ConversationBlip other = mockBlip();
    target.startReading(blip);
    target.markAsRead(other);

    reset(supplement);
    target.markAsUnread();
View Full Code Here

  //

  public void testNewBlipIsUnread() {
    WaveletBasedConversation c = setUpWithWaveModel();
    ObservableConversationThread t = c.getRootThread();
    ConversationBlip b = t.appendBlip();

    assertTrue(supplement.isUnread(b));
  }
View Full Code Here

  }

  public void testMarkBlipAsReadAffectsBlipReadState() {
    WaveletBasedConversation c = setUpWithWaveModel();
    ObservableConversationThread t = c.getRootThread();
    ConversationBlip b = t.appendBlip();

    supplement.markAsRead(b);
    assertFalse(supplement.isUnread(b));
  }
View Full Code Here

  public void testMarkBlipIsIdempotent() {
    // Use real wave-model view.
    WaveletBasedConversation c = setUpWithWaveModel();
    Wavelet w = c.getWavelet();
    ObservableConversationThread t = c.getRootThread();
    ConversationBlip b = t.appendBlip();

    supplement.markAsRead(b);
    int blipReadVersion = substrate.getLastReadBlipVersion(w.getId(), b.getId());
    int waveletVersion = (int) w.getVersion();
    assertEquals(waveletVersion, blipReadVersion);

    // Do something to increase wavelet version without increasing blip last-modified version.
    t.appendBlip();
    assert w.getVersion() > waveletVersion : "test wave model did not increase version";

    // Test that marking blip as read again has no effect.
    supplement.markAsRead(b);
    long newBlipReadVersion = substrate.getLastReadBlipVersion(w.getId(), b.getId());
    assertEquals(blipReadVersion, (int) newBlipReadVersion);
  }
View Full Code Here

    // design reason to test this use case; this is just here because it was a
    // specific case that was failing before.
    WaveletBasedConversation c = setUpWithWaveModel();
    Wavelet w = c.getWavelet();
    ObservableConversationThread t = c.getRootThread();
    ConversationBlip b = t.appendBlip();

    supplement.markAsRead(b);
    supplement.markAsUnread();

    // Do something to increase wavelet version without increasing blip last-modified version.
    t.appendBlip();

    // Mark as read again, test that it's marked at wavelet version.
    supplement.markAsRead(b);
    int blipReadVersion = substrate.getLastReadBlipVersion(w.getId(), b.getId());
    assertEquals(blipReadVersion, (int) w.getVersion());
  }
View Full Code Here

    // design reason to test this use case; this is just here because it was a
    // specific case that was failing before.
    WaveletBasedConversation c = setUpWithWaveModel();
    Wavelet w = c.getWavelet();
    ObservableConversationThread t = c.getRootThread();
    ConversationBlip b = t.appendBlip();

    supplement.markAsRead(b);
    supplement.markAsUnread();

    // Increase both last-modified blip version and wavelet version (but latter more than former).
    b.getContent().appendXml(Blips.INITIAL_CONTENT);
    t.appendBlip();

    // Mark as read again, test that it's marked at wavelet version, not blip last-modified version.
    supplement.markAsRead(b);
    long blipReadVersion = substrate.getLastReadBlipVersion(w.getId(), b.getId());
    assertEquals(blipReadVersion, (int) w.getVersion());
  }
View Full Code Here

TOP

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

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.