@Test public void a_job_found_for_next_execution_executor_service_called() { UUID uuid = UUID.randomUUID(); PDSJob job = mock(PDSJob.class); when(job.getUUID()).thenReturn(uuid); when(repository.findNextJobToExecute()).thenReturn(Optional.of(job)); serviceToTest.triggerExecutionOfNextJob(); verify(executionService).addToExecutionQueueAsynchron(uuid); }
@Scheduled(initialDelayString = "${sechub.pds.config.trigger.nextjob.initialdelay:" + DEFAULT_INITIAL_DELAY_MILLIS + "}", fixedDelayString = "${sechub.pds.config.trigger.nextjob.delay:" + DEFAULT_FIXED_DELAY_MILLIS + "}") @Transactional public void triggerExecutionOfNextJob() { if (!schedulingEnabled) { LOG.trace("Trigger execution of next job canceled, because scheduling disabled."); return; } LOG.trace("Trigger execution of next job started."); if (executionService.isQueueFull()) { LOG.debug("Execution service is not able to execute next job, so cancel here"); return; } Optional<PDSJob> nextJob = repository.findNextJobToExecute(); if (!nextJob.isPresent()) { LOG.trace("No next job present"); return; } PDSJob pdsJob = nextJob.get(); pdsJob.setState(PDSJobStatusState.QUEUED); executionService.addToExecutionQueueAsynchron(pdsJob.getUUID()); }
PDSBatchTriggerService { @Scheduled(initialDelayString = "${sechub.pds.config.trigger.nextjob.initialdelay:" + DEFAULT_INITIAL_DELAY_MILLIS + "}", fixedDelayString = "${sechub.pds.config.trigger.nextjob.delay:" + DEFAULT_FIXED_DELAY_MILLIS + "}") @Transactional public void triggerExecutionOfNextJob() { if (!schedulingEnabled) { LOG.trace("Trigger execution of next job canceled, because scheduling disabled."); return; } LOG.trace("Trigger execution of next job started."); if (executionService.isQueueFull()) { LOG.debug("Execution service is not able to execute next job, so cancel here"); return; } Optional<PDSJob> nextJob = repository.findNextJobToExecute(); if (!nextJob.isPresent()) { LOG.trace("No next job present"); return; } PDSJob pdsJob = nextJob.get(); pdsJob.setState(PDSJobStatusState.QUEUED); executionService.addToExecutionQueueAsynchron(pdsJob.getUUID()); } }
PDSBatchTriggerService { @Scheduled(initialDelayString = "${sechub.pds.config.trigger.nextjob.initialdelay:" + DEFAULT_INITIAL_DELAY_MILLIS + "}", fixedDelayString = "${sechub.pds.config.trigger.nextjob.delay:" + DEFAULT_FIXED_DELAY_MILLIS + "}") @Transactional public void triggerExecutionOfNextJob() { if (!schedulingEnabled) { LOG.trace("Trigger execution of next job canceled, because scheduling disabled."); return; } LOG.trace("Trigger execution of next job started."); if (executionService.isQueueFull()) { LOG.debug("Execution service is not able to execute next job, so cancel here"); return; } Optional<PDSJob> nextJob = repository.findNextJobToExecute(); if (!nextJob.isPresent()) { LOG.trace("No next job present"); return; } PDSJob pdsJob = nextJob.get(); pdsJob.setState(PDSJobStatusState.QUEUED); executionService.addToExecutionQueueAsynchron(pdsJob.getUUID()); }  }
PDSBatchTriggerService { @Scheduled(initialDelayString = "${sechub.pds.config.trigger.nextjob.initialdelay:" + DEFAULT_INITIAL_DELAY_MILLIS + "}", fixedDelayString = "${sechub.pds.config.trigger.nextjob.delay:" + DEFAULT_FIXED_DELAY_MILLIS + "}") @Transactional public void triggerExecutionOfNextJob() { if (!schedulingEnabled) { LOG.trace("Trigger execution of next job canceled, because scheduling disabled."); return; } LOG.trace("Trigger execution of next job started."); if (executionService.isQueueFull()) { LOG.debug("Execution service is not able to execute next job, so cancel here"); return; } Optional<PDSJob> nextJob = repository.findNextJobToExecute(); if (!nextJob.isPresent()) { LOG.trace("No next job present"); return; } PDSJob pdsJob = nextJob.get(); pdsJob.setState(PDSJobStatusState.QUEUED); executionService.addToExecutionQueueAsynchron(pdsJob.getUUID()); }  @Scheduled(initialDelayString = "${sechub.pds.config.trigger.nextjob.initialdelay:" + DEFAULT_INITIAL_DELAY_MILLIS + "}", fixedDelayString = "${sechub.pds.config.trigger.nextjob.delay:" + DEFAULT_FIXED_DELAY_MILLIS + "}") @Transactional void triggerExecutionOfNextJob(); }
PDSBatchTriggerService { @Scheduled(initialDelayString = "${sechub.pds.config.trigger.nextjob.initialdelay:" + DEFAULT_INITIAL_DELAY_MILLIS + "}", fixedDelayString = "${sechub.pds.config.trigger.nextjob.delay:" + DEFAULT_FIXED_DELAY_MILLIS + "}") @Transactional public void triggerExecutionOfNextJob() { if (!schedulingEnabled) { LOG.trace("Trigger execution of next job canceled, because scheduling disabled."); return; } LOG.trace("Trigger execution of next job started."); if (executionService.isQueueFull()) { LOG.debug("Execution service is not able to execute next job, so cancel here"); return; } Optional<PDSJob> nextJob = repository.findNextJobToExecute(); if (!nextJob.isPresent()) { LOG.trace("No next job present"); return; } PDSJob pdsJob = nextJob.get(); pdsJob.setState(PDSJobStatusState.QUEUED); executionService.addToExecutionQueueAsynchron(pdsJob.getUUID()); }  @Scheduled(initialDelayString = "${sechub.pds.config.trigger.nextjob.initialdelay:" + DEFAULT_INITIAL_DELAY_MILLIS + "}", fixedDelayString = "${sechub.pds.config.trigger.nextjob.delay:" + DEFAULT_FIXED_DELAY_MILLIS + "}") @Transactional void triggerExecutionOfNextJob();  }