Search in sources :

Example 1 with NewsItem

use of com.rbmhtechnology.vind.monitoring.model.NewsItem in project vind by RBMHTechnology.

the class MonitoringSearchServerTest method testQueryMonitoringWithSessionAndLogger.

@Test
public void testQueryMonitoringWithSessionAndLogger() throws IOException {
    TestMonitoringWriter logger = new TestMonitoringWriter();
    MonitoringSearchServer server = new MonitoringSearchServer(testSearchServer.getSearchServer(), new SimpleApplication("app"), new SimpleSession("123"), logger);
    // index 2 news items
    NewsItem i1 = new NewsItem("1", "New Vind instance needed", ZonedDateTime.now().minusMonths(3), "article", "coding");
    NewsItem i2 = new NewsItem("2", "Vind instance available", ZonedDateTime.now(), "blog", "coding", "release");
    server.indexBean(i1);
    server.indexBean(i2);
    server.commit();
    // this search should retrieve news items that should match the search term best
    FulltextSearch search = Search.fulltext("vind release");
    search.facet("category", "kind");
    BeanSearchResult<NewsItem> result = server.execute(search, NewsItem.class);
    assertEquals(1, logger.logs.size());
}
Also used : SimpleApplication(com.rbmhtechnology.vind.monitoring.model.application.SimpleApplication) SimpleSession(com.rbmhtechnology.vind.monitoring.model.session.SimpleSession) FulltextSearch(com.rbmhtechnology.vind.api.query.FulltextSearch) NewsItem(com.rbmhtechnology.vind.monitoring.model.NewsItem) Test(org.junit.Test)

Aggregations

FulltextSearch (com.rbmhtechnology.vind.api.query.FulltextSearch)1 NewsItem (com.rbmhtechnology.vind.monitoring.model.NewsItem)1 SimpleApplication (com.rbmhtechnology.vind.monitoring.model.application.SimpleApplication)1 SimpleSession (com.rbmhtechnology.vind.monitoring.model.session.SimpleSession)1 Test (org.junit.Test)1