From 1df65c9a2677707b97a1485eb7dc4c7846e9ad3c Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 3 Jul 2024 10:58:21 +0200 Subject: [PATCH 1/3] feature(chore):884 - fix internal url. --- .github/workflows/argo.yml | 29 ------------------- .../charts/backend/templates/deployment.yaml | 2 ++ .../properties/TraceabilityProperties.java | 2 +- .../base/service/NotificationsEDCFacade.java | 4 --- .../EdcNotificationContractService.java | 2 +- tx-backend/src/main/resources/application.yml | 1 + 6 files changed, 5 insertions(+), 35 deletions(-) diff --git a/.github/workflows/argo.yml b/.github/workflows/argo.yml index fb6a12ef96..498d54cb1a 100644 --- a/.github/workflows/argo.yml +++ b/.github/workflows/argo.yml @@ -54,13 +54,6 @@ on: options: - Yes - No - trigger_registry_reload: - type: choice - description: Do You want to trigger registry reload right away? - required: true - options: - - Yes - - No env: ARGO_TEST_REGISTRY: "https://argo.dev.demo.catena-x.net/api/v1/applications/tracex-dt-registry-test" @@ -156,8 +149,6 @@ jobs: echo "- test data version: ${{ github.event.inputs.testdata_version }}" >> $GITHUB_STEP_SUMMARY echo "- do hard refresh: ${{ github.event.inputs.hard_refresh }}" >> $GITHUB_STEP_SUMMARY echo "- upload test data: ${{ github.event.inputs.testdata_upload }}" >> $GITHUB_STEP_SUMMARY - echo "- reload registry: ${{ github.event.inputs.trigger_registry_reload }}" >> $GITHUB_STEP_SUMMARY - hard_refresh_environment: needs: print_environment @@ -404,23 +395,3 @@ jobs: elif [ "${{ github.event.inputs.testdata_upload }}" == "false" ]; then echo "Testdata upload skipped" fi - - registry_reload: - needs: - - upload_testdata - runs-on: ubuntu-latest - steps: - - name: reload the registry - run: | - if [ "${{ github.event.inputs.trigger_registry_reload }}" == "true" ]; then - if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then - curl -X GET "$ARGO_TEST_RegistryReload" - curl -X GET "$ARGO_DEV_RegistryReload" - elif [ "${{ github.event.inputs.environment }}" == "E2E-A/E2E-B" ]; then - curl -X GET "$ARGO_E2E_A_RegistryReload" - curl -X GET "$ARGO_E2E_B_RegistryReload" - elif [ "${{ github.event.inputs.environment }}" == "int-a/int-b" ]; then - curl -X GET "$ARGO_INT_A_RegistryReload" - curl -X GET "$ARGO_INT_B_RegistryReload" - fi - fi diff --git a/charts/traceability-foss/charts/backend/templates/deployment.yaml b/charts/traceability-foss/charts/backend/templates/deployment.yaml index f2415b7073..18502238aa 100644 --- a/charts/traceability-foss/charts/backend/templates/deployment.yaml +++ b/charts/traceability-foss/charts/backend/templates/deployment.yaml @@ -78,6 +78,8 @@ spec: value: {{ .Values.traceability.bpn | quote }} - name: TRACEABILITY_URL value: {{ .Values.traceability.url | quote }} + - name: TRACEABILITY_URL_INTERNAL + value: {{ .Values.traceability.internalUrl | quote }} - name: TRACEABILITY_LEFT_OPERAND value: {{ .Values.traceability.leftOperand | quote }} - name: TRACEABILITY_OPERATOR_TYPE diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/properties/TraceabilityProperties.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/properties/TraceabilityProperties.java index 12578326c6..49a2cadd5c 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/properties/TraceabilityProperties.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/properties/TraceabilityProperties.java @@ -38,7 +38,7 @@ public class TraceabilityProperties { private BPN bpn; private String url; - + private String internalUrl; private String leftOperand; private String operatorType; private String rightOperand; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/NotificationsEDCFacade.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/NotificationsEDCFacade.java index f5b481bb7e..f09bb13dd1 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/NotificationsEDCFacade.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/NotificationsEDCFacade.java @@ -79,15 +79,11 @@ public class NotificationsEDCFacade { @Qualifier(EDC_NOTIFICATION_TEMPLATE) private final RestTemplate edcNotificationTemplate; - private final NotificationRepository notificationRepository; - private final EDCCatalogFacade edcCatalogFacade; private final ContractNegotiationService contractNegotiationService; private final EndpointDataReferenceStorage endpointDataReferenceStorage; - private final PolicyCheckerService policyCheckerService; private final ContractService contractService; - private static final String CX_TAXO_QUALITY_INVESTIGATION_RECEIVE = "https://w3id.org/catenax/taxonomy#ReceiveQualityInvestigationNotification"; private static final String CX_TAXO_QUALITY_INVESTIGATION_UPDATE = "https://w3id.org/catenax/taxonomy#UpdateQualityInvestigationNotification"; private static final String CX_TAXO_QUALITY_ALERT_RECEIVE = "https://w3id.org/catenax/taxonomy#ReceiveQualityAlertNotification"; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/contract/EdcNotificationContractService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/contract/EdcNotificationContractService.java index 22e6fd7186..db5f6123d6 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/contract/EdcNotificationContractService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/contract/EdcNotificationContractService.java @@ -156,6 +156,6 @@ private void revertNotificationAsset(String notificationAssetId) { private String createBaseUrl(org.eclipse.tractusx.traceability.notification.application.contract.model.NotificationType notificationType, NotificationMethod notificationMethod) { final String template = notificationType.equals(org.eclipse.tractusx.traceability.notification.application.contract.model.NotificationType.QUALITY_ALERT) ? TRACE_FOSS_QUALITY_NOTIFICATION_ALERT_URL_TEMPLATE : TRACE_FOSS_QUALITY_NOTIFICATION_INVESTIGATION_URL_TEMPLATE; - return traceabilityProperties.getUrl() + template.formatted(notificationMethod.getValue()); + return traceabilityProperties.getInternalUrl() + template.formatted(notificationMethod.getValue()); } } diff --git a/tx-backend/src/main/resources/application.yml b/tx-backend/src/main/resources/application.yml index 6133078985..9ea9b24e4d 100644 --- a/tx-backend/src/main/resources/application.yml +++ b/tx-backend/src/main/resources/application.yml @@ -21,6 +21,7 @@ traceability: bpn: ${TRACEABILITY_BPN} url: ${TRACEABILITY_URL} + internalUrl: ${TRACEABILITY_URL_INTERNAL} leftOperand: ${TRACEABILITY_LEFT_OPERAND} operatorType: ${TRACEABILITY_OPERATOR_TYPE} rightOperand: ${TRACEABILITY_RIGHT_OPERAND} From 5dbccfc9b587894c116c9cee98c403ca899dae87 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 3 Jul 2024 10:59:05 +0200 Subject: [PATCH 2/3] feature(chore):884 - fix internal url. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a95fb03149..43a0e9077a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ _**For better traceability add the corresponding GitHub issue number in each cha - #786 Added authorization as admin for submodel api & registry api - #884 Upgraded tractionBatteryCode from 1.0.0 to 2.0.0 - #786 Added alternative port (only accessible within same cluster) for application which is used for unsecured API endpoints. +- #786 Introduced internal url for notification contracts. - #994 improved bpn edc configuration view uux - #1082 fix update of parts when synchronizing with IRS From 5279e48c0063c357a73289ed5c5fd85d2e77cea0 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 3 Jul 2024 11:06:57 +0200 Subject: [PATCH 3/3] feature(chore):884 - added internal urls. --- .../service/EdcNotificationContractServiceTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/infrastructure/edc/notificationcontract/service/EdcNotificationContractServiceTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/infrastructure/edc/notificationcontract/service/EdcNotificationContractServiceTest.java index d36b3b8e46..04377ad72b 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/infrastructure/edc/notificationcontract/service/EdcNotificationContractServiceTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/infrastructure/edc/notificationcontract/service/EdcNotificationContractServiceTest.java @@ -100,7 +100,7 @@ void testHandle() throws CreateEdcAssetException, CreateEdcPolicyDefinitionExcep CreateNotificationContractRequest request = new CreateNotificationContractRequest(notificationType, notificationMethod); when(edcNotificationAssetService.createNotificationAsset(any(), any(), any(), any())).thenReturn(notificationAssetId); - when(traceabilityProperties.getUrl()).thenReturn("https://test"); + when(traceabilityProperties.getInternalUrl()).thenReturn("https://test"); when(edcPolicyDefinitionService.createAccessPolicy(any(EdcCreatePolicyDefinitionRequest.class))).thenReturn(accessPolicyId); when(edcContractDefinitionService.createContractDefinition(notificationAssetId, accessPolicyId)).thenReturn(contractDefinitionId); @@ -125,7 +125,7 @@ void givenService_whenAssetCreationThrowsException_thenThrowException() throws C NotificationType notificationType = NotificationType.QUALITY_INVESTIGATION; NotificationMethod notificationMethod = NotificationMethod.RESOLVE; CreateNotificationContractRequest request = new CreateNotificationContractRequest(notificationType, notificationMethod); - when(traceabilityProperties.getUrl()).thenReturn("https://test"); + when(traceabilityProperties.getInternalUrl()).thenReturn("https://test"); doThrow(CreateEdcAssetException.class).when(edcNotificationAssetService).createNotificationAsset(any(), any(), any(), any()); // when/then @@ -148,7 +148,7 @@ void givenService_whenPolicyDefinitionServiceThrowsException_thenThrowException( CreateNotificationContractRequest request = new CreateNotificationContractRequest(notificationType, notificationMethod); when(edcNotificationAssetService.createNotificationAsset(any(), any(), any(), any())).thenReturn(notificationAssetId); - when(traceabilityProperties.getUrl()).thenReturn("https://test"); + when(traceabilityProperties.getInternalUrl()).thenReturn("https://test"); doThrow(CreateEdcPolicyDefinitionException.class).when(edcPolicyDefinitionService).createAccessPolicy(any(EdcCreatePolicyDefinitionRequest.class)); @@ -174,7 +174,7 @@ void givenService_whenContractDefinitionServiceThrowsException_thenThrowExceptio CreateNotificationContractRequest request = new CreateNotificationContractRequest(notificationType, notificationMethod); when(edcNotificationAssetService.createNotificationAsset(any(), any(), any(), any())).thenReturn(notificationAssetId); - when(traceabilityProperties.getUrl()).thenReturn("https://test"); + when(traceabilityProperties.getInternalUrl()).thenReturn("https://test"); doThrow(CreateEdcContractDefinitionException.class).when(edcContractDefinitionService).createContractDefinition(any(), any());