@Test public void a_job_found_for_next_execution_but_scheduling_disabled_job_is_not_changed() { serviceToTest.schedulingEnabled=false; PDSJob job = new PDSJob(); job.setState(PDSJobStatusState.READY_TO_START); when(repository.findNextJobToExecute()).thenReturn(Optional.of(job)); assertEquals(PDSJobStatusState.READY_TO_START, job.getState()); serviceToTest.triggerExecutionOfNextJob(); assertEquals(PDSJobStatusState.READY_TO_START, job.getState()); }
@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();  }