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());
}
Aggregations