@Test void testStartupAllIsFine() { when(indexService.hasIndex(attributeMetadata)).thenReturn(true); when(dataService.findAll( IndexJobExecutionMetadata.INDEX_JOB_EXECUTION, new QueryImpl<IndexJobExecution>().eq(JobExecutionMetaData.STATUS, FAILED), IndexJobExecution.class)) .thenReturn(Stream.empty()); indexBootstrapper.bootstrap(); verify(indexActionRegisterService, never()).register(any(EntityType.class), any()); }
public void bootstrap() { if (!indexService.hasIndex(attrMetadata)) { LOG.debug( "No index for Attribute found, asuming missing index, schedule (re)index for all entities"); metaDataService .getRepositories() .forEach(repo -> indexActionRegisterService.register(repo.getEntityType(), null)); LOG.debug("Done scheduling (re)index jobs for all entities"); } else { LOG.debug("Index for Attribute found, index is present, no (re)index needed"); List<IndexJobExecution> failedIndexJobs = dataService .findAll( IndexJobExecutionMetadata.INDEX_JOB_EXECUTION, new QueryImpl<IndexJobExecution>().eq(JobExecutionMetaData.STATUS, FAILED), IndexJobExecution.class) .collect(Collectors.toList()); failedIndexJobs.forEach(this::registerNewIndexActionForDirtyJobs); } }
IndexBootstrapper { public void bootstrap() { if (!indexService.hasIndex(attrMetadata)) { LOG.debug( "No index for Attribute found, asuming missing index, schedule (re)index for all entities"); metaDataService .getRepositories() .forEach(repo -> indexActionRegisterService.register(repo.getEntityType(), null)); LOG.debug("Done scheduling (re)index jobs for all entities"); } else { LOG.debug("Index for Attribute found, index is present, no (re)index needed"); List<IndexJobExecution> failedIndexJobs = dataService .findAll( IndexJobExecutionMetadata.INDEX_JOB_EXECUTION, new QueryImpl<IndexJobExecution>().eq(JobExecutionMetaData.STATUS, FAILED), IndexJobExecution.class) .collect(Collectors.toList()); failedIndexJobs.forEach(this::registerNewIndexActionForDirtyJobs); } } }
IndexBootstrapper { public void bootstrap() { if (!indexService.hasIndex(attrMetadata)) { LOG.debug( "No index for Attribute found, asuming missing index, schedule (re)index for all entities"); metaDataService .getRepositories() .forEach(repo -> indexActionRegisterService.register(repo.getEntityType(), null)); LOG.debug("Done scheduling (re)index jobs for all entities"); } else { LOG.debug("Index for Attribute found, index is present, no (re)index needed"); List<IndexJobExecution> failedIndexJobs = dataService .findAll( IndexJobExecutionMetadata.INDEX_JOB_EXECUTION, new QueryImpl<IndexJobExecution>().eq(JobExecutionMetaData.STATUS, FAILED), IndexJobExecution.class) .collect(Collectors.toList()); failedIndexJobs.forEach(this::registerNewIndexActionForDirtyJobs); } } IndexBootstrapper(
      MetaDataService metaDataService,
      IndexService indexService,
      IndexActionRegisterService indexActionRegisterService,
      DataService dataService,
      AttributeMetadata attrMetadata); }
IndexBootstrapper { public void bootstrap() { if (!indexService.hasIndex(attrMetadata)) { LOG.debug( "No index for Attribute found, asuming missing index, schedule (re)index for all entities"); metaDataService .getRepositories() .forEach(repo -> indexActionRegisterService.register(repo.getEntityType(), null)); LOG.debug("Done scheduling (re)index jobs for all entities"); } else { LOG.debug("Index for Attribute found, index is present, no (re)index needed"); List<IndexJobExecution> failedIndexJobs = dataService .findAll( IndexJobExecutionMetadata.INDEX_JOB_EXECUTION, new QueryImpl<IndexJobExecution>().eq(JobExecutionMetaData.STATUS, FAILED), IndexJobExecution.class) .collect(Collectors.toList()); failedIndexJobs.forEach(this::registerNewIndexActionForDirtyJobs); } } IndexBootstrapper(
      MetaDataService metaDataService,
      IndexService indexService,
      IndexActionRegisterService indexActionRegisterService,
      DataService dataService,
      AttributeMetadata attrMetadata); void bootstrap(); }
IndexBootstrapper { public void bootstrap() { if (!indexService.hasIndex(attrMetadata)) { LOG.debug( "No index for Attribute found, asuming missing index, schedule (re)index for all entities"); metaDataService .getRepositories() .forEach(repo -> indexActionRegisterService.register(repo.getEntityType(), null)); LOG.debug("Done scheduling (re)index jobs for all entities"); } else { LOG.debug("Index for Attribute found, index is present, no (re)index needed"); List<IndexJobExecution> failedIndexJobs = dataService .findAll( IndexJobExecutionMetadata.INDEX_JOB_EXECUTION, new QueryImpl<IndexJobExecution>().eq(JobExecutionMetaData.STATUS, FAILED), IndexJobExecution.class) .collect(Collectors.toList()); failedIndexJobs.forEach(this::registerNewIndexActionForDirtyJobs); } } IndexBootstrapper(
      MetaDataService metaDataService,
      IndexService indexService,
      IndexActionRegisterService indexActionRegisterService,
      DataService dataService,
      AttributeMetadata attrMetadata); void bootstrap();  }