Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): non existing attrs in append or update operations should be ignored #1059

Merged
merged 4 commits into from
Dec 18, 2023

Conversation

bobeal
Copy link
Member

@bobeal bobeal commented Dec 4, 2023

When an attribute is ignored in such an operation, it should not raise an error

@bobeal bobeal added the core Relates to core API label Dec 4, 2023
@bobeal bobeal self-assigned this Dec 4, 2023
@github-actions github-actions bot added the fix Something isn't working label Dec 4, 2023
Copy link
Contributor

github-actions bot commented Dec 4, 2023

Test Results

  54 files  ±0    54 suites  ±0   1m 18s ⏱️ -14s
880 tests ±0  880 ✔️ ±0  0 💤 ±0  0 ±0 
919 runs  ±0  919 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit eb1d51a. ± Comparison against base commit 3faa8e7.

This pull request removes 93 and adds 16 tests. Note that renamed tests count towards both.

               "2020-03-25T08:33:17.965206Z"
               "urn:ngsi-ld:Beekeeper:1234",
               20,
               25,
            "instanceId":"urn:ngsi-ld:Instance:45678",
            "instanceId":"urn:ngsi-ld:In…
            "observedAt":"2020-03-25T08:33:17.965206Z",
            "sub": "sub"
            "type":"Property",
…
com.egm.stellio.search.service.TemporalEntityBuilderTests ‑ [10] scopeHistory=[], attributeAndResultsMap={TemporalEntityAttribute(id=2888cef8-b096-45e4-a9a0-2e7b9a0ca231, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Property, attributeValueType=STRING, datasetId=null, createdAt=2023-12-18T10:15:25.379118139Z, modifiedAt=null, payload=JsonByteArrayInput{{}})=[SimplifiedAttributeInstanceResult(temporalEntityAttribute=78b3af62-9e87-44a3-abc1-f65bd7055138, value=Beehive_incoming_123, time=2020-03-25T08:29:17.965206Z), SimplifiedAttributeInstanceRe…, withTemporalValues=true, withAudit=false, expectation={
  "id" : "urn:ngsi-ld:BeeHive:TESTC",
  "type" : "BeeHive",
  "incoming" : {
    "type" : "Property",
    "values" : [ ["Beehive_incoming_123","2020-03-25T08:29:17.965206Z"], ["Beehive_incoming_124","2020-03-25T08:33:17.965206Z"] ]
  }
}

com.egm.stellio.search.service.TemporalEntityBuilderTests ‑ [11] scopeHistory=[SimplifiedScopeInstanceResult(entityId=urn:ngsi-ld:BeeHive:TESTC, scopes=[/A/B, /C/D], time=2020-03-25T08:29:17.965206Z), SimplifiedScopeInstanceResult(entityId=urn:ngsi-ld:BeeHive:TESTC, scopes=[/C/D], time=2020-03-25T09:29:17.965206Z)], attributeAndResultsMap={}, withTemporalValues=true, withAudit=false, expectation={
  "id" : "urn:ngsi-ld:BeeHive:TESTC",
  "type" : "BeeHive",
  "scope" : {
    "type" : "Property",
    "values" : [ [["/A/B", "/C/D"],"2020-03-25T08:29:17.965206Z"], [["/C/D"],"2020-03-25T09:29:17.965206Z"] ]
  }
}

com.egm.stellio.search.service.TemporalEntityBuilderTests ‑ [12] scopeHistory=[FullScopeInstanceResult(entityId=urn:ngsi-ld:BeeHive:TESTC, scopes=[/A/B, /C/D], time=2020-03-25T08:29:17.965206Z, timeproperty=modifiedAt, sub=null), FullScopeInstanceResult(entityId=urn:ngsi-ld:BeeHive:TESTC, scopes=[/C/D], time=2020-03-25T09:29:17.965206Z, timeproperty=modifiedAt, sub=null)], attributeAndResultsMap={}, withTemporalValues=false, withAudit=false, expectation={
  "id" : "urn:ngsi-ld:BeeHive:TESTC",
  "type" : "BeeHive",
  "scope" : [{
    "type": "Property",
    "value": ["/A/B", "/C/D"],
    "modifiedAt": "2020-03-25T08:29:17.965206Z"
  }, {
    "type": "Property",
    "value": ["/C/D"],
    "modifiedAt": "2020-03-25T09:29:17.965206Z"
  }]
}

com.egm.stellio.search.service.TemporalEntityBuilderTests ‑ [1] entityTemporalResults=[EntityTemporalResult(entityPayload=EntityPayload(entityId=urn:ngsi-ld:BeeHive:TESTC, types=[https://ontology.eglobalmark.com/apic#BeeHive], scopes=null, createdAt=2023-12-18T10:15:25.322146476Z, modifiedAt=null, contexts=[https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/master/apic/jsonld-contexts/apic-compound.jsonld], payload=JsonByteArrayInput{{}}, specificAccessPolicy=null), scopeHistory=[], teaInstancesResult={TemporalEntityAttribute(id=26587732-f3ec-4c1f-8ca0-63f207e73471,…, withTemporalValues=false, withAudit=true, expectation=[
   {
      "id":"urn:ngsi-ld:BeeHive:TESTC",
      "type":"BeeHive",
      "incoming":[
         {
            "type":"Property",
            "value":20,
            "instanceId":"urn:ngsi-ld:Instance:45678",
            "observedAt":"2020-03-25T08:33:17.965206Z",
            "sub": "sub"
         }
      ]
   },
   {
      "id":"urn:ngsi-ld:BeeHive:TESTD",
      "type":"BeeHive",
      "outgoing":[
         {
            "type":"Property",
            "value":25,
            "instanceId":"urn:ngsi-ld:In…
com.egm.stellio.search.service.TemporalEntityBuilderTests ‑ [1] scopeHistory=[], attributeAndResultsMap={TemporalEntityAttribute(id=7abf45b4-2a98-4919-97ee-f65ffb0f20e2, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Property, attributeValueType=NUMBER, datasetId=null, createdAt=2023-12-18T10:15:25.379118139Z, modifiedAt=null, payload=JsonByteArrayInput{{}})=[FullAttributeInstanceResult(temporalEntityAttribute=9d94bb55-e680-469d-ba2b-64abebc424cb, payload={"type":"Property","instanceId":"urn:ngsi-ld:Instance:45678","observedAt":"2020-03-25T08:2…, withTemporalValues=false, withAudit=false, expectation={
  "id" : "urn:ngsi-ld:BeeHive:TESTC",
  "type" : "BeeHive",
  "incoming" : [ {
    "type" : "Property",
    "value" : 550.0,
    "instanceId" : "urn:ngsi-ld:Instance:45678",
    "observedAt" : "2020-03-25T08:29:17.965206Z"
  }, {
    "type" : "Property",
    "value" : 650.0,
    "instanceId" : "urn:ngsi-ld:Instance:45679",
    "observedAt" : "2020-03-25T08:33:17.965206Z"
  } ]
}

com.egm.stellio.search.service.TemporalEntityBuilderTests ‑ [2] entityTemporalResults=[EntityTemporalResult(entityPayload=EntityPayload(entityId=urn:ngsi-ld:BeeHive:TESTC, types=[https://ontology.eglobalmark.com/apic#BeeHive], scopes=null, createdAt=2023-12-18T10:15:25.322146476Z, modifiedAt=null, contexts=[https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/master/apic/jsonld-contexts/apic-compound.jsonld], payload=JsonByteArrayInput{{}}, specificAccessPolicy=null), scopeHistory=[], teaInstancesResult={TemporalEntityAttribute(id=cf048c6e-f89e-405e-94cb-7ea5ebf4ab57,…, withTemporalValues=true, withAudit=false, expectation=[
   {
      "id":"urn:ngsi-ld:BeeHive:TESTC",
      "type":"BeeHive",
      "incoming": {
         "type":"Property",
         "values":[
            [
               20,
               "2020-03-25T08:33:17.965206Z"
            ]
         ]
      }
   },
   {
      "id":"urn:ngsi-ld:BeeHive:TESTD",
      "type":"BeeHive",
      "outgoing": {
         "type":"Property",
         "values":[
            [
               25,
               "2020-03-25T08:33:17.965206Z"
            ]
         ]
      }
   }
]

com.egm.stellio.search.service.TemporalEntityBuilderTests ‑ [2] scopeHistory=[], attributeAndResultsMap={TemporalEntityAttribute(id=4e484be1-b1a7-49d5-b772-96f9e19b426d, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Relationship, attributeValueType=STRING, datasetId=null, createdAt=2023-12-18T10:15:25.379118139Z, modifiedAt=null, payload=JsonByteArrayInput{{}})=[FullAttributeInstanceResult(temporalEntityAttribute=6d3f3d5f-33e1-45f6-a1f9-0be41af10fa3, payload={"type":"Relationship","instanceId":"urn:ngsi-ld:Instance:45678","observedAt":"2020-03…, withTemporalValues=false, withAudit=false, expectation={
  "id" : "urn:ngsi-ld:BeeHive:TESTC",
  "type" : "BeeHive",
  "incoming" : [ {
    "type" : "Relationship",
    "object" : "urn:ngsi-ld:Entity:1234",
    "instanceId" : "urn:ngsi-ld:Instance:45678",
    "observedAt" : "2020-03-25T08:29:17.965206Z"
  }, {
    "type" : "Relationship",
    "object" : "urn:ngsi-ld:Entity:5678",
    "instanceId" : "urn:ngsi-ld:Instance:45679",
    "observedAt" : "2020-03-25T08:33:17.965206Z"
  } ]
}

com.egm.stellio.search.service.TemporalEntityBuilderTests ‑ [3] entityTemporalResults=[EntityTemporalResult(entityPayload=EntityPayload(entityId=urn:ngsi-ld:BeeHive:TESTC, types=[https://ontology.eglobalmark.com/apic#BeeHive], scopes=null, createdAt=2023-12-18T10:15:25.322146476Z, modifiedAt=null, contexts=[https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/master/apic/jsonld-contexts/apic-compound.jsonld], payload=JsonByteArrayInput{{}}, specificAccessPolicy=null), scopeHistory=[], teaInstancesResult={TemporalEntityAttribute(id=463f0218-3934-44d2-8f34-5a8ca3890436,…, withTemporalValues=true, withAudit=false, expectation=[
   {
      "id":"urn:ngsi-ld:BeeHive:TESTC",
      "type":"BeeHive",
      "incoming": {
         "type":"Property",
         "values":[
            [
               20,
               "2020-03-25T08:33:17.965206Z"
            ]
         ]
      },
      "managedBy": {
         "type": "Relationship",
         "objects": [
            [
               "urn:ngsi-ld:Beekeeper:1234",
               "2020-03-25T08:33:17.965206Z"
            ]
         ]
      }
   },
   {
      "id":"urn:ngsi-ld:BeeHive:TEST…
com.egm.stellio.search.service.TemporalEntityBuilderTests ‑ [3] scopeHistory=[], attributeAndResultsMap={TemporalEntityAttribute(id=b365cdfe-f7cd-43e1-8519-41ceea402e72, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Property, attributeValueType=NUMBER, datasetId=urn:ngsi-ld:Dataset:01234, createdAt=2023-12-18T10:15:25.379118139Z, modifiedAt=null, payload=JsonByteArrayInput{{}})=[FullAttributeInstanceResult(temporalEntityAttribute=7ef8574a-7193-4152-ab68-1b6c1576eea5, payload={"type":"Property","datasetId":"urn:ngsi-ld:Dataset:01234","instanceI…, withTemporalValues=false, withAudit=false, expectation={
  "id" : "urn:ngsi-ld:BeeHive:TESTC",
  "type" : "BeeHive",
  "incoming" : [ {
    "type" : "Property",
    "datasetId" : "urn:ngsi-ld:Dataset:01234",
    "value" : 550.0,
    "instanceId" : "urn:ngsi-ld:Instance:01234",
    "observedAt" : "2020-03-25T08:29:17.965206Z"
  }, {
    "type" : "Property",
    "datasetId" : "urn:ngsi-ld:Dataset:01234",
    "value" : 650.0,
    "instanceId" : "urn:ngsi-ld:Instance:01235",
    "observedAt" : "2020-03-25T08:33:17.965206Z"
  }, {
    "type" : "Property",
    "data…
com.egm.stellio.search.service.TemporalEntityBuilderTests ‑ [4] scopeHistory=[], attributeAndResultsMap={TemporalEntityAttribute(id=dfe62d11-a6fc-486e-95ce-39c735aa4037, entityId=urn:ngsi-ld:BeeHive:TESTC, attributeName=https://ontology.eglobalmark.com/apic#incoming, attributeType=Property, attributeValueType=STRING, datasetId=urn:ngsi-ld:Dataset:45678, createdAt=2023-12-18T10:15:25.379118139Z, modifiedAt=null, payload=JsonByteArrayInput{{}})=[FullAttributeInstanceResult(temporalEntityAttribute=8939eff2-eb6f-4a3f-844d-85771e2927fa, payload={"type":"Property","datasetId":"urn:ngsi-ld:Dataset:45678","instanceI…, withTemporalValues=false, withAudit=false, expectation={
  "id" : "urn:ngsi-ld:BeeHive:TESTC",
  "type" : "BeeHive",
  "incoming" : [ {
    "type" : "Property",
    "datasetId" : "urn:ngsi-ld:Dataset:45678",
    "value" : "Beehive_incoming_123",
    "instanceId" : "urn:ngsi-ld:Instance:45678",
    "observedAt" : "2020-03-25T08:29:17.965206Z"
  }, {
    "type" : "Property",
    "datasetId" : "urn:ngsi-ld:Dataset:45678",
    "value" : "Beehive_incoming_124",
    "instanceId" : "urn:ngsi-ld:Instance:45679",
    "observedAt" : "2020-03-25T08:33:17.965206Z"
  } ]
}

…

♻️ This comment has been updated with latest results.

@bobeal bobeal force-pushed the fix/ignore-existing-attrs-in-update-operation branch from edd6cd7 to b7ed99b Compare December 18, 2023 09:22
Copy link

@bobeal bobeal merged commit 577ad56 into develop Dec 18, 2023
10 checks passed
@bobeal bobeal deleted the fix/ignore-existing-attrs-in-update-operation branch December 18, 2023 10:19
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
core Relates to core API fix Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant