From abcfd276ce63ef8666097a8d712a7649e5ee29a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:03:37 +0200 Subject: [PATCH 01/12] build(deps): bump org.apache.maven.plugins:maven-surefire-plugin (#490) Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.2.5 to 3.3.1. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.2.5...surefire-3.3.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-surefire-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Damien Trouillet <4112390+dtrouillet@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dc0e717..e79b57b 100644 --- a/pom.xml +++ b/pom.xml @@ -615,7 +615,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.2.5 + 3.3.1 2 true From 577b20667af58f61cfec0bafd6583e3b52b5f80c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:04:31 +0200 Subject: [PATCH 02/12] build(deps): bump com.querydsl:querydsl-core from 5.0.0 to 5.1.0 (#487) Bumps com.querydsl:querydsl-core from 5.0.0 to 5.1.0. --- updated-dependencies: - dependency-name: com.querydsl:querydsl-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Damien Trouillet <4112390+dtrouillet@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e79b57b..429136d 100644 --- a/pom.xml +++ b/pom.xml @@ -385,7 +385,7 @@ com.querydsl querydsl-core - 5.0.0 + 5.1.0 com.querydsl From e85baae49f0278a290b08c24456e8124b24f347a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:04:40 +0200 Subject: [PATCH 03/12] build(deps): bump org.apache.maven.plugins:maven-compiler-plugin (#486) Bumps [org.apache.maven.plugins:maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.11.0 to 3.13.0. - [Release notes](https://github.com/apache/maven-compiler-plugin/releases) - [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.11.0...maven-compiler-plugin-3.13.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-compiler-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Damien Trouillet <4112390+dtrouillet@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 429136d..001c6c6 100644 --- a/pom.xml +++ b/pom.xml @@ -589,7 +589,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + 3.13.0 ${java.version} ${java.version} From 712baf23fabc84c2abf9b79a6ee0389e98ddc356 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:04:49 +0200 Subject: [PATCH 04/12] build(deps): bump org.projectlombok:lombok from 1.18.30 to 1.18.34 (#485) Bumps [org.projectlombok:lombok](https://github.com/projectlombok/lombok) from 1.18.30 to 1.18.34. - [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown) - [Commits](https://github.com/projectlombok/lombok/compare/v1.18.30...v1.18.34) --- updated-dependencies: - dependency-name: org.projectlombok:lombok dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Damien Trouillet <4112390+dtrouillet@users.noreply.github.com> --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 001c6c6..809b672 100644 --- a/pom.xml +++ b/pom.xml @@ -355,7 +355,7 @@ org.projectlombok lombok - 1.18.30 + 1.18.34 provided @@ -602,7 +602,7 @@ org.projectlombok lombok - 1.18.30 + 1.18.34 org.projectlombok From 81c635f475041ac7364ba97711e6f29f3be8117b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:05:51 +0200 Subject: [PATCH 05/12] build(deps): bump org.liquibase:liquibase-core from 4.17.2 to 4.29.1 (#514) Bumps [org.liquibase:liquibase-core](https://github.com/liquibase/liquibase) from 4.17.2 to 4.29.1. - [Release notes](https://github.com/liquibase/liquibase/releases) - [Changelog](https://github.com/liquibase/liquibase/blob/v4.29.1/changelog.txt) - [Commits](https://github.com/liquibase/liquibase/compare/v4.17.2...v4.29.1) --- updated-dependencies: - dependency-name: org.liquibase:liquibase-core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 809b672..4059a62 100644 --- a/pom.xml +++ b/pom.xml @@ -478,7 +478,7 @@ org.liquibase liquibase-core - 4.17.2 + 4.29.1 From f5e2a0bff60d0c04b4ecd7af1d3b3829dd424e5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:07:35 +0200 Subject: [PATCH 06/12] build(deps): bump org.codehaus.mojo:properties-maven-plugin (#459) Bumps [org.codehaus.mojo:properties-maven-plugin](https://github.com/mojohaus/properties-maven-plugin) from 1.2.0 to 1.2.1. - [Release notes](https://github.com/mojohaus/properties-maven-plugin/releases) - [Commits](https://github.com/mojohaus/properties-maven-plugin/compare/1.2.0...1.2.1) --- updated-dependencies: - dependency-name: org.codehaus.mojo:properties-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4059a62..584b872 100644 --- a/pom.xml +++ b/pom.xml @@ -542,7 +542,7 @@ org.codehaus.mojo properties-maven-plugin - 1.2.0 + 1.2.1 initialize From 97a090bfb1da61137130b810123ec746d82c25a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:07:45 +0200 Subject: [PATCH 07/12] Bump jobrunr-spring-boot-starter from 4.0.10 to 5.3.3 (#355) Bumps [jobrunr-spring-boot-starter](https://github.com/jobrunr/jobrunr) from 4.0.10 to 5.3.3. - [Release notes](https://github.com/jobrunr/jobrunr/releases) - [Commits](https://github.com/jobrunr/jobrunr/compare/v4.0.10...v5.3.3) --- updated-dependencies: - dependency-name: org.jobrunr:jobrunr-spring-boot-starter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 584b872..bec9d9a 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ 7.0.0.CR1 ${project.build.directory}/test-results 0.9.0 - 5.3.1 + 5.3.3 3.12.0 From cdce3e987a37293ce87b492a821ad33dc9aad92a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 01:12:29 +0200 Subject: [PATCH 08/12] build(deps): bump problem-spring-web from 0.27.0 to 0.29.1 (#393) * build(deps): bump problem-spring-web from 0.27.0 to 0.29.1 Bumps [problem-spring-web](https://github.com/zalando/problem-spring-web) from 0.27.0 to 0.29.1. - [Release notes](https://github.com/zalando/problem-spring-web/releases) - [Commits](https://github.com/zalando/problem-spring-web/compare/0.27.0...0.29.1) --- updated-dependencies: - dependency-name: org.zalando:problem-spring-web dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * fix(jakarta): replace javax by jakarta --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Damien Trouillet --- pom.xml | 2 +- src/main/java/fr/icdc/ebad/web/rest/errors/ApiError.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index bec9d9a..c4b1721 100644 --- a/pom.xml +++ b/pom.xml @@ -362,7 +362,7 @@ org.zalando problem-spring-web - 0.27.0 + 0.29.1 diff --git a/src/main/java/fr/icdc/ebad/web/rest/errors/ApiError.java b/src/main/java/fr/icdc/ebad/web/rest/errors/ApiError.java index e269262..9408099 100644 --- a/src/main/java/fr/icdc/ebad/web/rest/errors/ApiError.java +++ b/src/main/java/fr/icdc/ebad/web/rest/errors/ApiError.java @@ -3,13 +3,13 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; +import jakarta.validation.ConstraintViolation; import lombok.Data; import org.hibernate.validator.internal.engine.path.PathImpl; import org.springframework.http.HttpStatus; import org.springframework.validation.FieldError; import org.springframework.validation.ObjectError; -import javax.validation.ConstraintViolation; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; From d3dd8c7dbb3ecaf80d704a5dd908aaff14a6aed4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 01:19:51 +0200 Subject: [PATCH 09/12] build(deps): bump org.apache.sshd:sshd-sftp from 2.8.0 to 2.13.2 (#512) * build(deps): bump org.apache.sshd:sshd-sftp from 2.8.0 to 2.13.2 Bumps [org.apache.sshd:sshd-sftp](https://github.com/apache/mina-sshd) from 2.8.0 to 2.13.2. - [Release notes](https://github.com/apache/mina-sshd/releases) - [Changelog](https://github.com/apache/mina-sshd/blob/master/CHANGES.md) - [Commits](https://github.com/apache/mina-sshd/compare/sshd-2.8.0...sshd-2.13.2) --- updated-dependencies: - dependency-name: org.apache.sshd:sshd-sftp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * bump(sshd-core): bump to 2.13.2 --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Damien Trouillet <4112390+dtrouillet@users.noreply.github.com> Co-authored-by: Damien Trouillet --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index c4b1721..6321a77 100644 --- a/pom.xml +++ b/pom.xml @@ -158,7 +158,7 @@ org.apache.sshd sshd-core - 2.8.0 + 2.13.2 commons-io @@ -428,7 +428,7 @@ org.apache.sshd sshd-sftp - 2.8.0 + 2.13.2 org.powermock From b9b96ac34e0b552341e8fb0f09b493bdb4625bd2 Mon Sep 17 00:00:00 2001 From: Damien Trouillet <4112390+dtrouillet@users.noreply.github.com> Date: Thu, 1 Aug 2024 16:02:29 +0200 Subject: [PATCH 10/12] bump(spring-boot): bump to 3.3.2 (#515) * bump(spring-boot): bump to 3.3.2 * bump(spring-boot): fix unit test --- pom.xml | 27 +++++++------------ .../java/fr/icdc/ebad/EbadApplication.java | 4 +++ .../ebad/config/DatabaseConfiguration.java | 6 ++--- .../fr/icdc/ebad/domain/GlobalSetting.java | 4 +-- .../icdc/ebad/repository/UserRepository.java | 4 +-- .../AccreditationRequestServiceTest.java | 9 ++++--- .../ebad/service/ApiTokenServiceTest.java | 2 +- .../AccreditationRequestResourceTest.java | 14 +++++++--- .../ebad/web/rest/ApiTokenResourceTest.java | 2 +- .../web/rest/ApplicationResourceTest.java | 10 ++++--- .../ebad/web/rest/ChaineResourceTest.java | 3 ++- .../ebad/web/rest/DirectoryResourceTest.java | 3 ++- .../web/rest/EnvironnementResourceTest.java | 3 ++- .../ebad/web/rest/IdentityResourceTest.java | 4 +-- .../icdc/ebad/web/rest/LogsResourceTest.java | 7 ++--- .../icdc/ebad/web/rest/NewResourceTest.java | 5 ++-- .../icdc/ebad/web/rest/NormResourceTest.java | 4 +-- .../ebad/web/rest/SchedulingResourceTest.java | 5 ++-- .../web/rest/TypeFichierResourceTest.java | 3 ++- .../icdc/ebad/web/rest/UserResourceTest.java | 3 ++- src/test/resources/nop.sql | 8 +++--- 21 files changed, 72 insertions(+), 58 deletions(-) diff --git a/pom.xml b/pom.xml index 6321a77..279cd47 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ spring-boot-starter-parent org.springframework.boot - 3.0.0 + 3.3.2 @@ -41,7 +41,6 @@ UTF-8 1.0.0m1 - 1.7.0 2.16.1 3.15.0 2.2.4 @@ -126,7 +125,7 @@ com.fasterxml.jackson.datatype - jackson-datatype-hibernate5 + jackson-datatype-hibernate6 com.fasterxml.jackson.datatype @@ -147,14 +146,6 @@ runtime 2.3.230 - - - com.jayway.awaitility - awaitility - ${awaitility.version} - test - - org.apache.sshd sshd-core @@ -222,17 +213,17 @@ org.hibernate.orm hibernate-jcache - 6.1.5.Final + 6.5.2.Final org.ehcache ehcache-transactions - 3.10.6 + 3.10.8 org.hibernate.orm hibernate-envers - 6.1.5.Final + 6.5.2.Final org.hibernate.validator @@ -242,7 +233,7 @@ org.hibernate hibernate-entitymanager - 5.6.12.Final + 5.6.15.Final @@ -319,7 +310,7 @@ org.springframework.boot spring-boot-starter-oauth2-resource-server - 3.0.6 + 3.3.2 @@ -403,7 +394,7 @@ org.springframework.data spring-data-commons - 3.0.0 + 3.3.2 org.springdoc @@ -502,7 +493,7 @@ org.springframework.data spring-data-commons - 2.7.5 + 3.3.2 diff --git a/src/main/java/fr/icdc/ebad/EbadApplication.java b/src/main/java/fr/icdc/ebad/EbadApplication.java index 30989da..738b5ef 100644 --- a/src/main/java/fr/icdc/ebad/EbadApplication.java +++ b/src/main/java/fr/icdc/ebad/EbadApplication.java @@ -13,6 +13,7 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; import org.springframework.core.env.Environment; +import org.springframework.data.web.config.EnableSpringDataWebSupport; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; @@ -20,11 +21,14 @@ import java.net.UnknownHostException; import java.util.Arrays; +import static org.springframework.data.web.config.EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO; + @SpringBootApplication @ComponentScan(excludeFilters={@ComponentScan.Filter(type= FilterType.ASSIGNABLE_TYPE, value=SpringDocDataRestConfiguration.class)}) @EnableConfigurationProperties(EbadProperties.class) @EnableAsync @EnableScheduling +@EnableSpringDataWebSupport(pageSerializationMode = VIA_DTO) public class EbadApplication { private static final Logger APPLICATION_LOGGER = LoggerFactory.getLogger(EbadApplication.class); diff --git a/src/main/java/fr/icdc/ebad/config/DatabaseConfiguration.java b/src/main/java/fr/icdc/ebad/config/DatabaseConfiguration.java index 5df1dd2..c921166 100644 --- a/src/main/java/fr/icdc/ebad/config/DatabaseConfiguration.java +++ b/src/main/java/fr/icdc/ebad/config/DatabaseConfiguration.java @@ -1,6 +1,6 @@ package fr.icdc.ebad.config; -import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; +import com.fasterxml.jackson.datatype.hibernate6.Hibernate6Module; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; @@ -14,7 +14,7 @@ @EnableTransactionManagement public class DatabaseConfiguration { @Bean - public Hibernate5Module hibernate5Module() { - return new Hibernate5Module(); + public Hibernate6Module hibernate5Module() { + return new Hibernate6Module(); } } diff --git a/src/main/java/fr/icdc/ebad/domain/GlobalSetting.java b/src/main/java/fr/icdc/ebad/domain/GlobalSetting.java index a0855eb..693640a 100644 --- a/src/main/java/fr/icdc/ebad/domain/GlobalSetting.java +++ b/src/main/java/fr/icdc/ebad/domain/GlobalSetting.java @@ -24,10 +24,10 @@ @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class GlobalSetting { @Id - @Column(name = "key") + @Column(name = "`key`") private String key; - @Column(name = "value", nullable = false) + @Column(name = "`value`", nullable = false) private String value; @Column(name = "label", nullable = false) diff --git a/src/main/java/fr/icdc/ebad/repository/UserRepository.java b/src/main/java/fr/icdc/ebad/repository/UserRepository.java index 472cc64..d1d0068 100644 --- a/src/main/java/fr/icdc/ebad/repository/UserRepository.java +++ b/src/main/java/fr/icdc/ebad/repository/UserRepository.java @@ -58,10 +58,10 @@ default void customize(QuerydslBindings bindings, QUser root) { @Query("select user from User user left join user.usageApplications usageApplication left join usageApplication.application application left join application.environnements environnement left join environnement.batchs batch where batch.id = :batch and user.login = :login and usageApplication.canManage = true") User findManagerFromBatch(@Param("batch") Long batch, @Param("login") String login); - @Query("select user from User user left join user.usageApplications usageApplication on user.id = usageApplication.user left join usageApplication.application application where application.id = :application and user.login = :login and usageApplication.canUse = true") + @Query("select user from User user left join user.usageApplications usageApplication on user.id = usageApplication.user.id left join usageApplication.application application where application.id = :application and user.login = :login and usageApplication.canUse = true") User findUserFromApplication(@Param("application") Long application, @Param("login") String login); - @Query("select user from User user left join user.usageApplications usageApplication on user.id = usageApplication.user left join usageApplication.application application where application.id = :application and user.login = :login and usageApplication.canManage = true") + @Query("select user from User user left join user.usageApplications usageApplication on user.id = usageApplication.user.id left join usageApplication.application application where application.id = :application and user.login = :login and usageApplication.canManage = true") User findManagerFromApplication(@Param("application") Long application, @Param("login") String login); @Query("select user from User user left join user.usageApplications usageApplication left join usageApplication.application application left join application.environnements environnement where environnement.id = :env and user.login = :login and usageApplication.canUse = true") diff --git a/src/test/java/fr/icdc/ebad/service/AccreditationRequestServiceTest.java b/src/test/java/fr/icdc/ebad/service/AccreditationRequestServiceTest.java index 5ff55ea..01915ae 100644 --- a/src/test/java/fr/icdc/ebad/service/AccreditationRequestServiceTest.java +++ b/src/test/java/fr/icdc/ebad/service/AccreditationRequestServiceTest.java @@ -19,6 +19,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; @@ -196,7 +197,7 @@ public void getAllAccreditationRequestToAnswerAdmin() { accreditationRequestList.add(accreditationRequest2); PageRequest pageRequest = PageRequest.of(0, 10); - when(accreditationRequestRepository.findAll(any(Predicate.class), eq(pageRequest))).thenReturn(new PageImpl<>(accreditationRequestList)); + when(accreditationRequestRepository.findAll(any(Predicate.class), eq(pageRequest))).thenReturn(new PageImpl<>(accreditationRequestList, Pageable.ofSize(accreditationRequestList.size()), accreditationRequestList.size())); Page result = accreditationRequestService.getAllAccreditationRequestToAnswer(pageRequest); @@ -221,7 +222,7 @@ public void getAllAccreditationRequestToAnswer() { application2.setId(2L); applications.add(application2); - PageImpl applicationPage = new PageImpl<>(applications); + PageImpl applicationPage = new PageImpl<>(applications, Pageable.ofSize(applications.size()), applications.size()); when(applicationRepository.findAllManagedByUser(any(), any())).thenReturn(applicationPage); @@ -248,7 +249,7 @@ public void getAllAccreditationRequestToAnswer() { accreditationRequestList.add(accreditationRequest2); PageRequest pageRequest = PageRequest.of(0, 10); - when(accreditationRequestRepository.findAll(any(Predicate.class), eq(pageRequest))).thenReturn(new PageImpl<>(accreditationRequestList)); + when(accreditationRequestRepository.findAll(any(Predicate.class), eq(pageRequest))).thenReturn(new PageImpl<>(accreditationRequestList, Pageable.ofSize(accreditationRequestList.size()), accreditationRequestList.size())); Page result = accreditationRequestService.getAllAccreditationRequestToAnswer(pageRequest); @@ -286,7 +287,7 @@ public void getMyAccreditationRequest() { accreditationRequestList.add(accreditationRequest2); PageRequest pageRequest = PageRequest.of(0, 10); - when(accreditationRequestRepository.findAll(any(Predicate.class), eq(pageRequest))).thenReturn(new PageImpl<>(accreditationRequestList)); + when(accreditationRequestRepository.findAll(any(Predicate.class), eq(pageRequest))).thenReturn(new PageImpl<>(accreditationRequestList, Pageable.ofSize(accreditationRequestList.size()), accreditationRequestList.size())); Page result = accreditationRequestService.getMyAccreditationRequest(pageRequest); diff --git a/src/test/java/fr/icdc/ebad/service/ApiTokenServiceTest.java b/src/test/java/fr/icdc/ebad/service/ApiTokenServiceTest.java index b98e79c..fb09e5a 100644 --- a/src/test/java/fr/icdc/ebad/service/ApiTokenServiceTest.java +++ b/src/test/java/fr/icdc/ebad/service/ApiTokenServiceTest.java @@ -48,7 +48,7 @@ public void findTokenByUser() { ApiToken apiToken2 = ApiToken.builder().id(2L).build(); apiTokens.add(apiToken1); apiTokens.add(apiToken2); - Page apiTokenPage = new PageImpl<>(apiTokens); + Page apiTokenPage = new PageImpl<>(apiTokens, Pageable.ofSize(apiTokens.size()), apiTokens.size()); when(apiTokenRepository.findAllByUserLogin(eq("myLogin"), eq(pageable))).thenReturn(apiTokenPage); Page results = apiTokenService.findTokenByUser("myLogin", pageable); diff --git a/src/test/java/fr/icdc/ebad/web/rest/AccreditationRequestResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/AccreditationRequestResourceTest.java index 393e18e..a517bf8 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/AccreditationRequestResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/AccreditationRequestResourceTest.java @@ -9,6 +9,7 @@ import fr.icdc.ebad.service.AccreditationRequestService; import fr.icdc.ebad.web.rest.dto.CreationAccreditationRequestDto; import fr.icdc.ebad.web.rest.dto.ResponseAccreditationRequestDto; +import fr.icdc.ebad.web.rest.errors.ExceptionTranslator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -18,6 +19,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.security.test.context.support.WithMockUser; @@ -38,6 +40,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -53,6 +56,9 @@ public class AccreditationRequestResourceTest { @Autowired private AccreditationRequestResource accreditationRequestResource; + @Autowired + private ExceptionTranslator exceptionTranslator; + @Autowired private WebApplicationContext context; @@ -64,6 +70,7 @@ public void setup() { this.restMvc = MockMvcBuilders .standaloneSetup(accreditationRequestResource) .setCustomArgumentResolvers(new PageableHandlerMethodArgumentResolver()) + .setControllerAdvice(exceptionTranslator) .build(); objectMapper.registerModule(new JavaTimeModule()); } @@ -93,12 +100,13 @@ public void findAll() throws Exception { accreditationRequestList.add(accreditationRequest1); accreditationRequestList.add(accreditationRequest2); - Page accreditationRequestPage = new PageImpl<>(accreditationRequestList); + Page accreditationRequestPage = new PageImpl<>(accreditationRequestList, Pageable.ofSize(2), 2); + when(accreditationRequestService.getAllAccreditationRequestToAnswer(any())).thenReturn(accreditationRequestPage); MockHttpServletRequestBuilder builder = MockMvcRequestBuilders.get("/accreditation-requests/need-answer"); - restMvc.perform(builder) + restMvc.perform(builder).andDo(print()) .andExpect(status().isOk()) .andExpect(jsonPath("$.content").isArray()) .andExpect(jsonPath("$.content", hasSize(2))) @@ -139,7 +147,7 @@ public void findAllMyRequest() throws Exception { accreditationRequestList.add(accreditationRequest1); accreditationRequestList.add(accreditationRequest2); - Page accreditationRequestPage = new PageImpl<>(accreditationRequestList); + Page accreditationRequestPage = new PageImpl<>(accreditationRequestList, Pageable.ofSize(accreditationRequestList.size()), accreditationRequestList.size()); when(accreditationRequestService.getMyAccreditationRequest(any())).thenReturn(accreditationRequestPage); diff --git a/src/test/java/fr/icdc/ebad/web/rest/ApiTokenResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/ApiTokenResourceTest.java index 6859bb0..74dfd1c 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/ApiTokenResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/ApiTokenResourceTest.java @@ -74,7 +74,7 @@ public void findToken() throws Exception { ApiToken apiToken2 = ApiToken.builder().id(2L).build(); apiTokens.add(apiToken1); apiTokens.add(apiToken2); - Page apiTokenPage = new PageImpl<>(apiTokens); + Page apiTokenPage = new PageImpl<>(apiTokens, Pageable.ofSize(apiTokens.size()), apiTokens.size()); when(apiTokenService.findTokenByUser(eq("user"), ArgumentMatchers.any(Pageable.class))).thenReturn(apiTokenPage); restMvc.perform(builder) diff --git a/src/test/java/fr/icdc/ebad/web/rest/ApplicationResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/ApplicationResourceTest.java index 22783c2..2174f85 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/ApplicationResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/ApplicationResourceTest.java @@ -19,6 +19,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.data.web.querydsl.QuerydslPredicateArgumentResolver; import org.springframework.http.MediaType; @@ -103,7 +104,7 @@ public void findApplication() throws Exception { Application application2 = new Application(); application2.setId(2L); applications.add(application2); - PageImpl applicationPage = new PageImpl<>(applications); + PageImpl applicationPage = new PageImpl<>(applications, Pageable.ofSize(applications.size()), applications.size()); when(applicationService.findApplication(any(), any())).thenReturn(applicationPage); @@ -131,7 +132,7 @@ public void getAll() throws Exception { Application application2 = new Application(); application2.setId(2L); applications.add(application2); - PageImpl applicationPage = new PageImpl<>(applications); + PageImpl applicationPage = new PageImpl<>(applications, Pageable.ofSize(applications.size()), applications.size()); when(applicationService.getAllApplicationsUsed(any(), eq("user"))).thenReturn(applicationPage); when(userRepository.findUserFromApplication(anyLong(), anyString())).thenReturn(new User()); @@ -160,7 +161,8 @@ public void getAllWrite() throws Exception { application2.setId(2L); applications.add(application2); - PageImpl applicationPage = new PageImpl<>(applications); + PageImpl applicationPage = new PageImpl<>(applications, Pageable.ofSize(applications.size()), applications.size()); + when(applicationService.getAllApplicationsManaged(any(), eq("dtrouillet"))).thenReturn(applicationPage); when(userRepository.findManagerFromApplication(eq(1L), eq("dtrouillet"))).thenReturn(new User()); @@ -188,7 +190,7 @@ public void getAllManage() throws Exception { application2.setId(2L); applications.add(application2); - PageImpl applicationPage = new PageImpl<>(applications); + PageImpl applicationPage = new PageImpl<>(applications, Pageable.ofSize(applications.size()), applications.size()); when(applicationService.getAllApplications(any(), any())).thenReturn(applicationPage); restMvc.perform(builder) diff --git a/src/test/java/fr/icdc/ebad/web/rest/ChaineResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/ChaineResourceTest.java index b74882f..f7e3b76 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/ChaineResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/ChaineResourceTest.java @@ -21,6 +21,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.data.web.querydsl.QuerydslPredicateArgumentResolver; import org.springframework.http.MediaType; @@ -96,7 +97,7 @@ public void getAllFromEnv() throws Exception { chaines.add(chaine1); chaines.add(chaine2); - Page chainePage = new PageImpl<>(chaines); + Page chainePage = new PageImpl<>(chaines, Pageable.ofSize(chaines.size()), chaines.size()); when(chaineService.getAllChaineFromEnvironmentWithPageable(any(), any(), argThat((environnement -> environnement.getId().equals(1L))))).thenReturn(chainePage); when(permissionEnvironnement.canRead(eq(1L), any())).thenReturn(true); diff --git a/src/test/java/fr/icdc/ebad/web/rest/DirectoryResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/DirectoryResourceTest.java index cd7d75b..6bab2bd 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/DirectoryResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/DirectoryResourceTest.java @@ -16,6 +16,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.data.web.querydsl.QuerydslPredicateArgumentResolver; import org.springframework.security.core.userdetails.UserDetails; @@ -100,7 +101,7 @@ public void getAllFromEnv() throws Exception { Directory directory2 = Directory.builder().id(3L).name("directory2").build(); directoryList.add(directory1); directoryList.add(directory2); - Page directoryPage = new PageImpl<>(directoryList); + Page directoryPage = new PageImpl<>(directoryList, Pageable.ofSize(directoryList.size()), directoryList.size()); when(directoryService.findDirectoryFromEnvironnement(any(), any(), eq(1L))).thenReturn(directoryPage); when(permissionEnvironnement.canRead(eq(1L), any())).thenReturn(true); diff --git a/src/test/java/fr/icdc/ebad/web/rest/EnvironnementResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/EnvironnementResourceTest.java index 8b614b4..42069ee 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/EnvironnementResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/EnvironnementResourceTest.java @@ -15,6 +15,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.data.web.querydsl.QuerydslPredicateArgumentResolver; import org.springframework.security.test.context.support.WithMockUser; @@ -77,7 +78,7 @@ public void getEnvironmentsFromApp() throws Exception { List environnementList = new ArrayList<>(); environnementList.add(environnement1); environnementList.add(environnement2); - Page environnementPage = new PageImpl<>(environnementList); + Page environnementPage = new PageImpl<>(environnementList, Pageable.ofSize(environnementList.size()), environnementList.size()); MockHttpServletRequestBuilder builder = MockMvcRequestBuilders.get("/environments?applicationId=1"); when(environnementService.getEnvironmentFromApp(eq(1L), any(Predicate.class), any())).thenReturn(environnementPage); when(permissionApplication.canRead(eq(1L), any())).thenReturn(true); diff --git a/src/test/java/fr/icdc/ebad/web/rest/IdentityResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/IdentityResourceTest.java index b583631..5b3c5e3 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/IdentityResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/IdentityResourceTest.java @@ -126,7 +126,7 @@ public void getAllIdentities() throws Exception { identities.add(identity2); identities.add(identity3); - Page identityPage = new PageImpl<>(identities); + Page identityPage = new PageImpl<>(identities, Pageable.ofSize(identities.size()), identities.size()); when(identityService.findWithoutApp(any(Predicate.class), any(Pageable.class))).thenReturn(identityPage); restMvc.perform( @@ -162,7 +162,7 @@ public void getAllIdentitiesWithApplication() throws Exception { identities.add(identity2); identities.add(identity3); - Page identityPage = new PageImpl<>(identities); + Page identityPage = new PageImpl<>(identities, Pageable.ofSize(identities.size()), identities.size()); when(identityService.findAllByApplication(eq(1L), any(Predicate.class), any(Pageable.class))).thenReturn(identityPage); restMvc.perform( diff --git a/src/test/java/fr/icdc/ebad/web/rest/LogsResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/LogsResourceTest.java index 7e918cc..4dc1d86 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/LogsResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/LogsResourceTest.java @@ -16,6 +16,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.data.web.querydsl.QuerydslPredicateArgumentResolver; import org.springframework.security.test.context.support.WithMockUser; @@ -86,7 +87,7 @@ public void getAllLog() throws Exception { logBatches.add(logBatch1); logBatches.add(logBatch2); - PageImpl logBatchPage = new PageImpl<>(logBatches); + PageImpl logBatchPage = new PageImpl<>(logBatches, Pageable.ofSize(logBatches.size()), logBatches.size()); when(logBatchService.getAllLogBatchWithPageable(any(), any())).thenReturn(logBatchPage); @@ -114,7 +115,7 @@ public void getAllLogFromEnv() throws Exception { logBatches.add(logBatch1); logBatches.add(logBatch2); - PageImpl logBatchPage = new PageImpl<>(logBatches); + PageImpl logBatchPage = new PageImpl<>(logBatches, Pageable.ofSize(logBatches.size()), logBatches.size()); when(logBatchService.getAllLogBatchWithPageable(any(), any())).thenReturn(logBatchPage); when(permissionEnvironnement.canRead(eq(1L), any())).thenReturn(true); @@ -142,7 +143,7 @@ public void getAllLogFromEnvBatch() throws Exception { logBatches.add(logBatch1); logBatches.add(logBatch2); - PageImpl logBatchPage = new PageImpl<>(logBatches); + PageImpl logBatchPage = new PageImpl<>(logBatches, Pageable.ofSize(logBatches.size()), logBatches.size()); when(logBatchService.getAllLogBatchWithPageable(any(), any())).thenReturn(logBatchPage); when(permissionEnvironnement.canRead(eq(1L), any())).thenReturn(true); diff --git a/src/test/java/fr/icdc/ebad/web/rest/NewResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/NewResourceTest.java index c522959..b30d1ce 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/NewResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/NewResourceTest.java @@ -14,6 +14,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ActiveProfiles; @@ -76,7 +77,7 @@ public void getAll() throws Exception { Actualite actualite2 = new Actualite(); actualite2.setId(2L); actualites.add(actualite2); - Page actualitePage = new PageImpl<>(actualites); + Page actualitePage = new PageImpl<>(actualites, Pageable.ofSize(actualites.size()), actualites.size()); when(newService.getAllActualites(ArgumentMatchers.any())).thenReturn(actualitePage); restMvc.perform(builder) @@ -100,7 +101,7 @@ public void getAllNonDraft() throws Exception { Actualite actualite2 = new Actualite(); actualite2.setId(2L); actualites.add(actualite2); - Page actualitePage = new PageImpl<>(actualites); + Page actualitePage = new PageImpl<>(actualites, Pageable.ofSize(actualites.size()), actualites.size()); when(newService.getAllActualitesPubliees(ArgumentMatchers.any())).thenReturn(actualitePage); diff --git a/src/test/java/fr/icdc/ebad/web/rest/NormResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/NormResourceTest.java index ac7bed9..ae66ffd 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/NormResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/NormResourceTest.java @@ -77,7 +77,7 @@ public void getAll() throws Exception { normeList.add(norme1); normeList.add(norme2); - Page normePage = new PageImpl<>(normeList); + Page normePage = new PageImpl<>(normeList, Pageable.ofSize(normeList.size()), normeList.size()); MockHttpServletRequestBuilder builder = MockMvcRequestBuilders.get("/norms"); when(normeService.getAllNormes(any(Predicate.class), any(Pageable.class))).thenReturn(normePage); @@ -105,7 +105,7 @@ public void getAllList() throws Exception { normeList.add(norme1); normeList.add(norme2); - Page normePage = new PageImpl<>(normeList); + Page normePage = new PageImpl<>(normeList, Pageable.ofSize(normeList.size()), normeList.size()); MockHttpServletRequestBuilder builder = MockMvcRequestBuilders.get("/norms/name"); when(normeService.getAllNormes(any(Predicate.class), any(Pageable.class))).thenReturn(normePage); diff --git a/src/test/java/fr/icdc/ebad/web/rest/SchedulingResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/SchedulingResourceTest.java index 663e759..173eee1 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/SchedulingResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/SchedulingResourceTest.java @@ -17,6 +17,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.security.test.context.support.WithMockUser; @@ -140,7 +141,7 @@ public void listByEnvironment() throws Exception { schedulings.add(scheduling1); schedulings.add(scheduling2); - PageImpl page = new PageImpl<>(schedulings); + PageImpl page = new PageImpl<>(schedulings, Pageable.ofSize(schedulings.size()), schedulings.size()); when(permissionEnvironnement.canRead(eq(2L), any())).thenReturn(true); when(schedulingService.listByEnvironment(eq(2L), any())).thenReturn(page); @@ -191,7 +192,7 @@ public void listAll() throws Exception { schedulings.add(scheduling1); schedulings.add(scheduling2); - PageImpl page = new PageImpl<>(schedulings); + PageImpl page = new PageImpl<>(schedulings, Pageable.ofSize(schedulings.size()), schedulings.size()); when(schedulingService.listAll(any())).thenReturn(page); restMvc.perform(builder) diff --git a/src/test/java/fr/icdc/ebad/web/rest/TypeFichierResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/TypeFichierResourceTest.java index edfdd29..69f9cbe 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/TypeFichierResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/TypeFichierResourceTest.java @@ -19,6 +19,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.data.web.querydsl.QuerydslPredicateArgumentResolver; import org.springframework.http.MediaType; @@ -93,7 +94,7 @@ public void getAllFromEnv() throws Exception { typeFichiers.add(typeFichier1); typeFichiers.add(typeFichier2); - Page typeFichierPage = new PageImpl<>(typeFichiers); + Page typeFichierPage = new PageImpl<>(typeFichiers, Pageable.ofSize(typeFichiers.size()), typeFichiers.size()); when(typeFichierService.getTypeFichierFromApplication(any(), any(), eq(1L))).thenReturn(typeFichierPage); when(permissionApplication.canRead(eq(1L), any())).thenReturn(true); diff --git a/src/test/java/fr/icdc/ebad/web/rest/UserResourceTest.java b/src/test/java/fr/icdc/ebad/web/rest/UserResourceTest.java index f446f5a..8fa6945 100644 --- a/src/test/java/fr/icdc/ebad/web/rest/UserResourceTest.java +++ b/src/test/java/fr/icdc/ebad/web/rest/UserResourceTest.java @@ -14,6 +14,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.data.web.querydsl.QuerydslPredicateArgumentResolver; import org.springframework.security.test.context.support.WithMockUser; @@ -108,7 +109,7 @@ public void getAll() throws Exception { User user2 = new User(); user2.setId(2L); users.add(user2); - PageImpl userPage = new PageImpl<>(users); + PageImpl userPage = new PageImpl<>(users, Pageable.ofSize(users.size()), users.size()); when(userService.getAllUsers(any(), any())).thenReturn(userPage); diff --git a/src/test/resources/nop.sql b/src/test/resources/nop.sql index 8b2153a..bfa23e9 100644 --- a/src/test/resources/nop.sql +++ b/src/test/resources/nop.sql @@ -1,7 +1,7 @@ -INSERT INTO t_global_setting (key, value, description, label) VALUES ('APPLICATION_IMPORT_ENABLED', false, 'Allow to import applications from plugin', 'Application import enabled'); -INSERT INTO t_global_setting (key, value, description, label) VALUES ('ENVIRONMENT_IMPORT_ENABLED', false, 'Allow to import environments from plugin', 'Environment import enabled'); -INSERT INTO t_global_setting (key, value, description, label) VALUES ('ENVIRONMENT_CREATE_ENABLED', true, 'Allow to create new environment', 'Environment creation enabled'); -INSERT INTO t_global_setting (key, value, description, label) VALUES ('APPLICATION_CREATE_ENABLED', true, 'Allow to create new application', 'Application creation enabled'); +INSERT INTO t_global_setting (`key`, `value`, description, label) VALUES ('APPLICATION_IMPORT_ENABLED', false, 'Allow to import applications from plugin', 'Application import enabled'); +INSERT INTO t_global_setting (`key`, `value`, description, label) VALUES ('ENVIRONMENT_IMPORT_ENABLED', false, 'Allow to import environments from plugin', 'Environment import enabled'); +INSERT INTO t_global_setting (`key`, `value`, description, label) VALUES ('ENVIRONMENT_CREATE_ENABLED', true, 'Allow to create new environment', 'Environment creation enabled'); +INSERT INTO t_global_setting (`key`, `value`, description, label) VALUES ('APPLICATION_CREATE_ENABLED', true, 'Allow to create new application', 'Application creation enabled'); INSERT INTO t_authority (name) VALUES ('ROLE_USER'); INSERT INTO t_authority (name)VALUES ('ROLE_ADMIN'); From f156d5c192561f510a6e9093be381fc8f126911e Mon Sep 17 00:00:00 2001 From: Damien Trouillet Date: Thu, 1 Aug 2024 17:04:24 +0200 Subject: [PATCH 11/12] build(java): add jdk 21 and 22 --- .github/workflows/docker.yml | 2 +- .github/workflows/maven.yml | 2 +- .github/workflows/sonarcloud.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f3d0281..c11e393 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -22,7 +22,7 @@ jobs: uses: actions/setup-java@v2 with: distribution: adopt - java-version: 17 + java-version: 21 - name: Set env run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/} - name: Dockerize with Maven diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 035a005..81b4156 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 17, 19 ] + java: [ 17, 21, 22 ] steps: - uses: actions/checkout@v1 - name: Cache Maven Repo diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index e5782f4..066abf3 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -18,7 +18,7 @@ jobs: uses: actions/setup-java@v2 with: distribution: adopt - java-version: 17 + java-version: 21 - name: Build with Maven run: mvn -B --no-transfer-progress org.jacoco:jacoco-maven-plugin:prepare-agent package --file pom.xml --settings settings.xml env: 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 12/12] 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 279cd47..b7ec6b4 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 47b961d..dcb0ef9 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 c2206ea..3625a92 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 3cd78b0..38c6be0 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 be3cfb6..f6d2e25 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 133d554..e17c2c2 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)); }