use of com.searchcode.app.service.JobService in project searchcode-server by boyter.
the class IndexServiceTest method testReindexAllNoReturnSetsIndexingStatus.
public void testReindexAllNoReturnSetsIndexingStatus() throws IOException {
JobService jobServiceMock = mock(JobService.class);
when(jobServiceMock.forceEnqueueWithCount()).thenReturn(0);
this.indexService = new IndexService(Singleton.getData(), Singleton.getStatsService(), Singleton.getSearchCodeLib(), Singleton.getLogger(), Singleton.getHelpers(), Singleton.getCodeIndexQueue(), jobServiceMock);
assertThat(this.indexService.shouldExit(IIndexService.JobType.REPO_PARSER)).isFalse();
assertThat(this.indexService.getReindexingAll()).isFalse();
this.indexService.reindexAll();
assertThat(this.indexService.getRepoAdderPause()).isFalse();
assertThat(this.indexService.getReindexingAll()).isFalse();
assertThat(this.indexService.shouldExit(IIndexService.JobType.REPO_PARSER)).isFalse();
}
use of com.searchcode.app.service.JobService in project searchcode-server by boyter.
the class IndexServiceTest method testReindexAllSetsIndexingStatus.
public void testReindexAllSetsIndexingStatus() throws IOException {
JobService jobServiceMock = mock(JobService.class);
when(jobServiceMock.forceEnqueueWithCount()).thenReturn(2);
this.indexService = new IndexService(Singleton.getData(), Singleton.getStatsService(), Singleton.getSearchCodeLib(), Singleton.getLogger(), Singleton.getHelpers(), Singleton.getCodeIndexQueue(), jobServiceMock);
assertThat(this.indexService.shouldExit(IIndexService.JobType.REPO_PARSER)).isFalse();
assertThat(this.indexService.getReindexingAll()).isFalse();
this.indexService.reindexAll();
assertThat(this.indexService.getRepoAdderPause()).isFalse();
assertThat(this.indexService.getReindexingAll()).isTrue();
assertThat(this.indexService.shouldExit(IIndexService.JobType.REPO_PARSER)).isFalse();
this.indexService.decrementRepoJobsCount();
assertThat(this.indexService.getReindexingAll()).isTrue();
this.indexService.decrementRepoJobsCount();
assertThat(this.indexService.getReindexingAll()).isFalse();
}
Aggregations