/** * 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() : ""; } }
private WaveletId getAnchorWaveletId() { // may be null String anchorWaveletId = manifest.getAnchor().getConversationId(); return widFor(anchorWaveletId); }
public void testDeleteBlipWithInlineReplyDeletesReply() { ConversationBlip blip = target.getRootThread().appendBlip(); MutableDocument<?, ?, ?> doc = blip.getContent(); ConversationThread reply = blip.addReplyThread(locateAfterLineElement(doc)); ConversationBlip replyBlip = reply.appendBlip(); blip.delete(); assertNull(target.getRootThread().getFirstBlip()); assertThreadInvalid(reply); assertBlipInvalid(replyBlip); }
public void testDeleteConversationInvalidatesNonRootThreads() { ObservableConversationBlip outerBlip = target.getRootThread().appendBlip(); ObservableConversationThread inlineThread = outerBlip.addReplyThread(locateAfterLineElement(outerBlip.getContent())); ObservableConversationBlip innerBlip = inlineThread.appendBlip(); target.addListener(convListener); target.delete(); assertBlipInvalid(outerBlip); assertBlipInvalid(innerBlip); assertThreadInvalid(inlineThread); }
/** * Very basic test to see that we can create the object with a document and use it. */ public void testSimpleUsageWithDocument() { ObservableManifestThread thread = buildThreadElement( ConversationTestUtils.createManifestDocument(), "t1"); ManifestBlip blip = thread.appendBlip("b+1"); assertNotNull(blip); assertEquals("b+1", blip.getId()); assertFalse(thread.isInline()); }
public void testCanAppendAfterDeletingRootThreadReplies() { ConversationBlip first = target.getRootThread().appendBlip(); ConversationBlip second = target.getRootThread().appendBlip(); ConversationThread reply = first.addReplyThread(); reply.appendBlip(); second.delete(); first.delete(); ConversationBlip newFirst = target.getRootThread().appendBlip(); assertBlipValid(newFirst); }
public void testDeleteSingleRootThreadBlipRemovesIt() { ConversationBlip blip = target.getRootThread().appendBlip(); blip.delete(); assertNull(target.getRootThread().getFirstBlip()); assertBlipInvalid(blip); }
/** * Very basic test to see that we can create the object with a document and use it. */ public void testSimpleUsageWithDocument() { ObservableManifestBlip blip = buildBlipElement(ConversationTestUtils.createManifestDocument(), "b+1"); assertEquals("b+1", blip.getId()); ManifestThread reply = blip.appendReply("t1", false); assertNotNull(reply); assertEquals("t1", reply.getId()); }
public void testCreateAnchor() { populate(alternate); ConversationBlip blip = getFirstBlip(alternate); Anchor anchor = alternate.createAnchor(blip); assertTrue(alternate == anchor.getConversation()); assertTrue(blip == anchor.getBlip()); }
public void testAppendBlipsInRootThreadUpdatesManifest() { WaveletBasedConversationBlip first = target.getRootThread().appendBlip(); assertManifestXml("<blip id=\"" + first.getId() + "\"></blip>"); WaveletBasedConversationBlip second = target.getRootThread().appendBlip(); assertManifestXml("<blip id=\"" + first.getId() + "\"></blip>" + "<blip id=\"" + second.getId() + "\"></blip>"); assertMirrorConversationEquivalent(); }
public void testCanAppendAfterDeletingOnlyRootThreadBlip() { ConversationBlip first = target.getRootThread().appendBlip(); first.delete(); ConversationBlip second = target.getRootThread().appendBlip(); assertBlipInvalid(first); assertBlipValid(second); }
public void testCannotGetBlipAsDataDocument() { ConversationBlip blip = target.getRootThread().appendBlip(); try { target.getDataDocument(blip.getId()); fail("Expected an exception fetching a blip document as a data doc"); } catch (IllegalArgumentException expected) { } }
/** * Removes a thread from the manifest, as though a remote client had done so. */ private void remoteRemoveThread(WaveletBasedConversationThread thread) { ManifestBlip parentBlip = thread.getParentBlip().getManifestBlip(); ManifestThread manifestThread = thread.getManifestThread(); parentBlip.removeReply(manifestThread); }
/** * Asserts that a new conversation model built on top of the target * conversation's substrate matches the structure of that. */ private void assertMirrorConversationEquivalent() { Conversation copy = mirrorConversation(target); assertThreadsEquivalent(target.getRootThread(), copy.getRootThread()); }
public void testDeleteBlipWithInlineReplyDeletesReply() { ConversationBlip blip = target.getRootThread().appendBlip(); MutableDocument<?, ?, ?> doc = blip.getContent(); ConversationThread reply = blip.addReplyThread(locateAfterLineElement(doc)); ConversationBlip replyBlip = reply.appendBlip(); blip.delete(); assertNull(target.getRootThread().getFirstBlip()); assertThreadInvalid(reply); assertBlipInvalid(replyBlip); }
public void testDeleteConversationInvalidatesNonRootThreads() { ObservableConversationBlip outerBlip = target.getRootThread().appendBlip(); ObservableConversationThread inlineThread = outerBlip.addReplyThread(locateAfterLineElement(outerBlip.getContent())); ObservableConversationBlip innerBlip = inlineThread.appendBlip(); target.addListener(convListener); target.delete(); assertBlipInvalid(outerBlip); assertBlipInvalid(innerBlip); assertThreadInvalid(inlineThread); }
/** * Very basic test to see that we can create the object with a document and use it. */ public void testSimpleUsageWithDocument() { ObservableManifestThread thread = buildThreadElement( ConversationTestUtils.createManifestDocument(), "t1"); ManifestBlip blip = thread.appendBlip("b+1"); assertNotNull(blip); assertEquals("b+1", blip.getId()); assertFalse(thread.isInline()); }
public void testCanAppendAfterDeletingRootThreadReplies() { ConversationBlip first = target.getRootThread().appendBlip(); ConversationBlip second = target.getRootThread().appendBlip(); ConversationThread reply = first.addReplyThread(); reply.appendBlip(); second.delete(); first.delete(); ConversationBlip newFirst = target.getRootThread().appendBlip(); assertBlipValid(newFirst); }
public void testDeleteSingleRootThreadBlipRemovesIt() { ConversationBlip blip = target.getRootThread().appendBlip(); blip.delete(); assertNull(target.getRootThread().getFirstBlip()); assertBlipInvalid(blip); }
public void testAppendBlipsInRootThreadUpdatesManifest() { WaveletBasedConversationBlip first = target.getRootThread().appendBlip(); assertManifestXml("<blip id=\"" + first.getId() + "\"></blip>"); WaveletBasedConversationBlip second = target.getRootThread().appendBlip(); assertManifestXml("<blip id=\"" + first.getId() + "\"></blip>" + "<blip id=\"" + second.getId() + "\"></blip>"); assertMirrorConversationEquivalent(); }