From 1d7fce222cd0c3dca952a604e996c0e563be69b6 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Mon, 12 Jun 2023 11:17:46 +0200 Subject: [PATCH] feat: upgrade to 0.1.1-SNAPSHOT, fix resulting compile errors --- .github/workflows/deployment-test.yaml | 2 +- .github/workflows/verify.yaml | 1 + build.gradle.kts | 6 ++++++ .../edc/api/cp/adapter/AdapterEdrControllerTest.java | 4 ++-- .../cp/adapter/callback/TransferProcessLocalCallback.java | 8 +++----- .../callback/TransferProcessLocalCallbackTest.java | 6 +++--- .../ProvisionAdditionalHeadersExtensionTest.java | 1 - .../edc/transferprocess/sftp/common/SftpDataAddress.java | 2 +- gradle.properties | 6 +++--- gradle/libs.versions.toml | 2 +- 10 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deployment-test.yaml b/.github/workflows/deployment-test.yaml index 056d835dd..9071de487 100644 --- a/.github/workflows/deployment-test.yaml +++ b/.github/workflows/deployment-test.yaml @@ -108,7 +108,7 @@ jobs: helm install tx-prod charts/tractusx-connector \ -f edc-tests/deployment/src/main/resources/helm/tractusx-connector-test.yaml \ --dependency-update \ - --wait-for-jobs --timeout=120s + --wait-for-jobs --timeout=120s # wait for the pod to become ready kubectl rollout status deployment tx-prod-controlplane diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index 81c62c9f0..9961015b7 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -26,6 +26,7 @@ on: branches: - main - releases + - previews/* tags: - '[0-9]+.[0-9]+.[0-9]+' release: diff --git a/build.gradle.kts b/build.gradle.kts index d7286a4ea..7d01e7b84 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -175,4 +175,10 @@ nexusPublishing { maxRetries.set(120) delayBetween.set(Duration.ofSeconds(10)) } +} + +configurations.all { + // Check for updates every 5 mins + // TODO: REMOVE THIS BEFORE MERGING TO main!!!! + resolutionStrategy.cacheChangingModulesFor(5, TimeUnit.MINUTES) } \ No newline at end of file diff --git a/edc-extensions/control-plane-adapter-api/src/test/java/org/eclipse/tractusx/edc/api/cp/adapter/AdapterEdrControllerTest.java b/edc-extensions/control-plane-adapter-api/src/test/java/org/eclipse/tractusx/edc/api/cp/adapter/AdapterEdrControllerTest.java index a345406b1..d423b7d1c 100644 --- a/edc-extensions/control-plane-adapter-api/src/test/java/org/eclipse/tractusx/edc/api/cp/adapter/AdapterEdrControllerTest.java +++ b/edc-extensions/control-plane-adapter-api/src/test/java/org/eclipse/tractusx/edc/api/cp/adapter/AdapterEdrControllerTest.java @@ -127,7 +127,7 @@ void getEdr_shouldReturnDataAddress_whenFound() { var transferProcessId = "id"; var edr = EndpointDataReference.Builder.newInstance().endpoint("test").id(transferProcessId).build(); var response = Json.createObjectBuilder() - .add(DataAddress.TYPE, EndpointDataReference.EDR_SIMPLE_TYPE) + .add(DataAddress.EDC_DATA_ADDRESS_TYPE, EndpointDataReference.EDR_SIMPLE_TYPE) .add(EndpointDataReference.ENDPOINT, edr.getEndpoint()) .add(EndpointDataReference.ID, edr.getId()) .build(); @@ -164,7 +164,7 @@ void queryEdrs_shouldReturnCachedEntries_whenAssetIdIsProvided() { .add(EDR_ENTRY_TRANSFER_PROCESS_ID, entry.getTransferProcessId()) .add(EDR_ENTRY_AGREEMENT_ID, entry.getAgreementId()) .build(); - + when(adapterTransferProcessService.findByAssetAndAgreement(assetId, null)).thenReturn(ServiceResult.success(List.of(entry))); when(transformerRegistry.transform(any(EndpointDataReferenceEntry.class), eq(JsonObject.class))).thenReturn(Result.success(response)); diff --git a/edc-extensions/control-plane-adapter-callback/src/main/java/org/eclipse/tractusx/edc/cp/adapter/callback/TransferProcessLocalCallback.java b/edc-extensions/control-plane-adapter-callback/src/main/java/org/eclipse/tractusx/edc/cp/adapter/callback/TransferProcessLocalCallback.java index 04040b0fa..cfb8518a1 100644 --- a/edc-extensions/control-plane-adapter-callback/src/main/java/org/eclipse/tractusx/edc/cp/adapter/callback/TransferProcessLocalCallback.java +++ b/edc-extensions/control-plane-adapter-callback/src/main/java/org/eclipse/tractusx/edc/cp/adapter/callback/TransferProcessLocalCallback.java @@ -43,8 +43,7 @@ public TransferProcessLocalCallback(EndpointDataReferenceCache edrCache, Transfe @Override public Result invoke(CallbackEventRemoteMessage message) { - if (message.getEventEnvelope().getPayload() instanceof TransferProcessStarted) { - var transferProcessStarted = (TransferProcessStarted) message.getEventEnvelope().getPayload(); + if (message.getEventEnvelope().getPayload() instanceof TransferProcessStarted transferProcessStarted) { if (transferProcessStarted.getDataAddress() != null) { return EndpointDataAddressConstants.to(transferProcessStarted.getDataAddress()) .compose(this::storeEdr) @@ -57,8 +56,7 @@ public Result invoke(CallbackEventRemoteMessage messa private Result storeEdr(EndpointDataReference edr) { return transactionContext.execute(() -> { // TODO upstream api for getting the TP with the DataRequest#id - var transferProcessId = transferProcessStore.processIdForDataRequestId(edr.getId()); - var transferProcess = transferProcessStore.findById(transferProcessId); + var transferProcess = transferProcessStore.findForCorrelationId(edr.getId()); if (transferProcess != null) { var cacheEntry = EndpointDataReferenceEntry.Builder.newInstance() .transferProcessId(transferProcess.getId()) @@ -69,7 +67,7 @@ private Result storeEdr(EndpointDataReference edr) { edrCache.save(cacheEntry, edr); return Result.success(); } else { - return Result.failure(format("Failed to find a transfer process with ID %s", transferProcessId)); + return Result.failure(format("Failed to find a transfer process with correlation ID %s", edr.getId())); } }); diff --git a/edc-extensions/control-plane-adapter-callback/src/test/java/org/eclipse/tractusx/edc/cp/adapter/callback/TransferProcessLocalCallbackTest.java b/edc-extensions/control-plane-adapter-callback/src/test/java/org/eclipse/tractusx/edc/cp/adapter/callback/TransferProcessLocalCallbackTest.java index b4b6d8480..6f508990e 100644 --- a/edc-extensions/control-plane-adapter-callback/src/test/java/org/eclipse/tractusx/edc/cp/adapter/callback/TransferProcessLocalCallbackTest.java +++ b/edc-extensions/control-plane-adapter-callback/src/test/java/org/eclipse/tractusx/edc/cp/adapter/callback/TransferProcessLocalCallbackTest.java @@ -79,8 +79,6 @@ void invoke_shouldStoreTheEdrInCache_whenDataAddressIsPresent() { var edr = getEdr(); - when(transferProcessStore.processIdForDataRequestId(edr.getId())).thenReturn(transferProcessId); - var dataRequest = DataRequest.Builder.newInstance().id(edr.getId()) .destinationType("HttpProxy") .assetId(assetId) @@ -92,6 +90,8 @@ void invoke_shouldStoreTheEdrInCache_whenDataAddressIsPresent() { .dataRequest(dataRequest) .build(); + when(transferProcessStore.findForCorrelationId(edr.getId())).thenReturn(transferProcess); + when(transferProcessStore.findById(transferProcessId)).thenReturn(transferProcess); @@ -130,7 +130,7 @@ void invoke_shouldNotFail_whenTransferProcessNotFound() { var edr = getEdr(); - when(transferProcessStore.processIdForDataRequestId(edr.getId())).thenReturn(transferProcessId); + when(transferProcessStore.findForCorrelationId(edr.getId())).thenReturn(null); when(transferProcessStore.findById(transferProcessId)).thenReturn(null); diff --git a/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/ProvisionAdditionalHeadersExtensionTest.java b/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/ProvisionAdditionalHeadersExtensionTest.java index 723398a3e..ad88b6bc2 100644 --- a/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/ProvisionAdditionalHeadersExtensionTest.java +++ b/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/ProvisionAdditionalHeadersExtensionTest.java @@ -101,7 +101,6 @@ void shouldPutContractIdAsHeaderInDataAddress( var transferMessage = TransferRequestMessage.Builder.newInstance() .id("id") .protocol("protocol") - .assetId("assetId") .contractId("1:assetId:aContractId") .dataDestination(DataAddress.Builder.newInstance().type("HttpProxy").build()) .callbackAddress("callbackAddress") diff --git a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpDataAddress.java b/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpDataAddress.java index a9ae68638..f3cf35b18 100644 --- a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpDataAddress.java +++ b/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpDataAddress.java @@ -101,7 +101,7 @@ public Builder sftpUser(SftpUser user) { this.address.getProperties().put(USER_PASSWORD, user.getPassword()); if (user.getKeyPair() != null) { this.address.getProperties().put(USER_PRIVATE_KEY, Base64.getEncoder().encodeToString(user.getKeyPair().getPrivate().getEncoded())); - this.address.getProperties().put(KEY_NAME, user.getName()); + this.address.getProperties().put(EDC_DATA_ADDRESS_KEY_NAME, user.getName()); } return this; } diff --git a/gradle.properties b/gradle.properties index c4ad5e5b9..fe50648e7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ group=org.eclipse.tractusx.edc version=0.4.2-SNAPSHOT # configure the build: -annotationProcessorVersion=0.1.0 -edcGradlePluginsVersion=0.1.0 -metaModelVersion=0.1.0 +annotationProcessorVersion=0.1.1-SNAPSHOT +edcGradlePluginsVersion=0.1.1-SNAPSHOT +metaModelVersion=0.1.1-SNAPSHOT txScmConnection=scm:git:git@github.com:eclipse-tractusx/tractusx-edc.git txWebsiteUrl=https://github.com/eclipse-tractusx/tractusx-edc.git txScmUrl=https://github.com/eclipse-tractusx/tractusx-edc.git diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8d2050a55..70fb791fb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ format.version = "1.1" [versions] -edc = "0.1.0" +edc = "0.1.1-SNAPSHOT" postgres = "42.6.0" awaitility = "4.2.0" nimbus = "9.31"