diff options
author | 2021-07-27 09:14:02 +0200 | |
---|---|---|
committer | 2021-07-28 13:04:28 +0000 | |
commit | 024a5ea23d7f17d182576f0d2b11a019a4e3b8a9 (patch) | |
tree | 2b6aab31b1c0bb599f409c7756d3037d18aa73af /src/main/java/org | |
parent | 5995a778e7a5a7718c480a8099b9c2f47549530d (diff) |
O1 PM Bulk support - Start and End date changes
Issue-ID: INT-1945
Signed-off-by: Stanislav Marszalek <s.marszalek2@partner.samsung.com>
Change-Id: I02d3684c98d563d7f386de2fdf032e930ac44b3f
Diffstat (limited to 'src/main/java/org')
3 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/org/onap/a1pesimulator/data/fileready/FileData.java b/src/main/java/org/onap/a1pesimulator/data/fileready/FileData.java index 7e47897..9eb8c5f 100644 --- a/src/main/java/org/onap/a1pesimulator/data/fileready/FileData.java +++ b/src/main/java/org/onap/a1pesimulator/data/fileready/FileData.java @@ -1,6 +1,7 @@ package org.onap.a1pesimulator.data.fileready; import java.io.File; +import java.time.ZonedDateTime; import lombok.Builder; import lombok.Data; @@ -15,4 +16,6 @@ public class FileData { File pmBulkFile; File archivedPmBulkFile; FileReadyEvent fileReadyEvent; + ZonedDateTime startEventDate; + ZonedDateTime endEventDate; } diff --git a/src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java b/src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java index 644ce3b..bf5b88a 100644 --- a/src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java +++ b/src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java @@ -5,7 +5,9 @@ import static org.onap.a1pesimulator.util.Constants.FILE_READY_CHANGE_IDENTIFIER import static org.onap.a1pesimulator.util.Constants.FILE_READY_CHANGE_TYPE; import java.io.File; +import java.time.Instant; import java.time.ZonedDateTime; +import java.time.temporal.ChronoUnit; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -16,7 +18,6 @@ import org.onap.a1pesimulator.data.fileready.FileReadyEvent; import org.onap.a1pesimulator.data.fileready.NotificationFields; import org.onap.a1pesimulator.data.fileready.NotificationFields.ArrayOfNamedHashMap; import org.onap.a1pesimulator.data.ves.CommonEventHeader; -import org.onap.a1pesimulator.util.RanVesUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -81,8 +82,10 @@ public class FileReadyEventService { */ protected FileData createFileReadyEvent(FileData fileData) { FileReadyEvent event = new FileReadyEvent(); - event.setCommonEventHeader(getCommonHeader()); - RanVesUtils.updateHeader(event); + CommonEventHeader commonEventHeader = getCommonHeader(); + event.setCommonEventHeader(commonEventHeader); + commonEventHeader.setStartEpochMicrosec(ChronoUnit.MICROS.between(Instant.EPOCH, fileData.getStartEventDate())); + commonEventHeader.setLastEpochMicrosec(ChronoUnit.MICROS.between(Instant.EPOCH, fileData.getEndEventDate())); event.setNotificationFields(getNotificationFields(fileData.getArchivedPmBulkFile().getName())); fileData.setFileReadyEvent(event); return fileData; diff --git a/src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java b/src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java index 37b3440..4534b7e 100644 --- a/src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java +++ b/src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java @@ -140,9 +140,11 @@ public class PMBulkFileService { File xmlFile = writeDocumentIntoXmlFile(doc, collectedEvents); + Mono<FileData> justMono = Mono.just(FileData.builder().pmBulkFile(xmlFile).startEventDate(earliestEventTime(collectedEvents)) + .endEventDate(latestEventTime(collectedEvents)).build()); log.trace("Removing all VES events from memory: {}", collectedEvents.size()); collectedEvents.clear(); - return Mono.just(FileData.builder().pmBulkFile(xmlFile).build()); + return justMono; } catch (ParserConfigurationException | TransformerException pce) { log.error("Error occurs while creating PM Bulk File", pce); |