@Override public BlipData toBlipData(ConversationBlip blip, Wavelet wavelet, EventMessageBundle eventMessageBundle) { BlipData blipData = super.toBlipData(blip, wavelet, eventMessageBundle); String threadId = blip.getThread().getId(); blipData.setThreadId(threadId); // If it's the root thread, that doesn't have thread id, then skip. if (!threadId.isEmpty()) { ConversationThread thread = blip.getThread(); addThread(eventMessageBundle, thread, -1, wavelet); } // Add the inline reply threads. List<String> threadIds = Lists.newLinkedList(); for (LocatedReplyThread<? extends ConversationThread> thread : blip.locateReplyThreads()) { String replyThreadId = thread.getThread().getId(); threadIds.add(replyThreadId); addThread(eventMessageBundle, thread.getThread(), thread.getLocation(), wavelet); } blipData.setReplyThreadIds(threadIds); return blipData; }
public void testToBlipDataHandlesBlipWithEmptyDocument() throws Exception { Blips.init(); Conversation conversation = makeConversation(); Wavelet wavelet = mock(Wavelet.class); when(wavelet.getWaveId()).thenReturn(WAVE_ID); when(wavelet.getId()).thenReturn(WAVELET_ID); EventDataConverterV21 converter = new EventDataConverterV21(); assertEquals("", converter.toBlipData(conversation.getRootThread().getFirstBlip(), wavelet, new EventMessageBundle(null, null)).getContent()); }
public void testToBlipDataHandlesBlipWithEmptyDocument() throws Exception { Blips.init(); Conversation conversation = makeConversation(); Wavelet wavelet = mock(Wavelet.class); when(wavelet.getWaveId()).thenReturn(WAVE_ID); when(wavelet.getId()).thenReturn(WAVELET_ID); EventDataConverterV21 converter = new EventDataConverterV21(); assertEquals("", converter.toBlipData(conversation.getRootThread().getFirstBlip(), wavelet, new EventMessageBundle(null, null)).getContent()); }