private ConversationBlip mockBlip() { ConversationBlip blip = mock(ConversationBlip.class); Blip raw = mock(Blip.class); when(blip.hackGetRaw()).thenReturn(raw); return blip; }
private ConversationBlip mockBlip() { ConversationBlip blip = mock(ConversationBlip.class); Blip raw = mock(Blip.class); when(blip.hackGetRaw()).thenReturn(raw); return blip; }
@Override public boolean isUnread(ConversationBlip blip) { Blip raw = blip.hackGetRaw(); return supplement.isBlipUnread(raw.getWavelet().getId(), raw.getId(), raw .getLastModifiedVersion().intValue()); }
@SuppressWarnings("deprecation") public void testRemoteOpStopsAutoReading() { ArgumentCaptor<WaveletListener> arg = ArgumentCaptor.forClass(WaveletListener.class); verify(root).addListener(arg.capture()); WaveletListener listener = arg.getValue(); target.markAsRead(blip); timer.tick(LocalSupplementedWaveImpl.REPEAT_MS); reset(supplement); // Ignore anything that happened before now. listener.onRemoteBlipContentModified(root, blip.hackGetRaw()); // Expect that target removed the blip from the auto-read collection. timer.tick(LocalSupplementedWaveImpl.REPEAT_MS); verify(supplement, never()).markAsRead(blip); }
@SuppressWarnings("deprecation") public void testRemoteOpStopsAutoReading() { ArgumentCaptor<WaveletListener> arg = ArgumentCaptor.forClass(WaveletListener.class); verify(root).addListener(arg.capture()); WaveletListener listener = arg.getValue(); target.markAsRead(blip); timer.tick(LocalSupplementedWaveImpl.REPEAT_MS); reset(supplement); // Ignore anything that happened before now. listener.onRemoteBlipContentModified(root, blip.hackGetRaw()); // Expect that target removed the blip from the auto-read collection. timer.tick(LocalSupplementedWaveImpl.REPEAT_MS); verify(supplement, never()).markAsRead(blip); }
@Override public void markAsRead(ConversationBlip b) { // Because we use the current wavelet version to mark a blip as read, and // because the wavelet version can change independently of that blip, the // mark-blip-as-read action is not idempotent. Therefore, to minimise // chatter, we do it only for unread blips. if (isUnread(b)) { Blip raw = b.hackGetRaw(); Wavelet wavelet = raw.getWavelet(); supplement.markBlipAsRead(wavelet.getId(), raw.getId(), // It is possible that during a VersionUpdateOperatin, the blip version is updated // before the wavelet version is updated, hence the max. // TODO(user, zdwang) to remove this once the wave model does correct event boundaries. (int) Math.max(raw.getLastModifiedVersion(), wavelet.getVersion())); } }
/** * 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(); }