/** * Finds the parent of a blip. The parent is the preceding blip in the thread, * or the blip to which the thread is a reply for the first blip in a thread. * The first blip of the root thread has no parent. * * @param blip the blip. * @return the blip's parent, or {@code null} if the blip is the first blip * in a conversation. */ @Override public ConversationBlip findBlipParent(ConversationBlip blip) { ConversationThread containingThread = blip.getThread(); if (containingThread.getFirstBlip() == blip && containingThread != blip.getConversation().getRootThread()) { return containingThread.getParentBlip(); } return findPreviousSibling(blip); }
public void testAppendBlipAppendsBlipsToThread() { ConversationThread thread = target.getRootThread(); ConversationBlip b1 = thread.appendBlip(); ConversationBlip b2 = thread.appendBlip(); ConversationBlip b3 = thread.appendBlip(); assertSame(b1, thread.getFirstBlip()); assertSame(target, b1.getConversation()); assertSame(thread, b1.getThread()); assertSame(b1, target.getBlip(b1.getId())); assertEquals(Arrays.asList(b1, b2, b3), getBlipList(thread)); }
public void testAppendBlipAppendsBlipsToThread() { ConversationThread thread = target.getRootThread(); ConversationBlip b1 = thread.appendBlip(); ConversationBlip b2 = thread.appendBlip(); ConversationBlip b3 = thread.appendBlip(); assertSame(b1, thread.getFirstBlip()); assertSame(target, b1.getConversation()); assertSame(thread, b1.getThread()); assertSame(b1, target.getBlip(b1.getId())); assertEquals(Arrays.asList(b1, b2, b3), getBlipList(thread)); }
/** * Asserts that the state-querying methods on a blip can be called. */ protected static void assertBlipAccessible(ConversationBlip blip) { blip.getReplyThreads(); blip.getAuthorId(); blip.getContent(); blip.getContributorIds(); blip.getConversation(); blip.getId(); blip.locateReplyThreads(); blip.getLastModifiedTime(); blip.getLastModifiedVersion(); blip.getReplyThreads(); blip.getThread(); blip.hackGetRaw(); blip.isRoot(); }
/** * Asserts that the state-querying methods on a blip can be called. */ protected static void assertBlipAccessible(ConversationBlip blip) { blip.getReplyThreads(); blip.getAuthorId(); blip.getContent(); blip.getContributorIds(); blip.getConversation(); blip.getId(); blip.locateReplyThreads(); blip.getLastModifiedTime(); blip.getLastModifiedVersion(); blip.getReplyThreads(); blip.getThread(); blip.hackGetRaw(); blip.isRoot(); }
void populate(ConversationBlip blip, FakeBlipView blipUi) { for (ThreadBuilder threadBuilder : unanchored) { ConversationThread thread = blip.addReplyThread(); threadBuilder.populate(thread, blipUi.insertDefaultAnchorBefore(null, thread).getThread()); } for (ThreadBuilder threadBuilder : anchored) { ConversationThread thread = blip.addReplyThread(blip.getContent().size() - 1); FakeAnchor anchor = blipUi.insertDefaultAnchorBefore(null, thread); FakeInlineThreadView threadUi = anchor.getThread(); threadBuilder.populate(thread, threadUi); anchor.detach(threadUi); blipUi.getMeta().createInlineAnchorBefore(null, thread).attach(threadUi); } for (ConversationBuilder conversationBuilder : privates) { Conversation conversation = wave.createConversation(); conversation.setAnchor(blip.getConversation().createAnchor(blip)); assert conversation.hasAnchor(); conversationBuilder.populate( conversation, blipUi.insertConversationBefore(null, conversation)); } }
void populate(ConversationBlip blip, FakeBlipView blipUi) { for (ThreadBuilder threadBuilder : unanchored) { ConversationThread thread = blip.addReplyThread(); threadBuilder.populate(thread, blipUi.insertDefaultAnchorBefore(null, thread).getThread()); } for (ThreadBuilder threadBuilder : anchored) { ConversationThread thread = blip.addReplyThread(blip.getContent().size() - 1); FakeAnchor anchor = blipUi.insertDefaultAnchorBefore(null, thread); FakeInlineThreadView threadUi = anchor.getThread(); threadBuilder.populate(thread, threadUi); anchor.detach(threadUi); blipUi.getMeta().createInlineAnchorBefore(null, thread).attach(threadUi); } for (ConversationBuilder conversationBuilder : privates) { Conversation conversation = wave.createConversation(); conversation.setAnchor(blip.getConversation().createAnchor(blip)); assert conversation.hasAnchor(); conversationBuilder.populate( conversation, blipUi.insertConversationBefore(null, conversation)); } }