From 5a709c169f468cb46915e9b0dd6ba3466f303d4b Mon Sep 17 00:00:00 2001 From: Avgustin Marinov Date: Mon, 9 Dec 2024 17:45:14 +0200 Subject: [PATCH] Make Action active field convertor JPA Vendor portable Signed-off-by: Avgustin Marinov --- .../java/org/eclipse/hawkbit/repository/ActionFields.java | 4 ++-- .../acm/controller/DistributionSetAccessControllerTest.java | 2 +- .../jpa/acm/controller/TargetTypeAccessControllerTest.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/ActionFields.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/ActionFields.java index 3dfabb53b8..55e8f509fd 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/ActionFields.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/ActionFields.java @@ -65,9 +65,9 @@ public String[] possibleValues(final ActionFields e) { private static Object convertStatusValue(final String value) { final String trimmedValue = value.trim(); if (trimmedValue.equalsIgnoreCase(ACTIVE)) { - return 1; + return true; } else if (trimmedValue.equalsIgnoreCase(INACTIVE)) { - return 0; + return false; } else { return null; } diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/acm/controller/DistributionSetAccessControllerTest.java b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/acm/controller/DistributionSetAccessControllerTest.java index 510d9d4e03..002b38b921 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/acm/controller/DistributionSetAccessControllerTest.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/acm/controller/DistributionSetAccessControllerTest.java @@ -207,7 +207,7 @@ void verifyTagFilteringAndManagement() { assertThat(distributionSetManagement.findByTag(Pageable.unpaged(), dsTag.getId()).get().map(Identifiable::getId) .toList()).containsOnly(permitted.getId(), readOnly.getId()); - assertThat(distributionSetManagement.findByRsqlAndTag(Pageable.unpaged(), "id==*", dsTag.getId()).get() + assertThat(distributionSetManagement.findByRsqlAndTag(Pageable.unpaged(), "name==*", dsTag.getId()).get() .map(Identifiable::getId).toList()).containsOnly(permitted.getId(), readOnly.getId()); // verify distributionSetManagement#unassignTag on permitted target diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/acm/controller/TargetTypeAccessControllerTest.java b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/acm/controller/TargetTypeAccessControllerTest.java index e5cb50c5fb..213f08e551 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/acm/controller/TargetTypeAccessControllerTest.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/test/java/org/eclipse/hawkbit/repository/jpa/acm/controller/TargetTypeAccessControllerTest.java @@ -52,7 +52,7 @@ void verifyTargetTypeReadOperations() { .containsOnly(permittedTargetType.getId()); // verify targetTypeManagement#findByRsql - assertThat(targetTypeManagement.findByRsql(Pageable.unpaged(), "id==*").get().map(Identifiable::getId).toList()) + assertThat(targetTypeManagement.findByRsql(Pageable.unpaged(), "name==*").get().map(Identifiable::getId).toList()) .containsOnly(permittedTargetType.getId()); // verify targetTypeManagement#findByName