@Test void rebuildIndexDeleteSingleEntityTest() { when(dataService.findOneById("TypeTestRefDynamic", "entityId")).thenReturn(null); IndexAction indexAction = indexActionFactory .create() .setIndexActionGroup(indexActionGroup) .setEntityTypeId("entityType") .setEntityId("entityId") .setActionOrder(0) .setIndexStatus(IndexActionMetadata.IndexStatus.PENDING); mockGetAllIndexActions(of(indexAction)); indexActionGroup.setCount(1); when(dataService.hasRepository("TypeTestRefDynamic")).thenReturn(true); indexJobService.executeJob(progress, transactionId); assertEquals(FINISHED, indexAction.getIndexStatus()); verify(indexService).deleteById(testEntityType, "entityId"); verify(progress).status("Start indexing for transaction id: [aabbcc]"); verify(progress).setProgressMax(1); verify(progress).progress(0, "Indexing TypeTestRefDynamic.entityId"); verify(progress).progress(1, "Executed all index actions, cleaning up the actions..."); verify(progress).status("Refresh index start"); verify(progress).status("Refresh index done"); verify(progress).status("Finished indexing for transaction id: [aabbcc]"); verify(indexService).refreshIndex(); verify(dataService, times(2)).update(INDEX_ACTION, indexAction); }
@Timed( value = "service.index", description = "Timing information for the index service.", histogram = true) public Void executeJob(Progress progress, String transactionId) { requireNonNull(progress); IndexActionGroup indexActionGroup = dataService.findOneById(INDEX_ACTION_GROUP, transactionId, IndexActionGroup.class); if (indexActionGroup != null && indexActionGroup.getCount() > 0) { progress.setProgressMax(indexActionGroup.getCount()); progress.status(format("Start indexing for transaction id: [{0}]", transactionId)); performIndexActions(progress, transactionId); progress.status(format("Finished indexing for transaction id: [{0}]", transactionId)); } else { progress.status(format("No index actions found for transaction id: [{0}]", transactionId)); } return null; }
IndexJobService { @Timed( value = "service.index", description = "Timing information for the index service.", histogram = true) public Void executeJob(Progress progress, String transactionId) { requireNonNull(progress); IndexActionGroup indexActionGroup = dataService.findOneById(INDEX_ACTION_GROUP, transactionId, IndexActionGroup.class); if (indexActionGroup != null && indexActionGroup.getCount() > 0) { progress.setProgressMax(indexActionGroup.getCount()); progress.status(format("Start indexing for transaction id: [{0}]", transactionId)); performIndexActions(progress, transactionId); progress.status(format("Finished indexing for transaction id: [{0}]", transactionId)); } else { progress.status(format("No index actions found for transaction id: [{0}]", transactionId)); } return null; } }
IndexJobService { @Timed( value = "service.index", description = "Timing information for the index service.", histogram = true) public Void executeJob(Progress progress, String transactionId) { requireNonNull(progress); IndexActionGroup indexActionGroup = dataService.findOneById(INDEX_ACTION_GROUP, transactionId, IndexActionGroup.class); if (indexActionGroup != null && indexActionGroup.getCount() > 0) { progress.setProgressMax(indexActionGroup.getCount()); progress.status(format("Start indexing for transaction id: [{0}]", transactionId)); performIndexActions(progress, transactionId); progress.status(format("Finished indexing for transaction id: [{0}]", transactionId)); } else { progress.status(format("No index actions found for transaction id: [{0}]", transactionId)); } return null; } IndexJobService(
      DataService dataService, IndexService indexService, EntityTypeFactory entityTypeFactory); }
IndexJobService { @Timed( value = "service.index", description = "Timing information for the index service.", histogram = true) public Void executeJob(Progress progress, String transactionId) { requireNonNull(progress); IndexActionGroup indexActionGroup = dataService.findOneById(INDEX_ACTION_GROUP, transactionId, IndexActionGroup.class); if (indexActionGroup != null && indexActionGroup.getCount() > 0) { progress.setProgressMax(indexActionGroup.getCount()); progress.status(format("Start indexing for transaction id: [{0}]", transactionId)); performIndexActions(progress, transactionId); progress.status(format("Finished indexing for transaction id: [{0}]", transactionId)); } else { progress.status(format("No index actions found for transaction id: [{0}]", transactionId)); } return null; } IndexJobService(
      DataService dataService, IndexService indexService, EntityTypeFactory entityTypeFactory); @Timed( value = "service.index", description = "Timing information for the index service.", histogram = true) Void executeJob(Progress progress, String transactionId); }
IndexJobService { @Timed( value = "service.index", description = "Timing information for the index service.", histogram = true) public Void executeJob(Progress progress, String transactionId) { requireNonNull(progress); IndexActionGroup indexActionGroup = dataService.findOneById(INDEX_ACTION_GROUP, transactionId, IndexActionGroup.class); if (indexActionGroup != null && indexActionGroup.getCount() > 0) { progress.setProgressMax(indexActionGroup.getCount()); progress.status(format("Start indexing for transaction id: [{0}]", transactionId)); performIndexActions(progress, transactionId); progress.status(format("Finished indexing for transaction id: [{0}]", transactionId)); } else { progress.status(format("No index actions found for transaction id: [{0}]", transactionId)); } return null; } IndexJobService(
      DataService dataService, IndexService indexService, EntityTypeFactory entityTypeFactory); @Timed( value = "service.index", description = "Timing information for the index service.", histogram = true) Void executeJob(Progress progress, String transactionId);  }