Package org.rssowl.core.model.reference

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


  @Test
  public void testFlatPersonEvents() throws Exception {
    PersonListener personListener = null;
    try {
      /* Add */
      FeedReference feedRef = new FeedReference(fDao.saveFeed(fFactory.createFeed(null, new URL("http://www.feed4.com"))).getId());
      NewsReference newsRef = new NewsReference(fDao.saveNews(fFactory.createNews(null, feedRef.resolve(), new Date())).getId());
      IPerson person1 = fFactory.createPerson(null, feedRef.resolve());
      person1.setName("Person1");
      IPerson person2 = fFactory.createPerson(null, newsRef.resolve());
      person2.setName("Person2");
      final boolean personEvents[] = new boolean[6];
      final PersonReference personReference[] = new PersonReference[2];
View Full Code Here


   * @throws Exception
   */
  @Test
  public void testFolderMarkGrouping() throws Exception {
    IFeed feed = fFactory.createFeed(null, new URL("http://www.link.com"));
    FeedReference feedRef = new FeedReference(fDao.saveFeed(feed).getId());

    IFolder root = fFactory.createFolder(null, null, "Root");

    /* Today */
    IBookMark bookmark1 = fFactory.createBookMark(null, root, feed.getLink(), feedRef, "BookMark 1");
View Full Code Here

  public void testFolderMarkFiltering() throws Exception {
    IFeed feed1 = fFactory.createFeed(null, new URL("http://www.foo.com"));
    feed1.setDescription("This is the bar.");
    fFactory.createNews(null, feed1, new Date());
    fFactory.createNews(null, feed1, new Date()).setState(INews.State.UNREAD);
    FeedReference feedRef1 = new FeedReference(fDao.saveFeed(feed1).getId());

    IFeed feed2 = fFactory.createFeed(null, new URL("http://www.bar.com"));
    feed2.setDescription("This is the foo.");
    FeedReference feedRef2 = new FeedReference(fDao.saveFeed(feed2).getId());

    IFolder root = fFactory.createFolder(null, null, "Root");

    IBookMark bm1 = fFactory.createBookMark(null, root, feed1.getLink(), feedRef1, "FookMark 1");
    bm1.setErrorLoading(true);
View Full Code Here

  public void testRemoveBookMarkWithoutFolder() throws Exception {
    IFolder folder = fFactory.createFolder(null, null, "Folder");
    IFeed feed = createFeed("http://www.someurl.com");
    feed = fDao.saveFeed(feed);
    fFactory.createBookMark(null, folder, feed.getLink(),
        new FeedReference(feed.getId()), "Mark");
    IFolder savedFolder = fDao.saveFolder(folder);
    IBookMark savedMark = (IBookMark) savedFolder.getMarks().get(0);
    fDao.deleteBookMark(new BookMarkReference(savedMark.getId()));
    assertNotNull(fDao.loadFolder(savedFolder.getId()));
  }
View Full Code Here

    {
      IFolder folder = fFactory.createFolder(null, null, "Folder");
      IFeed feed = createFeed("http://www.someurl.com");
      feed = fDao.saveFeed(feed);
      fFactory.createBookMark(null, folder, feed.getLink(),
          new FeedReference(feed.getId()), "Mark");
      IFolder savedFolder = fDao.saveFolder(folder);
      IBookMark savedMark = (IBookMark) savedFolder.getMarks().get(0);
      IFeed savedFeed = savedMark.getFeedReference().resolve();
      fDao.deleteBookMark(new BookMarkReference(savedMark.getId()));
      assertNull("Feed must also be deleted since no more bookmarks reference it", fDao.loadFeed(savedFeed.getId()));
    }
    {
      IFolder folder = fFactory.createFolder(null, null, "AnotherFolder");
      IFeed feed = createFeed("http://www.anotherurl.com");
      feed = fDao.saveFeed(feed);
      fFactory.createBookMark(null, folder, feed.getLink(),
          new FeedReference(feed.getId()), "Mark1");
      fFactory.createBookMark(null, folder, feed.getLink(),
          new FeedReference(feed.getId()), "Mark2");
      IFolder savedFolder = fDao.saveFolder(folder);
      IBookMark savedMark1 = (IBookMark) savedFolder.getMarks().get(0);
      IBookMark savedMark2 = (IBookMark) savedFolder.getMarks().get(1);
      if (savedMark1.getName().equals("Mark2")) {
        IBookMark tempMark = savedMark1;
View Full Code Here

        }
      };
      fModel.addFeedListener(feedListener);

      /* Save Feed since a IBookMark now doesn't contain a feed */
      FeedReference feedRef = new FeedReference(fDao.saveFeed(feed).getId());

      final IBookMark bookMark1 = fFactory.createBookMark(null, root, feed.getLink(),
          feedRef, "Root BookMark");
      final IBookMark bookMark2 = fFactory.createBookMark(null, rootChild,
          feed.getLink(), feedRef, "Root Child BookMark");
View Full Code Here

    AttachmentListener attachmentListener = null;
    PersonListener personListener = null;
    CategoryListener categoryListener = null;
    try {
      IFeed feed = fFactory.createFeed(null, new URL("http://www.foobar.com"));
      FeedReference feedReference = new FeedReference(fDao.saveFeed(feed).getId());

      /* Check News Added */
      final INews news = fFactory.createNews(null, feedReference.resolve(), new Date());
      news.setTitle("News Title");
      final boolean newsAdded[] = new boolean[1];
      newsListener = new NewsAdapter() {
        @Override
        public void newsAdded(Set<NewsEvent> events) {
View Full Code Here

  public void testDeleteFeedNewsAndAttachment() throws Exception   {
    NewsListener newsListener = null;
    AttachmentListener attachmentListener = null;
    try {
      IFeed feed = fFactory.createFeed(null, new URL("http://www.foobar.com"));
      FeedReference feedReference = new FeedReference(fDao.saveFeed(feed).getId());

      /* Check News Added */
      final INews news = fFactory.createNews(null, feedReference.resolve(), new Date());
      news.setTitle("News Title");
      final IAttachment attachment0 = fFactory.createAttachment(null, news);
      attachment0.setUrl(new URI("http://www.attachment1.com"));
      final IAttachment attachment1 = fFactory.createAttachment(null, news);
      attachment1.setUrl(new URI("http://www.attachment1.com"));
      fDao.saveFeed(feed);
      NewsReference newsRef = new NewsReference(feed.getNews().get(0).getId());
      AttachmentReference attachmentRef0 = new AttachmentReference(news.getAttachments().get(0).getId());
      AttachmentReference attachmentRef1 = new AttachmentReference(news.getAttachments().get(1).getId());
     
      final boolean[] newsDeleted = new boolean[1];
      newsListener = new NewsListener() {
        public void newsDeleted(Set<NewsEvent> events) {
          for (NewsEvent event : events) {
            assertFalse("Expected this Event to be no Root Event", event.isRoot());
            if (event.getEntity().getTitle().equals(news.getTitle()))
              newsDeleted[0] = true;

            try {
              assertEquals(new URL("http://www.foobar.com").toString(),
                  event.getEntity().getFeedReference().getLink().toString());
            } catch (MalformedURLException e) {
              fail(e.getMessage());
            }
          }
        }
        public void newsUpdated(Set<NewsEvent> events) {
          fail("Unexpected event");
        }
        public void newsAdded(Set<NewsEvent> events) {
          fail("Unexpected event");
        }
      };
      fModel.addNewsListener(newsListener);

      /* Check Attachments Added */
      final boolean attachmentDeleted[] = new boolean[2];
      attachmentListener = new AttachmentAdapter() {
        @Override
        public void attachmentDeleted(Set<AttachmentEvent> events) {
          for (AttachmentEvent event : events) {
            assertFalse("Expected this Event to be no Root Event", event.isRoot());

            IAttachment attachment = event.getEntity();

            if (attachment.getUrl().equals(attachment0.getUrl()))
              attachmentDeleted[0] = true;
            if (attachment.getUrl().equals(attachment1.getUrl()))
              attachmentDeleted[1] = true;
          }
        }
      };
      fModel.addAttachmentListener(attachmentListener);

      fDao.deleteFeed(new FeedReference(feed.getId()));
      assertNull(fDao.loadFeed(feed.getId()));
      assertNull(fDao.loadNews(newsRef.getId()));
      assertNull(fDao.loadAttachment(attachmentRef0.getId()));
      assertNull(fDao.loadAttachment(attachmentRef1.getId()));
     
View Full Code Here

  public void testDeleteAttachmentFiresNewsUpdatedEvent() throws Exception {
    NewsListener newsListener = null;
    AttachmentListener attachmentListener = null;
    try {
      IFeed feed = fFactory.createFeed(null, new URL("http://www.foobar.com"));
      FeedReference feedReference = new FeedReference(fDao.saveFeed(feed).getId());

      /* Check News Added */
      final INews news = fFactory.createNews(null, feedReference.resolve(), new Date());
      news.setTitle("News Title");
      final IAttachment attachment1 = fFactory.createAttachment(null, news);
      attachment1.setUrl(new URI("http://www.attachment1.com"));
      fDao.saveNews(news);

View Full Code Here

      };
      fModel.addFolderListener(folderListener);

      /* Check BookMark Deleted */
      final IFeed feed = fFactory.createFeed(null, new URL("http://www.feed.com"));
      final FeedReference feedRef = new FeedReference(fDao.saveFeed(feed).getId());

      IBookMark bookMark1 = fFactory.createBookMark(null, rootRef.resolve(),
          feed.getLink(), feedRef, "Root BookMark");
      root = fDao.saveFolder(bookMark1.getFolder());
      final BookMarkReference bookMarkRef1 = new BookMarkReference(root.getMarks().get(0).getId());

      IBookMark bookMark2 = fFactory.createBookMark(null, rootChildRef.resolve(),
          feed.getLink(), feedRef, "Root Child BookMark");
      rootChild = fDao.saveFolder(bookMark2.getFolder());
      final BookMarkReference bookMarkRef2 = new BookMarkReference(rootChild.getMarks().get(0).getId());

      IBookMark bookMark3 = fFactory.createBookMark(null, rootChildChild1Ref.resolve(),
          feed.getLink(), feedRef, "Root Child Child #1 BookMark");
      rootChildChild1 = fDao.saveFolder(bookMark3.getFolder());
      final BookMarkReference bookMarkRef3 = new BookMarkReference(rootChildChild1.getMarks().get(0).getId());

      final boolean bookMarkEventsIssued[] = new boolean[3];
      final boolean feedEventsIssued[] = new boolean[1];

      bookMarkListener = new BookMarkAdapter() {
        @Override
        public void bookMarkDeleted(Set<BookMarkEvent> events) {
          for (BookMarkEvent event : events) {
            IBookMark bookMark = event.getEntity();

            if (bookMarkRef1.references(bookMark))
              bookMarkEventsIssued[0] = true;

            else if (bookMarkRef2.references(bookMark))
              bookMarkEventsIssued[1] = true;

            else if (bookMarkRef3.references(bookMark))
              bookMarkEventsIssued[2] = true;
          }
        }
      };
      fModel.addBookMarkListener(bookMarkListener);

      feedListener = new FeedAdapter() {
        @Override
        public void feedDeleted(Set<FeedEvent> events) {
          for (FeedEvent event : events) {
            assertFalse("Already received feed deleted event!", feedEventsIssued[0]);
            if (feedRef.references(event.getEntity()))
              feedEventsIssued[0] = true;
          }
        }
      };
      fModel.addFeedListener(feedListener);
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.