stellio-hub / stellio-context-broker

Stellio is an NGSI-LD compatible context broker
https://stellio.readthedocs.io
Apache License 2.0
27 stars 10 forks source link

refactor: remove contexts from expanded entity representation #1147

Closed bobeal closed 5 months ago

bobeal commented 5 months ago

Once an entity is expanded, the contexts used to do the expansion should not be used anymore. So remove them to avoid any misuse of them.

github-actions[bot] commented 5 months ago

Test Results

 58 files  ±0   58 suites  ±0   1m 21s :stopwatch: -5s 953 tests ±0  953 :white_check_mark: ±0  0 :zzz: ±0  0 :x: ±0  992 runs  ±0  992 :white_check_mark: ±0  0 :zzz: ±0  0 :x: ±0 

Results for commit 88f1eafb. ± Comparison against base commit 3c80bbc1.

This pull request removes 170 and adds 30 tests. Note that renamed tests count towards both. ``` …, withTemporalValues=true, withAudit=false, expectation={ "@type": "@json", … "@value": "/A/B" "@value": "/C/D" "@value": 20 "… { "@type": "https://uri.etsi.org/ngsi-ld/DateTime", "@value": "2020-03-25T08:29:17.965206Z" … ``` ``` com.egm.stellio.search.util.PatchAttributeTests ‑ [1] source={ "attribute": { "type": "Property", "value": 12.0, "observedAt": "2024-04-14T12:34:56Z" } }, target={ "attribute": { "type": "Property", "value": 12.2, "unitCode": "GRM" } }, expected={ "attribute": { "type": "Property", "value": 12.2, "unitCode": "GRM", "observedAt": "2024-04-14T12:34:56Z" } } com.egm.stellio.search.util.PatchAttributeTests ‑ [1] source={ "attribute": { "type": "Property", "value": 12.0, "observedAt": "2024-04-14T12:34:56Z", "subAttribute": { "type": "Property", "value": "subAttribute" } } }, target={ "attribute": { "type": "Property", "value": 12.2, "unitCode": "GRM", "subAttribute": { "type": "Property", "value": "newSubAttributeValue" } } }, expected={ "attribute": { "type": "Property", "value": 12.2, "unitCode": "GRM", "observedAt": "2024-04-14T12:34:56Z", "subAttribute": { "type": "Property", "value": "newSubAttributeValue" } } } com.egm.stellio.search.util.PatchAttributeTests ‑ [2] source={ "attribute": { "type": "Property", "value": { "en": "car", "fr": "voiture" } } }, target={ "attribute": { "type": "Property", "value": { "fr": "vélo", "es": "bicicleta" } } }, expected={ "attribute": { "type": "Property", "value": { "en": "car", "fr": "vélo", "es": "bicicleta" } } } com.egm.stellio.search.util.PatchAttributeTests ‑ [2] source={ "incoming": { "type": "JsonProperty", "json": { "id": 1, "b": null, "c": 12.4 }, "observedAt": "2022-12-24T14:01:22.066Z", "subAttribute": { "type": "Property", "value": "subAttribute" } } }, target={ "incoming": { "type": "JsonProperty", "json": { "id": 2, "b": "something" }, "observedAt": "2023-12-24T14:01:22.066Z" } }, expected={ "incoming": { "type": "JsonProperty", "json": { "id": 2, "b": "something" }, "observedAt": "2023-12-24T14:01:22.066Z", "subAttribute": { "type": "Property", "value": "subAttribute" } } } com.egm.stellio.search.util.PatchAttributeTests ‑ [3] source={ "attribute": { "type": "Property", "value": [ "car", "voiture" ] } }, target={ "attribute": { "type": "Property", "value": [ "vélo", "bicicleta" ] } }, expected={ "attribute": { "type": "Property", "value": [ "vélo", "bicicleta" ] } } com.egm.stellio.search.util.PatchAttributeTests ‑ [4] source={ "attribute": { "type": "Relationship", "object": "urn:ngsi-ld:Entity:01" } }, target={ "attribute": { "type": "Relationship", "object": "urn:ngsi-ld:Entity:02" } }, expected={ "attribute": { "type": "Relationship", "object": "urn:ngsi-ld:Entity:02" } } com.egm.stellio.search.util.PatchAttributeTests ‑ [5] source={ "attribute": { "type": "LanguageProperty", "languageMap": { "en": "train", "fr": "train" } } }, target={ "attribute": { "type": "LanguageProperty", "languageMap": { "fr": "TGV", "es": "tren" } } }, expected={ "attribute": { "type": "LanguageProperty", "languageMap": { "en": "train", "fr": "TGV", "es": "tren" } } } com.egm.stellio.search.util.PatchAttributeTests ‑ [6] source={ "incoming": { "type": "JsonProperty", "json": { "a": 1, "b": "thing" } } }, target={ "incoming": { "type": "JsonProperty", "json": { "a": 2, "c": "other thing" } } }, expected={ "incoming": { "type": "JsonProperty", "json": { "a": 2, "b": "thing", "c": "other thing" } } } com.egm.stellio.search.util.TemporalEntityBuilderTests ‑ [10] scopeHistory=[], attributeAndResultsMap={TemporalEntityAttribute(id=f3e7a932-42ea-4af5-92e3-c432f4d3f454, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Property, attributeValueType=STRING, datasetId=null, createdAt=2024-04-27T16:20:39.394813335Z, modifiedAt=null, payload=JsonByteArrayInput{{}})=[SimplifiedAttributeInstanceResult(temporalEntityAttribute=e2b43682-aa52-464c-a1d9-4c7af00a9968, value=Beehive_incoming_123, time=2020-03-25T08:29:17.965206Z), SimplifiedAttributeInstanceRe…, withTemporalValues=true, withAudit=false, expectation={ "@id": "urn:ngsi-ld:BeeHive:TESTC", "@type": [ "https://ontology.eglobalmark.com/apic#BeeHive" ], "https://ontology.eglobalmark.com/apic#incoming": [ { "@type": [ "https://uri.etsi.org/ngsi-ld/Property" ], "https://uri.etsi.org/ngsi-ld/hasValues": [ { "@list": [ { "@list": [ { "@value": "Beehive_incoming_123" }, { "@value": "2020-03-25T0… com.egm.stellio.search.util.TemporalEntityBuilderTests ‑ [11] scopeHistory=[], attributeAndResultsMap={TemporalEntityAttribute(id=483e72f0-d5b9-45f0-be0e-43fae847dd2b, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Relationship, attributeValueType=STRING, datasetId=urn:ngsi-ld:Dataset:45678, createdAt=2024-04-27T16:20:39.394813335Z, modifiedAt=null, payload=JsonByteArrayInput{{}})=[SimplifiedAttributeInstanceResult(temporalEntityAttribute=3f9324a3-d5a7-4af0-a2cd-711c40477e54, value=urn:ngsi-ld:Entity:1234, time=2020-03-25T08:29:17.965206Z), S…, withTemporalValues=true, withAudit=false, expectation={ "@id": "urn:ngsi-ld:BeeHive:TESTC", "@type": [ "https://ontology.eglobalmark.com/apic#BeeHive" ], "https://ontology.eglobalmark.com/apic#incoming": [ { "@type": [ "https://uri.etsi.org/ngsi-ld/Relationship" ], "https://uri.etsi.org/ngsi-ld/datasetId": [ { "@id": "urn:ngsi-ld:Dataset:45678" } ], "https://uri.etsi.org/ngsi-ld/hasObjects": [ { "@list": [ { "@list": [ { … … ```
sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
74.2% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud