@Test void publish_new_best_solution_if_all_fact_changes_processed() { VehicleRoutingSolution solution = SolutionFactory.emptySolution(); when(bestSolutionChangedEvent.isEveryProblemFactChangeProcessed()).thenReturn(true); when(bestSolutionChangedEvent.getNewBestSolution()).thenReturn(solution); solverManager.bestSolutionChanged(bestSolutionChangedEvent); verify(routeChangedEventPublisher).publishSolution(solutionArgumentCaptor.capture()); VehicleRoutingSolution event = solutionArgumentCaptor.getValue(); assertThat(event).isSameAs(solution); }
@Override public void bestSolutionChanged(BestSolutionChangedEvent<VehicleRoutingSolution> bestSolutionChangedEvent) { if (!bestSolutionChangedEvent.isEveryProblemFactChangeProcessed()) { logger.info("Ignoring a new best solution that has some problem facts missing"); return; } routeChangedEventPublisher.publishSolution(bestSolutionChangedEvent.getNewBestSolution()); }
SolverManager implements SolverEventListener<VehicleRoutingSolution> { @Override public void bestSolutionChanged(BestSolutionChangedEvent<VehicleRoutingSolution> bestSolutionChangedEvent) { if (!bestSolutionChangedEvent.isEveryProblemFactChangeProcessed()) { logger.info("Ignoring a new best solution that has some problem facts missing"); return; } routeChangedEventPublisher.publishSolution(bestSolutionChangedEvent.getNewBestSolution()); } }
SolverManager implements SolverEventListener<VehicleRoutingSolution> { @Override public void bestSolutionChanged(BestSolutionChangedEvent<VehicleRoutingSolution> bestSolutionChangedEvent) { if (!bestSolutionChangedEvent.isEveryProblemFactChangeProcessed()) { logger.info("Ignoring a new best solution that has some problem facts missing"); return; } routeChangedEventPublisher.publishSolution(bestSolutionChangedEvent.getNewBestSolution()); } @Autowired  SolverManager(
            Solver<VehicleRoutingSolution> solver,
            AsyncListenableTaskExecutor executor,
            RouteChangedEventPublisher routeChangedEventPublisher,
            ApplicationEventPublisher eventPublisher); }
SolverManager implements SolverEventListener<VehicleRoutingSolution> { @Override public void bestSolutionChanged(BestSolutionChangedEvent<VehicleRoutingSolution> bestSolutionChangedEvent) { if (!bestSolutionChangedEvent.isEveryProblemFactChangeProcessed()) { logger.info("Ignoring a new best solution that has some problem facts missing"); return; } routeChangedEventPublisher.publishSolution(bestSolutionChangedEvent.getNewBestSolution()); } @Autowired  SolverManager(
            Solver<VehicleRoutingSolution> solver,
            AsyncListenableTaskExecutor executor,
            RouteChangedEventPublisher routeChangedEventPublisher,
            ApplicationEventPublisher eventPublisher); @Override void bestSolutionChanged(BestSolutionChangedEvent<VehicleRoutingSolution> bestSolutionChangedEvent); }
SolverManager implements SolverEventListener<VehicleRoutingSolution> { @Override public void bestSolutionChanged(BestSolutionChangedEvent<VehicleRoutingSolution> bestSolutionChangedEvent) { if (!bestSolutionChangedEvent.isEveryProblemFactChangeProcessed()) { logger.info("Ignoring a new best solution that has some problem facts missing"); return; } routeChangedEventPublisher.publishSolution(bestSolutionChangedEvent.getNewBestSolution()); } @Autowired  SolverManager(
            Solver<VehicleRoutingSolution> solver,
            AsyncListenableTaskExecutor executor,
            RouteChangedEventPublisher routeChangedEventPublisher,
            ApplicationEventPublisher eventPublisher); @Override void bestSolutionChanged(BestSolutionChangedEvent<VehicleRoutingSolution> bestSolutionChangedEvent);  }