diff --git a/edc-extensions/business-partner-validation/src/main/java/org/eclipse/tractusx/edc/validation/businesspartner/functions/AbstractBusinessPartnerValidation.java b/edc-extensions/business-partner-validation/src/main/java/org/eclipse/tractusx/edc/validation/businesspartner/functions/AbstractBusinessPartnerValidation.java index e31f16511..1cacd83a6 100644 --- a/edc-extensions/business-partner-validation/src/main/java/org/eclipse/tractusx/edc/validation/businesspartner/functions/AbstractBusinessPartnerValidation.java +++ b/edc-extensions/business-partner-validation/src/main/java/org/eclipse/tractusx/edc/validation/businesspartner/functions/AbstractBusinessPartnerValidation.java @@ -27,6 +27,7 @@ import org.eclipse.edc.spi.monitor.Monitor; import org.jetbrains.annotations.Nullable; +import java.util.Map; import java.util.Objects; import static java.lang.String.format; @@ -102,8 +103,13 @@ protected boolean evaluate( monitor.debug(message); return false; } - + var referringConnectorClaim = getReferringConnectorClaim(policyContext.getParticipantAgent()); + final ParticipantAgent participantAgent = policyContext.getParticipantAgent(); + + if (participantAgent == null) { + return false; + } if (referringConnectorClaim == null || referringConnectorClaim.isEmpty()) { return false; 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 d423b7d1c..58105f6f9 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.EDC_DATA_ADDRESS_TYPE, EndpointDataReference.EDR_SIMPLE_TYPE) + .add(DataAddress.EDC_DATA_ADDRESS_TYPE_PROPERTY, EndpointDataReference.EDR_SIMPLE_TYPE) .add(EndpointDataReference.ENDPOINT, edr.getEndpoint()) .add(EndpointDataReference.ID, edr.getId()) .build(); diff --git a/edc-extensions/observability-api-customization/src/test/java/org/eclipse/tractusx/edc/api/observability/TxObservabilityApiControllerTest.java b/edc-extensions/observability-api-customization/src/test/java/org/eclipse/tractusx/edc/api/observability/TxObservabilityApiControllerTest.java index 2d0c1f570..5770ac4c6 100644 --- a/edc-extensions/observability-api-customization/src/test/java/org/eclipse/tractusx/edc/api/observability/TxObservabilityApiControllerTest.java +++ b/edc-extensions/observability-api-customization/src/test/java/org/eclipse/tractusx/edc/api/observability/TxObservabilityApiControllerTest.java @@ -22,6 +22,7 @@ import org.eclipse.edc.connector.spi.contractnegotiation.ContractNegotiationService; import org.eclipse.edc.connector.spi.policydefinition.PolicyDefinitionService; import org.eclipse.edc.connector.spi.transferprocess.TransferProcessService; +import org.eclipse.edc.jsonld.spi.JsonLd; import org.eclipse.edc.junit.annotations.ApiTest; import org.eclipse.edc.junit.extensions.EdcExtension; import org.eclipse.edc.spi.asset.DataAddressResolver; @@ -45,6 +46,35 @@ public class TxObservabilityApiControllerTest { private static final String API_KEY = "12345"; + // register all services that are required by the management API + protected void registerServiceMocks(EdcExtension extension) { + extension.registerServiceMock(DataAddressResolver.class, mock(DataAddressResolver.class)); + extension.registerServiceMock(CatalogService.class, mock(CatalogService.class)); + extension.registerServiceMock(ContractAgreementService.class, mock(ContractAgreementService.class)); + extension.registerServiceMock(ContractDefinitionService.class, mock(ContractDefinitionService.class)); + extension.registerServiceMock(AssetService.class, mock(AssetService.class)); + extension.registerServiceMock(ContractNegotiationService.class, mock(ContractNegotiationService.class)); + extension.registerServiceMock(PolicyDefinitionService.class, mock(PolicyDefinitionService.class)); + extension.registerServiceMock(TransferProcessService.class, mock(TransferProcessService.class)); + extension.registerServiceMock(JsonLd.class, mock(JsonLd.class)); + } + + static class BaseTest { + protected final int port = getFreePort(); + protected String basePath; + + protected BaseTest(String basePath) { + this.basePath = basePath; + } + + protected RequestSpecification baseRequest() { + return given() + .baseUri("http://localhost:" + port) + .basePath(basePath) + .when(); + } + } + @Nested @DisplayName("Allow unauthenticated access") class AllowsUnauthenticatedContextTest extends BaseTest { @@ -118,33 +148,4 @@ void defaultContext_whenNoAuthHeader_shouldReturn401(String path) { .body(notNullValue()); } } - - // register all services that are required by the management API - protected void registerServiceMocks(EdcExtension extension) { - extension.registerServiceMock(DataAddressResolver.class, mock(DataAddressResolver.class)); - extension.registerServiceMock(CatalogService.class, mock(CatalogService.class)); - extension.registerServiceMock(ContractAgreementService.class, mock(ContractAgreementService.class)); - extension.registerServiceMock(ContractDefinitionService.class, mock(ContractDefinitionService.class)); - extension.registerServiceMock(AssetService.class, mock(AssetService.class)); - extension.registerServiceMock(ContractNegotiationService.class, mock(ContractNegotiationService.class)); - extension.registerServiceMock(PolicyDefinitionService.class, mock(PolicyDefinitionService.class)); - extension.registerServiceMock(TransferProcessService.class, mock(TransferProcessService.class)); - } - - static class BaseTest { - protected final int port = getFreePort(); - protected String basePath; - - protected BaseTest(String basePath) { - this.basePath = basePath; - } - - protected RequestSpecification baseRequest() { - return given() - .baseUri("http://localhost:" + port) - .basePath(basePath) - .when(); - } - } - }