diff --git a/pom.xml b/pom.xml
index 6321a772..279cd47d 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 30989da9..738b5ef5 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 5df1dd2e..c9211661 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 a0855eb2..693640a3 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 472cc64f..d1d00683 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 5ff55ea4..01915aea 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 b98e79c7..fb09e5a7 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 393e18e4..a517bf8c 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 6859bb05..74dfd1c7 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 22783c21..2174f857 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 b74882f8..f7e3b760 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 cd7d75ba..6bab2bdc 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 8b614b47..42069eec 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 b5836311..5b3c5e3f 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 7e918ccb..4dc1d860 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 c5229590..b30d1cef 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 ac7bed99..ae66ffd7 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 663e7596..173eee13 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 edfdd29c..69f9cbee 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 f446f5a8..8fa6945a 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 8b2153aa..bfa23e9f 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');