JpaTarget switch to javax.persistence.Convert(er) (#2038)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-11-15 18:02:00 +02:00
committed by GitHub
parent bf1e171523
commit ec6009b268
3 changed files with 34 additions and 10 deletions

View File

@@ -53,6 +53,7 @@ class ActionTest extends AbstractJpaIntegrationTest {
}
@Test
@Description("Tests the action type mapping.")
void testActionTypeConvert() {
final long id = createAction().getId();
for (final ActionType actionType : ActionType.values()) {
@@ -66,6 +67,7 @@ class ActionTest extends AbstractJpaIntegrationTest {
}
@Test
@Description("Tests the status mapping.")
void testStatusConvert() {
final long id = createAction().getId();
for (final Status status : Status.values()) {
@@ -79,6 +81,7 @@ class ActionTest extends AbstractJpaIntegrationTest {
}
@Test
@Description("Tests the action status status mapping.")
void testActionsStatusStatusConvert() {
for (final Status status : Status.values()) {
final long id = createAction().getId();

View File

@@ -76,6 +76,7 @@ import org.eclipse.hawkbit.repository.model.TargetMetadata;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.repository.model.TargetType;
import org.eclipse.hawkbit.repository.model.TargetTypeAssignmentResult;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.repository.rsql.RsqlConfigHolder;
import org.eclipse.hawkbit.repository.test.matcher.Expect;
import org.eclipse.hawkbit.repository.test.matcher.ExpectEvents;
@@ -1208,6 +1209,19 @@ class TargetManagementTest extends AbstractJpaIntegrationTest {
() -> targetManagement.isTargetMatchingQueryAndDSNotAssignedAndCompatibleAndUpdatable(target, 123, "name==*"));
}
@Test
@Description("Test update status convert")
void testUpdateStatusConvert() {
final long id = testdataFactory.createTarget().getId();
for (final TargetUpdateStatus status : TargetUpdateStatus.values()) {
final JpaTarget target = targetRepository.findById(id).orElseThrow(() -> new IllegalStateException("Target not found"));
target.setUpdateStatus(status);
targetRepository.save(target);
assertThat(targetRepository.findById(target.getId()).orElseThrow(() -> new IllegalStateException("Target not found"))
.getUpdateStatus()).isEqualTo(status);
}
}
@Step
private void createAndUpdateTargetWithInvalidDescription(final Target target) {