Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.INews


   */
  @Test
  public void testRemovePersonWithoutNews() throws Exception {
    IFeed feed = createFeed("http://www.rssowl.org");
    feed = DynamicDAO.save(feed);
    INews news = fFactory.createNews(null, feed, new Date());
    fFactory.createPerson(null, news);
    INews savedNews = DynamicDAO.save(news);
    DynamicDAO.delete((savedNews.getAuthor()));
    savedNews = DynamicDAO.load(INews.class, savedNews.getId());
    assertNotNull(savedNews);
  }
View Full Code Here


   */
  @Test
  public void testRemoveCategoryWithoutNews() throws Exception {
    IFeed feed = createFeed("http://www.rssowl.org");
    feed = DynamicDAO.save(feed);
    INews news = fFactory.createNews(null, feed, new Date());
    fFactory.createCategory(null, news);
    INews savedNews = DynamicDAO.save(news);
    DynamicDAO.delete(news.getCategories().get(0));
    savedNews = DynamicDAO.load(INews.class, savedNews.getId());
    assertNotNull(savedNews);
  }
View Full Code Here

   */
  @Test
  public void testRemoveAttachmentWithoutNews() throws Exception {
    IFeed feed = createFeed("http://www.rssowl.org");
    feed = DynamicDAO.save(feed);
    INews news = fFactory.createNews(null, feed, new Date());
    fFactory.createAttachment(null, news);
    INews savedNews = DynamicDAO.save(news);
    DynamicDAO.delete(news.getAttachments().get(0));
    savedNews = DynamicDAO.load(INews.class, savedNews.getId());
    assertNotNull(savedNews);
  }
View Full Code Here

    /* Require a News */
    if (!(data instanceof INews))
      return false;

    /* Check if News is unread if set as flag */
    INews news = (INews) data;
    if (unread && !ModelUtils.isUnread(news.getState()))
      return false;

    return true;
  }
View Full Code Here

   */
  @Test
  public void testHandleReloadedWithAsyncLoadingOfEquivalentNews() throws Exception {
    IFeed feed0 = fFactory.createFeed(null, new URI("http://www.feed2.com"));
    URI newsLink = new URI("http://www.news.com");
    INews news0 = fFactory.createNews(null, feed0, new Date());
    news0.setLink(newsLink);
    news0.setState(INews.State.READ);
    DynamicDAO.save(feed0);

    IFolder folder = fFactory.createFolder(null, null, "Folder");
    IBookMark mark0 = fFactory.createBookMark(null, folder, new FeedLinkReference(feed0.getLink()), "Mark0");
    DynamicDAO.save(folder);
    fAppService.handleFeedReload(mark0, feed0, null, false);

    IFeed feed1 = fFactory.createFeed(null, new URI("http://www.feed1.com"));
    DynamicDAO.save(feed1);
    IBookMark mark1 = fFactory.createBookMark(null, folder, new FeedLinkReference(feed1.getLink()), "Mark1");
    DynamicDAO.save(folder);

    feed1 = fFactory.createFeed(null, new URI("http://www.feed1.com"));
    INews news1 = fFactory.createNews(null, feed1, new Date());
    news1.setLink(newsLink);
    fAppService.handleFeedReload(mark1, feed1, null, false);

    assertEquals(INews.State.READ, DynamicDAO.load(INews.class, news1.getId()).getState());
  }
View Full Code Here

    IBookMark mark = fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark");
    DynamicDAO.save(feed);
    DynamicDAO.save(folder);

    IFeed emptyFeed = fFactory.createFeed(null, feed.getLink());
    INews news = fFactory.createNews(null, emptyFeed, new Date());
    news.setState(INews.State.READ);

    Owl.getPreferenceService().getEntityScope(mark).putBoolean(DefaultPreferences.DEL_READ_NEWS_STATE, true);
    fAppService.handleFeedReload(mark, emptyFeed, null, false);

    assertEquals(0, feed.getVisibleNews().size());
    assertEquals(INews.State.DELETED, DynamicDAO.load(INews.class, news.getId()).getState());
  }
View Full Code Here

  @Test
  public void testHandleFeedReloadFillsOldNewsWithAttachmentDeleted() throws Exception {
    NewsListener newsListener = null;
    try {
      IFeed feed = fFactory.createFeed(null, new URI("http://www.rssowl.org"));
      INews news = fFactory.createNews(null, feed, new Date());
      news.setGuid(fFactory.createGuid(news, "newsguid"));
      fFactory.createAttachment(null, news);
      IFolder folder = fFactory.createFolder(null, null, "Folder");
      IBookMark mark = fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark");
      DynamicDAO.save(feed);
      DynamicDAO.save(folder);

      IFeed emptyFeed = fFactory.createFeed(null, feed.getLink());
      INews emptyNews = fFactory.createNews(null, emptyFeed, new Date());
      emptyNews.setGuid(fFactory.createGuid(news, news.getGuid().getValue()));

      newsListener = new NewsAdapter() {
        @Override
        public void entitiesUpdated(Set<NewsEvent> events) {
          assertEquals(1, events.size());
View Full Code Here

    NewsListener newsListener = null;
    try {
      IFeed feed1 = fFactory.createFeed(null, new URI("http://www.feed.com"));
      IFeed feed2 = fFactory.createFeed(null, new URI("http://www.feed2.com"));

      INews news1 = fFactory.createNews(null, feed1, new Date());
      news1.setLink(new URI("www.link.com"));

      INews news2 = fFactory.createNews(null, feed2, new Date());
      news2.setLink(new URI("www.link.com"));

      fFactory.createNews(null, feed1, new Date());
      fFactory.createNews(null, feed2, new Date());

      DynamicDAO.save(feed1);
View Full Code Here

    NewsListener newsListener = null;
    try {
      IFeed feed1 = fFactory.createFeed(null, new URI("http://www.feed.com"));
      IFeed feed2 = fFactory.createFeed(null, new URI("http://www.feed2.com"));

      INews news1 = fFactory.createNews(null, feed1, new Date());
      news1.setLink(new URI("www.link.com"));

      INews news2 = fFactory.createNews(null, feed2, new Date());
      news2.setLink(new URI("www.link.com"));

      fFactory.createNews(null, feed1, new Date());
      fFactory.createNews(null, feed2, new Date());

      DynamicDAO.save(feed1);
View Full Code Here

   * @throws Exception
   */
  @Test
  public void testSaveFeedNewsLost() throws Exception {
    IFeed feed = fFactory.createFeed(null, new URI("http://www.feed.com"));
    INews news0 = fFactory.createNews(null, feed, new Date());
    news0.setLink(new URI("http://www.feed.com/news1"));
    INews news1 = fFactory.createNews(null, feed, new Date());
    URI news1Link = new URI("http://www.feed.com/news2");
    news1.setLink(news1Link);
    DynamicDAO.save(feed);
    long feedId = feed.getId();
    INews news = feed.getNews().get(0);
    feed.removeNews(news);
    MergeResult mergeResult = new MergeResult();
    mergeResult.addRemovedObject(news);
    mergeResult.addUpdatedObject(feed);
    TestUtils.saveFeed(mergeResult);
View Full Code Here

TOP

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

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.