Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroVega committed May 6, 2024
1 parent 5ecd9f2 commit eddc687
Show file tree
Hide file tree
Showing 3 changed files with 263 additions and 20 deletions.
24 changes: 4 additions & 20 deletions test/unit/ngsiv2/HTTP_receive_ngsiv2_measures-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,8 @@ describe('HTTP: NGSIv2 Measure reception ', function () {
.matchHeader('fiware-service', 'smartgondor')
.matchHeader('fiware-servicepath', '/gardens')
.post(
'/v2/entities?options=upsert',
utils.readExampleFile('./test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json')
)
.reply(204);
contextBrokerMock
.matchHeader('fiware-service', 'smartgondor')
.matchHeader('fiware-servicepath', '/gardens')
.post(
'/v2/entities?options=upsert',
utils.readExampleFile('./test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json')
'/v2/op/update',
utils.readExampleFile('./test/unit/ngsiv2/contextRequests/ngsiv2PayloadMultipleMeasure.json')
)
.reply(204);
});
Expand Down Expand Up @@ -528,16 +520,8 @@ describe('HTTP: NGSIv2 Measure reception ', function () {
.matchHeader('fiware-service', 'smartgondor')
.matchHeader('fiware-servicepath', '/gardens')
.post(
'/v2/entities?options=upsert',
utils.readExampleFile('./test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json')
)
.reply(204);
contextBrokerMock
.matchHeader('fiware-service', 'smartgondor')
.matchHeader('fiware-servicepath', '/gardens')
.post(
'/v2/entities?options=upsert',
utils.readExampleFile('./test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json')
'/v2/op/update',
utils.readExampleFile('./test/unit/ngsiv2/contextRequests/ngsiv2PayloadMultipleMeasure2.json')
)
.reply(204);
});
Expand Down
130 changes: 130 additions & 0 deletions test/unit/ngsiv2/contextRequests/ngsiv2PayloadMultipleMeasure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"actionType": "append",
"entities": [
{
"id": "Second MQTT Device",
"type": "AnMQTTDevice",
"measure_id": {
"type": "Text",
"value": "urn:ngsiv2:Streetlight:Streetlight-Mylightpoint-2"
},
"measure_type": {
"type": "Text",
"value": "Streetlight"
},
"name": {
"type": "Text",
"value": "MyLightPoint-test1"
},
"description": {
"type": "Text",
"value": "testdescription"
},
"status": {
"type": "Text",
"value": "connected",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2023-11-17T11:59:22.661Z"
}
}
},
"dateServiceStarted": {
"type": "DateTime",
"value": "2020-06-04T09: 55: 02"
},
"locationComment": {
"type": "Text",
"value": "Test1"
},
"location": {
"type": "geo:json",
"value": {
"coordinates": [
-87.88429,
41.99499
],
"type": "Point"
}
},
"address": {
"type": "Text",
"value": {
"streetAddress": "MyStreet"
}
},
"isRemotelyManaged": {
"type": "Integer",
"value": 1
},
"installationDate": {
"type": "DateTime",
"value": "2022-04-17T02: 30: 04"
}
},
{
"id": "Second MQTT Device",
"type": "AnMQTTDevice",
"measure_id": {
"type": "Text",
"value": "urn:ngsiv2:Streetlight:Streetlight-Mylightpoint-3"
},
"measure_type": {
"type": "Text",
"value": "Streetlight"
},
"name": {
"type": "Text",
"value": "MyLightPoint-test2"
},
"description": {
"type": "Text",
"value": "testdescription"
},
"status": {
"type": "Text",
"value": "connected",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2023-11-17T11:59:22.661Z"
}
}
},
"dateServiceStarted": {
"type": "DateTime",
"value": "2022-06-04T09: 55: 02"
},
"locationComment": {
"type": "Text",
"value": "Test3"
},
"location": {
"type": "geo:json",
"value": {
"coordinates": [
-84.88429,
42.99499
],
"type": "Point"
}
},
"address": {
"type": "Text",
"value": {
"streetAddress": "MyFarStreet"
}
},
"isRemotelyManaged": {
"type": "Integer",
"value": 3
},
"installationDate": {
"type": "DateTime",
"value": "2023-04-17T02: 30: 04"
}
}
]
}

129 changes: 129 additions & 0 deletions test/unit/ngsiv2/contextRequests/ngsiv2PayloadMultipleMeasure2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"actionType": "append",
"entities": [
{
"id": "Second MQTT Device",
"type": "AnMQTTDevice",
"measure_id": {
"type": "Text",
"value": "urn:ngsiv2:Streetlight:Streetlight-Mylightpoint-2"
},
"measure_type": {
"type": "Text",
"value": "Streetlight"
},
"name": {
"type": "Text",
"value": "MyLightPoint-test1"
},
"description": {
"type": "Text",
"value": "testdescription"
},
"status": {
"type": "Text",
"value": "connected",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2023-11-17T11:59:22.661Z"
}
}
},
"dateServiceStarted": {
"type": "DateTime",
"value": "2020-06-04T09: 55: 02"
},
"locationComment": {
"type": "Text",
"value": "Test1"
},
"location": {
"type": "geo:json",
"value": {
"coordinates": [
-87.88429,
41.99499
],
"type": "Point"
}
},
"address": {
"type": "Text",
"value": {
"streetAddress": "MyStreet"
}
},
"isRemotelyManaged": {
"type": "Integer",
"value": 1
},
"installationDate": {
"type": "DateTime",
"value": "2022-04-17T02: 30: 04"
}
},
{
"id": "Second MQTT Device",
"type": "AnMQTTDevice",
"measure_id": {
"type": "Text",
"value": "urn:ngsiv2:Streetlight:Streetlight-Mylightpoint-3"
},
"measure_type": {
"type": "Text",
"value": "Streetlight"
},
"name": {
"type": "Text",
"value": "MyLightPoint-test2"
},
"description": {
"type": "Text",
"value": "testdescription"
},
"status": {
"type": "Text",
"value": "connected",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2023-11-17T11:59:22.661Z"
}
}
},
"dateServiceStarted": {
"type": "DateTime",
"value": "2022-06-04T09: 55: 02"
},
"locationComment": {
"type": "Text",
"value": "Test3"
},
"location": {
"type": "geo:json",
"value": {
"coordinates": [
-84.88429,
42.99499
],
"type": "Point"
}
},
"address": {
"type": "Text",
"value": {
"streetAddress": "MyFarStreet"
}
},
"isRemotelyManaged": {
"type": "Integer",
"value": 3
},
"installationDate": {
"type": "DateTime",
"value": "2023-04-17T02: 30: 04"
}
}
]
}

0 comments on commit eddc687

Please sign in to comment.