Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.ISearchMark


        }
      };
      DynamicDAO.addEntityListener(IBookMark.class, bookMarkListener);

      /* Check SearchMark Added */
      final ISearchMark searchMark1 = fFactory.createSearchMark(null, root, "Root SearchMark");
      final ISearchMark searchMark2 = fFactory.createSearchMark(null, rootChild, "Root Child SearchMark");
      final ISearchMark searchMark3 = fFactory.createSearchMark(null, rootChildChild1Child, "Root Child Child #1 SearchMark");

      final boolean searchMarkEventsIssued[] = new boolean[3];

      searchMarkListener = new SearchMarkAdapter() {
        @Override
        public void entitiesAdded(Set<SearchMarkEvent> events) {
          for (SearchMarkEvent event : events) {
            assertFalse("Expected this Event to be no Root Event", event.isRoot());

            ISearchMark searchMark = event.getEntity();

            if ("Root SearchMark".equals(searchMark.getName()))
              assertEquals("Root", searchMark.getParent().getName());
            else if ("Root Child SearchMark".equals(searchMark.getName()))
              assertEquals("Root Child", searchMark.getParent().getName());
            else if ("Root Child Child #1 SearchMark".equals(searchMark.getName()))
              assertEquals("Root Child Child #1 Child", searchMark.getParent().getName());

            if (searchMark.getName().equals(searchMark1.getName()))
              searchMarkEventsIssued[0] = true;

            else if (searchMark.getName().equals(searchMark2.getName()))
              searchMarkEventsIssued[1] = true;

            else if (searchMark.getName().equals(searchMark3.getName()))
              searchMarkEventsIssued[2] = true;
          }
        }
      };
      DynamicDAO.addEntityListener(ISearchMark.class, searchMarkListener);
View Full Code Here


        }
      };
      DynamicDAO.addEntityListener(IFeed.class, feedListener);

      /* Check SearchMark Deleted */
      ISearchMark searchMark1 = fFactory.createSearchMark(null, rootRef.resolve(), "Root SearchMark");
      root = DynamicDAO.save(searchMark1.getParent());
      searchMark1 = (ISearchMark) root.getMarks().get(root.getMarks().size() - 1);
      final SearchMarkReference searchMarkRef1 = new SearchMarkReference(searchMark1.getId());

      ISearchMark searchMark2 = fFactory.createSearchMark(null, rootChildRef.resolve(), "Root Child SearchMark");
      rootChild = DynamicDAO.save(searchMark2.getParent());
      searchMark2 = (ISearchMark) rootChild.getMarks().get(rootChild.getMarks().size() - 1);
      final SearchMarkReference searchMarkRef2 = new SearchMarkReference(searchMark2.getId());

      ISearchMark searchMark3 = fFactory.createSearchMark(null, rootChildChild1ChildRef.resolve(), "Root Child Child #1 Child SearchMark");
      rootChildChild1Child = DynamicDAO.save(searchMark3.getParent());
      searchMark3 = (ISearchMark) rootChildChild1Child.getMarks().get(rootChildChild1Child.getMarks().size() - 1);
      final SearchMarkReference searchMarkRef3 = new SearchMarkReference(searchMark3.getId());

      final boolean searchMarkEventsIssued[] = new boolean[3];

      searchMarkListener = new SearchMarkAdapter() {
        @Override
        public void entitiesDeleted(Set<SearchMarkEvent> events) {
          for (SearchMarkEvent event : events) {
            ISearchMark searchMark = event.getEntity();

            if (searchMarkRef1.references(searchMark))
              searchMarkEventsIssued[0] = true;

            else if (searchMarkRef2.references(searchMark))
View Full Code Here

        str.append(bookmark.getName()).append("\n\n");
      }

      /* ISearchMark */
      else if (selectedObject instanceof ISearchMark) {
        ISearchMark searchmark = (ISearchMark) selectedObject;
        str.append(searchmark.getName()).append("\n");
      }

      /* Entity Group */
      else if (selectedObject instanceof EntityGroup) {
        EntityGroup entitygroup = (EntityGroup) selectedObject;
View Full Code Here

    }

    /* Filter Events based on other criterias otherwise */
    else {
      for (SearchMarkEvent event : events) {
        ISearchMark searchmark = event.getEntity();
        List<ISearchCondition> conditions = searchmark.getSearchConditions();

        /* Check for new *new* News matching now */
        if (!event.isAddedNewNews())
          continue;

View Full Code Here

    INewsBin subSubSubRoot1NB1 = DynamicDAO.save(fFactory.createNewsBin(null, subSubSubRoot1, "Sub Sub Sub Root 1 Newsbin 1"));
    Long subSubSubRoot1NB1Id = subSubSubRoot1NB1.getId();
    setProperties(subSubSubRoot1NB1);

    /* Search Marks */
    ISearchMark rootSM1 = DynamicDAO.save(fFactory.createSearchMark(null, root, "Root Searchmark 1"));
    Long rootSM1Id = rootSM1.getId();
    setProperties(rootSM1);

    ISearchMark rootSM2 = DynamicDAO.save(fFactory.createSearchMark(null, root, "Root Searchmark 2"));
    Long rootSM2Id = rootSM2.getId();
    setProperties(rootSM2);

    ISearchMark subRoot1SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subRoot1, "Sub Root 1 Searchmark 1"));
    Long subRoot1SM1Id = subRoot1SM1.getId();
    setProperties(subRoot1SM1);

    ISearchMark subRoot1SM2 = DynamicDAO.save(fFactory.createSearchMark(null, subRoot1, "Sub Root 1 Searchmark 2"));
    Long subRoot1SM2Id = subRoot1SM2.getId();
    setProperties(subRoot1SM2);

    ISearchMark subRoot2SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subRoot2, "Sub Root 2 Searchmark 1"));
    Long subRoot2SM1Id = subRoot2SM1.getId();
    setProperties(subRoot2SM1);

    ISearchMark subRoot3SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subRoot3, "Sub Root 3 Searchmark 1"));
    Long subRoot3SM1Id = subRoot3SM1.getId();
    setProperties(subRoot3SM1);

    ISearchMark subSubRoot1SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subSubRoot1, "Sub Sub Root 1 Searchmark 1"));
    Long subSubRoot1SM1Id = subSubRoot1SM1.getId();
    setProperties(subSubRoot1SM1);

    ISearchMark subSubSubRoot1SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subSubSubRoot1, "Sub Sub Sub Root 1 Searchmark 1"));
    Long subSubSubRoot1SM1Id = subSubSubRoot1SM1.getId();
    setProperties(subSubSubRoot1SM1);

    DynamicDAO.save(root);

    /* Reopen Database */
    Owl.getPersistenceService().shutdown(false);

    root = null;
    subRoot1 = null;
    subRoot2 = null;
    subRoot3 = null;
    subSubRoot1 = null;
    subSubSubRoot1 = null;

    rootBM1 = null;
    rootBM2 = null;
    subRoot1BM1 = null;
    subRoot1BM2 = null;
    subRoot2BM1 = null;
    subRoot3BM1 = null;
    subSubRoot1BM1 = null;
    subSubSubRoot1BM1 = null;

    rootNB1 = null;
    rootNB2 = null;
    subRoot1NB1 = null;
    subRoot1NB2 = null;
    subRoot2NB1 = null;
    subRoot3NB1 = null;
    subSubRoot1NB1 = null;
    subSubSubRoot1NB1 = null;

    rootSM1 = null;
    rootSM2 = null;
    subRoot1SM1 = null;
    subRoot1SM2 = null;
    subRoot2SM1 = null;
    subRoot3SM1 = null;
    subSubRoot1SM1 = null;
    subSubSubRoot1SM1 = null;

    System.gc();
    Owl.getPersistenceService().startup(new NullOperationMonitor());

    /* Assert Folders */
    CachingDAO dao = (CachingDAO) DynamicDAO.getDAO(IFolderDAO.class);
    root = (IFolder) dao.load(rootFolderId);
    assertNotNull(root);
    assertEquals("Root", root.getName());
    assertProperties(root);

    subRoot1 = (IFolder) dao.load(subRootFolder1Id);
    assertNotNull(subRoot1);
    assertEquals("Sub Root 1", subRoot1.getName());
    assertProperties(subRoot1);

    subRoot2 = (IFolder) dao.load(subRootFolder2Id);
    assertNotNull(subRoot2);
    assertEquals("Sub Root 2", subRoot2.getName());
    assertProperties(subRoot2);

    subRoot3 = (IFolder) dao.load(subRootFolder3Id);
    assertNotNull(subRoot3);
    assertEquals("Sub Root 3", subRoot3.getName());
    assertProperties(subRoot3);

    subSubRoot1 = (IFolder) dao.load(subSubRootFolder1Id);
    assertNotNull(subSubRoot1);
    assertEquals("Sub Sub Root 1", subSubRoot1.getName());
    assertProperties(subSubRoot1);

    subSubSubRoot1 = (IFolder) dao.load(subSubSubRootFolder1Id);
    assertNotNull(subSubSubRoot1);
    assertEquals("Sub Sub Sub Root 1", subSubSubRoot1.getName());
    assertProperties(subSubSubRoot1);

    /* Assert Bookmarks */
    dao = (CachingDAO) DynamicDAO.getDAO(IBookMarkDAO.class);

    rootBM1 = (IBookMark) dao.load(rootBM1Id);
    assertNotNull(rootBM1);
    assertEquals("Root Bookmark 1", rootBM1.getName());
    assertProperties(rootBM1);

    rootBM2 = (IBookMark) dao.load(rootBM2Id);
    assertNotNull(rootBM2);
    assertEquals("Root Bookmark 2", rootBM2.getName());
    assertProperties(rootBM2);

    subRoot1BM1 = (IBookMark) dao.load(subRoot1BM1Id);
    assertNotNull(subRoot1BM1);
    assertEquals("Sub Root 1 Bookmark 1", subRoot1BM1.getName());
    assertProperties(subRoot1BM1);

    subRoot1BM2 = (IBookMark) dao.load(subRoot1BM2Id);
    assertNotNull(subRoot1BM2);
    assertEquals("Sub Root 1 Bookmark 2", subRoot1BM2.getName());
    assertProperties(subRoot1BM2);

    subRoot2BM1 = (IBookMark) dao.load(subRoot2BM1Id);
    assertNotNull(subRoot2BM1);
    assertEquals("Sub Root 2 Bookmark 1", subRoot2BM1.getName());
    assertProperties(subRoot2BM1);

    subRoot3BM1 = (IBookMark) dao.load(subRoot3BM1Id);
    assertNotNull(subRoot3BM1);
    assertEquals("Sub Root 3 Bookmark 1", subRoot3BM1.getName());
    assertProperties(subRoot3BM1);

    subSubRoot1BM1 = (IBookMark) dao.load(subSubRoot1BM1Id);
    assertNotNull(subSubRoot1BM1);
    assertEquals("Sub Sub Root 1 Bookmark 1", subSubRoot1BM1.getName());
    assertProperties(subSubRoot1BM1);

    subSubSubRoot1BM1 = (IBookMark) dao.load(subSubSubRoot1BM1Id);
    assertNotNull(subSubSubRoot1BM1);
    assertEquals("Sub Sub Sub Root 1 Bookmark 1", subSubSubRoot1BM1.getName());
    assertProperties(subSubSubRoot1BM1);

    /* Assert News Bins */
    dao = (CachingDAO) DynamicDAO.getDAO(INewsBinDAO.class);

    rootNB1 = (INewsBin) dao.load(rootNB1Id);
    assertNotNull(rootNB1);
    assertEquals("Root Newsbin 1", rootNB1.getName());
    assertProperties(rootNB1);

    rootNB2 = (INewsBin) dao.load(rootNB2Id);
    assertNotNull(rootNB2);
    assertEquals("Root Newsbin 2", rootNB2.getName());
    assertProperties(rootNB2);

    subRoot1NB1 = (INewsBin) dao.load(subRoot1NB1Id);
    assertNotNull(subRoot1NB1);
    assertEquals("Sub Root 1 Newsbin 1", subRoot1NB1.getName());
    assertProperties(subRoot1NB1);

    subRoot1NB2 = (INewsBin) dao.load(subRoot1NB2Id);
    assertNotNull(subRoot1NB2);
    assertEquals("Sub Root 1 Newsbin 2", subRoot1NB2.getName());
    assertProperties(subRoot1NB2);

    subRoot2NB1 = (INewsBin) dao.load(subRoot2NB1Id);
    assertNotNull(subRoot2NB1);
    assertEquals("Sub Root 2 Newsbin 1", subRoot2NB1.getName());
    assertProperties(subRoot2NB1);

    subRoot3NB1 = (INewsBin) dao.load(subRoot3NB1Id);
    assertNotNull(subRoot3NB1);
    assertEquals("Sub Root 3 Newsbin 1", subRoot3NB1.getName());
    assertProperties(subRoot3NB1);

    subSubRoot1NB1 = (INewsBin) dao.load(subSubRoot1NB1Id);
    assertNotNull(subSubRoot1NB1);
    assertEquals("Sub Sub Root 1 Newsbin 1", subSubRoot1NB1.getName());
    assertProperties(subSubRoot1NB1);

    subSubSubRoot1NB1 = (INewsBin) dao.load(subSubSubRoot1NB1Id);
    assertNotNull(subSubSubRoot1NB1);
    assertEquals("Sub Sub Sub Root 1 Newsbin 1", subSubSubRoot1NB1.getName());
    assertProperties(subSubSubRoot1NB1);

    /* Assert Search Marks */
    dao = (CachingDAO) DynamicDAO.getDAO(ISearchMarkDAO.class);

    rootSM1 = (ISearchMark) dao.load(rootSM1Id);
    assertNotNull(rootSM1);
    assertEquals("Root Searchmark 1", rootSM1.getName());
    assertProperties(rootSM1);

    rootSM2 = (ISearchMark) dao.load(rootSM2Id);
    assertNotNull(rootSM2);
    assertEquals("Root Searchmark 2", rootSM2.getName());
    assertProperties(rootSM2);

    subRoot1SM1 = (ISearchMark) dao.load(subRoot1SM1Id);
    assertNotNull(subRoot1SM1);
    assertEquals("Sub Root 1 Searchmark 1", subRoot1SM1.getName());
    assertProperties(subRoot1SM1);

    subRoot1SM2 = (ISearchMark) dao.load(subRoot1SM2Id);
    assertNotNull(subRoot1SM2);
    assertEquals("Sub Root 1 Searchmark 2", subRoot1SM2.getName());
    assertProperties(subRoot1SM2);

    subRoot2SM1 = (ISearchMark) dao.load(subRoot2SM1Id);
    assertNotNull(subRoot2SM1);
    assertEquals("Sub Root 2 Searchmark 1", subRoot2SM1.getName());
    assertProperties(subRoot2SM1);

    subRoot3SM1 = (ISearchMark) dao.load(subRoot3SM1Id);
    assertNotNull(subRoot3SM1);
    assertEquals("Sub Root 3 Searchmark 1", subRoot3SM1.getName());
    assertProperties(subRoot3SM1);

    subSubRoot1SM1 = (ISearchMark) dao.load(subSubRoot1SM1Id);
    assertNotNull(subSubRoot1SM1);
    assertEquals("Sub Sub Root 1 Searchmark 1", subSubRoot1SM1.getName());
    assertProperties(subSubRoot1SM1);

    subSubSubRoot1SM1 = (ISearchMark) dao.load(subSubSubRoot1SM1Id);
    assertNotNull(subSubSubRoot1SM1);
    assertEquals("Sub Sub Sub Root 1 Searchmark 1", subSubSubRoot1SM1.getName());
    assertProperties(subSubSubRoot1SM1);
  }
View Full Code Here

    INewsBin subSubSubRoot1NB1 = DynamicDAO.save(fFactory.createNewsBin(null, subSubSubRoot1, "Sub Sub Sub Root 1 Newsbin 1"));
    Long subSubSubRoot1NB1Id = subSubSubRoot1NB1.getId();
    setProperties(subSubSubRoot1NB1);

    /* Search Marks */
    ISearchMark rootSM1 = DynamicDAO.save(fFactory.createSearchMark(null, root1, "Root Searchmark 1"));
    Long rootSM1Id = rootSM1.getId();
    setProperties(rootSM1);

    ISearchMark rootSM2 = DynamicDAO.save(fFactory.createSearchMark(null, root1, "Root Searchmark 2"));
    Long rootSM2Id = rootSM2.getId();
    setProperties(rootSM2);

    ISearchMark subRoot1SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subRoot1, "Sub Root 1 Searchmark 1"));
    Long subRoot1SM1Id = subRoot1SM1.getId();
    setProperties(subRoot1SM1);

    ISearchMark subRoot1SM2 = DynamicDAO.save(fFactory.createSearchMark(null, subRoot1, "Sub Root 1 Searchmark 2"));
    Long subRoot1SM2Id = subRoot1SM2.getId();
    setProperties(subRoot1SM2);

    ISearchMark subRoot2SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subRoot2, "Sub Root 2 Searchmark 1"));
    Long subRoot2SM1Id = subRoot2SM1.getId();
    setProperties(subRoot2SM1);

    ISearchMark subRoot3SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subRoot3, "Sub Root 3 Searchmark 1"));
    Long subRoot3SM1Id = subRoot3SM1.getId();
    setProperties(subRoot3SM1);

    ISearchMark subSubRoot1SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subSubRoot1, "Sub Sub Root 1 Searchmark 1"));
    Long subSubRoot1SM1Id = subSubRoot1SM1.getId();
    setProperties(subSubRoot1SM1);

    ISearchMark subSubSubRoot1SM1 = DynamicDAO.save(fFactory.createSearchMark(null, subSubSubRoot1, "Sub Sub Sub Root 1 Searchmark 1"));
    Long subSubSubRoot1SM1Id = subSubSubRoot1SM1.getId();
    setProperties(subSubSubRoot1SM1);

    DynamicDAO.save(root1);

    /* Reopen Database */
    Owl.getPersistenceService().shutdown(false);

    root1 = null;
    root2 = null;
    root3 = null;
    subRoot1 = null;
    subRoot2 = null;
    subRoot3 = null;
    subSubRoot1 = null;
    subSubSubRoot1 = null;

    rootBM1 = null;
    rootBM2 = null;
    subRoot1BM1 = null;
    subRoot1BM2 = null;
    subRoot2BM1 = null;
    subRoot3BM1 = null;
    subSubRoot1BM1 = null;
    subSubSubRoot1BM1 = null;

    rootNB1 = null;
    rootNB2 = null;
    subRoot1NB1 = null;
    subRoot1NB2 = null;
    subRoot2NB1 = null;
    subRoot3NB1 = null;
    subSubRoot1NB1 = null;
    subSubSubRoot1NB1 = null;

    rootSM1 = null;
    rootSM2 = null;
    subRoot1SM1 = null;
    subRoot1SM2 = null;
    subRoot2SM1 = null;
    subRoot3SM1 = null;
    subSubRoot1SM1 = null;
    subSubSubRoot1SM1 = null;

    System.gc();
    Owl.getPersistenceService().startup(new NullOperationMonitor());

    /* Assert Folders */
    CachingDAO dao = (CachingDAO) DynamicDAO.getDAO(IFolderDAO.class);
    root1 = (IFolder) dao.load(rootFolder1Id);
    assertNotNull(root1);
    assertEquals("Root 1", root1.getName());
    assertProperties(root1);

    root2 = (IFolder) dao.load(rootFolder2Id);
    assertNotNull(root2);
    assertEquals("Root 2", root2.getName());
    assertProperties(root2);

    root3 = (IFolder) dao.load(rootFolder3Id);
    assertNotNull(root3);
    assertEquals("Root 3", root3.getName());
    assertProperties(root3);

    subRoot1 = (IFolder) dao.load(subRootFolder1Id);
    assertNotNull(subRoot1);
    assertEquals("Sub Root 1", subRoot1.getName());
    assertProperties(subRoot1);

    subRoot2 = (IFolder) dao.load(subRootFolder2Id);
    assertNotNull(subRoot2);
    assertEquals("Sub Root 2", subRoot2.getName());
    assertProperties(subRoot2);

    subRoot3 = (IFolder) dao.load(subRootFolder3Id);
    assertNotNull(subRoot3);
    assertEquals("Sub Root 3", subRoot3.getName());
    assertProperties(subRoot3);

    subSubRoot1 = (IFolder) dao.load(subSubRootFolder1Id);
    assertNotNull(subSubRoot1);
    assertEquals("Sub Sub Root 1", subSubRoot1.getName());
    assertProperties(subSubRoot1);

    subSubSubRoot1 = (IFolder) dao.load(subSubSubRootFolder1Id);
    assertNotNull(subSubSubRoot1);
    assertEquals("Sub Sub Sub Root 1", subSubSubRoot1.getName());
    assertProperties(subSubSubRoot1);

    /* Assert Bookmarks */
    dao = (CachingDAO) DynamicDAO.getDAO(IBookMarkDAO.class);

    rootBM1 = (IBookMark) dao.load(rootBM1Id);
    assertNotNull(rootBM1);
    assertEquals("Root Bookmark 1", rootBM1.getName());
    assertProperties(rootBM1);

    rootBM2 = (IBookMark) dao.load(rootBM2Id);
    assertNotNull(rootBM2);
    assertEquals("Root Bookmark 2", rootBM2.getName());
    assertProperties(rootBM2);

    subRoot1BM1 = (IBookMark) dao.load(subRoot1BM1Id);
    assertNotNull(subRoot1BM1);
    assertEquals("Sub Root 1 Bookmark 1", subRoot1BM1.getName());
    assertProperties(subRoot1BM1);

    subRoot1BM2 = (IBookMark) dao.load(subRoot1BM2Id);
    assertNotNull(subRoot1BM2);
    assertEquals("Sub Root 1 Bookmark 2", subRoot1BM2.getName());
    assertProperties(subRoot1BM2);

    subRoot2BM1 = (IBookMark) dao.load(subRoot2BM1Id);
    assertNotNull(subRoot2BM1);
    assertEquals("Sub Root 2 Bookmark 1", subRoot2BM1.getName());
    assertProperties(subRoot2BM1);

    subRoot3BM1 = (IBookMark) dao.load(subRoot3BM1Id);
    assertNotNull(subRoot3BM1);
    assertEquals("Sub Root 3 Bookmark 1", subRoot3BM1.getName());
    assertProperties(subRoot3BM1);

    subSubRoot1BM1 = (IBookMark) dao.load(subSubRoot1BM1Id);
    assertNotNull(subSubRoot1BM1);
    assertEquals("Sub Sub Root 1 Bookmark 1", subSubRoot1BM1.getName());
    assertProperties(subSubRoot1BM1);

    subSubSubRoot1BM1 = (IBookMark) dao.load(subSubSubRoot1BM1Id);
    assertNotNull(subSubSubRoot1BM1);
    assertEquals("Sub Sub Sub Root 1 Bookmark 1", subSubSubRoot1BM1.getName());
    assertProperties(subSubSubRoot1BM1);

    /* Assert News Bins */
    dao = (CachingDAO) DynamicDAO.getDAO(INewsBinDAO.class);

    rootNB1 = (INewsBin) dao.load(rootNB1Id);
    assertNotNull(rootNB1);
    assertEquals("Root Newsbin 1", rootNB1.getName());
    assertProperties(rootNB1);

    rootNB2 = (INewsBin) dao.load(rootNB2Id);
    assertNotNull(rootNB2);
    assertEquals("Root Newsbin 2", rootNB2.getName());
    assertProperties(rootNB2);

    subRoot1NB1 = (INewsBin) dao.load(subRoot1NB1Id);
    assertNotNull(subRoot1NB1);
    assertEquals("Sub Root 1 Newsbin 1", subRoot1NB1.getName());
    assertProperties(subRoot1NB1);

    subRoot1NB2 = (INewsBin) dao.load(subRoot1NB2Id);
    assertNotNull(subRoot1NB2);
    assertEquals("Sub Root 1 Newsbin 2", subRoot1NB2.getName());
    assertProperties(subRoot1NB2);

    subRoot2NB1 = (INewsBin) dao.load(subRoot2NB1Id);
    assertNotNull(subRoot2NB1);
    assertEquals("Sub Root 2 Newsbin 1", subRoot2NB1.getName());
    assertProperties(subRoot2NB1);

    subRoot3NB1 = (INewsBin) dao.load(subRoot3NB1Id);
    assertNotNull(subRoot3NB1);
    assertEquals("Sub Root 3 Newsbin 1", subRoot3NB1.getName());
    assertProperties(subRoot3NB1);

    subSubRoot1NB1 = (INewsBin) dao.load(subSubRoot1NB1Id);
    assertNotNull(subSubRoot1NB1);
    assertEquals("Sub Sub Root 1 Newsbin 1", subSubRoot1NB1.getName());
    assertProperties(subSubRoot1NB1);

    subSubSubRoot1NB1 = (INewsBin) dao.load(subSubSubRoot1NB1Id);
    assertNotNull(subSubSubRoot1NB1);
    assertEquals("Sub Sub Sub Root 1 Newsbin 1", subSubSubRoot1NB1.getName());
    assertProperties(subSubSubRoot1NB1);

    /* Assert Search Marks */
    dao = (CachingDAO) DynamicDAO.getDAO(ISearchMarkDAO.class);

    rootSM1 = (ISearchMark) dao.load(rootSM1Id);
    assertNotNull(rootSM1);
    assertEquals("Root Searchmark 1", rootSM1.getName());
    assertProperties(rootSM1);

    rootSM2 = (ISearchMark) dao.load(rootSM2Id);
    assertNotNull(rootSM2);
    assertEquals("Root Searchmark 2", rootSM2.getName());
    assertProperties(rootSM2);

    subRoot1SM1 = (ISearchMark) dao.load(subRoot1SM1Id);
    assertNotNull(subRoot1SM1);
    assertEquals("Sub Root 1 Searchmark 1", subRoot1SM1.getName());
    assertProperties(subRoot1SM1);

    subRoot1SM2 = (ISearchMark) dao.load(subRoot1SM2Id);
    assertNotNull(subRoot1SM2);
    assertEquals("Sub Root 1 Searchmark 2", subRoot1SM2.getName());
    assertProperties(subRoot1SM2);

    subRoot2SM1 = (ISearchMark) dao.load(subRoot2SM1Id);
    assertNotNull(subRoot2SM1);
    assertEquals("Sub Root 2 Searchmark 1", subRoot2SM1.getName());
    assertProperties(subRoot2SM1);

    subRoot3SM1 = (ISearchMark) dao.load(subRoot3SM1Id);
    assertNotNull(subRoot3SM1);
    assertEquals("Sub Root 3 Searchmark 1", subRoot3SM1.getName());
    assertProperties(subRoot3SM1);

    subSubRoot1SM1 = (ISearchMark) dao.load(subSubRoot1SM1Id);
    assertNotNull(subSubRoot1SM1);
    assertEquals("Sub Sub Root 1 Searchmark 1", subSubRoot1SM1.getName());
    assertProperties(subSubRoot1SM1);

    subSubSubRoot1SM1 = (ISearchMark) dao.load(subSubSubRoot1SM1Id);
    assertNotNull(subSubSubRoot1SM1);
    assertEquals("Sub Sub Sub Root 1 Searchmark 1", subSubSubRoot1SM1.getName());
    assertProperties(subSubSubRoot1SM1);
  }
View Full Code Here

      setProperties(bm);

      INewsBin nb = DynamicDAO.save(fFactory.createNewsBin(null, folder, "Newsbin " + i));
      setProperties(nb);

      ISearchMark sm = DynamicDAO.save(fFactory.createSearchMark(null, folder, "Searchmark " + i));
      setProperties(sm);

      DynamicDAO.save(folder);
    }
View Full Code Here

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

    /* Today */
    IBookMark bookmark1 = fFactory.createBookMark(null, root, new FeedLinkReference(feed1.getLink()), "BookMark 1");
    bookmark1.setLastVisitDate(fToday);
    ISearchMark searchmark1 = fFactory.createSearchMark(null, root, "SearchMark 1");
    searchmark1.setLastVisitDate(fToday);

    /* Yesterday */
    IBookMark bookmark2 = fFactory.createBookMark(null, root, new FeedLinkReference(feed2.getLink()), "BookMark 2");
    bookmark2.setLastVisitDate(fYesterday);
    ISearchMark searchmark2 = fFactory.createSearchMark(null, root, "SearchMark 2");
    searchmark2.setLastVisitDate(fYesterday);

    /* Earlier this Week */
    IBookMark bookmark3 = fFactory.createBookMark(null, root, new FeedLinkReference(feed3.getLink()), "BookMark 3");
    bookmark3.setLastVisitDate(fEarlierThisWeek);
    ISearchMark searchmark3 = fFactory.createSearchMark(null, root, "SearchMark 3");
    searchmark3.setLastVisitDate(fEarlierThisWeek);

    /* Last Week */
    IBookMark bookmark4 = fFactory.createBookMark(null, root, new FeedLinkReference(feed1.getLink()), "BookMark 4");
    bookmark4.setLastVisitDate(fLastWeek);
    ISearchMark searchmark4 = fFactory.createSearchMark(null, root, "SearchMark 4");
    searchmark4.setLastVisitDate(fLastWeek);

    /* More than one Week ago */
    IBookMark bookmark5 = fFactory.createBookMark(null, root, new FeedLinkReference(feed1.getLink()), "BookMark 5");
    bookmark5.setLastVisitDate(new Date(0));

    /* Visited Never */
    ISearchMark searchmark5 = fFactory.createSearchMark(null, root, "SearchMark 5");

    /* Future */
    IBookMark bookmark6 = fFactory.createBookMark(null, root, new FeedLinkReference(feed1.getLink()), "BookMark 6");
    bookmark6.setLastVisitDate(new Date(fToday.getTime() + 10000000));

View Full Code Here

    IBookMark bm1 = fFactory.createBookMark(null, root, new FeedLinkReference(feed1.getLink()), "FookMark 1");
    bm1.setErrorLoading(true);
    bm1.setPopularity(1);

    ISearchMark sm1 = fFactory.createSearchMark(null, root, "SearchMark 1");
    sm1.setPopularity(1);

    IBookMark bm2 = fFactory.createBookMark(null, root, new FeedLinkReference(feed2.getLink()), "BookMark 2");
    bm2.setPopularity(1);

    ISearchMark sm2 = fFactory.createSearchMark(null, root, "SearchMark 2");
    sm2.setPopularity(1);

    IBookMark bm3 = fFactory.createBookMark(null, root, new FeedLinkReference(feed1.getLink()), "BookMark 3");
    bm3.setPopularity(1);

    ISearchMark sm3 = fFactory.createSearchMark(null, root, "SearchMark 3");
    sm3.setPopularity(1);

    IBookMark bm4 = fFactory.createBookMark(null, root, new FeedLinkReference(feed2.getLink()), "BookMark 4");
    bm4.setPopularity(1);

    ISearchMark sm4 = fFactory.createSearchMark(null, root, "SearchMark 4");
    sm4.setPopularity(1);

    IBookMark bm5 = fFactory.createBookMark(null, root, new FeedLinkReference(feed1.getLink()), "BookMark 5");
    bm5.setPopularity(1);

    ISearchMark sm5 = fFactory.createSearchMark(null, root, "SearchMark 5");

    IBookMark bm6 = fFactory.createBookMark(null, root, new FeedLinkReference(feed2.getLink()), "BookMark 6");

    /* Fill into Array */
    Object elements[] = new Object[] { bm1, bm2, bm3, bm4, bm5, bm6, sm1, sm2, sm3, sm4, sm5 };
View Full Code Here

        }
      };
      DynamicDAO.addEntityListener(IBookMark.class, bookMarkListener);

      /* Check SearchMark Added */
      final ISearchMark searchMark1 = fFactory.createSearchMark(null, root, "Root SearchMark");
      final ISearchMark searchMark2 = fFactory.createSearchMark(null, rootChild, "Root Child SearchMark");
      final ISearchMark searchMark3 = fFactory.createSearchMark(null, rootChildChild1Child, "Root Child Child #1 SearchMark");

      final boolean searchMarkEventsIssued[] = new boolean[3];

      searchMarkListener = new SearchMarkAdapter() {
        @Override
        public void entitiesAdded(Set<SearchMarkEvent> events) {
          for (SearchMarkEvent event : events) {
            assertFalse("Expected this Event to be no Root Event", event.isRoot());

            ISearchMark searchMark = event.getEntity();

            if ("Root SearchMark".equals(searchMark.getName()))
              assertEquals("Root", searchMark.getParent().getName());
            else if ("Root Child SearchMark".equals(searchMark.getName()))
              assertEquals("Root Child", searchMark.getParent().getName());
            else if ("Root Child Child #1 SearchMark".equals(searchMark.getName()))
              assertEquals("Root Child Child #1 Child", searchMark.getParent().getName());

            if (searchMark.getName().equals(searchMark1.getName()))
              searchMarkEventsIssued[0] = true;

            else if (searchMark.getName().equals(searchMark2.getName()))
              searchMarkEventsIssued[1] = true;

            else if (searchMark.getName().equals(searchMark3.getName()))
              searchMarkEventsIssued[2] = true;
          }
        }
      };
      DynamicDAO.addEntityListener(ISearchMark.class, searchMarkListener);
View Full Code Here

TOP

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

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.