Package org.rssowl.core.model.reference

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


      return;
    }
    final News initialNews = (News) createNews(feed);
    initialNews.setState(State.NEW);
    INews newsItem = null;
    NewsReference newsRef = null;
    try {
      newsItem = fModelDAO.saveNews(initialNews);
      newsRef = new NewsReference(newsItem.getId());
    } catch (PersistenceException e) {
      fail(e.getMessage());
      return;
    }
    try {
      List<INews> newsList = new ArrayList<INews>();
      newsList.add(newsItem);
      fAppLayer.setNewsState(newsList, State.UPDATED, true, false);
      INews news = newsRef.resolve();
      assertEquals(State.UPDATED, news.getState());
      fAppLayer.setNewsState(newsList, State.DELETED, true, false);
      news = newsRef.resolve();
      assertEquals(State.DELETED, news.getState());
      fAppLayer.setNewsState(newsList, State.HIDDEN, true, false);
      news = newsRef.resolve();
      assertEquals(State.HIDDEN, news.getState());
      fAppLayer.setNewsState(newsList, State.READ, true, false);
      news = newsRef.resolve();
      assertEquals(State.READ, news.getState());
      fAppLayer.setNewsState(newsList, State.UNREAD, true, false);
      news = newsRef.resolve();
      assertEquals(State.UNREAD, news.getState());
      fAppLayer.setNewsState(newsList, State.NEW, true, false);
      news = newsRef.resolve();
      assertEquals(State.NEW, news.getState());
      // Make sure it doesn't change when we set it to the same
      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) {
View Full Code Here


    final NewsReference[] newsRef = new NewsReference[1];
    newsAdapter = new NewsAdapter() {
      @Override
      public void newsAdded(Set<NewsEvent> events) {
        assertEquals(1, events.size());
        newsRef[0] = new NewsReference(events.iterator().next().getEntity().getId());
      }
    };
    NewsModel.getDefault().addNewsListener(newsAdapter);
   
    final News initialNews1 = (News) createNews(feed1);
    initialNews1.setGuid(null);
    initialNews1.setState(State.NEW);
    final News initialNews2 = (News) createNews(feed2);
    initialNews2.setGuid(null);
    initialNews2.setState(State.NEW);

    INews newsItem1 = null;
    NewsReference newsRef1 = null;
   
    INews newsItem2 = null;
    NewsReference newsRef2 = null;
   
    NewsReference newsRef3 = null;
    try {
      fModelDAO.saveFeed(feed1);
      newsRef1 = newsRef[0];
      newsItem1 = newsRef1.resolve();
     
      feed2 = fModelDAO.saveFeed(feed2);
      newsRef2 = newsRef[0];
      newsItem2 = newsRef2.resolve();
     
      final News initialNews3 = (News) createNews(feed2);
      initialNews3.setTitle("Some other title");
      initialNews3.setGuid(null);
      initialNews3.setLink(null);
      initialNews3.setState(State.NEW);
      fModelDAO.saveFeed(feed2);
      newsRef3 = newsRef[0];
    } catch (PersistenceException e) {
      fail(e.getMessage());
      return;
    } finally {
      NewsModel.getDefault().removeNewsListener(newsAdapter);
    }
    try {
      List<INews> newsList1 = new ArrayList<INews>();
      newsList1.add(newsItem1);
     
      List<INews> newsList2 = new ArrayList<INews>();
      newsList2.add(newsItem2);
     
      fAppLayer.setNewsState(newsList1, State.UPDATED, true, false);
      INews news1 = newsRef1.resolve();
      INews news2 = newsRef2.resolve();
      INews news3 = newsRef3.resolve();
      assertEquals(State.UPDATED, news1.getState());
      assertEquals(State.UPDATED, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fAppLayer.setNewsState(newsList2, State.DELETED, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.DELETED, news1.getState());
      assertEquals(State.DELETED, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fAppLayer.setNewsState(newsList1, State.HIDDEN, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.HIDDEN, news1.getState());
      assertEquals(State.HIDDEN, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fAppLayer.setNewsState(newsList2, State.READ, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.READ, news1.getState());
      assertEquals(State.READ, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fAppLayer.setNewsState(newsList1, State.UNREAD, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.UNREAD, news1.getState());
      assertEquals(State.UNREAD, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fAppLayer.setNewsState(newsList2, State.NEW, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.NEW, news1.getState());
      assertEquals(State.NEW, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      // Make sure it doesn't change when we set it to the same
      fAppLayer.setNewsState(newsList1, State.NEW, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.NEW, news1.getState());
      assertEquals(State.NEW, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fModelDAO.deleteNews(newsRef1);
View Full Code Here

   
    newsAdapter = new NewsAdapter() {
      @Override
      public void newsAdded(Set<NewsEvent> events) {
        assertEquals(1, events.size());
        newsRef[0] = new NewsReference(events.iterator().next().getEntity().getId());
      }
    };
    NewsModel.getDefault().addNewsListener(newsAdapter);
    INews newsItem1 = null;
    NewsReference newsRef1 = null;
   
    INews newsItem2 = null;
    NewsReference newsRef2 = null;
   
    NewsReference newsRef3 = null;
    try {
      fModelDAO.saveFeed(feed1);
      newsRef1 = newsRef[0];
      newsItem1 = newsRef1.resolve();
     
      feed2 = fModelDAO.saveFeed(feed2);
      newsRef2 = newsRef[0];
      newsItem2 = newsRef2.resolve();
     
      final News initialNews3 = (News) createNews(feed2);
      initialNews3.setTitle("Some other title");
      initialNews3.setGuid(null);
      initialNews3.setLink(null);
      initialNews3.setState(State.NEW);
      fModelDAO.saveFeed(feed2);
      newsRef3 = newsRef[0];
    } catch (PersistenceException e) {
      fail(e.getMessage());
      return;
    } finally {
      NewsModel.getDefault().removeNewsListener(newsAdapter);
    }
    try {
      List<INews> newsList1 = new ArrayList<INews>();
      newsList1.add(newsItem1);
     
      List<INews> newsList2 = new ArrayList<INews>();
      newsList2.add(newsItem2);
     
      fAppLayer.setNewsState(newsList1, State.UPDATED, true, false);
      INews news1 = newsRef1.resolve();
      INews news2 = newsRef2.resolve();
      INews news3 = newsRef3.resolve();
      assertEquals(State.UPDATED, news1.getState());
      assertEquals(State.UPDATED, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fAppLayer.setNewsState(newsList2, State.DELETED, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.DELETED, news1.getState());
      assertEquals(State.DELETED, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fAppLayer.setNewsState(newsList1, State.HIDDEN, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.HIDDEN, news1.getState());
      assertEquals(State.HIDDEN, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fAppLayer.setNewsState(newsList2, State.READ, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.READ, news1.getState());
      assertEquals(State.READ, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fAppLayer.setNewsState(newsList1, State.UNREAD, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.UNREAD, news1.getState());
      assertEquals(State.UNREAD, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fAppLayer.setNewsState(newsList2, State.NEW, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.NEW, news1.getState());
      assertEquals(State.NEW, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      // Make sure it doesn't change when we set it to the same
      fAppLayer.setNewsState(newsList1, State.NEW, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.NEW, news1.getState());
      assertEquals(State.NEW, news2.getState());
      assertEquals(State.NEW, news3.getState());
     
      fModelDAO.deleteNews(newsRef1);
View Full Code Here

    }
    final News initialNews = (News) createNews(feed);
    initialNews.setState(State.NEW);
    initialNews.setGuid(null);
    INews newsItem = null;
    NewsReference newsRef = null;
    try {
      newsItem = fModelDAO.saveNews(initialNews);
      newsRef = new NewsReference(newsItem.getId());
    } catch (PersistenceException e) {
      fail(e.getMessage());
      return;
    }
    try {
      List<INews> newsList = new ArrayList<INews>();
      newsList.add(newsItem);
      fAppLayer.setNewsState(newsList, State.UPDATED, true, false);
      INews news = newsRef.resolve();
      assertEquals(State.UPDATED, news.getState());
      fAppLayer.setNewsState(newsList, State.DELETED, true, false);
      news = newsRef.resolve();
      assertEquals(State.DELETED, news.getState());
      fAppLayer.setNewsState(newsList, State.HIDDEN, true, false);
      news = newsRef.resolve();
      assertEquals(State.HIDDEN, news.getState());
      fAppLayer.setNewsState(newsList, State.READ, true, false);
      news = newsRef.resolve();
      assertEquals(State.READ, news.getState());
      fAppLayer.setNewsState(newsList, State.UNREAD, true, false);
      news = newsRef.resolve();
      assertEquals(State.UNREAD, news.getState());
      fAppLayer.setNewsState(newsList, State.NEW, true, false);
      news = newsRef.resolve();
      assertEquals(State.NEW, news.getState());
      // Make sure it doesn't change when we set it to the same
      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) {
View Full Code Here

TOP

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

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.