Search in sources :

Example 1 with EntriesRetriever

use of com.newsrob.EntriesRetriever in project newsrob by marianokamp.

the class DifferentialUpdateTests method testDifferentialUpdateRead2.

/** Is the pinned state preserved */
public void testDifferentialUpdateRead2() throws Exception {
    createTestDataSet1();
    // One pinned, one unread, one read
    assertEquals(3, entryManager.getArticleCount());
    assertEquals(2, entryManager.getUnreadArticleCount());
    assertEquals(1, entryManager.getUnreadArticleCountExcludingPinned());
    // do
    final EntriesRetriever entriesRetriever = getEntriesRetriever(new String[] { getAtomIdForArticle(3) });
    // First article should still be read,
    // 2nd article should now be read,
    // 3rd article should still be unread and pinned.
    entriesRetriever.differentialUpdateOfArticlesStates(entryManager, TestUtil.getDummyJob(entryManager), EntriesRetriever.GOOGLE_STATE_READING_LIST, EntriesRetriever.GOOGLE_STATE_READ, ArticleDbState.READ);
    // Unchanged
    assertEquals(3, entryManager.getArticleCount());
    assertEquals(1, entryManager.getUnreadArticleCount());
    assertEquals(0, entryManager.getUnreadArticleCountExcludingPinned());
    Entry firstArticle = entryManager.findEntryByAtomId(getAtomIdForArticle(1));
    assertEquals(ReadState.READ, firstArticle.getReadState());
    assertFalse(firstArticle.isReadStatePending());
    Entry secondArticle = entryManager.findEntryByAtomId(getAtomIdForArticle(2));
    assertEquals(ReadState.READ, secondArticle.getReadState());
    assertFalse(secondArticle.isReadStatePending());
    Entry thirdArticle = entryManager.findEntryByAtomId(getAtomIdForArticle(3));
    assertEquals(ReadState.PINNED, thirdArticle.getReadState());
    assertFalse(thirdArticle.isReadStatePending());
}
Also used : Entry(com.newsrob.Entry) EntriesRetriever(com.newsrob.EntriesRetriever)

Example 2 with EntriesRetriever

use of com.newsrob.EntriesRetriever in project newsrob by marianokamp.

the class DifferentialUpdateTests method testDifferentialUpdateRead1.

public void testDifferentialUpdateRead1() throws Exception {
    createTestDataSet1();
    // One pinned, one unread, one read
    assertEquals(3, entryManager.getArticleCount());
    assertEquals(2, entryManager.getUnreadArticleCount());
    assertEquals(1, entryManager.getUnreadArticleCountExcludingPinned());
    // do
    final EntriesRetriever entriesRetriever = getEntriesRetriever(new String[] { getAtomIdForArticle(1) });
    // First article should now be unread,
    // 2nd article should now be read,
    // 3rd article should now be read.
    entriesRetriever.differentialUpdateOfArticlesStates(entryManager, TestUtil.getDummyJob(entryManager), EntriesRetriever.GOOGLE_STATE_READING_LIST, EntriesRetriever.GOOGLE_STATE_READ, ArticleDbState.READ);
    // Unchanged
    assertEquals(3, entryManager.getArticleCount());
    assertEquals(1, entryManager.getUnreadArticleCount());
    assertEquals(1, entryManager.getUnreadArticleCountExcludingPinned());
    Entry firstArticle = entryManager.findEntryByAtomId(getAtomIdForArticle(1));
    assertEquals(ReadState.UNREAD, firstArticle.getReadState());
    assertFalse(firstArticle.isReadStatePending());
    Entry secondArticle = entryManager.findEntryByAtomId(getAtomIdForArticle(2));
    assertEquals(ReadState.READ, secondArticle.getReadState());
    assertFalse(secondArticle.isReadStatePending());
    Entry thirdArticle = entryManager.findEntryByAtomId(getAtomIdForArticle(3));
    assertEquals(ReadState.READ, thirdArticle.getReadState());
    assertFalse(thirdArticle.isReadStatePending());
}
Also used : Entry(com.newsrob.Entry) EntriesRetriever(com.newsrob.EntriesRetriever)

Aggregations

EntriesRetriever (com.newsrob.EntriesRetriever)2 Entry (com.newsrob.Entry)2