diff --git a/pom.xml b/pom.xml
index f08f213f0..d1a6c1c67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -141,15 +141,27 @@
- net.minidev
- json-smart
+ org.hibernate.orm
+ hibernate-core
+ 6.2.4.Final
-
+
org.hibernate.search
hibernate-search-mapper-orm
- 6.1.7.Final
+ 6.2.4.Final
+
+
+ org.hibernate
+ hibernate-core
+
+
+
+
+
+ net.minidev
+ json-smart
@@ -235,6 +247,12 @@
commons-lang3
+
+
+ org.apache.httpcomponents.client5
+ httpclient5
+
+
org.apache.commons
diff --git a/src/main/java/de/caritas/cob/userservice/api/model/Admin.java b/src/main/java/de/caritas/cob/userservice/api/model/Admin.java
index 4c2e55c21..c9a29e90d 100644
--- a/src/main/java/de/caritas/cob/userservice/api/model/Admin.java
+++ b/src/main/java/de/caritas/cob/userservice/api/model/Admin.java
@@ -41,9 +41,6 @@
@ToString
@Builder
@EntityListeners(AuditingEntityListener.class)
-@FilterDef(
- name = "tenantFilter",
- parameters = {@ParamDef(name = "tenantId", type = Long.class)})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
public class Admin implements TenantAware {
diff --git a/src/main/java/de/caritas/cob/userservice/api/model/Consultant.java b/src/main/java/de/caritas/cob/userservice/api/model/Consultant.java
index 9a284277c..8566c995e 100644
--- a/src/main/java/de/caritas/cob/userservice/api/model/Consultant.java
+++ b/src/main/java/de/caritas/cob/userservice/api/model/Consultant.java
@@ -52,9 +52,6 @@
@Setter
@Builder
@Indexed
-@FilterDef(
- name = "tenantFilter",
- parameters = {@ParamDef(name = "tenantId", type = Long.class)})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
public class Consultant implements TenantAware, NotificationsAware {
diff --git a/src/main/java/de/caritas/cob/userservice/api/model/ConsultantAgency.java b/src/main/java/de/caritas/cob/userservice/api/model/ConsultantAgency.java
index cac6191c1..dd0c65733 100644
--- a/src/main/java/de/caritas/cob/userservice/api/model/ConsultantAgency.java
+++ b/src/main/java/de/caritas/cob/userservice/api/model/ConsultantAgency.java
@@ -30,9 +30,6 @@
@Builder
@Getter
@Setter
-@FilterDef(
- name = "tenantFilter",
- parameters = {@ParamDef(name = "tenantId", type = Long.class)})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
public class ConsultantAgency implements TenantAware {
diff --git a/src/main/java/de/caritas/cob/userservice/api/model/Session.java b/src/main/java/de/caritas/cob/userservice/api/model/Session.java
index 2ce42c129..488897fe3 100644
--- a/src/main/java/de/caritas/cob/userservice/api/model/Session.java
+++ b/src/main/java/de/caritas/cob/userservice/api/model/Session.java
@@ -49,9 +49,6 @@
@Getter
@Setter
@ToString
-@FilterDef(
- name = "tenantFilter",
- parameters = {@ParamDef(name = "tenantId", type = Long.class)})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
public class Session implements TenantAware {
diff --git a/src/main/java/de/caritas/cob/userservice/api/model/User.java b/src/main/java/de/caritas/cob/userservice/api/model/User.java
index ef0795ddb..eac7113c9 100644
--- a/src/main/java/de/caritas/cob/userservice/api/model/User.java
+++ b/src/main/java/de/caritas/cob/userservice/api/model/User.java
@@ -42,9 +42,6 @@
@Setter
@ToString
@EntityListeners(AuditingEntityListener.class)
-@FilterDef(
- name = "tenantFilter",
- parameters = {@ParamDef(name = "tenantId", type = Long.class)})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
public class User implements TenantAware, NotificationsAware {
diff --git a/src/main/java/de/caritas/cob/userservice/api/model/package-info.java b/src/main/java/de/caritas/cob/userservice/api/model/package-info.java
new file mode 100644
index 000000000..e1fe04af8
--- /dev/null
+++ b/src/main/java/de/caritas/cob/userservice/api/model/package-info.java
@@ -0,0 +1,11 @@
+@FilterDefs({
+ @FilterDef(
+ name = "tenantFilter",
+ parameters = {@ParamDef(name = "tenantId", type = Long.class)}
+ )
+})
+package de.caritas.cob.userservice.api.model;
+
+import org.hibernate.annotations.FilterDef;
+import org.hibernate.annotations.FilterDefs;
+import org.hibernate.annotations.ParamDef;
\ No newline at end of file
diff --git a/src/main/java/de/caritas/cob/userservice/api/service/message/MessageServiceProvider.java b/src/main/java/de/caritas/cob/userservice/api/service/message/MessageServiceProvider.java
index fdc14aafe..4fbd4ec6b 100644
--- a/src/main/java/de/caritas/cob/userservice/api/service/message/MessageServiceProvider.java
+++ b/src/main/java/de/caritas/cob/userservice/api/service/message/MessageServiceProvider.java
@@ -16,7 +16,6 @@
import de.caritas.cob.userservice.api.service.httpheader.SecurityHeaderSupplier;
import de.caritas.cob.userservice.api.service.httpheader.TenantHeaderSupplier;
import de.caritas.cob.userservice.consultingtypeservice.generated.web.model.ExtendedConsultingTypeResponseDTO;
-import de.caritas.cob.userservice.messageservice.generated.ApiClient;
import de.caritas.cob.userservice.messageservice.generated.web.MessageControllerApi;
import de.caritas.cob.userservice.messageservice.generated.web.model.AliasMessageDTO;
import de.caritas.cob.userservice.messageservice.generated.web.model.AliasOnlyMessageDTO;
@@ -181,7 +180,8 @@ private void postAliasOnlyMessage(
}
}
- private void addDefaultHeaders(ApiClient apiClient) {
+ private void addDefaultHeaders(
+ de.caritas.cob.userservice.messageservice.generated.ApiClient apiClient) {
var headers = this.securityHeaderSupplier.getKeycloakAndCsrfHttpHeaders();
tenantHeaderSupplier.addTenantHeader(headers);
headers.forEach((key, value) -> apiClient.addDefaultHeader(key, value.iterator().next()));
diff --git a/src/main/resources/hibernate.properties b/src/main/resources/hibernate.properties
index 02b0dc11e..e06b03da8 100644
--- a/src/main/resources/hibernate.properties
+++ b/src/main/resources/hibernate.properties
@@ -1 +1 @@
-hibernate.search.default.directory_provider=local-heap
+hibernate.search.backend.type=lucene
\ No newline at end of file
diff --git a/src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java b/src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java
index 1ee3e1b6d..bdae5da19 100644
--- a/src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java
+++ b/src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java
@@ -41,9 +41,9 @@
import de.caritas.cob.userservice.api.port.out.IdentityClientConfig;
import de.caritas.cob.userservice.api.tenant.TenantContext;
import jakarta.ws.rs.BadRequestException;
-import jakarta.ws.rs.core.Response;
import java.util.HashMap;
import java.util.List;
+import javax.ws.rs.core.Response;
import org.apache.commons.lang3.RandomStringUtils;
import org.jeasy.random.EasyRandom;
import org.junit.jupiter.api.Assertions;
diff --git a/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/ConversationControllerE2EIT.java b/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/ConversationControllerE2EIT.java
index 9de01274e..f16eed55c 100644
--- a/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/ConversationControllerE2EIT.java
+++ b/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/ConversationControllerE2EIT.java
@@ -38,13 +38,13 @@
import de.caritas.cob.userservice.api.port.out.UserRepository;
import de.caritas.cob.userservice.consultingtypeservice.generated.web.ConsultingTypeControllerApi;
import de.caritas.cob.userservice.topicservice.generated.web.TopicControllerApi;
+import jakarta.servlet.http.Cookie;
import java.net.URI;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
-import javax.servlet.http.Cookie;
import lombok.NonNull;
import lombok.SneakyThrows;
import org.apache.commons.lang3.RandomStringUtils;
@@ -399,7 +399,7 @@ private void givenAValidRocketChatSystemUser() throws RocketChatUserNotInitializ
}
private void givenConsultingTypeServiceResponse(Integer consultingTypeId) {
- consultingTypeControllerApi.getApiClient().setBasePath("https://www.google.de/");
+
when(restTemplate.getUriTemplateHandler())
.thenReturn(
new UriTemplateHandler() {
diff --git a/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerE2EIT.java b/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerE2EIT.java
index 033f6c014..f5750b4b9 100644
--- a/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerE2EIT.java
+++ b/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerE2EIT.java
@@ -95,6 +95,7 @@
import de.caritas.cob.userservice.topicservice.generated.ApiClient;
import de.caritas.cob.userservice.topicservice.generated.web.TopicControllerApi;
import de.caritas.cob.userservice.topicservice.generated.web.model.TopicDTO;
+import jakarta.servlet.http.Cookie;
import java.net.URI;
import java.time.LocalDate;
import java.util.ArrayList;
@@ -105,7 +106,6 @@
import java.util.Set;
import java.util.UUID;
import java.util.stream.StreamSupport;
-import javax.servlet.http.Cookie;
import lombok.NonNull;
import lombok.SneakyThrows;
import org.apache.commons.lang3.RandomStringUtils;
@@ -1989,7 +1989,6 @@ private void givenAValidUser() {
}
private void givenConsultingTypeServiceResponse(Integer consultingTypeId) {
- consultingTypeControllerApi.getApiClient().setBasePath("https://www.google.de/");
when(restTemplate.getUriTemplateHandler())
.thenReturn(
new UriTemplateHandler() {
diff --git a/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerSessionE2EIT.java b/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerSessionE2EIT.java
index 9b941a0d2..6ef716247 100644
--- a/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerSessionE2EIT.java
+++ b/src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerSessionE2EIT.java
@@ -432,7 +432,7 @@ void getSessionsForAuthenticatedConsultantShouldReturnSessionsLastMessageTypeE2e
givenAValidUser();
givenAValidConsultant(true);
givenASessionInProgress();
- givenAValidRocketChatGetRoomsResponse(session.getGroupId(), MessageType.E2EE_ACTIVATED, null);
+ givenAValidRocketChatGetRoomsResponse(session.getGroupId(), MessageType.E2_EE_ACTIVATED, null);
givenAnEmptyRocketChatGetSubscriptionsResponse();
mockMvc
@@ -461,7 +461,7 @@ void getSessionsForAuthenticatedConsultantShouldReturnInformationAboutDeletedUse
givenADeletedUser(false);
givenAValidConsultant(true);
givenASessionInProgress();
- givenAValidRocketChatGetRoomsResponse(session.getGroupId(), MessageType.E2EE_ACTIVATED, null);
+ givenAValidRocketChatGetRoomsResponse(session.getGroupId(), MessageType.E2_EE_ACTIVATED, null);
givenAnEmptyRocketChatGetSubscriptionsResponse();
mockMvc
@@ -545,7 +545,7 @@ void getSessionsForAuthenticatedUserShouldReturnSessionsLastMessageTypeE2eeActiv
givenAValidConsultant();
givenASessionInProgress();
givenAValidRocketChatSystemUser();
- givenAValidRocketChatGetRoomsResponse(session.getGroupId(), MessageType.E2EE_ACTIVATED, null);
+ givenAValidRocketChatGetRoomsResponse(session.getGroupId(), MessageType.E2_EE_ACTIVATED, null);
givenAnEmptyRocketChatGetSubscriptionsResponse();
user.getSessions()
.forEach(session -> givenAValidRocketChatInfoUserResponse(session.getConsultant()));
diff --git a/src/test/java/de/caritas/cob/userservice/api/admin/facade/ConsultantAdminFacadeIT.java b/src/test/java/de/caritas/cob/userservice/api/admin/facade/ConsultantAdminFacadeIT.java
index 274f6b51e..93df68de3 100644
--- a/src/test/java/de/caritas/cob/userservice/api/admin/facade/ConsultantAdminFacadeIT.java
+++ b/src/test/java/de/caritas/cob/userservice/api/admin/facade/ConsultantAdminFacadeIT.java
@@ -78,7 +78,7 @@ class ConsultantAdminFacadeIT {
1,
100,
new ConsultantFilter(),
- new Sort().field(FieldEnum.FIRSTNAME).order(OrderEnum.ASC));
+ new Sort().field(FieldEnum.FIRST_NAME).order(OrderEnum.ASC));
var resultConsultant =
searchResult.getEmbedded().stream()
.filter(
@@ -102,7 +102,7 @@ class ConsultantAdminFacadeIT {
1,
100,
new ConsultantFilter(),
- new Sort().field(FieldEnum.FIRSTNAME).order(OrderEnum.ASC));
+ new Sort().field(FieldEnum.FIRST_NAME).order(OrderEnum.ASC));
var resultConsultant =
searchResult.getEmbedded().stream()
.filter(
@@ -201,7 +201,7 @@ void findFilteredConsultants_Should_retrieveConsultantAfterAddingRelationToAgenc
var searchResult =
this.consultantAdminFacade.findFilteredConsultants(
- 1, 100, consultantFilter, new Sort().field(FieldEnum.FIRSTNAME).order(OrderEnum.ASC));
+ 1, 100, consultantFilter, new Sort().field(FieldEnum.FIRST_NAME).order(OrderEnum.ASC));
assertThat(searchResult.getEmbedded(), hasSize(0));
@@ -209,7 +209,7 @@ void findFilteredConsultants_Should_retrieveConsultantAfterAddingRelationToAgenc
searchResult =
this.consultantAdminFacade.findFilteredConsultants(
- 1, 100, consultantFilter, new Sort().field(FieldEnum.FIRSTNAME).order(OrderEnum.ASC));
+ 1, 100, consultantFilter, new Sort().field(FieldEnum.FIRST_NAME).order(OrderEnum.ASC));
assertThat(searchResult.getEmbedded(), hasSize(greaterThanOrEqualTo(1)));
}
diff --git a/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/ConsultantAdminFilterServiceBase.java b/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/ConsultantAdminFilterServiceBase.java
index 74362dafe..06d284992 100644
--- a/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/ConsultantAdminFilterServiceBase.java
+++ b/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/ConsultantAdminFilterServiceBase.java
@@ -205,7 +205,7 @@ public void findFilteredConsultants_Should_returnResultWithoutPreviousLink_When_
public void
findFilteredConsultants_Should_orderResultByFirstNameDESC_When_sortParameterIsGiven() {
- var sort = new Sort().field(FieldEnum.FIRSTNAME).order(OrderEnum.DESC);
+ var sort = new Sort().field(FieldEnum.FIRST_NAME).order(OrderEnum.DESC);
var result =
this.consultantAdminFilterService.findFilteredConsultants(
diff --git a/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/ConsultantAdminFilterTenantAwareServiceTest.java b/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/ConsultantAdminFilterTenantAwareServiceTest.java
deleted file mode 100644
index c4a729576..000000000
--- a/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/ConsultantAdminFilterTenantAwareServiceTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package de.caritas.cob.userservice.api.admin.service.consultant;
-
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import de.caritas.cob.userservice.api.adapters.web.dto.ConsultantFilter;
-import de.caritas.cob.userservice.api.model.Consultant;
-import de.caritas.cob.userservice.api.tenant.TenantContext;
-import jakarta.persistence.EntityManagerFactory;
-import org.apache.lucene.search.Query;
-import org.hibernate.search.jpa.FullTextEntityManager;
-import org.hibernate.search.query.dsl.BooleanJunction;
-import org.hibernate.search.query.dsl.MustJunction;
-import org.hibernate.search.query.dsl.QueryBuilder;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Answers;
-import org.mockito.ArgumentCaptor;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-@ExtendWith(MockitoExtension.class)
-class ConsultantAdminFilterTenantAwareServiceTest {
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- FullTextEntityManager fullTextEntityManager;
-
- @Mock EntityManagerFactory entityManagerFactory;
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- QueryBuilder queryBuilder;
-
- @Mock BooleanJunction booleanJunction;
-
- @Mock MustJunction mustJunction;
-
- @Mock MustJunction secondMustJunction;
-
- @InjectMocks ConsultantAdminFilterTenantAwareService consultantAdminFilterTenantAwareService;
-
- @Test
- void
- buildFilteredQuery_Should_CreateFilteredQuery_WithoutTenantFilter_If_TenantContextIsSuperAdmin() {
- // given
- TenantContext.setCurrentTenant(TenantContext.TECHNICAL_TENANT_ID);
- when(fullTextEntityManager
- .getSearchFactory()
- .buildQueryBuilder()
- .forEntity(Consultant.class)
- .get())
- .thenReturn(queryBuilder);
- when(queryBuilder.bool()).thenReturn(booleanJunction);
- when(booleanJunction.must(Mockito.any(Query.class))).thenReturn(mustJunction);
-
- // when
- consultantAdminFilterTenantAwareService.buildFilteredQuery(
- new ConsultantFilter().agencyId(59L), fullTextEntityManager);
-
- // then
- ArgumentCaptor captor = ArgumentCaptor.forClass(Query.class);
- verify(fullTextEntityManager)
- .createFullTextQuery(captor.capture(), Mockito.eq(Consultant.class));
- verify(booleanJunction).must(Mockito.any(Query.class));
- verify(mustJunction, Mockito.never()).must(Mockito.any(Query.class));
- TenantContext.clear();
- }
-
- @Test
- void
- buildFilteredQuery_Should_CreateFilteredQuery_WithTenantFilter_When_TenantContextIsNotSuperAdmin() {
- // given
- TenantContext.setCurrentTenant(1L);
- when(fullTextEntityManager
- .getSearchFactory()
- .buildQueryBuilder()
- .forEntity(Consultant.class)
- .get())
- .thenReturn(queryBuilder);
- when(queryBuilder.bool()).thenReturn(booleanJunction);
- when(booleanJunction.must(Mockito.any(Query.class))).thenReturn(mustJunction);
- when(mustJunction.must(null)).thenReturn(secondMustJunction);
-
- // when
- consultantAdminFilterTenantAwareService.buildFilteredQuery(
- new ConsultantFilter().agencyId(59L), fullTextEntityManager);
-
- // then
- ArgumentCaptor captor = ArgumentCaptor.forClass(Query.class);
- verify(fullTextEntityManager)
- .createFullTextQuery(captor.capture(), Mockito.eq(Consultant.class));
- verify(booleanJunction, Mockito.times(2)).must(Mockito.any(Query.class));
- verify(mustJunction).must(Mockito.any());
- TenantContext.clear();
- }
-}
diff --git a/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceIT.java b/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceIT.java
index 2c45294fc..5bcea355a 100644
--- a/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceIT.java
+++ b/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceIT.java
@@ -6,7 +6,7 @@
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
-import static org.hibernate.search.util.impl.CollectionHelper.asSet;
+import static org.hibernate.validator.internal.util.CollectionHelper.asSet;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
diff --git a/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ImportRecordAgencyCreationInputAdapterTest.java b/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ImportRecordAgencyCreationInputAdapterTest.java
index 1afad8d6b..df06fc1e3 100644
--- a/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ImportRecordAgencyCreationInputAdapterTest.java
+++ b/src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ImportRecordAgencyCreationInputAdapterTest.java
@@ -3,7 +3,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
-import static org.hibernate.search.util.impl.CollectionHelper.asSet;
+import static org.hibernate.validator.internal.util.CollectionHelper.asSet;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/de/caritas/cob/userservice/api/conversation/provider/AnonymousEnquiryConversationListProviderIT.java b/src/test/java/de/caritas/cob/userservice/api/conversation/provider/AnonymousEnquiryConversationListProviderIT.java
index 55da81287..1e93fb024 100644
--- a/src/test/java/de/caritas/cob/userservice/api/conversation/provider/AnonymousEnquiryConversationListProviderIT.java
+++ b/src/test/java/de/caritas/cob/userservice/api/conversation/provider/AnonymousEnquiryConversationListProviderIT.java
@@ -31,6 +31,7 @@
import de.caritas.cob.userservice.api.service.agency.AgencyService;
import de.caritas.cob.userservice.api.service.user.UserAccountService;
import de.caritas.cob.userservice.api.testConfig.ConsultingTypeManagerTestConfig;
+import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.collections4.iterators.PeekingIterator;
@@ -120,7 +121,9 @@ void buildConversations_Should_returnElementsInExpectedOrder() {
ConsultantSessionResponseDTO current = peeker.next();
ConsultantSessionResponseDTO next = peeker.peek();
if (nonNull(next)) {
- assertThat(next.getLatestMessage(), greaterThanOrEqualTo(current.getLatestMessage()));
+ assertThat(
+ (Date) next.getLatestMessage(),
+ greaterThanOrEqualTo((Date) current.getLatestMessage()));
}
}
}
diff --git a/src/test/java/de/caritas/cob/userservice/api/conversation/provider/ArchivedSessionConversationListProviderTestIT.java b/src/test/java/de/caritas/cob/userservice/api/conversation/provider/ArchivedSessionConversationListProviderTestIT.java
index 825466736..75cf3207e 100644
--- a/src/test/java/de/caritas/cob/userservice/api/conversation/provider/ArchivedSessionConversationListProviderTestIT.java
+++ b/src/test/java/de/caritas/cob/userservice/api/conversation/provider/ArchivedSessionConversationListProviderTestIT.java
@@ -28,6 +28,7 @@
import de.caritas.cob.userservice.api.port.out.UserRepository;
import de.caritas.cob.userservice.api.service.user.UserAccountService;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@@ -110,7 +111,9 @@ void buildConversations_Should_returnElementsInExpectedOrder() {
ConsultantSessionResponseDTO current = peeker.next();
ConsultantSessionResponseDTO next = peeker.peek();
if (nonNull(next)) {
- assertThat(next.getLatestMessage(), greaterThanOrEqualTo(current.getLatestMessage()));
+ assertThat(
+ (Date) next.getLatestMessage(),
+ greaterThanOrEqualTo((Date) current.getLatestMessage()));
}
}
}
diff --git a/src/test/java/de/caritas/cob/userservice/api/conversation/provider/ArchivedTeamSessionConversationListProviderTestIT.java b/src/test/java/de/caritas/cob/userservice/api/conversation/provider/ArchivedTeamSessionConversationListProviderTestIT.java
index 5d4bc128a..333fa535c 100644
--- a/src/test/java/de/caritas/cob/userservice/api/conversation/provider/ArchivedTeamSessionConversationListProviderTestIT.java
+++ b/src/test/java/de/caritas/cob/userservice/api/conversation/provider/ArchivedTeamSessionConversationListProviderTestIT.java
@@ -28,6 +28,7 @@
import de.caritas.cob.userservice.api.port.out.UserRepository;
import de.caritas.cob.userservice.api.service.user.UserAccountService;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@@ -111,7 +112,9 @@ void buildConversations_Should_returnElementsInExpectedOrder() {
ConsultantSessionResponseDTO current = peeker.next();
ConsultantSessionResponseDTO next = peeker.peek();
if (nonNull(next)) {
- assertThat(next.getLatestMessage(), greaterThanOrEqualTo(current.getLatestMessage()));
+ assertThat(
+ (Date) next.getLatestMessage(),
+ greaterThanOrEqualTo((Date) current.getLatestMessage()));
}
}
}
diff --git a/src/test/java/de/caritas/cob/userservice/api/conversation/provider/RegisteredEnquiryConversationListProviderIT.java b/src/test/java/de/caritas/cob/userservice/api/conversation/provider/RegisteredEnquiryConversationListProviderIT.java
index ec1c47833..7ed163240 100644
--- a/src/test/java/de/caritas/cob/userservice/api/conversation/provider/RegisteredEnquiryConversationListProviderIT.java
+++ b/src/test/java/de/caritas/cob/userservice/api/conversation/provider/RegisteredEnquiryConversationListProviderIT.java
@@ -25,6 +25,7 @@
import de.caritas.cob.userservice.api.port.out.SessionRepository;
import de.caritas.cob.userservice.api.port.out.UserRepository;
import de.caritas.cob.userservice.api.service.user.UserAccountService;
+import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
@@ -111,7 +112,9 @@ public void buildConversations_Should_returnElementsInExpectedOrder() {
ConsultantSessionResponseDTO current = peeker.next();
ConsultantSessionResponseDTO next = peeker.peek();
if (nonNull(next)) {
- assertThat(next.getLatestMessage(), greaterThanOrEqualTo(current.getLatestMessage()));
+ assertThat(
+ (Date) next.getLatestMessage(),
+ greaterThanOrEqualTo((Date) current.getLatestMessage()));
}
}
}
diff --git a/src/test/java/de/caritas/cob/userservice/api/service/liveevents/LiveEventNotificationServiceTest.java b/src/test/java/de/caritas/cob/userservice/api/service/liveevents/LiveEventNotificationServiceTest.java
index 2fde9b046..851744603 100644
--- a/src/test/java/de/caritas/cob/userservice/api/service/liveevents/LiveEventNotificationServiceTest.java
+++ b/src/test/java/de/caritas/cob/userservice/api/service/liveevents/LiveEventNotificationServiceTest.java
@@ -1,8 +1,8 @@
package de.caritas.cob.userservice.api.service.liveevents;
-import static de.caritas.cob.userservice.liveservice.generated.web.model.EventType.ANONYMOUSCONVERSATIONFINISHED;
-import static de.caritas.cob.userservice.liveservice.generated.web.model.EventType.ANONYMOUSENQUIRYACCEPTED;
-import static de.caritas.cob.userservice.liveservice.generated.web.model.EventType.DIRECTMESSAGE;
+import static de.caritas.cob.userservice.liveservice.generated.web.model.EventType.ANONYMOUS_CONVERSATION_FINISHED;
+import static de.caritas.cob.userservice.liveservice.generated.web.model.EventType.ANONYMOUS_ENQUIRY_ACCEPTED;
+import static de.caritas.cob.userservice.liveservice.generated.web.model.EventType.DIRECT_MESSAGE;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
@@ -41,7 +41,7 @@
@MockitoSettings(strictness = Strictness.LENIENT)
public class LiveEventNotificationServiceTest {
- private static final LiveEventMessage MESSAGE = new LiveEventMessage().eventType(DIRECTMESSAGE);
+ private static final LiveEventMessage MESSAGE = new LiveEventMessage().eventType(DIRECT_MESSAGE);
@InjectMocks private LiveEventNotificationService liveEventNotificationService;
@@ -154,7 +154,7 @@ public void sendLiveNewAnonymousEnquiryEventToUsers_Should_TriggerLiveEventWithC
ArgumentCaptor captor = ArgumentCaptor.forClass(LiveEventMessage.class);
verify(liveControllerApi, times(1)).sendLiveEvent(captor.capture());
- assertEquals(EventType.NEWANONYMOUSENQUIRY, captor.getValue().getEventType());
+ assertEquals(EventType.NEW_ANONYMOUS_ENQUIRY, captor.getValue().getEventType());
}
@Test
@@ -179,7 +179,7 @@ public void sendAcceptAnonymousEnquiryEventToUser_Should_triggerLiveEvent_When_u
verify(this.liveControllerApi, times(1))
.sendLiveEvent(
new LiveEventMessage()
- .eventType(ANONYMOUSENQUIRYACCEPTED)
+ .eventType(ANONYMOUS_ENQUIRY_ACCEPTED)
.userIds(singletonList("userId")));
}
@@ -208,7 +208,7 @@ public void sendLiveFinishedAnonymousConversationToUsers_Should_doNothing_When_u
verify(this.liveControllerApi, times(1))
.sendLiveEvent(
new LiveEventMessage()
- .eventType(ANONYMOUSCONVERSATIONFINISHED)
+ .eventType(ANONYMOUS_CONVERSATION_FINISHED)
.userIds(singletonList("userId"))
.eventContent(
new StatusSource()
diff --git a/src/test/java/de/caritas/cob/userservice/api/tenant/AccessTokenTenantResolverTest.java b/src/test/java/de/caritas/cob/userservice/api/tenant/AccessTokenTenantResolverTest.java
index 017587405..d0bfbfd64 100644
--- a/src/test/java/de/caritas/cob/userservice/api/tenant/AccessTokenTenantResolverTest.java
+++ b/src/test/java/de/caritas/cob/userservice/api/tenant/AccessTokenTenantResolverTest.java
@@ -7,23 +7,28 @@
import jakarta.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Optional;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken;
-import org.mockito.Answers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
class AccessTokenTenantResolverTest {
@Mock HttpServletRequest authenticatedRequest;
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- KeycloakAuthenticationToken token;
+ @Mock KeycloakAuthenticationToken token;
@InjectMocks AccessTokenTenantResolver accessTokenTenantResolver;
+ @BeforeEach
+ public void setUp() {
+ token = Mockito.mock(KeycloakAuthenticationToken.class, Mockito.RETURNS_DEEP_STUBS);
+ }
+
@Test
void resolve_Should_ResolveTenantId_When_TenantIdInAccessTokenClaim() {
// given
diff --git a/src/test/java/de/caritas/cob/userservice/api/tenant/TechnicalUserTenantResolverTest.java b/src/test/java/de/caritas/cob/userservice/api/tenant/TechnicalUserTenantResolverTest.java
index 81376e225..b9d5ac5ff 100644
--- a/src/test/java/de/caritas/cob/userservice/api/tenant/TechnicalUserTenantResolverTest.java
+++ b/src/test/java/de/caritas/cob/userservice/api/tenant/TechnicalUserTenantResolverTest.java
@@ -5,14 +5,15 @@
import jakarta.servlet.http.HttpServletRequest;
import org.assertj.core.util.Sets;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken;
import org.keycloak.representations.AccessToken;
import org.keycloak.representations.AccessToken.Access;
-import org.mockito.Answers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
@@ -20,16 +21,20 @@ class TechnicalUserTenantResolverTest {
public static final long TECHNICAL_CONTEXT = 0L;
@Mock HttpServletRequest authenticatedRequest;
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- KeycloakAuthenticationToken token;
+ @Mock KeycloakAuthenticationToken token;
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- AccessToken accessToken;
+ @Mock AccessToken accessToken;
@Mock Access access;
@InjectMocks TechnicalOrSuperAdminUserTenantResolver technicalOrSuperadminUserTenantResolver;
+ @BeforeEach
+ public void setUp() {
+ token = Mockito.mock(KeycloakAuthenticationToken.class, Mockito.RETURNS_DEEP_STUBS);
+ accessToken = Mockito.mock(AccessToken.class, Mockito.RETURNS_DEEP_STUBS);
+ }
+
@Test
void resolve_should_ResolveTechnicalTenantId_ForTechnicalUserRole() {
// given
diff --git a/src/test/java/de/caritas/cob/userservice/api/tenant/TenantResolverServiceTest.java b/src/test/java/de/caritas/cob/userservice/api/tenant/TenantResolverServiceTest.java
index d8af76430..258e0a130 100644
--- a/src/test/java/de/caritas/cob/userservice/api/tenant/TenantResolverServiceTest.java
+++ b/src/test/java/de/caritas/cob/userservice/api/tenant/TenantResolverServiceTest.java
@@ -6,12 +6,13 @@
import jakarta.servlet.http.HttpServletRequest;
import java.util.Optional;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken;
-import org.mockito.Answers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.security.access.AccessDeniedException;
@@ -28,8 +29,7 @@ class TenantResolverServiceTest {
@Mock HttpServletRequest nonAuthenticatedRequest;
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- KeycloakAuthenticationToken token;
+ @Mock KeycloakAuthenticationToken token;
@InjectMocks TenantResolverService tenantResolverService;
@@ -40,6 +40,11 @@ class TenantResolverServiceTest {
@Mock
private MultitenancyWithSingleDomainTenantResolver multitenancyWithSingleDomainTenantResolver;
+ @BeforeEach
+ public void setUp() {
+ token = Mockito.mock(KeycloakAuthenticationToken.class, Mockito.RETURNS_DEEP_STUBS);
+ }
+
@Test
void resolve_Should_ResolveFromAccessTokenForAuthenticatedUser_And_PassValidation() {
// given
diff --git a/src/test/java/de/caritas/cob/userservice/api/testConfig/ApiControllerTestConfig.java b/src/test/java/de/caritas/cob/userservice/api/testConfig/ApiControllerTestConfig.java
index 47e3bbc45..2c60193ae 100644
--- a/src/test/java/de/caritas/cob/userservice/api/testConfig/ApiControllerTestConfig.java
+++ b/src/test/java/de/caritas/cob/userservice/api/testConfig/ApiControllerTestConfig.java
@@ -16,7 +16,7 @@ public class ApiControllerTestConfig {
@Primary
AgencyServiceApiClientConfig agencyServiceApiClientConfig() {
return new AgencyServiceApiClientConfig() {
- @Override
+
public AgencyControllerApi agencyControllerApi(
de.caritas.cob.userservice.agencyserivce.generated.ApiClient agencyServiceApiClient) {
return new TestAgencyControllerApi(agencyServiceApiClient);