Package org.rssowl.ui.internal.services

Examples of org.rssowl.ui.internal.services.SyncItemsManager


   * @throws Exception
   */
  @Before
  public void setUp() throws Exception {
    ((PersistenceServiceImpl) Owl.getPersistenceService()).recreateSchemaForTests();
    SyncItemsManager manager = new SyncItemsManager();
    manager.startup();
    manager.clearUncommittedItems();
    manager.shutdown();
  }
View Full Code Here


  /**
   * @throws Exception
   */
  @Test
  public void testSyncItemsManager() throws Exception {
    SyncItemsManager manager = new SyncItemsManager();
    manager.startup();

    assertTrue(manager.getUncommittedItems().isEmpty());

    IFeed feed = fFactory.createFeed(null, URI.create("rssowl.org"));

    INews news1 = fFactory.createNews(null, feed, new Date());
    news1.setInReplyTo(feed.getLink().toString());
    news1.setGuid(fFactory.createGuid(news1, "tag:google.com/foo", true));

    INews news2 = fFactory.createNews(null, feed, new Date());
    news2.setInReplyTo(feed.getLink().toString());
    news2.setGuid(fFactory.createGuid(news2, "tag:google.com/bar", true));

    SyncItem item1 = SyncItem.toSyncItem(news1);
    item1.setMarkedRead();

    SyncItem item2 = SyncItem.toSyncItem(news2);
    item2.addLabel("Foo");
    item2.addLabel("Bar");
    item2.removeLabel("Hello World");

    manager.addUncommitted(Arrays.asList(item1, item2));

    assertTrue(manager.hasUncommittedItems());

    manager.shutdown();
    assertFalse(manager.hasUncommittedItems());
    manager.startup();
    assertTrue(manager.hasUncommittedItems());

    Collection<SyncItem> uncommittedItems = manager.getUncommittedItems().values();
    assertEquals(2, uncommittedItems.size());

    Iterator<SyncItem> iterator = uncommittedItems.iterator();
    SyncItem loadedItem1 = iterator.next();
    SyncItem loadedItem2 = iterator.next();

    assertTrue(item1.isEquivalent(loadedItem1));
    assertTrue(item2.isEquivalent(loadedItem2));

    SyncItem item3 = SyncItem.toSyncItem(news1);
    item3.setMarkedUnread();
    item3.setStarred();

    manager.addUncommitted(Collections.singleton(item3));

    uncommittedItems = manager.getUncommittedItems().values();
    assertEquals(2, uncommittedItems.size());

    iterator = uncommittedItems.iterator();
    loadedItem1 = iterator.next();

View Full Code Here

   * @throws Exception
   */
  @Before
  public void setUp() throws Exception {
    ((PersistenceServiceImpl) Owl.getPersistenceService()).recreateSchemaForTests();
    SyncItemsManager manager = new SyncItemsManager();
    manager.startup();
    manager.clearUncommittedItems();
    manager.shutdown();
  }
View Full Code Here

TOP

Related Classes of org.rssowl.ui.internal.services.SyncItemsManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.