use of org.graylog.plugins.views.search.views.ViewSummaryDTO in project graylog2-server by Graylog2.
the class SearchesCleanUpJobTest method testForReferencedSearches.
@Test
public void testForReferencedSearches() {
final String searchId = "This search is in use";
final ViewSummaryDTO view = mock(ViewSummaryDTO.class);
when(view.searchId()).thenReturn(searchId);
when(viewService.streamAll()).thenReturn(Stream.of(view));
final Search search = mock(Search.class);
when(search.createdAt()).thenReturn(DateTime.now(DateTimeZone.UTC).minus(Duration.standardDays(30)));
when(search.id()).thenReturn(searchId);
when(searchDbService.streamAll()).thenReturn(Stream.of(search));
this.searchesCleanUpJob.doRun();
verify(searchDbService, never()).delete(any());
}
use of org.graylog.plugins.views.search.views.ViewSummaryDTO in project graylog2-server by Graylog2.
the class SearchesCleanUpJobTest method testForEmptySearches.
@Test
public void testForEmptySearches() {
final ViewSummaryDTO view = mock(ViewSummaryDTO.class);
when(viewService.streamAll()).thenReturn(Stream.of(view));
when(searchDbService.streamAll()).thenReturn(Stream.empty());
this.searchesCleanUpJob.doRun();
verify(searchDbService, never()).delete(any());
}
Aggregations