From 64d5cba3dcd497ad7c013963095a5a80b4e9ab0a Mon Sep 17 00:00:00 2001 From: AnurosePrakash Date: Fri, 26 May 2023 13:28:50 +0200 Subject: [PATCH 1/7] feat: Adding Transfer History Page Model(WIP) --- .../api/ui/model/TransferHistoryEntry.java | 42 +++++++++++++++++++ ...rHistoryEntryContractAgreementDetails.java | 31 ++++++++++++++ .../api/ui/model/TransferHistoryPage.java | 24 +++++++++++ 3 files changed, 97 insertions(+) create mode 100644 extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java create mode 100644 extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java create mode 100644 extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryPage.java diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java new file mode 100644 index 000000000..90b46851c --- /dev/null +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022 sovity GmbH + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + * + * Contributors: + * sovity GmbH - initial API and implementation + * + */ + +package de.sovity.edc.ext.wrapper.api.ui.model; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.OffsetDateTime; + +@Data +@Schema(description = "Transfer History Entry for Transfer History Page") +public class TransferHistoryEntry { + @Schema(description = "Transfer Process ID", requiredMode = Schema.RequiredMode.REQUIRED) + private String transferProcessId; + + @Schema(description = "Contract Agreement Details of Transfer Entry", requiredMode = Schema.RequiredMode.REQUIRED) + private TransferHistoryEntryContractAgreementDetails contractAgreementDetails; + + @Schema(description = "Created Date", requiredMode = Schema.RequiredMode.REQUIRED) + private OffsetDateTime createdDate; + + @Schema(description = "Last Change Date", requiredMode = Schema.RequiredMode.REQUIRED) + private OffsetDateTime lastUpdatedDate; + + @Schema(description = "Transfer History State", requiredMode = Schema.RequiredMode.REQUIRED) + private TransferProcessState state; + + @Schema(description = "Error Message") + private String errorMessage; +} diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java new file mode 100644 index 000000000..f2bfd3a26 --- /dev/null +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java @@ -0,0 +1,31 @@ +package de.sovity.edc.ext.wrapper.api.ui.model; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.OffsetDateTime; + +@Data +public class TransferHistoryEntryContractAgreementDetails { + + @Schema(description = "Contract Agreements Start Date", requiredMode = Schema.RequiredMode.REQUIRED) + private OffsetDateTime contractStartDate; + + @Schema(description = "Contract Agreements End Date", requiredMode = Schema.RequiredMode.REQUIRED) + private OffsetDateTime contractEndDate; + + @Schema(description = "Incoming vs Outgoing", requiredMode = Schema.RequiredMode.REQUIRED) + private ContractAgreementDirection direction; + + @Schema(description = "Other Connector's Endpoint", requiredMode = Schema.RequiredMode.REQUIRED) + private String counterPartyAddress; + + @Schema(description = "Other Connector's ID", requiredMode = Schema.RequiredMode.REQUIRED) + private String counterPartyId; + + @Schema(description = "Asset Name", requiredMode = Schema.RequiredMode.REQUIRED) + private String assetName; + + @Schema(description = "Contract Policy Name", requiredMode = Schema.RequiredMode.REQUIRED) + private String contractPolicyName; +} diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryPage.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryPage.java new file mode 100644 index 000000000..17ca701a2 --- /dev/null +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryPage.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022 sovity GmbH + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + * + * Contributors: + * sovity GmbH - initial API and implementation + * + */ + +package de.sovity.edc.ext.wrapper.api.ui.model; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class TransferHistoryPage { + //private List +} From bfc00ad42158f86f8efa9248057bc357ee5d9a84 Mon Sep 17 00:00:00 2001 From: AnurosePrakash Date: Tue, 30 May 2023 16:38:09 +0200 Subject: [PATCH 2/7] feat: Adding Transfer History Page Model --- .../ui/model/DataDestinationProperties.java | 31 +++++++++++++++++++ .../api/ui/model/TransferHistoryEntry.java | 6 ++++ ...rHistoryEntryContractAgreementDetails.java | 5 +-- .../api/ui/model/TransferHistoryPage.java | 6 +++- 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/DataDestinationProperties.java diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/DataDestinationProperties.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/DataDestinationProperties.java new file mode 100644 index 000000000..a0a1f7862 --- /dev/null +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/DataDestinationProperties.java @@ -0,0 +1,31 @@ +package de.sovity.edc.ext.wrapper.api.ui.model; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@Schema(description = "Data Destination Properties of Data Transfer") +public class DataDestinationProperties { + + @Schema(description = "Base Url", requiredMode = Schema.RequiredMode.REQUIRED) + private String baseUrl; + + @Schema(description = "EDC Receiver HTTP Dynamic Auth Code", requiredMode = Schema.RequiredMode.REQUIRED) + private String edcReceiverHttpDynamicAuthCode; + + @Schema(description = "EDC Receiver HTTP Dynamic Endpoint", requiredMode = Schema.RequiredMode.REQUIRED) + private String edcReceiverHttpDynamicEndpoint; + + @Schema(description = "EDC Receiver HTTP Dynamic Auth Key", requiredMode = Schema.RequiredMode.REQUIRED) + private String edcReceiverHttpDynamicAuthKey; + + @Schema(description = "Method Name", requiredMode = Schema.RequiredMode.REQUIRED) + private String method; + + @Schema(description = "EDC Receiver HTTP Endpoint", requiredMode = Schema.RequiredMode.REQUIRED) + private String receiverHttpEndpoint; + + @Schema(description = "Method Type", requiredMode = Schema.RequiredMode.REQUIRED) + private String type; + +} diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java index 90b46851c..81373d1e9 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java @@ -25,6 +25,9 @@ public class TransferHistoryEntry { @Schema(description = "Transfer Process ID", requiredMode = Schema.RequiredMode.REQUIRED) private String transferProcessId; + @Schema(description = "connector Name", requiredMode = Schema.RequiredMode.REQUIRED) + private String connectorName; + @Schema(description = "Contract Agreement Details of Transfer Entry", requiredMode = Schema.RequiredMode.REQUIRED) private TransferHistoryEntryContractAgreementDetails contractAgreementDetails; @@ -39,4 +42,7 @@ public class TransferHistoryEntry { @Schema(description = "Error Message") private String errorMessage; + + @Schema(description = "Data Destination Properties of Transfer Entry") + private DataDestinationProperties dataDestinationProperties; } diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java index f2bfd3a26..dc8d9c8b8 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java @@ -8,6 +8,9 @@ @Data public class TransferHistoryEntryContractAgreementDetails { + @Schema(description = "Contract Agreement ID", requiredMode = Schema.RequiredMode.REQUIRED) + private String contractAgreementId; + @Schema(description = "Contract Agreements Start Date", requiredMode = Schema.RequiredMode.REQUIRED) private OffsetDateTime contractStartDate; @@ -26,6 +29,4 @@ public class TransferHistoryEntryContractAgreementDetails { @Schema(description = "Asset Name", requiredMode = Schema.RequiredMode.REQUIRED) private String assetName; - @Schema(description = "Contract Policy Name", requiredMode = Schema.RequiredMode.REQUIRED) - private String contractPolicyName; } diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryPage.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryPage.java index 17ca701a2..cfe921976 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryPage.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryPage.java @@ -14,11 +14,15 @@ package de.sovity.edc.ext.wrapper.api.ui.model; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Data; +import java.util.List; + @Data @AllArgsConstructor public class TransferHistoryPage { - //private List + @Schema(description = "Transfer History Page Entries", requiredMode = Schema.RequiredMode.REQUIRED) + private List transferEntries; } From aaee0e565a328ed3619bd366d6a6e3553e56cb91 Mon Sep 17 00:00:00 2001 From: AnurosePrakash Date: Wed, 31 May 2023 12:39:26 +0200 Subject: [PATCH 3/7] feat: updated data model of transfer entry page --- .../ui/model/DataDestinationProperties.java | 31 ------------------- .../api/ui/model/TransferHistoryEntry.java | 24 +++++++++----- ...rHistoryEntryContractAgreementDetails.java | 20 ------------ 3 files changed, 17 insertions(+), 58 deletions(-) delete mode 100644 extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/DataDestinationProperties.java diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/DataDestinationProperties.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/DataDestinationProperties.java deleted file mode 100644 index a0a1f7862..000000000 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/DataDestinationProperties.java +++ /dev/null @@ -1,31 +0,0 @@ -package de.sovity.edc.ext.wrapper.api.ui.model; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -@Data -@Schema(description = "Data Destination Properties of Data Transfer") -public class DataDestinationProperties { - - @Schema(description = "Base Url", requiredMode = Schema.RequiredMode.REQUIRED) - private String baseUrl; - - @Schema(description = "EDC Receiver HTTP Dynamic Auth Code", requiredMode = Schema.RequiredMode.REQUIRED) - private String edcReceiverHttpDynamicAuthCode; - - @Schema(description = "EDC Receiver HTTP Dynamic Endpoint", requiredMode = Schema.RequiredMode.REQUIRED) - private String edcReceiverHttpDynamicEndpoint; - - @Schema(description = "EDC Receiver HTTP Dynamic Auth Key", requiredMode = Schema.RequiredMode.REQUIRED) - private String edcReceiverHttpDynamicAuthKey; - - @Schema(description = "Method Name", requiredMode = Schema.RequiredMode.REQUIRED) - private String method; - - @Schema(description = "EDC Receiver HTTP Endpoint", requiredMode = Schema.RequiredMode.REQUIRED) - private String receiverHttpEndpoint; - - @Schema(description = "Method Type", requiredMode = Schema.RequiredMode.REQUIRED) - private String type; - -} diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java index 81373d1e9..b7045a79b 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java @@ -25,11 +25,6 @@ public class TransferHistoryEntry { @Schema(description = "Transfer Process ID", requiredMode = Schema.RequiredMode.REQUIRED) private String transferProcessId; - @Schema(description = "connector Name", requiredMode = Schema.RequiredMode.REQUIRED) - private String connectorName; - - @Schema(description = "Contract Agreement Details of Transfer Entry", requiredMode = Schema.RequiredMode.REQUIRED) - private TransferHistoryEntryContractAgreementDetails contractAgreementDetails; @Schema(description = "Created Date", requiredMode = Schema.RequiredMode.REQUIRED) private OffsetDateTime createdDate; @@ -40,9 +35,24 @@ public class TransferHistoryEntry { @Schema(description = "Transfer History State", requiredMode = Schema.RequiredMode.REQUIRED) private TransferProcessState state; + @Schema(description = "Contract Agreement ID", requiredMode = Schema.RequiredMode.REQUIRED) + private String contractAgreementId; + + @Schema(description = "Incoming vs Outgoing", requiredMode = Schema.RequiredMode.REQUIRED) + private ContractAgreementDirection direction; + + @Schema(description = "Other Connector's Endpoint", requiredMode = Schema.RequiredMode.REQUIRED) + private String counterPartyAddress; + + + @Schema(description = "Asset Name", requiredMode = Schema.RequiredMode.REQUIRED) + private String assetName; + + @Schema(description = "Asset ID", requiredMode = Schema.RequiredMode.REQUIRED) + private String assetId; + @Schema(description = "Error Message") private String errorMessage; - @Schema(description = "Data Destination Properties of Transfer Entry") - private DataDestinationProperties dataDestinationProperties; + } diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java index dc8d9c8b8..89ba560f2 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java @@ -8,25 +8,5 @@ @Data public class TransferHistoryEntryContractAgreementDetails { - @Schema(description = "Contract Agreement ID", requiredMode = Schema.RequiredMode.REQUIRED) - private String contractAgreementId; - - @Schema(description = "Contract Agreements Start Date", requiredMode = Schema.RequiredMode.REQUIRED) - private OffsetDateTime contractStartDate; - - @Schema(description = "Contract Agreements End Date", requiredMode = Schema.RequiredMode.REQUIRED) - private OffsetDateTime contractEndDate; - - @Schema(description = "Incoming vs Outgoing", requiredMode = Schema.RequiredMode.REQUIRED) - private ContractAgreementDirection direction; - - @Schema(description = "Other Connector's Endpoint", requiredMode = Schema.RequiredMode.REQUIRED) - private String counterPartyAddress; - - @Schema(description = "Other Connector's ID", requiredMode = Schema.RequiredMode.REQUIRED) - private String counterPartyId; - - @Schema(description = "Asset Name", requiredMode = Schema.RequiredMode.REQUIRED) - private String assetName; } From 83ccf523db1d785b151df9b1df462300b9b90d24 Mon Sep 17 00:00:00 2001 From: AnurosePrakash Date: Wed, 31 May 2023 13:05:47 +0200 Subject: [PATCH 4/7] chore: renamed data model of transfer entry page --- .../wrapper/api/ui/model/TransferHistoryEntry.java | 5 +---- ...TransferHistoryEntryContractAgreementDetails.java | 12 ------------ 2 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java index b7045a79b..c36de171c 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntry.java @@ -25,7 +25,6 @@ public class TransferHistoryEntry { @Schema(description = "Transfer Process ID", requiredMode = Schema.RequiredMode.REQUIRED) private String transferProcessId; - @Schema(description = "Created Date", requiredMode = Schema.RequiredMode.REQUIRED) private OffsetDateTime createdDate; @@ -42,8 +41,7 @@ public class TransferHistoryEntry { private ContractAgreementDirection direction; @Schema(description = "Other Connector's Endpoint", requiredMode = Schema.RequiredMode.REQUIRED) - private String counterPartyAddress; - + private String counterPartyConnectorEndpoint; @Schema(description = "Asset Name", requiredMode = Schema.RequiredMode.REQUIRED) private String assetName; @@ -54,5 +52,4 @@ public class TransferHistoryEntry { @Schema(description = "Error Message") private String errorMessage; - } diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java deleted file mode 100644 index 89ba560f2..000000000 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/model/TransferHistoryEntryContractAgreementDetails.java +++ /dev/null @@ -1,12 +0,0 @@ -package de.sovity.edc.ext.wrapper.api.ui.model; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.time.OffsetDateTime; - -@Data -public class TransferHistoryEntryContractAgreementDetails { - - -} From 5b12de4cb95e0d8a57f6c88cb8d153a17e2da7ed Mon Sep 17 00:00:00 2001 From: AnurosePrakash <108627760+AnurosePrakash@users.noreply.github.com> Date: Wed, 31 May 2023 12:32:16 +0200 Subject: [PATCH 5/7] feat: build dates for LastCommitInfoExtension (#357) * feat: Reworking Last commit Info Extension * chore: make pipeline set both jar and env build date and last commit info, fix wording * Updated CHANGELOG.md --------- Co-authored-by: Richard Treier --- .../build-and-publish-connector-images.yml | 5 +- .../build-and-publish-maven-artifacts.yml | 5 +- CHANGELOG.md | 4 ++ connector/Dockerfile | 5 +- extensions/last-commit-info/build.gradle.kts | 6 ++ .../sovity/edc/extension/LastCommitInfo.java | 27 ++++++++ .../extension/LastCommitInfoController.java | 3 +- .../edc/extension/LastCommitInfoService.java | 48 +++++++++----- .../src/main/resources/jar-build-date.txt | 1 + .../controller/LastCommitInfoEnvTest.java | 42 ------------ .../controller/LastCommitInfoJarTest.java | 43 ------------ .../controller/LastCommitInfoTest.java | 65 +++++++++++++++++++ .../version/controller/TestUtils.java | 34 +--------- .../src/test/resources/jar-build-date.txt | 1 + .../test/resources/jar-last-commit-info.txt | 1 + 15 files changed, 150 insertions(+), 140 deletions(-) create mode 100644 extensions/last-commit-info/src/main/java/de/sovity/edc/extension/LastCommitInfo.java create mode 100644 extensions/last-commit-info/src/main/resources/jar-build-date.txt delete mode 100644 extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/LastCommitInfoEnvTest.java delete mode 100644 extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/LastCommitInfoJarTest.java create mode 100644 extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/LastCommitInfoTest.java create mode 100644 extensions/last-commit-info/src/test/resources/jar-build-date.txt create mode 100644 extensions/last-commit-info/src/test/resources/jar-last-commit-info.txt diff --git a/.github/workflows/build-and-publish-connector-images.yml b/.github/workflows/build-and-publish-connector-images.yml index 763aed12b..5bac2180a 100644 --- a/.github/workflows/build-and-publish-connector-images.yml +++ b/.github/workflows/build-and-publish-connector-images.yml @@ -47,7 +47,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Store last commit's author, message and SHA + - name: Store last commit info and build date id: last-commit-information run: | echo "Saving local commit details." @@ -56,6 +56,8 @@ jobs: echo "$LAST_COMMIT_INFO" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV + echo "BUILD_DATE=$(date --utc +%FT%TZ)" >> $GITHUB_ENV + - name: Log in to the Container registry uses: docker/login-action@v2 with: @@ -92,3 +94,4 @@ jobs: build-args: | BUILD_ARGS=${{ matrix.imageVariants.buildArgs }} EDC_LAST_COMMIT_INFO_ARG="${{ env.LAST_COMMIT_INFO }}" + EDC_BUILD_DATE_ARG="${{ env.BUILD_DATE }}" diff --git a/.github/workflows/build-and-publish-maven-artifacts.yml b/.github/workflows/build-and-publish-maven-artifacts.yml index b9482611e..eff7ca2b4 100644 --- a/.github/workflows/build-and-publish-maven-artifacts.yml +++ b/.github/workflows/build-and-publish-maven-artifacts.yml @@ -32,11 +32,12 @@ jobs: server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file - - name: Store last commit's author, message and SHA + - name: Store last commit info and build date run: | echo "Saving local commit details in src/assets/version.txt" echo $(ls) - git log -1 > extensions/last-commit-info/src/main/resources/version.txt + git log -1 > extensions/last-commit-info/src/main/resources/jar-last-commit-info.txt + echo $(date --utc +%FT%TZ) > extensions/last-commit-info/src/main/resources/jar-build-date.txt - name: Override artifact versions in release tags. run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index f79297558..1fe24d838 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## [x.x.x] - UNRELEASED +### Minor Changes + +- Added build dates to Last Commit Info Extension + ### Patch Changes - Fix API Wrapper Broker Server API Spec not showing in client libraries. diff --git a/connector/Dockerfile b/connector/Dockerfile index 7dc5830a1..eee98cd31 100644 --- a/connector/Dockerfile +++ b/connector/Dockerfile @@ -9,11 +9,12 @@ RUN --mount=type=cache,target=/home/gradle/.gradle/caches gradle build --no-daem # -buster is required to have apt available FROM openjdk:17-slim-buster -# Github pipeline sets this to the last commit information. -# This build arg is later converted to an ENV variable, since the github action didn't support ENVs we used build args. ARG EDC_LAST_COMMIT_INFO_ARG="The docker container was built outside of github actions and you didn't provide the build arg EDC_LAST_COMMIT_INFO_ARG, so there's no last commit info." ENV EDC_LAST_COMMIT_INFO=$EDC_LAST_COMMIT_INFO_ARG +ARG EDC_BUILD_DATE_ARG="The docker container was built outside of github actions and you didn't provide the build arg EDC_BUILD_DATE_ARG, so there's no build date." +ENV EDC_BUILD_DATE=$EDC_BUILD_DATE_ARG + # Optional JVM arguments, such as memory settings ARG JVM_ARGS="" diff --git a/extensions/last-commit-info/build.gradle.kts b/extensions/last-commit-info/build.gradle.kts index 9a80c0001..d07978cf6 100644 --- a/extensions/last-commit-info/build.gradle.kts +++ b/extensions/last-commit-info/build.gradle.kts @@ -8,6 +8,9 @@ plugins { } dependencies { + annotationProcessor("org.projectlombok:lombok:1.18.28") + compileOnly("org.projectlombok:lombok:1.18.28") + api("${edcGroup}:core-spi:${edcVersion}") api("${edcGroup}:control-plane-spi:${edcVersion}") implementation("${edcGroup}:api-core:${edcVersion}") @@ -16,6 +19,9 @@ dependencies { implementation("jakarta.ws.rs:jakarta.ws.rs-api:3.1.0") implementation("jakarta.validation:jakarta.validation-api:3.0.2") + testAnnotationProcessor("org.projectlombok:lombok:1.18.28") + testCompileOnly("org.projectlombok:lombok:1.18.28") + testImplementation("${edcGroup}:control-plane-core:${edcVersion}") testImplementation("${edcGroup}:junit:${edcVersion}") testImplementation("${edcGroup}:http:${edcVersion}") diff --git a/extensions/last-commit-info/src/main/java/de/sovity/edc/extension/LastCommitInfo.java b/extensions/last-commit-info/src/main/java/de/sovity/edc/extension/LastCommitInfo.java new file mode 100644 index 000000000..99e52ea91 --- /dev/null +++ b/extensions/last-commit-info/src/main/java/de/sovity/edc/extension/LastCommitInfo.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 sovity GmbH + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + * + * Contributors: + * sovity GmbH - initial API and implementation + * + */ + +package de.sovity.edc.extension; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class LastCommitInfo { + private String envLastCommitInfo; + private String envBuildDate; + private String jarLastCommitInfo; + private String jarBuildDate; +} diff --git a/extensions/last-commit-info/src/main/java/de/sovity/edc/extension/LastCommitInfoController.java b/extensions/last-commit-info/src/main/java/de/sovity/edc/extension/LastCommitInfoController.java index 1d48f0bce..9f7994694 100644 --- a/extensions/last-commit-info/src/main/java/de/sovity/edc/extension/LastCommitInfoController.java +++ b/extensions/last-commit-info/src/main/java/de/sovity/edc/extension/LastCommitInfoController.java @@ -29,7 +29,8 @@ public LastCommitInfoController(LastCommitInfoService lastCommitInfoService) { } @GET - public String getLastCommitInfo() { + @Produces(MediaType.APPLICATION_JSON) + public LastCommitInfo getLastCommitInfo() { return lastCommitInfoService.getLastCommitInfo(); } } diff --git a/extensions/last-commit-info/src/main/java/de/sovity/edc/extension/LastCommitInfoService.java b/extensions/last-commit-info/src/main/java/de/sovity/edc/extension/LastCommitInfoService.java index 461b0a8df..e39f9363b 100644 --- a/extensions/last-commit-info/src/main/java/de/sovity/edc/extension/LastCommitInfoService.java +++ b/extensions/last-commit-info/src/main/java/de/sovity/edc/extension/LastCommitInfoService.java @@ -28,30 +28,42 @@ public LastCommitInfoService(ServiceExtensionContext context) { this.context = context; } - public String getLastCommitInfo() { - var result = ""; - - if (!getEnvLastCommitInfo().equals("")) { - result += "Env Last Commit Info: \n"; - result += getEnvLastCommitInfo() + "\n"; - } - - if (!getEnvLastCommitInfo().equals(getJarLastCommitInfo())) { - result += "Jar Last Commit Info: \n"; - result += getJarLastCommitInfo(); - } - - return result; + private String readFileInCurrentClassClasspath(String path) { + var classLoader = LastCommitInfoService.class.getClassLoader(); + var is = classLoader.getResourceAsStream(path); + var scanner = new Scanner(Objects.requireNonNull(is), StandardCharsets.UTF_8).useDelimiter("\\A"); + return scanner.hasNext() ? scanner.next() : ""; } + public String getJarLastCommitInfo() { - var classLoader = Thread.currentThread().getContextClassLoader(); - var is = classLoader.getResourceAsStream("jar-last-commit-info.txt"); - var scanner = new Scanner(Objects.requireNonNull(is), StandardCharsets.UTF_8).useDelimiter("\\A"); - return scanner.hasNext() ? scanner.next() : ""; + return this.readFileInCurrentClassClasspath("jar-last-commit-info.txt").trim(); } public String getEnvLastCommitInfo() { return context.getSetting("edc.last.commit.info", ""); } + + public String getJarBuildDate() { + return readFileInCurrentClassClasspath("jar-build-date.txt").trim(); + } + + public String getEnvBuildDate() { + return context.getSetting("edc.build.date", ""); + } + + public LastCommitInfo getLastCommitInfo() { + var lastCommitInfo = new LastCommitInfo(); + lastCommitInfo.setEnvLastCommitInfo(getEnvLastCommitInfo()); + lastCommitInfo.setJarLastCommitInfo(getJarLastCommitInfo()); + + lastCommitInfo.setJarBuildDate(getJarBuildDate()); + lastCommitInfo.setEnvBuildDate(getEnvBuildDate()); + return lastCommitInfo; + } } + + + + + diff --git a/extensions/last-commit-info/src/main/resources/jar-build-date.txt b/extensions/last-commit-info/src/main/resources/jar-build-date.txt new file mode 100644 index 000000000..e3a56bf7d --- /dev/null +++ b/extensions/last-commit-info/src/main/resources/jar-build-date.txt @@ -0,0 +1 @@ +The GitHub Pipeline will replace this file during build time with the current date. diff --git a/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/LastCommitInfoEnvTest.java b/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/LastCommitInfoEnvTest.java deleted file mode 100644 index c3f59a247..000000000 --- a/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/LastCommitInfoEnvTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2023 sovity GmbH - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - * - * Contributors: - * sovity GmbH - initial API and implementation - * - */ - -package de.sovity.edc.extension.version.controller; - -import org.eclipse.edc.junit.annotations.ApiTest; -import org.eclipse.edc.junit.extensions.EdcExtension; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; - -import static de.sovity.edc.extension.version.controller.TestUtils.createConfiguration; -import static de.sovity.edc.extension.version.controller.TestUtils.mockRequest; -import static org.hamcrest.Matchers.containsStringIgnoringCase; - -@ApiTest -@ExtendWith(EdcExtension.class) -class LastCommitInfoEnvTest { - - @BeforeEach - void setUp(EdcExtension extension) { - extension.setConfiguration(createConfiguration("env")); - } - - @Test - void testEnvAndJar() { - var request = mockRequest(); - request.assertThat().body(containsStringIgnoringCase("pipeline")); - request.assertThat().body(containsStringIgnoringCase("env")); - } -} diff --git a/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/LastCommitInfoJarTest.java b/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/LastCommitInfoJarTest.java deleted file mode 100644 index 65f87062e..000000000 --- a/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/LastCommitInfoJarTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2023 sovity GmbH - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - * - * Contributors: - * sovity GmbH - initial API and implementation - * - */ - -package de.sovity.edc.extension.version.controller; - -import org.eclipse.edc.junit.annotations.ApiTest; -import org.eclipse.edc.junit.extensions.EdcExtension; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; - -import static de.sovity.edc.extension.version.controller.TestUtils.createConfiguration; -import static de.sovity.edc.extension.version.controller.TestUtils.mockRequest; -import static org.hamcrest.Matchers.containsStringIgnoringCase; -import static org.hamcrest.Matchers.not; - -@ApiTest -@ExtendWith(EdcExtension.class) -class LastCommitInfoJarTest { - - @BeforeEach - void setUp(EdcExtension extension) { - extension.setConfiguration(createConfiguration("")); - } - - @Test - void testOnlyJar() { - var request = mockRequest(); - request.assertThat().body(containsStringIgnoringCase("pipeline")); - request.assertThat().body(not(containsStringIgnoringCase("env"))); - } -} diff --git a/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/LastCommitInfoTest.java b/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/LastCommitInfoTest.java new file mode 100644 index 000000000..242e83794 --- /dev/null +++ b/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/LastCommitInfoTest.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2023 sovity GmbH + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + * + * Contributors: + * sovity GmbH - initial API and implementation + * + */ + +package de.sovity.edc.extension.version.controller; + +import io.restassured.http.ContentType; +import org.eclipse.edc.junit.annotations.ApiTest; +import org.eclipse.edc.junit.extensions.EdcExtension; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +import java.util.Map; + +import static io.restassured.RestAssured.given; +import static org.eclipse.edc.junit.testfixtures.TestUtils.getFreePort; +import static org.hamcrest.Matchers.equalTo; + +@ApiTest +@ExtendWith(EdcExtension.class) +class LastCommitInfoTest { + + @BeforeEach + void setUp(EdcExtension extension) { + extension.setConfiguration(Map.of( + "web.http.port", String.valueOf(getFreePort()), + "web.http.path", "/api", + "web.http.management.port", String.valueOf(TestUtils.DATA_PORT), + "web.http.management.path", "/api/v1/data", + "edc.api.auth.key", TestUtils.AUTH_KEY, + "edc.last.commit.info", "test env commit message", + "edc.build.date", "2023-05-08T15:30:00Z")); + } + + @Test + void testEnvAndJar() { + var request = given() + .baseUri("http://localhost:" + TestUtils.DATA_PORT) + .basePath("/api/v1/data") + .header("x-api-key", TestUtils.AUTH_KEY) + .when() + .contentType(ContentType.JSON) + .get("/last-commit-info") + .then() + .statusCode(200) + .contentType(ContentType.JSON); + + request.assertThat().body("envLastCommitInfo", equalTo("test env commit message")) + .body("envBuildDate", equalTo("2023-05-08T15:30:00Z")) + .body("jarLastCommitInfo", equalTo("test jar commit message")) + .body("jarBuildDate", equalTo("2023-05-09T15:30:00Z")); + + } +} diff --git a/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/TestUtils.java b/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/TestUtils.java index 8ceecd847..92ccecf04 100644 --- a/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/TestUtils.java +++ b/extensions/last-commit-info/src/test/java/de/sovity/edc/extension/version/controller/TestUtils.java @@ -14,41 +14,13 @@ package de.sovity.edc.extension.version.controller; -import io.restassured.http.ContentType; -import io.restassured.response.ValidatableResponse; -import org.jetbrains.annotations.NotNull; - -import java.util.Map; - -import static io.restassured.RestAssured.given; import static org.eclipse.edc.junit.testfixtures.TestUtils.getFreePort; + public class TestUtils { - private static final int DATA_PORT = getFreePort(); - private static final String AUTH_KEY = "123456"; + public static final String AUTH_KEY = "123456"; + public static final int DATA_PORT = getFreePort(); - @NotNull - static Map createConfiguration(String commitInfo) { - return Map.of( - "web.http.port", String.valueOf(getFreePort()), - "web.http.path", "/api", - "web.http.management.port", String.valueOf(DATA_PORT), - "web.http.management.path", "/api/v1/data", - "edc.api.auth.key", AUTH_KEY, - "edc.last.commit.info", commitInfo); - } - static ValidatableResponse mockRequest() { - return given() - .baseUri("http://localhost:" + DATA_PORT) - .basePath("/api/v1/data") - .header("x-api-key", AUTH_KEY) - .when() - .contentType(ContentType.TEXT) - .get(String.format("/last-commit-info")) - .then() - .statusCode(200) - .contentType(ContentType.JSON); - } } diff --git a/extensions/last-commit-info/src/test/resources/jar-build-date.txt b/extensions/last-commit-info/src/test/resources/jar-build-date.txt new file mode 100644 index 000000000..3f3faacba --- /dev/null +++ b/extensions/last-commit-info/src/test/resources/jar-build-date.txt @@ -0,0 +1 @@ +2023-05-09T15:30:00Z diff --git a/extensions/last-commit-info/src/test/resources/jar-last-commit-info.txt b/extensions/last-commit-info/src/test/resources/jar-last-commit-info.txt new file mode 100644 index 000000000..1516a70eb --- /dev/null +++ b/extensions/last-commit-info/src/test/resources/jar-last-commit-info.txt @@ -0,0 +1 @@ +test jar commit message From b601d1674309936356a65ce4e32ad3a56536da38 Mon Sep 17 00:00:00 2001 From: AnurosePrakash Date: Wed, 31 May 2023 13:14:35 +0200 Subject: [PATCH 6/7] Updated CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fe24d838..8c3deb2b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Minor Changes - Added build dates to Last Commit Info Extension +- Added Transfer History Page model to API Wrapper ### Patch Changes From e1006187666b08e040ae7b50bcc9bd18aca0aa45 Mon Sep 17 00:00:00 2001 From: AnurosePrakash Date: Wed, 31 May 2023 13:29:51 +0200 Subject: [PATCH 7/7] Updated UiResource to add transferhistorypage endpoint --- .../de/sovity/edc/ext/wrapper/api/ui/UiResource.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/UiResource.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/UiResource.java index d4bdda6e6..6b351c50d 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/UiResource.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/UiResource.java @@ -15,6 +15,7 @@ package de.sovity.edc.ext.wrapper.api.ui; import de.sovity.edc.ext.wrapper.api.ui.model.ContractAgreementPage; +import de.sovity.edc.ext.wrapper.api.ui.model.TransferHistoryPage; import de.sovity.edc.ext.wrapper.api.ui.services.ContractAgreementPageService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -37,4 +38,12 @@ public class UiResource { public ContractAgreementPage contractAgreementEndpoint() { return contractAgreementApiService.contractAgreementPage(); } + + @GET + @Path("pages/transfer-history-page") + @Produces(MediaType.APPLICATION_JSON) + public TransferHistoryPage transferHistoryPageEndpoint() { + // TODO: Implement + throw new IllegalStateException("Not yet implemented"); + } }