From bf6e176de078b8c486fe986995239ac4121c4cfe Mon Sep 17 00:00:00 2001 From: Stefan Wiedemann Date: Tue, 21 Jan 2025 15:11:46 +0100 Subject: [PATCH 1/6] add path checking --- src/main/resources/mapping.json | 12 ++++++++++++ src/main/resources/rego/http/leftOperand.rego | 7 +++++++ src/main/resources/rego/http/operator.rego | 7 +++++++ 3 files changed, 26 insertions(+) create mode 100644 src/main/resources/rego/http/leftOperand.rego create mode 100644 src/main/resources/rego/http/operator.rego diff --git a/src/main/resources/mapping.json b/src/main/resources/mapping.json index 1044ed0..ecb8e64 100644 --- a/src/main/resources/mapping.json +++ b/src/main/resources/mapping.json @@ -54,6 +54,12 @@ } }, "operator": { + "http": { + "isInPath": { + "regoPackage": "http.operator as http_operator", + "regoMethod": "http_operator.is_in_path_operator(%s,%s)" + } + }, "odrl": { "eq": { "regoPackage": "odrl.operator as odrl_operator", @@ -136,6 +142,12 @@ } }, "leftOperand": { + "http": { + "path": { + "regoPackage": "http.leftOperand as http_lo", + "regoMethod": "http_lo.path(helper.http_part)" + } + }, "vc": { "role": { "regoPackage": "vc.leftOperand as vc_lo", diff --git a/src/main/resources/rego/http/leftOperand.rego b/src/main/resources/rego/http/leftOperand.rego new file mode 100644 index 0000000..ff2e411 --- /dev/null +++ b/src/main/resources/rego/http/leftOperand.rego @@ -0,0 +1,7 @@ +package http.leftOperand + +import rego.v1 + +## http:path +# returns the currently requested path +path(http_part) := http_part.path \ No newline at end of file diff --git a/src/main/resources/rego/http/operator.rego b/src/main/resources/rego/http/operator.rego new file mode 100644 index 0000000..36e77c1 --- /dev/null +++ b/src/main/resources/rego/http/operator.rego @@ -0,0 +1,7 @@ +package http.operator + +import rego.v1 + +## http:isInPath +# check that left operand is in the path of the right operand +is_in_path_operator(leftOperand, rightOperand) if startswith(leftOperand, rightOperand) From 7d9c84af2c5417db8f0a3ed869a27e094e738bbc Mon Sep 17 00:00:00 2001 From: Stefan Wiedemann Date: Wed, 22 Jan 2025 08:06:55 +0100 Subject: [PATCH 2/6] deactivate --- src/test/java/org/fiware/odrl/OdrlTest.java | 58 +++++++++---------- .../OpenPolicyAgentTestResource.java | 2 +- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/test/java/org/fiware/odrl/OdrlTest.java b/src/test/java/org/fiware/odrl/OdrlTest.java index 9a6b616..4a90585 100644 --- a/src/test/java/org/fiware/odrl/OdrlTest.java +++ b/src/test/java/org/fiware/odrl/OdrlTest.java @@ -102,35 +102,35 @@ public static Stream validCombinations() { "PUT"), new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), - Arguments.of( - List.of("/examples/dome/1001/_1001.json"), - getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", - "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", - "PATCH"), - new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") - .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), - Arguments.of( - List.of("/examples/dome/1002/_1002.json"), - getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", - "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", - "GET"), - new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") - .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), - Arguments.of( - List.of("/examples/dome/1003/_1003.json"), - getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", - "/urn:ngsi-ld:button:onboard", - "GET"), - new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") - .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), - Arguments.of( - List.of("/examples/dome/1003/_1003.json"), - getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", - "/urn:ngsi-ld:button:onboard", - "GET", - List.of("onboarder"), Optional.empty()), - new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") - .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), +// Arguments.of( +// List.of("/examples/dome/1001/_1001.json"), +// getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", +// "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", +// "PATCH"), +// new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") +// .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), +// Arguments.of( +// List.of("/examples/dome/1002/_1002.json"), +// getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", +// "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", +// "GET"), +// new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") +// .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), +// Arguments.of( +// List.of("/examples/dome/1003/_1003.json"), +// getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", +// "/urn:ngsi-ld:button:onboard", +// "GET"), +// new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") +// .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), +// Arguments.of( +// List.of("/examples/dome/1003/_1003.json"), +// getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", +// "/urn:ngsi-ld:button:onboard", +// "GET", +// List.of("onboarder"), Optional.empty()), +// new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") +// .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), Arguments.of( List.of("/examples/dome/1003/_1003.json"), getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", diff --git a/src/test/java/org/fiware/odrl/resources/OpenPolicyAgentTestResource.java b/src/test/java/org/fiware/odrl/resources/OpenPolicyAgentTestResource.java index c46b8d1..2f0fca8 100644 --- a/src/test/java/org/fiware/odrl/resources/OpenPolicyAgentTestResource.java +++ b/src/test/java/org/fiware/odrl/resources/OpenPolicyAgentTestResource.java @@ -21,7 +21,7 @@ public class OpenPolicyAgentTestResource implements QuarkusTestResourceLifecycle @Override public Map start() { - opaContainer = new GenericContainer("openpolicyagent/opa:0.63.0") + opaContainer = new GenericContainer("openpolicyagent/opa:0.64.1") .withReuse(false) .withCopyToContainer(MountableFile.forClasspathResource("opa.yaml"), "/opa.yaml") .withCommand("run", "--server", "-l", "debug", "-c", "/opa.yaml", "--addr", "localhost:8181") From 952fba812ad4b89c480afc8556a9396274802292 Mon Sep 17 00:00:00 2001 From: Stefan Wiedemann Date: Wed, 22 Jan 2025 08:29:21 +0100 Subject: [PATCH 3/6] disable the tests --- src/test/java/org/fiware/odrl/OdrlTest.java | 48 ++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/test/java/org/fiware/odrl/OdrlTest.java b/src/test/java/org/fiware/odrl/OdrlTest.java index 4a90585..2825f54 100644 --- a/src/test/java/org/fiware/odrl/OdrlTest.java +++ b/src/test/java/org/fiware/odrl/OdrlTest.java @@ -88,49 +88,49 @@ public static Stream validCombinations() { "PATCH"), new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), - Arguments.of( - List.of("/examples/dome/1001/_1001.json"), - getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", - "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", - "GET"), - new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") - .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), - Arguments.of( - List.of("/examples/dome/1001/_1001.json"), - getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", - "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", - "PUT"), - new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") - .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), // Arguments.of( // List.of("/examples/dome/1001/_1001.json"), // getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", // "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", -// "PATCH"), +// "GET"), // new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") // .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), // Arguments.of( -// List.of("/examples/dome/1002/_1002.json"), +// List.of("/examples/dome/1001/_1001.json"), // getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", // "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", -// "GET"), +// "PUT"), // new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") // .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), // Arguments.of( -// List.of("/examples/dome/1003/_1003.json"), +// List.of("/examples/dome/1001/_1001.json"), // getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", -// "/urn:ngsi-ld:button:onboard", -// "GET"), +// "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", +// "PATCH"), // new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") // .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), // Arguments.of( -// List.of("/examples/dome/1003/_1003.json"), +// List.of("/examples/dome/1002/_1002.json"), // getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", -// "/urn:ngsi-ld:button:onboard", -// "GET", -// List.of("onboarder"), Optional.empty()), +// "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", +// "GET"), // new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") // .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), + Arguments.of( + List.of("/examples/dome/1003/_1003.json"), + getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", + "/urn:ngsi-ld:button:onboard", + "GET"), + new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") + .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), + Arguments.of( + List.of("/examples/dome/1003/_1003.json"), + getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", + "/urn:ngsi-ld:button:onboard", + "GET", + List.of("onboarder"), Optional.empty()), + new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") + .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), Arguments.of( List.of("/examples/dome/1003/_1003.json"), getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", From efa2cad7f973a4d18ba52f6e11b28d96b59828ce Mon Sep 17 00:00:00 2001 From: Stefan Wiedemann Date: Wed, 22 Jan 2025 10:37:43 +0100 Subject: [PATCH 4/6] update resoureces --- doc/REGO.md | 39 ++++++++++++++++----------- src/main/resources/rego-resources.txt | 19 +++++++++++++ 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/doc/REGO.md b/doc/REGO.md index 3214ba1..fcdb7df 100644 --- a/doc/REGO.md +++ b/doc/REGO.md @@ -5,6 +5,8 @@ | ODRL Class | ODRL Key | Rego-Method | Description | | --- | --- | --- | --- | +| action | dome-op:create | is_creation(request) | Check if the given request is a creation | +| action | dome-op:set_published | is_set_published(request) | check if the entity is set to published in the request. | | leftOperand | dome-op:role | role(verifiable_credential,organization_id) | retrieves the roles from the (lear) credential, that target the current organization | | leftOperand | dome-op:currentParty | current_party(credential) | the current (organization)party, | | leftOperand | dome-op:relatedParty | related_party(http_part) | get the entity from tm-forum and extract related party | @@ -12,18 +14,16 @@ | leftOperand | dome-op:relatedParty_role | related_party_role(entity) | return the role from the related party of an entity | | leftOperand | dome-op:validFor_endDateTime | valid_for_end_date_time(entity) | return the end of the validity of an entity | | leftOperand | dome-op:validFor_startDateTime | valid_for_start_date_time(entity) | return the start of the validity of an entity | -| action | dome-op:create | is_creation(request) | Check if the given request is a creation | -| action | dome-op:set_published | is_set_published(request) | check if the entity is set to published in the request. | ## odrl | ODRL Class | ODRL Key | Rego-Method | Description | | --- | --- | --- | --- | +| rightOperand | odrl:policyUsage | policy_usage | return the current time in ms, e.g. the time that the policy is used | | operand | odrl:and | and_operand(constraints) | checks if all given constraints are true | | operand | odrl:andSequence | and_sequence_operand(constraints) | checks if all given constraints are true | | operand | odrl:or | or_operand(constraints) | check that at least one of the constraints is true | | operand | odrl:xone | only_one_operand(constraints) | check that exactly one of the constraints is true | -| rightOperand | odrl:policyUsage | policy_usage | return the current time in ms, e.g. the time that the policy is used | | operator | odrl:eq | eq_operator(leftOperand, | check that both operands are equal | | operator | odrl:hasPart | has_part_operator(leftOperand, | check that the rightOperand is in the leftOperand | | operator | odrl:gt | gt_operator(leftOperand, | check that the leftOperand is greater than the rightOperand | @@ -35,13 +35,13 @@ | operator | odrl:lt | lt_operator(leftOperand, | check that the leftOperand is less than the rightOperand | | operator | odrl:lteq | lt_eq_operator(leftOperand, | check that the leftOperand is less or equal to the rightOperand | | operator | odrl:neq | n_eq_operator(leftOperand, | check that the operands are unequal | -| leftOperand | odrl:currentTime | current_time | returns the current time in ms | -| target | odrl:target,odrl:uid | is_target(target, | check that the uid of the target is equal to the given uid | | action | odrl:modify | is_modification(request) | checks if the given request is a modification | | action | odrl:delete | is_deletion(request) | checks if the given request is a deletion | | action | odrl:read | is_read(request) | checks if the given request is a read operation | | action | odrl:use | is_use(request) | checks if the given request is a usage | +| target | odrl:target,odrl:uid | is_target(target, | check that the uid of the target is equal to the given uid | | assignee | odrl:uid,odrl:assignee | is_user(user,uid) | is the given user id the same as the given uid | +| leftOperand | odrl:currentTime | current_time | returns the current time in ms | ## utils @@ -61,30 +61,37 @@ | helper | ## | entity | the entity provided as http-body | | helper | ## | target | the target of the request, found as the last part of the path | -## vc - -| ODRL Class | ODRL Key | Rego-Method | Description | -| --- | --- | --- | --- | -| leftOperand | vc:role | role(verifiable_credential,organization_id) | retrieves the roles from the credential, that target the current organization | -| leftOperand | vc:currentParty | current_party(credential) | the current (organization)party, | -| leftOperand | vc:type | types(verifiable_credential) | the type(s) of the current credential | -| assignee | odrl:any | is_any | allows for any user | - ## ngsild | ODRL Class | ODRL Key | Rego-Method | Description | | --- | --- | --- | --- | +| action | ngsild:create | is_creation(request) | Check if the given request is a creation | | leftOperand | ngsi-ld:entityType | entity_type(http_part) | retrieves the type from an entity, either from the request path or from the body | | leftOperand | ngsi-ld: | # | retrieves the value of the property, only applies to properties of type "Property". The method should be concretized in the mapping.json, to match a concrete property. | | leftOperand | ngsi-ld:_observedAt | # | retrieves the observedAt of the property The method should be concretized in the mapping.json, to match a concrete property. | | leftOperand | ngsi-ld:_modifiedAt | # | retrieves the modifiedAt of the property The method should be concretized in the mapping.json, to match a concrete property. | | leftOperand | ngsi-ld: | # | retrieves the object of the relationship, only applies to properties of type "Relationship". The method should be concretized in the mapping.json, to match a concrete property. | -| action | ngsild:create | is_creation(request) | Check if the given request is a creation | ## tmf | ODRL Class | ODRL Key | Rego-Method | Description | | --- | --- | --- | --- | +| action | tmf:create | is_creation(request) | Check if the given request is a creation | | leftOperand | tmf:lifecycleStatus | life_cycle_status(entity) | return the lifeCycleStatus of a given entity | | leftOperand | tmf:resource | resource_type(http_part) | retrieves the type of the resource from the path | -| action | tmf:create | is_creation(request) | Check if the given request is a creation | + +## vc + +| ODRL Class | ODRL Key | Rego-Method | Description | +| --- | --- | --- | --- | +| assignee | odrl:any | is_any | allows for any user | +| leftOperand | vc:role | role(verifiable_credential,organization_id) | retrieves the roles from the credential, that target the current organization | +| leftOperand | vc:currentParty | current_party(credential) | the current (organization)party, | +| leftOperand | vc:type | types(verifiable_credential) | the type(s) of the current credential | + +## http + +| ODRL Class | ODRL Key | Rego-Method | Description | +| --- | --- | --- | --- | +| operator | http:isInPath | is_in_path_operator(leftOperand, | check that left operand is in the path of the right operand | +| leftOperand | http:path | path(http_part) | returns the currently requested path | diff --git a/src/main/resources/rego-resources.txt b/src/main/resources/rego-resources.txt index daabaa2..7f8441b 100644 --- a/src/main/resources/rego-resources.txt +++ b/src/main/resources/rego-resources.txt @@ -136,3 +136,22 @@ rego/ngsi-ld/leftOperand.rego rego/ngsi-ld/action.rego rego/tmf/leftOperand.rego rego/tmf/action.rego +rego/dome/action.rego +rego/dome/leftOperand.rego +rego/odrl/rightOperand.rego +rego/odrl/operand.rego +rego/odrl/operator.rego +rego/odrl/action.rego +rego/odrl/target.rego +rego/odrl/assignee.rego +rego/odrl/leftOperand.rego +rego/utils/apisix.rego +rego/utils/kong.rego +rego/ngsi-ld/action.rego +rego/ngsi-ld/leftOperand.rego +rego/tmf/action.rego +rego/tmf/leftOperand.rego +rego/vc/assignee.rego +rego/vc/leftOperand.rego +rego/http/operator.rego +rego/http/leftOperand.rego From 2aac9beb4c8550e85d61a0a8df0a0dfb37e057cd Mon Sep 17 00:00:00 2001 From: Stefan Wiedemann Date: Wed, 22 Jan 2025 15:47:56 +0100 Subject: [PATCH 5/6] reenable tests --- src/test/java/org/fiware/odrl/OdrlTest.java | 56 ++++++++++----------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/test/java/org/fiware/odrl/OdrlTest.java b/src/test/java/org/fiware/odrl/OdrlTest.java index 2825f54..9a6b616 100644 --- a/src/test/java/org/fiware/odrl/OdrlTest.java +++ b/src/test/java/org/fiware/odrl/OdrlTest.java @@ -88,34 +88,34 @@ public static Stream validCombinations() { "PATCH"), new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), -// Arguments.of( -// List.of("/examples/dome/1001/_1001.json"), -// getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", -// "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", -// "GET"), -// new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") -// .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), -// Arguments.of( -// List.of("/examples/dome/1001/_1001.json"), -// getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", -// "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", -// "PUT"), -// new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") -// .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), -// Arguments.of( -// List.of("/examples/dome/1001/_1001.json"), -// getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", -// "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", -// "PATCH"), -// new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") -// .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), -// Arguments.of( -// List.of("/examples/dome/1002/_1002.json"), -// getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", -// "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", -// "GET"), -// new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") -// .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), + Arguments.of( + List.of("/examples/dome/1001/_1001.json"), + getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", + "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", + "GET"), + new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") + .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), + Arguments.of( + List.of("/examples/dome/1001/_1001.json"), + getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", + "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", + "PUT"), + new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") + .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), + Arguments.of( + List.of("/examples/dome/1001/_1001.json"), + getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", + "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", + "PATCH"), + new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") + .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), + Arguments.of( + List.of("/examples/dome/1002/_1002.json"), + getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", + "/productOffering/urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6", + "GET"), + new MockEntity().id("urn:ngsi-ld:product-offering:62d4f929-d29d-4070-ae1f-9fe7dd1de5f6") + .relatedParty(List.of(new RelatedParty().role("Owner").id("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2")))), Arguments.of( List.of("/examples/dome/1003/_1003.json"), getRequest("urn:ngsi-ld:organization:0b03975e-7ded-4fbd-9c3b-a5d6550df7e2", From 20ee849d49e5ae21a903c60dfc80d20500f475bf Mon Sep 17 00:00:00 2001 From: Stefan Wiedemann Date: Thu, 23 Jan 2025 08:41:56 +0100 Subject: [PATCH 6/6] fix tests --- src/main/resources/rego-resources.txt | 19 ++++++++++++++++++ .../resources/examples/dome/1001/_1001.json | Bin 3478 -> 3478 bytes 2 files changed, 19 insertions(+) diff --git a/src/main/resources/rego-resources.txt b/src/main/resources/rego-resources.txt index 7f8441b..7c4448c 100644 --- a/src/main/resources/rego-resources.txt +++ b/src/main/resources/rego-resources.txt @@ -155,3 +155,22 @@ rego/vc/assignee.rego rego/vc/leftOperand.rego rego/http/operator.rego rego/http/leftOperand.rego +rego/dome/action.rego +rego/dome/leftOperand.rego +rego/odrl/rightOperand.rego +rego/odrl/operand.rego +rego/odrl/operator.rego +rego/odrl/action.rego +rego/odrl/target.rego +rego/odrl/assignee.rego +rego/odrl/leftOperand.rego +rego/utils/apisix.rego +rego/utils/kong.rego +rego/ngsi-ld/action.rego +rego/ngsi-ld/leftOperand.rego +rego/tmf/action.rego +rego/tmf/leftOperand.rego +rego/vc/assignee.rego +rego/vc/leftOperand.rego +rego/http/operator.rego +rego/http/leftOperand.rego diff --git a/src/test/resources/examples/dome/1001/_1001.json b/src/test/resources/examples/dome/1001/_1001.json index b2cb54d3230b87cd671678c0082538fa22883807..58ada905ee1f2b9af30793c4884f578d55ac2463 100644 GIT binary patch delta 14 VcmbOxJxzLp1`nh8W=)=4MgSn~1JwWk delta 14 VcmbOxJxzLp1`ng@W=)=4MgSn;1JeKi