Package org.rssowl.core.internal.persist.service

Examples of org.rssowl.core.internal.persist.service.EntityIdsByEventType


    news.setLink(new URI("http://www.news.com"));

    DynamicDAO.save(feed);

    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    EntityIdsByEventType outstandingNewsIds = dao.load();
    assertEquals(1, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());

    /* Wait for Indexer */
    waitForIndexer();

    /* Force a Flush */
    runBogusSearch();

    outstandingNewsIds = dao.load();
    assertEquals(0, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());
  }
View Full Code Here


    news.setState(INews.State.HIDDEN);
    DynamicDAO.save(news);

    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    EntityIdsByEventType outstandingNewsIds = dao.load();
    assertEquals(1, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(1, outstandingNewsIds.getRemovedEntityRefs().size());

    /* Wait for Indexer */
    waitForIndexer();

    /* Force a Flush */
    runBogusSearch();

    outstandingNewsIds = dao.load();
    assertEquals(0, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());
  }
View Full Code Here

    news.setState(INews.State.DELETED);
    DynamicDAO.save(news);

    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    EntityIdsByEventType outstandingNewsIds = dao.load();
    assertEquals(1, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(1, outstandingNewsIds.getRemovedEntityRefs().size());

    /* Wait for Indexer */
    waitForIndexer();

    /* Force a Flush */
    runBogusSearch();

    outstandingNewsIds = dao.load();
    assertEquals(0, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());
  }
View Full Code Here

    news.setState(INews.State.READ);
    DynamicDAO.save(news);

    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    EntityIdsByEventType outstandingNewsIds = dao.load();
    assertEquals(1, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(1, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());

    /* Wait for Indexer */
    waitForIndexer();

    /* Force a Flush */
    runBogusSearch();

    outstandingNewsIds = dao.load();
    assertEquals(0, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());
  }
View Full Code Here

    news.setState(INews.State.DELETED);
    DynamicDAO.save(news);

    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    EntityIdsByEventType outstandingNewsIds = dao.load();
    assertEquals(1, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(1, outstandingNewsIds.getRemovedEntityRefs().size());

    /* Wait for Indexer */
    waitForIndexer();

    /* Force a Flush */
    runBogusSearch();

    outstandingNewsIds = dao.load();
    assertEquals(0, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());
  }
View Full Code Here

    news.setState(INews.State.NEW);
    DynamicDAO.save(news);

    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    EntityIdsByEventType outstandingNewsIds = dao.load();
    assertEquals(2, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(1, outstandingNewsIds.getRemovedEntityRefs().size());

    /* Wait for Indexer */
    waitForIndexer();

    /* Force a Flush */
    runBogusSearch();

    outstandingNewsIds = dao.load();
    assertEquals(0, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());
  }
View Full Code Here

      assertEquals(condGet.getIfModifiedSince(), otherCondGet.getIfModifiedSince());
      assertEquals(condGet.getIfNoneMatch(), otherCondGet.getIfNoneMatch());
    }

    /* Assert EntityIdsByEventType */
    EntityIdsByEventType eventType = db.query(EntityIdsByEventType.class).get(0);
    EntityIdsByEventType otherEventType = defragmentedDb.query(EntityIdsByEventType.class).get(0);
    assertNotNull(eventType);
    assertNotNull(otherEventType);
    assertEquals(eventType, otherEventType);

    /* Assert NewsCounter / NewsCounterItem */
 
View Full Code Here

  }

  @Override
  protected void onDatabaseOpened(DatabaseEvent event) {
    super.onDatabaseOpened(event);
    EntityIdsByEventType entityIds = doLoad();
    if (entityIds == null) {
      entityIds = new EntityIdsByEventType(false);
      save(entityIds);
    }
    fEntityIds = entityIds;
  }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testSaveLoadEntitiesToBeIndexed() throws Exception {
    EntityIdsByEventType entitiesToBeIndexed = DBHelper.getEntitiesToBeIndexedDAO().load();
    assertEquals(0, entitiesToBeIndexed.size());

    IFeed feed = fFactory.createFeed(null, new URI("http://www.feed.com/feed.xml"));
    INews news1 = createNews(feed, "Foo", "http://www.news.com/news1.html", State.READ);
    INews news2 = createNews(feed, " Bar", "http://www.news.com/news2.html", State.NEW);
    DynamicDAO.save(feed);

    entitiesToBeIndexed = DBHelper.getEntitiesToBeIndexedDAO().load();
    assertEquals(2, entitiesToBeIndexed.size());
    Owl.getPersistenceService().shutdown(true);
    Owl.getPersistenceService().startup(new NullProgressLongOperationMonitor());

    entitiesToBeIndexed = DBHelper.getEntitiesToBeIndexedDAO().load();
    assertEquals(2, entitiesToBeIndexed.size());
    for (long id : entitiesToBeIndexed.getPersistedEntityIds().toArray()) {
      assertTrue(id == news1.getId().longValue() || id == news2.getId().longValue());
    }

    Owl.getPersistenceService().shutdown(false);
    Owl.getPersistenceService().startup(new NullProgressLongOperationMonitor());
    assertEquals(0, entitiesToBeIndexed.size());
  }
View Full Code Here

   */
  Indexer(ModelSearchImpl search, Directory directory) throws PersistenceException {
    fSearch = search;
    fIndexDirectory = directory;
    fJobQueue = new JobQueue(Messages.Indexer_UPDATE_SAVED_SEARCHES, MAX_INDEX_JOBS_COUNT, Integer.MAX_VALUE, false, INDEX_JOB_PROGRESS_DELAY);
    fUncommittedNews = new EntityIdsByEventType(false);
  }
View Full Code Here

TOP

Related Classes of org.rssowl.core.internal.persist.service.EntityIdsByEventType

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.