Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.INewsBin


   * @throws Exception
   */
  @Test
  public void testNewsDaoLoadAllFromFeed() throws Exception {
    IFolder root = fTypesFactory.createFolder(null, null, "Root");
    INewsBin bin = fTypesFactory.createNewsBin(null, root, "Bin");
    DynamicDAO.save(root);

    IFeed parent = fTypesFactory.createFeed(null, new URI("http://www.feed.com"));
    INews news = fTypesFactory.createNews(null, parent, new Date());
    DynamicDAO.save(parent);
View Full Code Here


    INews news = fTypesFactory.createNews(null, feed, new Date());
    news.setState(INews.State.DELETED);
    DynamicDAO.save(feed);

    IFolder folder = fTypesFactory.createFolder(null, null, "Folder");
    INewsBin newsBin = fTypesFactory.createNewsBin(null, folder, "NewsBin");
    DynamicDAO.save(folder);

    INews newsCopy = fTypesFactory.createNews(news, newsBin);
    DynamicDAO.save(newsCopy);
    DynamicDAO.save(newsBin);

    assertEquals(0, newsBin.getNews().size());
    assertEquals(null, fNewsDAO.load(newsCopy.getId()));
  }
View Full Code Here

    INews news = fTypesFactory.createNews(null, feed, new Date());
    news.setState(INews.State.READ);
    DynamicDAO.save(feed);

    IFolder folder = fTypesFactory.createFolder(null, null, "Folder");
    INewsBin newsBin = fTypesFactory.createNewsBin(null, folder, "NewsBin");
    DynamicDAO.save(folder);

    INews newsCopy = fTypesFactory.createNews(news, newsBin);
    newsCopy.setState(INews.State.NEW);
    DynamicDAO.save(newsCopy);
    DynamicDAO.save(newsBin);

    assertEquals(1, newsBin.getNews(EnumSet.of(INews.State.NEW)).size());
  }
View Full Code Here

    fTypesFactory.createGuid(news, "http://www.link.com", true);
    DynamicDAO.save(feed);

    IFolder folder = fTypesFactory.createFolder(null, null, "Folder");
    IBookMark bookMark = fTypesFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");
    INewsBin newsBin = fTypesFactory.createNewsBin(null, folder, "NewsBin");
    DynamicDAO.save(folder);

    INews newsCopy = fTypesFactory.createNews(news, newsBin);
    DynamicDAO.save(newsCopy);
    DynamicDAO.save(newsBin);
View Full Code Here

    fTypesFactory.createGuid(news, "http://www.link.com", true);
    DynamicDAO.save(feed);

    IFolder folder = fTypesFactory.createFolder(null, null, "Folder");
    IBookMark bookMark = fTypesFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");
    INewsBin newsBin = fTypesFactory.createNewsBin(null, folder, "NewsBin");
    DynamicDAO.save(folder);

    INews newsCopy = fTypesFactory.createNews(news, newsBin);
    DynamicDAO.save(newsCopy);
    DynamicDAO.save(newsBin);

    assertEquals(1, bookMark.getNewsCount(EnumSet.of(INews.State.NEW)));
    assertEquals(1, newsBin.getNewsCount(EnumSet.of(INews.State.NEW)));

    fNewsDAO.setState(Collections.singleton(newsCopy), INews.State.READ, false, false);

    assertEquals(1, bookMark.getNewsCount(EnumSet.of(INews.State.NEW)));
    assertEquals(0, newsBin.getNewsCount(EnumSet.of(INews.State.NEW)));
  }
View Full Code Here

    fTypesFactory.createGuid(news, "http://www.link.com", true);
    DynamicDAO.save(feed);

    IFolder folder = fTypesFactory.createFolder(null, null, "Folder");
    fTypesFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");
    INewsBin newsBin = fTypesFactory.createNewsBin(null, folder, "NewsBin");
    DynamicDAO.save(folder);

    INews newsCopy = fTypesFactory.createNews(news, newsBin);
    DynamicDAO.save(newsCopy);
    DynamicDAO.save(newsBin);

    fNewsDAO.setState(Collections.singleton(newsCopy), INews.State.HIDDEN, false, false);
    assertEquals(1, newsBin.getNewsRefs().size());
    assertEquals(1, newsBin.getNewsRefs(EnumSet.of(INews.State.HIDDEN)).size());
    assertEquals(0, newsBin.getNewsRefs(EnumSet.of(INews.State.NEW)).size());
    assertEquals(newsCopy, newsBin.getNews().get(0));

    fNewsDAO.setState(Collections.singleton(newsCopy), INews.State.DELETED, false, false);
    assertEquals(0, newsBin.getNewsRefs().size());
    assertNull(fNewsDAO.load(newsCopy.getId()));
  }
View Full Code Here

    fTypesFactory.createGuid(news, "http://www.link.com", true);
    DynamicDAO.save(feed);

    IFolder folder = fTypesFactory.createFolder(null, null, "Folder");
    IBookMark mark = fTypesFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");
    INewsBin newsBin = fTypesFactory.createNewsBin(null, folder, "NewsBin");
    DynamicDAO.save(folder);

    INews newsCopy = fTypesFactory.createNews(news, newsBin);
    DynamicDAO.save(newsCopy);
    DynamicDAO.save(newsBin);

    DynamicDAO.delete(mark);
    /*
     * Mark containing the feed was deleted, but feed is not deleted because
     * it's still referenced by a copied news. The feed is hence empty.
     */
    assertEquals(0, feed.getNews().size());
    assertEquals(1, newsBin.getNewsRefs().size());
    assertEquals(newsCopy, newsBin.getNews().get(0));
  }
View Full Code Here

    fTypesFactory.createGuid(news, "http://www.link.com", true);
    DynamicDAO.save(feed);

    IFolder folder = fTypesFactory.createFolder(null, null, "Folder");
    IBookMark bookMark = fTypesFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark");
    INewsBin newsBin = fTypesFactory.createNewsBin(null, folder, "bin");
    DynamicDAO.save(folder);

    INews newsCopy = fTypesFactory.createNews(news, newsBin);
    DynamicDAO.save(newsCopy);
    DynamicDAO.save(newsBin);
View Full Code Here

    fTypesFactory.createGuid(news, "http://www.link.com", true);
    DynamicDAO.save(feed);

    IFolder folder = fTypesFactory.createFolder(null, null, "Folder");
    fTypesFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");
    INewsBin newsBin = fTypesFactory.createNewsBin(null, folder, "NewsBin");
    DynamicDAO.save(folder);

    INews newsCopy = fTypesFactory.createNews(news, newsBin);
    DynamicDAO.save(newsCopy);
    DynamicDAO.save(newsBin);
View Full Code Here

   * Tests that deleting a news bin is not sending out folder-deleted events.
   */
  @Test
  public void testDeleteBinIsNotSendindFolderDeleteEvents() {
    IFolder folder = fTypesFactory.createFolder(null, null, "Folder");
    INewsBin bin = fTypesFactory.createNewsBin(null, folder, "News Bin");
    DynamicDAO.save(folder);

    assertNotNull(DynamicDAO.load(INewsBin.class, bin.getId()));

    final boolean[] bool = new boolean[] { false };

    FolderAdapter folderListener = new FolderAdapter() {
      @Override
      public void entitiesDeleted(Set<FolderEvent> events) {
        bool[0] = true;
      }
    };

    DynamicDAO.addEntityListener(IFolder.class, folderListener);

    DynamicDAO.delete(bin);
    assertNull(DynamicDAO.load(INewsBin.class, bin.getId()));

    DynamicDAO.removeEntityListener(IFolder.class, folderListener);

    assertFalse("Unexpected Folder Event", bool[0]);
  }
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.INewsBin

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.