Package org.rssowl.core.model.reference

Examples of org.rssowl.core.model.reference.FeedReference


      List<INews> newsList = new ArrayList<INews>();
      newsList.add(news);
      fAppLayer.setNewsState(newsList, State.NEW, true, false);
      NewsModel.getDefault().removeNewsListener(newsListener);
      fModelDAO.deleteNews(new NewsReference(news.getId()));
      fModelDAO.deleteFeed(new FeedReference(feed.getId()));
    } catch (PersistenceException e) {
      fail(e.getMessage());
    } finally {
      if (newsListener != null) {
        NewsModel.getDefault().removeNewsListener(newsListener);
View Full Code Here


      fAppLayer.setNewsState(newsList, State.NEW, true, false);
      news = newsRef.resolve();
      assertEquals(State.NEW, news.getState());
     
      fModelDAO.deleteNews(newsRef);
      fModelDAO.deleteFeed(new FeedReference(feed.getId()));
    } catch (PersistenceException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

      assertEquals(State.NEW, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fModelDAO.deleteNews(newsRef1);
      fModelDAO.deleteNews(newsRef2);
      fModelDAO.deleteFeed(new FeedReference(feed1.getId()));
      fModelDAO.deleteFeed(new FeedReference(feed2.getId()));
    } catch (PersistenceException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

      assertEquals(State.NEW, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fModelDAO.deleteNews(newsRef1);
      fModelDAO.deleteNews(newsRef2);
      fModelDAO.deleteFeed(new FeedReference(feed1.getId()));
      fModelDAO.deleteFeed(new FeedReference(feed2.getId()));
    } catch (PersistenceException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

      fAppLayer.setNewsState(newsList, State.NEW, true, false);
      news = newsRef.resolve();
      assertEquals(State.NEW, news.getState());
     
      fModelDAO.deleteNews(newsRef);
      fModelDAO.deleteFeed(new FeedReference(feed.getId()));
    } catch (PersistenceException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

      final URI news2Link = new URI("http://www.news2.com/index.html");
      final URI news3Link = new URI("http://www.news3.com/index.html");
      news1.setLink(news1Link);
      news2.setLink(news2Link);
      news3.setLink(news3Link);
      FeedReference feedRef = new FeedReference(fDao.saveFeed(feed).getId());

      assertEquals(3, fDao.loadFeed(feedRef.getId()).getNews().size());

      /* Mark 2 News as Deleted and save News */
      news1 = fDao.loadFeed(feedRef.getId()).getNews().get(0);
      news1.setState(INews.State.DELETED);
      news2 = fDao.loadFeed(feedRef.getId()).getNews().get(1);
      news2.setState(INews.State.DELETED);
      news3 = fDao.loadFeed(feedRef.getId()).getNews().get(2);
      news3.setState(INews.State.READ);

      final boolean newsUpdatedEvents[] = new boolean[2];

      newsListener = new NewsAdapter() {
        @Override
        public void newsUpdated(Set<NewsEvent> events) {
          for (NewsEvent event : events) {
            INews news = event.getEntity();
            if (news.getLink().equals(news1Link))
              newsUpdatedEvents[0] = true;
            else if (news.getLink().equals(news2Link))
              newsUpdatedEvents[1] = true;
          }
        }
      };
      fModel.addNewsListener(newsListener);

      NewsReference newsReference1 = new NewsReference(fDao.saveNews(news1).getId());
      NewsReference newsReference2 = new NewsReference(fDao.saveNews(news2).getId());
      NewsReference newsReference3 = new NewsReference(fDao.saveNews(news3).getId());

      assertEquals(INews.State.DELETED, fDao.loadFeed(feedRef.getId()).getNews().get(0).getState());
      assertEquals(INews.State.DELETED, fDao.loadFeed(feedRef.getId()).getNews().get(1).getState());
      assertEquals(INews.State.READ, fDao.loadFeed(feedRef.getId()).getNews().get(2).getState());

      /* Check Deleted News now being Deleted from DB */
      feed = fFactory.createFeed(null, new URL("http://www.feed.com"));
      List<INews> removedNews = feedRef.resolve().mergeAndCleanUp(feed);
      fAppLayer.saveFeed(feed, removedNews);

      /* Asserts follow */
      assertEquals(1, fDao.loadFeed(feedRef.getId()).getNews().size());
      assertNull(fDao.loadNews(newsReference1.getId()));
      assertNull(fDao.loadNews(newsReference2.getId()));
      assertNotNull(fDao.loadNews(newsReference3.getId()));

      for (int i = 0; i < newsUpdatedEvents.length; i++)
View Full Code Here

  public void testFlatBookMarkEvents() throws Exception {
    BookMarkListener bookMarkListener = null;
    try {
      IFeed feed = fFactory.createFeed(null, new URL("http://www.feed.com"));
      /* Add */
      FeedReference feedRef = new FeedReference(fDao.saveFeed(feed).getId());
      final FolderReference folderRef = new FolderReference(fDao.saveFolder(fFactory.createFolder(null, null, "Folder")).getId());
      IBookMark bookMark = fFactory.createBookMark(null, folderRef.resolve(),
          feed.getLink(), feedRef, "BookMark");
      final boolean bookMarkEvents[] = new boolean[3];
      final BookMarkReference bookMarkReference[] = new BookMarkReference[1];
View Full Code Here

    FeedListener feedListener = null;
    try {
      /* Add */
      IFeed feed = fFactory.createFeed(null, new URL("http://www.feed.com"));
      final boolean feedEvents[] = new boolean[3];
      final FeedReference feedReference[] = new FeedReference[1];
      feedListener = new FeedListener() {
        public void feedAdded(Set<FeedEvent> events) {
          for (FeedEvent event : events) {
            assertTrue("Expected this Event to be Root Event", event.isRoot());
            feedEvents[0] = true;
          }
        }

        public void feedDeleted(Set<FeedEvent> events) {
          for (FeedEvent event : events) {
            assertTrue("Expected this Event to be Root Event", event.isRoot());
            if (feedReference[0].references(event.getEntity()))
              feedEvents[1] = true;
          }
        }

        public void feedUpdated(Set<FeedEvent> events) {
          for (FeedEvent event : events) {
            assertTrue("Expected this Event to be Root Event", event.isRoot());
            if (feedReference[0].references(event.getEntity()))
              feedEvents[2] = true;
          }
        }
      };
      fModel.addFeedListener(feedListener);
      feedReference[0] = new FeedReference(fDao.saveFeed(feed).getId());

      /* Update */
      feed = feedReference[0].resolve();
      feed.setTitle("Feed Updated");
      fDao.saveFeed(feed);
View Full Code Here

  @Test
  public void testFlatAttachmentEvents() throws Exception {
    AttachmentListener attachmentListener = null;
    try {
      /* Add */
      FeedReference feedRef = new FeedReference(fDao.saveFeed(fFactory.createFeed(null, new URL("http://www.feed1.com"))).getId());
      NewsReference newsRef = new NewsReference(fDao.saveNews(fFactory.createNews(null, feedRef.resolve(), new Date())).getId());
      IAttachment attachment = fFactory.createAttachment(null, newsRef.resolve());
      attachment.setUrl(new URI("http://www.attachment.com"));
      final boolean attachmentEvents[] = new boolean[3];
      final AttachmentReference attachmentReference[] = new AttachmentReference[1];
      attachmentListener = new AttachmentAdapter() {
View Full Code Here

  @Test
  public void testFlatCategoryEvents() throws Exception {
    CategoryListener categoryListener = null;
    try {
      /* Add */
      FeedReference feedRef = new FeedReference(fDao.saveFeed(fFactory.createFeed(null, new URL("http://www.feed2.com"))).getId());
      NewsReference newsRef = new NewsReference(fDao.saveNews(fFactory.createNews(null, feedRef.resolve(), new Date())).getId());
      ICategory category1 = fFactory.createCategory(null, feedRef.resolve());
      category1.setName("Category");
      ICategory category2 = fFactory.createCategory(null, newsRef.resolve());
      category2.setName("Category");
      final boolean categoryEvents[] = new boolean[6];
      final CategoryReference categoryReference[] = new CategoryReference[2];
View Full Code Here

TOP

Related Classes of org.rssowl.core.model.reference.FeedReference

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.