Package org.waveprotocol.wave.model.conversation

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


  /**
   * This test verifies the count in an empty inline thread.
   */
  public void testEmptyInlineThread() throws Exception {
    ConversationBlip rb1 = rootThread.appendBlip();
    ConversationThread t1 = rb1.addReplyThread(0);
    assertEquals(1, monitor.getTotalCount(rootThread));
    assertEquals(0, monitor.getTotalCount(t1));
  }
View Full Code Here


  /**
   * This test ensures that the total blip counts aggregate properly up through
   * nested inline threads.
   */
  public void testNestedThreadBlips() throws Exception {
    ConversationBlip rb1 = rootThread.appendBlip();
    ConversationThread t1 = rb1.addReplyThread(0);
    t1.appendBlip();
    t1.appendBlip();

    ConversationBlip rb2 = rootThread.appendBlip();
    ConversationThread t2 = rb2.addReplyThread(0);
    t2.appendBlip();
    ConversationBlip t2b2 = t2.appendBlip();

    ConversationThread t3 = t2b2.addReplyThread();
    t3.appendBlip();

    assertEquals(2, monitor.getTotalCount(t1));
    assertEquals(3, monitor.getTotalCount(t2));
    assertEquals(1, monitor.getTotalCount(t3));
View Full Code Here

  /**
   * This test verifies that blips counts are aggregated properly when a blip is
   * deleted which contains an inline thread.
   */
  public void testNestedThreadDeleteBlip() throws Exception {
    ConversationBlip rb1 = rootThread.appendBlip();
    ConversationThread t1 = rb1.addReplyThread(0);
    t1.appendBlip();
    t1.appendBlip();

    ConversationBlip rb2 = rootThread.appendBlip();
    ConversationThread t2 = rb2.addReplyThread(0);
    t2.appendBlip();
    ConversationBlip t2b2 = t2.appendBlip();

    ConversationThread t3 = t2b2.addReplyThread();
    t3.appendBlip();

    t2b2.delete();

    assertEquals(2, monitor.getTotalCount(t1));
    assertEquals(1, monitor.getTotalCount(t2));
    assertEquals(0, monitor.getTotalCount(t3));
    assertEquals(5, monitor.getTotalCount(rootThread));
View Full Code Here

  }

  @Override
  public BlipData toBlipData(ConversationBlip blip, Wavelet wavelet,
      EventMessageBundle eventMessageBundle) {
    ConversationBlip parentBlip = findBlipParent(blip);
    BlipData blipData = new BlipData();
    blipData.setCreator(blip.getAuthorId().getAddress());
    blipData.setContributors(idsToParticipantIdList(blip.getContributorIds()));
    blipData.setBlipId(blip.getId());
    blipData.setLastModifiedTime(blip.getLastModifiedTime());
    blipData.setVersion(blip.getLastModifiedVersion());
    blipData.setParentBlipId(parentBlip == null ? null : parentBlip.getId());
    blipData.setWaveId(ApiIdSerializer.instance().serialiseWaveId(wavelet.getWaveId()));
    blipData.setWaveletId(ApiIdSerializer.instance().serialiseWaveletId(wavelet.getId()));
    blipData.setChildBlipIds(toBlipIdList(findBlipChildren(blip)));

    ApiView apiView = new ApiView(blip.getContent(), wavelet);
View Full Code Here

   * @return the children of the given blip.
   */
  @Override
  public List<ConversationBlip> findBlipChildren(ConversationBlip blip) {
    List<ConversationBlip> siblings = Lists.newArrayList();
    ConversationBlip nextSibling = findNextSibling(blip);
    if (nextSibling != null) {
      siblings.add(nextSibling);
    }
    for (ConversationThread reply : blip.getReplyThreads()) {
      if (reply.getFirstBlip() != null) {
View Full Code Here

   * thread.
   */
  public void testRootThreadReading() throws Exception {
    rootThread.appendBlip();
    rootThread.appendBlip();
    ConversationBlip blip = rootThread.appendBlip();

    supplementedWave.markAsRead(blip);

    assertEquals(1, monitor.getReadCount(rootThread));
    assertEquals(2, monitor.getUnreadCount(rootThread));
View Full Code Here

   * @return the previous sibling of the blip, or {@code null}.
   */
  @VisibleForTesting
  static ConversationBlip findPreviousSibling(ConversationBlip blip) {
    ConversationThread thread = blip.getThread();
    ConversationBlip previous = null;
    for (ConversationBlip sibling : thread.getBlips()) {
      if (sibling == blip) {
        break;
      }
      previous = sibling;
View Full Code Here

  /**
   * This test verifies the read and unread state in both the root thread as
   * well as an inline thread.
   */
  public void testNestedThreadReading() throws Exception {
    ConversationBlip rb1 = rootThread.appendBlip();
    ConversationThread t1 = rb1.addReplyThread(0);
    t1.appendBlip();
    t1.appendBlip();

    ConversationBlip rb2 = rootThread.appendBlip();
    ConversationThread t2 = rb2.addReplyThread(0);
    t2.appendBlip();
    ConversationBlip t2b2 = t2.appendBlip();

    ConversationThread t3 = t2b2.addReplyThread();
    ConversationBlip t3b1 = t3.appendBlip();

    supplementedWave.markAsRead(t3b1);

    assertEquals(0, monitor.getReadCount(t1));
    assertEquals(2, monitor.getUnreadCount(t1));
View Full Code Here

  private static String getTitle(Wavelet wavelet, Conversation conversation) {
    ConversationThread rootThread = conversation.getRootThread();
    if (rootThread == null) {
      return "";
    }
    ConversationBlip firstBlip = rootThread.getFirstBlip();
    if (firstBlip == null) {
      return "";
    }
    Document doc = firstBlip.getContent();
    return TitleHelper.extractTitle(doc);
  }
View Full Code Here

  /**
   * This test verifies the read and unread state when a thread with read and
   * unread blips is deleted.
   */
  public void testNestedThreadWithDeleteReading() throws Exception {
    ConversationBlip rb1 = rootThread.appendBlip();
    ConversationThread t1 = rb1.addReplyThread(0);
    t1.appendBlip();
    ConversationBlip t1b2 = t1.appendBlip();

    ConversationBlip rb2 = rootThread.appendBlip();
    ConversationThread t2 = rb2.addReplyThread(0);
    t2.appendBlip();
    ConversationBlip t2b2 = t2.appendBlip();

    ConversationThread t3 = t2b2.addReplyThread();
    t3.appendBlip();
    ConversationBlip t3b1 = t3.appendBlip();

    supplementedWave.markAsRead(t3b1);
    supplementedWave.markAsRead(t1b2);
    t2b2.delete();

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.