From ca2ccf524b48328608ed8daabcd8bff812273e3a Mon Sep 17 00:00:00 2001 From: siarhei_hrabko Date: Thu, 22 Aug 2024 17:45:17 +0300 Subject: [PATCH] EPMRPP-90911 make integration search case-insensitive --- .../ta/reportportal/dao/IntegrationRepository.java | 4 ++-- .../ta/reportportal/dao/IntegrationRepositoryTest.java | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/epam/ta/reportportal/dao/IntegrationRepository.java b/src/main/java/com/epam/ta/reportportal/dao/IntegrationRepository.java index 27ffe6554..585623165 100644 --- a/src/main/java/com/epam/ta/reportportal/dao/IntegrationRepository.java +++ b/src/main/java/com/epam/ta/reportportal/dao/IntegrationRepository.java @@ -32,9 +32,9 @@ public interface IntegrationRepository extends ReportPortalRepository, IntegrationRepositoryCustom { - boolean existsByNameAndTypeIdAndProjectIdIsNull(String name, Long typeId); + boolean existsByNameIgnoreCaseAndTypeIdAndProjectIdIsNull(String name, Long typeId); - boolean existsByNameAndTypeIdAndProjectId(String name, Long typeId, Long projectId); + boolean existsByNameIgnoreCaseAndTypeIdAndProjectId(String name, Long typeId, Long projectId); /** * Retrieve integration by ID and project ID diff --git a/src/test/java/com/epam/ta/reportportal/dao/IntegrationRepositoryTest.java b/src/test/java/com/epam/ta/reportportal/dao/IntegrationRepositoryTest.java index ecad47f5f..9a37e5819 100644 --- a/src/test/java/com/epam/ta/reportportal/dao/IntegrationRepositoryTest.java +++ b/src/test/java/com/epam/ta/reportportal/dao/IntegrationRepositoryTest.java @@ -164,25 +164,27 @@ void findAllGlobal() { @Test void existsByNameTypePositive() { - boolean exists = integrationRepository.existsByNameAndTypeIdAndProjectIdIsNull("jira", 6L); + boolean exists = integrationRepository.existsByNameIgnoreCaseAndTypeIdAndProjectIdIsNull("jira", 6L); assertTrue(exists); } @Test void existsByNameTypeNegative() { - boolean exists = integrationRepository.existsByNameAndTypeIdAndProjectIdIsNull("jira1", 4L); + boolean exists = integrationRepository.existsByNameIgnoreCaseAndTypeIdAndProjectIdIsNull("jira1", 4L); assertFalse(exists); } @Test void existsByNameTypeProjectIdPositive() { - boolean exists = integrationRepository.existsByNameAndTypeIdAndProjectId("jira1", 6L, 1L); + boolean exists = integrationRepository.existsByNameIgnoreCaseAndTypeIdAndProjectId("jira1", 6L, 1L); + assertTrue(exists); + exists = integrationRepository.existsByNameIgnoreCaseAndTypeIdAndProjectId("JiRa1", 6L, 1L); assertTrue(exists); } @Test void existsByNameTypeProjectIdNegative() { - boolean exists = integrationRepository.existsByNameAndTypeIdAndProjectId("jira", 6L, 2L); + boolean exists = integrationRepository.existsByNameIgnoreCaseAndTypeIdAndProjectId("jira", 6L, 2L); assertFalse(exists); }