From 75cd94b5007e4ce50883092d1fa9a8cc209c4d1e Mon Sep 17 00:00:00 2001
From: Damien Trouillet <4112390+dtrouillet@users.noreply.github.com>
Date: Thu, 1 Aug 2024 17:34:43 +0200
Subject: [PATCH] deps(jobrunr): upgrade to 7.2.2 (#516)
* deps(jobrunr): upgrade to 7.2.2
---
pom.xml | 4 ++--
src/main/java/fr/icdc/ebad/service/BatchService.java | 3 ++-
.../java/fr/icdc/ebad/service/EnvironnementService.java | 3 ++-
src/main/java/fr/icdc/ebad/service/SchedulingService.java | 2 +-
src/test/java/fr/icdc/ebad/service/BatchServiceTest.java | 6 +++---
.../java/fr/icdc/ebad/service/EnvironnementServiceTest.java | 4 ++--
6 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/pom.xml b/pom.xml
index 279cd47d..b7ec6b4d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,7 +60,7 @@
7.0.0.CR1
${project.build.directory}/test-results
0.9.0
- 5.3.3
+ 7.2.2
3.12.0
@@ -95,7 +95,7 @@
org.jobrunr
- jobrunr-spring-boot-starter
+ jobrunr-spring-boot-3-starter
${jobrunr.version}
diff --git a/src/main/java/fr/icdc/ebad/service/BatchService.java b/src/main/java/fr/icdc/ebad/service/BatchService.java
index 47b961df..dcb0ef9d 100644
--- a/src/main/java/fr/icdc/ebad/service/BatchService.java
+++ b/src/main/java/fr/icdc/ebad/service/BatchService.java
@@ -14,6 +14,7 @@
import fr.icdc.ebad.repository.SchedulingRepository;
import fr.icdc.ebad.security.SecurityUtils;
import fr.icdc.ebad.service.util.EbadServiceException;
+import org.jobrunr.jobs.JobId;
import org.jobrunr.jobs.annotations.Job;
import org.jobrunr.scheduling.JobScheduler;
import org.slf4j.Logger;
@@ -254,7 +255,7 @@ public void deleteBatch(Long id) {
public void deleteScheduledJobFromBatch(Long batchId){
List schedulings = schedulingRepository.findAllByBatchId(batchId);
schedulings.forEach(scheduling -> {
- jobScheduler.delete(String.valueOf(scheduling.getId()));
+ jobScheduler.deleteRecurringJob(String.valueOf(scheduling.getId()));
schedulingRepository.delete(scheduling);
});
}
diff --git a/src/main/java/fr/icdc/ebad/service/EnvironnementService.java b/src/main/java/fr/icdc/ebad/service/EnvironnementService.java
index c2206eae..3625a920 100644
--- a/src/main/java/fr/icdc/ebad/service/EnvironnementService.java
+++ b/src/main/java/fr/icdc/ebad/service/EnvironnementService.java
@@ -24,6 +24,7 @@
import fr.icdc.ebad.service.util.EbadServiceException;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotNull;
+import org.jobrunr.jobs.JobId;
import org.jobrunr.scheduling.JobScheduler;
import org.pf4j.PluginRuntimeException;
import org.pf4j.PluginWrapper;
@@ -154,7 +155,7 @@ public String getEspaceDisque(Long id) {
public void deleteScheduledJobFromEnvironment(Long environmentId){
List schedulings = schedulingRepository.findAllByEnvironnementId(environmentId);
schedulings.forEach(scheduling -> {
- jobScheduler.delete(String.valueOf(scheduling.getId()));
+ jobScheduler.deleteRecurringJob(String.valueOf(scheduling.getId()));
schedulingRepository.delete(scheduling);
});
}
diff --git a/src/main/java/fr/icdc/ebad/service/SchedulingService.java b/src/main/java/fr/icdc/ebad/service/SchedulingService.java
index 3cd78b01..38c6be03 100644
--- a/src/main/java/fr/icdc/ebad/service/SchedulingService.java
+++ b/src/main/java/fr/icdc/ebad/service/SchedulingService.java
@@ -65,7 +65,7 @@ public Scheduling saveAndRun(Long batchId, Long environnementId, String paramete
@Transactional
public void remove(Long schedulingId) {
Scheduling scheduling = schedulingRepository.getById(schedulingId);
- jobScheduler.delete(String.valueOf(scheduling.getId()));
+ jobScheduler.deleteRecurringJob(String.valueOf(scheduling.getId()));
schedulingRepository.delete(scheduling);
}
diff --git a/src/test/java/fr/icdc/ebad/service/BatchServiceTest.java b/src/test/java/fr/icdc/ebad/service/BatchServiceTest.java
index be3cfb69..f6d2e257 100644
--- a/src/test/java/fr/icdc/ebad/service/BatchServiceTest.java
+++ b/src/test/java/fr/icdc/ebad/service/BatchServiceTest.java
@@ -297,7 +297,7 @@ public void removeBatchsWithoutEnvironnement() {
verify(logBatchRepository).deleteAllByBatchId(eq(1L));
verify(logBatchRepository).deleteAllByBatchId(eq(2L));
- verify(jobScheduler, times(1)).delete(eq("10"));
+ verify(jobScheduler, times(1)).deleteRecurringJob(eq("10"));
verify(schedulingRepository, times(1)).delete(eq(scheduling));
verify(batchRepository).delete(batch1);
@@ -440,7 +440,7 @@ public void testDeleteBatchById() {
batchService.deleteBatch(1L);
verify(logBatchRepository).deleteAllByBatchId(1L);
verify(batchRepository).deleteById(1L);
- verify(jobScheduler, times(1)).delete(eq("10"));
+ verify(jobScheduler, times(1)).deleteRecurringJob(eq("10"));
verify(schedulingRepository, times(1)).delete(eq(scheduling));
}
@@ -459,7 +459,7 @@ public void deleteBatch() {
verify(logBatchRepository).deleteAllByBatchId(1L);
verify(batchRepository).deleteById(1L);
- verify(jobScheduler, times(1)).delete(eq("10"));
+ verify(jobScheduler, times(1)).deleteRecurringJob(eq("10"));
verify(schedulingRepository, times(1)).delete(eq(scheduling));
}
diff --git a/src/test/java/fr/icdc/ebad/service/EnvironnementServiceTest.java b/src/test/java/fr/icdc/ebad/service/EnvironnementServiceTest.java
index 133d5547..e17c2c28 100644
--- a/src/test/java/fr/icdc/ebad/service/EnvironnementServiceTest.java
+++ b/src/test/java/fr/icdc/ebad/service/EnvironnementServiceTest.java
@@ -167,7 +167,7 @@ public void deleteEnvironnement() {
verify(batchRepository, times(1)).deleteAll(eq(environnement.getBatchs()));
verify(directoryRepository, times(1)).deleteByEnvironnement(eq(environnement));
verify(environnementRepository, times(1)).delete(eq(environnement));
- verify(jobScheduler, times(1)).delete(eq("10"));
+ verify(jobScheduler, times(1)).deleteRecurringJob(eq("10"));
verify(schedulingRepository, times(1)).delete(eq(scheduling));
}
@@ -204,7 +204,7 @@ public void deleteEnvironnement2() {
verify(batchRepository, times(0)).deleteAll(eq(environnement.getBatchs()));
verify(directoryRepository, times(1)).deleteByEnvironnement(eq(environnement));
verify(environnementRepository, times(1)).delete(eq(environnement));
- verify(jobScheduler, times(1)).delete(eq("10"));
+ verify(jobScheduler, times(1)).deleteRecurringJob(eq("10"));
verify(schedulingRepository, times(1)).delete(eq(scheduling));
}