From 8384f094a21866bd0f250054dfa9053306c0014c Mon Sep 17 00:00:00 2001 From: Istvan Zoltan Nagy Date: Fri, 12 Apr 2024 15:08:07 +0200 Subject: [PATCH] EDC extension - Update due to EDC changes - Swap parameters of the DtrDataPlaneAccessControlService Updates #352 Signed-off-by: Istvan Zoltan Nagy --- .../DtrDataPlaneAccessControlService.java | 2 +- .../DtrDataPlaneAccessControlServiceTest.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/edc-extension/src/main/java/org/eclipse/tractusx/semantics/edc/dataplane/http/accesscontrol/DtrDataPlaneAccessControlService.java b/libraries/edc-extension/src/main/java/org/eclipse/tractusx/semantics/edc/dataplane/http/accesscontrol/DtrDataPlaneAccessControlService.java index 7eb8d33b..3eb0de38 100644 --- a/libraries/edc-extension/src/main/java/org/eclipse/tractusx/semantics/edc/dataplane/http/accesscontrol/DtrDataPlaneAccessControlService.java +++ b/libraries/edc-extension/src/main/java/org/eclipse/tractusx/semantics/edc/dataplane/http/accesscontrol/DtrDataPlaneAccessControlService.java @@ -56,7 +56,7 @@ public DtrDataPlaneAccessControlService( } @Override - public Result checkAccess( ClaimToken claimToken, DataAddress address, Map additionalData, Map requestData ) { + public Result checkAccess( ClaimToken claimToken, DataAddress address, Map requestData, Map additionalData ) { if ( isNotActive() ) { //no DTR clients are registered, therefore the extension is turned off return Result.success(); diff --git a/libraries/edc-extension/src/test/java/org/eclipse/tractusx/semantics/edc/dataplane/http/accesscontrol/DtrDataPlaneAccessControlServiceTest.java b/libraries/edc-extension/src/test/java/org/eclipse/tractusx/semantics/edc/dataplane/http/accesscontrol/DtrDataPlaneAccessControlServiceTest.java index 0775362c..82ea0c28 100644 --- a/libraries/edc-extension/src/test/java/org/eclipse/tractusx/semantics/edc/dataplane/http/accesscontrol/DtrDataPlaneAccessControlServiceTest.java +++ b/libraries/edc-extension/src/test/java/org/eclipse/tractusx/semantics/edc/dataplane/http/accesscontrol/DtrDataPlaneAccessControlServiceTest.java @@ -96,7 +96,7 @@ void test_DtrLookupCall_ShouldSucceed_WhenBpnHeaderIsPresent() { when( uriInfo.getRequestUri() ).thenReturn( URI.create( "http://edc.example.com/public/v2/api/dtr/resource?param1=value1" ) ); //when - final Result actual = underTest.checkAccess( claimToken, address, additionalData, requestData ); + final Result actual = underTest.checkAccess( claimToken, address, requestData, additionalData ); //then verify( address ).getStringProperty( ADDRESS_HEADER_EDC_BPN ); @@ -115,7 +115,7 @@ void test_DtrLookupCall_ShouldSucceed_WhenBpnHeaderIsMissing() { when( uriInfo.getRequestUri() ).thenReturn( URI.create( "http://edc.example.com/public/v2/api/dtr/resource?param1=value1" ) ); //when - final Result actual = underTest.checkAccess( claimToken, address, additionalData, requestData ); + final Result actual = underTest.checkAccess( claimToken, address, requestData, additionalData ); //then verify( address ).getStringProperty( ADDRESS_HEADER_EDC_BPN ); @@ -138,7 +138,7 @@ void test_AspectModelBackendRequest_ShouldSucceed_WhenBpnHeaderIsPresentAndDtrRe when( client.shouldAllowAccess( proxyPath, queryString, Map.of( HEADER_EDC_BPN, BPN_0001 ) ) ).thenReturn( true ); //when - final Result actual = underTest.checkAccess( claimToken, address, additionalData, requestData ); + final Result actual = underTest.checkAccess( claimToken, address, requestData, additionalData ); //then verify( monitor, never() ).info( anyString() ); @@ -164,7 +164,7 @@ void test_AspectModelBackendRequest_ShouldReturnFailure_WhenBpnHeaderIsPresentAn when( client.shouldAllowAccess( proxyPath, queryString, Map.of( HEADER_EDC_BPN, BPN_0001 ) ) ).thenReturn( false ); //when - final Result actual = underTest.checkAccess( claimToken, address, additionalData, requestData ); + final Result actual = underTest.checkAccess( claimToken, address, requestData, additionalData ); //then verify( monitor, never() ).info( anyString() ); @@ -190,7 +190,7 @@ void test_AspectModelBackendRequest_ShouldReturnFailure_WhenBpnHeaderIsMissing( when( client.shouldAllowAccess( proxyPath, queryString, Collections.emptyMap() ) ).thenReturn( false ); //when - final Result actual = underTest.checkAccess( claimToken, address, additionalData, requestData ); + final Result actual = underTest.checkAccess( claimToken, address, requestData, additionalData ); //then verify( monitor, never() ).info( anyString() ); @@ -217,7 +217,7 @@ void test_AspectModelBackendRequest_ShouldReturnFailure_WhenBpnHeaderIsPresentBu when( client.shouldAllowAccess( proxyPath, queryString, Map.of( HEADER_EDC_BPN, BPN_0001 ) ) ).thenReturn( false ); //when - final Result actual = underTest.checkAccess( claimToken, address, additionalData, requestData ); + final Result actual = underTest.checkAccess( claimToken, address, requestData, additionalData ); //then verify( monitor, never() ).info( anyString() );