From ee5cb1ff53eba185998580722267d48f1ade6ac3 Mon Sep 17 00:00:00 2001 From: zhiyaoPCCW Date: Tue, 19 Nov 2024 15:26:47 +0800 Subject: [PATCH] improvement on sync kraken version --- .../operator/sync/service/PushKrakenVersionService.java | 5 ++--- .../operator/sync/service/PushKrakenVersionServiceTest.java | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kraken-java-sdk/kraken-java-sdk-sync/src/main/java/com/consoleconnect/kraken/operator/sync/service/PushKrakenVersionService.java b/kraken-java-sdk/kraken-java-sdk-sync/src/main/java/com/consoleconnect/kraken/operator/sync/service/PushKrakenVersionService.java index 4e3227e4..9e06658a 100644 --- a/kraken-java-sdk/kraken-java-sdk-sync/src/main/java/com/consoleconnect/kraken/operator/sync/service/PushKrakenVersionService.java +++ b/kraken-java-sdk/kraken-java-sdk-sync/src/main/java/com/consoleconnect/kraken/operator/sync/service/PushKrakenVersionService.java @@ -5,7 +5,6 @@ import com.consoleconnect.kraken.operator.core.enums.MgmtEventType; import com.consoleconnect.kraken.operator.core.repo.MgmtEventRepository; import com.consoleconnect.kraken.operator.core.repo.SystemInfoRepository; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -29,8 +28,8 @@ public void runIt() { .ifPresent( systemInfoEntity -> { Page mgmtEventEntities = - mgmtEventRepository.findByEventTypeInAndStatus( - List.of(MgmtEventType.CLIENT_SYSTEM_INFO.name()), null, Pageable.ofSize(1)); + mgmtEventRepository.search( + MgmtEventType.CLIENT_SYSTEM_INFO.name(), null, Pageable.ofSize(1)); if (CollectionUtils.isEmpty(mgmtEventEntities.getContent())) { MgmtEventEntity entity = new MgmtEventEntity(); entity.setStatus(EventStatusType.WAIT_TO_SEND.name()); diff --git a/kraken-java-sdk/kraken-java-sdk-sync/src/test/java/com/consoleconnect/kraken/operator/sync/service/PushKrakenVersionServiceTest.java b/kraken-java-sdk/kraken-java-sdk-sync/src/test/java/com/consoleconnect/kraken/operator/sync/service/PushKrakenVersionServiceTest.java index 622123a5..30f44f1c 100644 --- a/kraken-java-sdk/kraken-java-sdk-sync/src/test/java/com/consoleconnect/kraken/operator/sync/service/PushKrakenVersionServiceTest.java +++ b/kraken-java-sdk/kraken-java-sdk-sync/src/test/java/com/consoleconnect/kraken/operator/sync/service/PushKrakenVersionServiceTest.java @@ -42,6 +42,9 @@ void givenSystemInfoEvent_whenRun_thenPushSuccessfully() { systemInfoRepository.save(entity); // when pushKrakenVersionService.runIt(); + entity.setStageAppVersion("2.0.0"); + systemInfoRepository.save(entity); + pushKrakenVersionService.runIt(); // then Page eventEntities = mgmtEventRepository.findByEventTypeInAndStatus(