Package org.waveprotocol.wave.model.conversation.Conversation

Examples of org.waveprotocol.wave.model.conversation.Conversation.Anchor


  public void testSetAnchorUpdatesManifest() {
    // Anchor target(wavelet1) in alternate (wavelet2).
    WaveletBasedConversation conversation2 = makeConversation();
    populate(conversation2);
    ConversationBlip firstBlip = getFirstBlip(conversation2);
    Anchor anchor = conversation2.createAnchor(firstBlip);
    target.setAnchor(anchor);
    assertEquals(WaveletBasedConversation.idFor(conversation2.getWavelet().getId()),
        getManifestAttribute(manifestDoc, "anchorWavelet"));
    assertEquals(firstBlip.getId(), getManifestAttribute(manifestDoc, "anchorBlip"));
  }
View Full Code Here


   * un-anchored.
   */
  public void testClearAnchorClearsManifest() {
    WaveletBasedConversation conversation2 = makeConversation();
    populate(conversation2);
    Anchor anchor = conversation2.createAnchor(getFirstBlip(conversation2));
    target.setAnchor(anchor);
    target.setAnchor(null);
    assertNull(getManifestAttribute(manifestDoc, "anchorWavelet"));
    assertNull(getManifestAttribute(manifestDoc, "anchorBlip"));
  }
View Full Code Here

  }

  public void testCreateAnchor() {
    populate(alternate);
    ConversationBlip blip = getFirstBlip(alternate);
    Anchor anchor = alternate.createAnchor(blip);
    assertTrue(alternate == anchor.getConversation());
    assertTrue(blip == anchor.getBlip());
  }
View Full Code Here

  }

  public void testSetAnchor() {
    populate(alternate);
    ConversationBlip blip = getFirstBlip(alternate);
    Anchor anchor = alternate.createAnchor(blip);
    target.setAnchor(anchor);
    assertTrue(target.hasAnchor());
    assertEquals(anchor, target.getAnchor());
  }
View Full Code Here

  }

  public void testAnchorToSelfFails() {
    populate(target);
    ConversationBlip blip = getFirstBlip(target);
    Anchor anchor = target.createAnchor(blip);
    try {
      target.setAnchor(anchor);
      fail("Expected an IllegalArgumentException");
    } catch (IllegalArgumentException expected) {
    }
View Full Code Here

  }

  public void testClearAnchor() {
    populate(alternate);
    ConversationBlip blip = getFirstBlip(alternate);
    Anchor anchor = alternate.createAnchor(blip);
    target.setAnchor(anchor);
    target.setAnchor(null);
    assertFalse(target.hasAnchor());
  }
View Full Code Here

  // Regression test for a bug where the manifest was forgotten after
  // any element removed.
  public void testAnchorStillAccessibleAfterBlipAdded() {
    populate(alternate);
    ConversationBlip blip = getFirstBlip(alternate);
    Anchor anchor = alternate.createAnchor(blip);
    target.setAnchor(anchor);

    target.getRootThread().appendBlip();
    target.getRootThread().getFirstBlip().delete();
    assertTrue(target.hasAnchor());
View Full Code Here

  public void testSetAnchorEventsAreFired() {
    populate(alternate);
    ObservableConversation.AnchorListener listener =
        mock(ObservableConversation.AnchorListener.class);
    target.addListener(listener);
    Anchor anchor1 = alternate.createAnchor(getFirstBlip(alternate));

    // Set anchor from null.
    target.setAnchor(anchor1);
    verify(listener).onAnchorChanged(null, anchor1);

    // Change anchor to different blip.
    Anchor anchor11 = alternate.createAnchor(alternate.getRootThread().getFirstBlip()
        .getReplyThreads().iterator().next().getFirstBlip());
    target.setAnchor(anchor11);
    verify(listener).onAnchorChanged(anchor1, anchor11);

    // Change anchor to different wavelet.
    ObservableConversation alternate2 = makeConversation();
    populate(alternate2);
    Anchor anchor2 = alternate2.createAnchor(getFirstBlip(alternate2));
    target.setAnchor(anchor2);
    verify(listener).onAnchorChanged(anchor11, anchor2);

    // Set anchor to null.
    target.setAnchor(null);
View Full Code Here

    for (Conversation conversation : wave.getConversations()) {
      if (conversation == mainConversation) {
        continue;
      }

      Anchor anchor = conversation.getAnchor();
      ConversationBlip blip = anchor != null ? anchor.getBlip() : null;
      if (blip != null) {
        addLazily((anchoring = createIfNull(anchoring)), blip, conversation);
      } else {
        (unanchored = createIfNull(unanchored)).add(conversation);
      }
View Full Code Here

    for (Conversation conversation : wave.getConversations()) {
      if (conversation == mainConversation) {
        continue;
      }

      Anchor anchor = conversation.getAnchor();
      ConversationBlip blip = anchor != null ? anchor.getBlip() : null;
      if (blip != null) {
        addLazily((anchoring = createIfNull(anchoring)), blip, conversation);
      } else {
        (unanchored = createIfNull(unanchored)).add(conversation);
      }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.conversation.Conversation.Anchor

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.