From 128c4f50df976ebca28b586bd478d6427a7e8e12 Mon Sep 17 00:00:00 2001 From: Ken Zangelin Date: Thu, 11 May 2023 17:40:15 +0200 Subject: [PATCH] Added a CLI option to set the broker's trace levels + Added a few steps in a functest to test pre-expanded entity types in GET /entities --- .../0000_ngsild/ngsild_entities_get.test | 90 +++++++++++++++++++ test/functionalTest/testHarness.sh | 2 + 2 files changed, 92 insertions(+) diff --git a/test/functionalTest/cases/0000_ngsild/ngsild_entities_get.test b/test/functionalTest/cases/0000_ngsild/ngsild_entities_get.test index 0273abd7b8..96a027c30b 100644 --- a/test/functionalTest/cases/0000_ngsild/ngsild_entities_get.test +++ b/test/functionalTest/cases/0000_ngsild/ngsild_entities_get.test @@ -42,6 +42,8 @@ orionldStart CB # 10. GET all entities with id E.* with count and limit==0 - see empty array and count==4 # 11. GET all entities of type T with options=sysAttrs set, see E1 and E3, with createdAt/modifiedAt present # 12. GET ALL LOCAL entities +# 13. GET all entities using an pre-expanded type for T +# 14. GET all entities using an pre-expanded type for T that is url-encoded manually # echo "01. POST /ngsi-ld/v1/entities::http://a.b.c/entity/E1, with test context, and type T" @@ -180,6 +182,20 @@ echo echo +echo "13. GET all entities using an pre-expanded type for T" +echo "=====================================================" +orionCurl --url '/ngsi-ld/v1/entities?type=http://example.org/T&prettyPrint=yes' --noPayloadCheck -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' +echo +echo + + +echo "14. GET all entities using an pre-expanded type for T that is url-encoded manually" +echo "==================================================================================" +orionCurl --url '/ngsi-ld/v1/entities?type=http%3A%2F%2Fexample.org/T&prettyPrint=yes' --noPayloadCheck -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' +echo +echo + + --REGEXPECT-- 01. POST /ngsi-ld/v1/entities::http://a.b.c/entity/E1, with test context, and type T ==================================================================================== @@ -520,6 +536,80 @@ Date: REGEX(.*) +13. GET all entities using an pre-expanded type for T +===================================================== +HTTP/1.1 200 OK +Content-Length: 435 +Content-Type: application/json +Date: REGEX(.*) +Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json" + +[ + { + "id": "http://a.b.c/entity/E1", + "type": "T", + "P1": { + "type": "Property", + "value": "E1" + }, + "R1": { + "type": "Relationship", + "object": "http://a.b.c/entity/E1" + } + }, + { + "id": "http://a.b.c/entity/E3", + "type": "T", + "P1": { + "type": "Property", + "value": "E3" + }, + "R1": { + "type": "Relationship", + "object": "http://a.b.c/entity/E3" + } + } +] + + + +14. GET all entities using an pre-expanded type for T that is url-encoded manually +================================================================================== +HTTP/1.1 200 OK +Content-Length: 435 +Content-Type: application/json +Date: REGEX(.*) +Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json" + +[ + { + "id": "http://a.b.c/entity/E1", + "type": "T", + "P1": { + "type": "Property", + "value": "E1" + }, + "R1": { + "type": "Relationship", + "object": "http://a.b.c/entity/E1" + } + }, + { + "id": "http://a.b.c/entity/E3", + "type": "T", + "P1": { + "type": "Property", + "value": "E3" + }, + "R1": { + "type": "Relationship", + "object": "http://a.b.c/entity/E3" + } + } +] + + + --TEARDOWN-- brokerStop CB dbDrop CB diff --git a/test/functionalTest/testHarness.sh b/test/functionalTest/testHarness.sh index 710fe901b4..0ee7040eaf 100755 --- a/test/functionalTest/testHarness.sh +++ b/test/functionalTest/testHarness.sh @@ -172,6 +172,7 @@ function usage() empty=$(echo $sfile | tr 'a-zA-z/0-9.:' ' ') echo "$sfile [-u (usage)]" echo "$empty [-v (verbose)]" + echo "$empty [-t (trace level for broker)]" echo "$empty [--loud (loud - see travis extra info)]" echo "$empty [-ld (only ngsild tests)]" echo "$empty [-troe (only ngsild TRoE (Temporal Representation of Entities) tests)]" @@ -434,6 +435,7 @@ while [ "$#" != 0 ] do if [ "$1" == "-u" ]; then usage 0; elif [ "$1" == "-v" ]; then verbose=on; + elif [ "$1" == "-t" ]; then export CB_TRACELEVELS="$2"; shift; elif [ "$1" == "-ld" ]; then ngsild=on; elif [ "$1" == "-troe" ]; then troe=on; elif [ "$1" == "-eb" ]; then externalBroker=ON;