From 22afdd2eda55a9d8c3aa3c73c2817716bc1e2e42 Mon Sep 17 00:00:00 2001 From: Keshav-NEC Date: Wed, 31 Jan 2024 12:14:00 +0000 Subject: [PATCH 1/4] constants.DEFAULT_ATTRIBUTE_TYPE is changed to Text --- lib/constants.js | 2 +- .../unit/ngsiv2/contextRequests/ngsildMeasure.json | 5 ++--- .../contextRequests/ngsildPayloadMeasure.json | 4 ++-- .../contextRequests/ngsildPayloadMeasure2.json | 4 ++-- .../unit/ngsiv2/contextRequests/ngsiv2Measure.json | 4 ++-- .../contextRequests/ngsiv2PayloadMeasure.json | 4 ++-- .../contextRequests/ngsiv2PayloadMeasure2.json | 4 ++-- .../ngsiv2/contextRequests/pollingMeasure.json | 2 +- .../contextRequests/timeInstantMeasures3.json | 2 +- .../ngsiv2/contextRequests/unknownMeasures.json | 2 +- .../ngsiv2/contextRequests/unknownMeasures2.json | 2 +- .../contextRequests/unprovisionedDevice.json | 4 ++-- .../contextRequests/unprovisionedDevice2.json | 4 ++-- .../contextRequests/unprovisionedDevice3.json | 2 +- test/unit/ngsiv2/explicit_attributes-test.js | 14 +++++++------- 15 files changed, 29 insertions(+), 30 deletions(-) diff --git a/lib/constants.js b/lib/constants.js index ded407577..f0abf0886 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -42,7 +42,7 @@ module.exports = { TIMESTAMP_ATTRIBUTE: 'TimeInstant', TIMESTAMP_TYPE_NGSI2: 'DateTime', - DEFAULT_ATTRIBUTE_TYPE: 'string', + DEFAULT_ATTRIBUTE_TYPE: 'Text', COMMAND_STATUS_PENDING: 'PENDING', COMMAND_STATUS_ERROR: 'ERROR', diff --git a/test/unit/ngsiv2/contextRequests/ngsildMeasure.json b/test/unit/ngsiv2/contextRequests/ngsildMeasure.json index 76d01b9a7..f975c0b79 100644 --- a/test/unit/ngsiv2/contextRequests/ngsildMeasure.json +++ b/test/unit/ngsiv2/contextRequests/ngsildMeasure.json @@ -3,7 +3,7 @@ "type": "AnMQTTDevice", "actionType": { "value": "APPEND", - "type": "string" + "type": "Text" }, "entities": { "value": [ @@ -45,7 +45,6 @@ ] } ], - "type": "string" + "type": "Text" } } - diff --git a/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure.json b/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure.json index 3d7965f15..8d6c703e8 100644 --- a/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure.json +++ b/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure.json @@ -2,11 +2,11 @@ "id": "Second MQTT Device", "type": "AnMQTTDevice", "measure_id": { - "type": "string", + "type": "Text", "value": "urn:ngsi-ld:ParkingSpot:santander:daoiz_velarde_1_5:3" }, "measure_type": { - "type": "string", + "type": "Text", "value": "ParkingSpot" }, "status": { diff --git a/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure2.json b/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure2.json index 6dd1c3d4a..0594bffe5 100644 --- a/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure2.json +++ b/test/unit/ngsiv2/contextRequests/ngsildPayloadMeasure2.json @@ -2,11 +2,11 @@ "id": "Second MQTT Device", "type": "AnMQTTDevice", "measure_id": { - "type": "string", + "type": "Text", "value": "urn:ngsi-ld:ParkingSpot:santander:reyes_magos_1_1:1" }, "measure_type": { - "type": "string", + "type": "Text", "value": "ParkingSpot" }, "status": { diff --git a/test/unit/ngsiv2/contextRequests/ngsiv2Measure.json b/test/unit/ngsiv2/contextRequests/ngsiv2Measure.json index 7151f1b1f..c304e1bd4 100644 --- a/test/unit/ngsiv2/contextRequests/ngsiv2Measure.json +++ b/test/unit/ngsiv2/contextRequests/ngsiv2Measure.json @@ -3,7 +3,7 @@ "type":"AnMQTTDevice", "actionType": { "value": "APPEND", - "type": "string" + "type": "Text" }, "entities": { "value": [ @@ -56,6 +56,6 @@ } } ], - "type": "string" + "type": "Text" } } diff --git a/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json b/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json index 7b9762346..eb1e90805 100644 --- a/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json +++ b/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure.json @@ -2,11 +2,11 @@ "id":"Second MQTT Device", "type":"AnMQTTDevice", "measure_id": { - "type": "string", + "type": "Text", "value": "urn:ngsiv2:Streetlight:Streetlight-Mylightpoint-2" }, "measure_type": { - "type": "string", + "type": "Text", "value": "Streetlight" }, "name": { diff --git a/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json b/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json index 49fdc2639..c90bf8bd3 100644 --- a/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json +++ b/test/unit/ngsiv2/contextRequests/ngsiv2PayloadMeasure2.json @@ -2,11 +2,11 @@ "id": "Second MQTT Device", "type": "AnMQTTDevice", "measure_id": { - "type": "string", + "type": "Text", "value": "urn:ngsiv2:Streetlight:Streetlight-Mylightpoint-3" }, "measure_type": { - "type": "string", + "type": "Text", "value": "Streetlight" }, "name": { diff --git a/test/unit/ngsiv2/contextRequests/pollingMeasure.json b/test/unit/ngsiv2/contextRequests/pollingMeasure.json index 7c88ac531..ca3eef03e 100644 --- a/test/unit/ngsiv2/contextRequests/pollingMeasure.json +++ b/test/unit/ngsiv2/contextRequests/pollingMeasure.json @@ -2,7 +2,7 @@ "id":"Second MQTT Device", "type":"AnMQTTDevice", "a": { - "type": "string", + "type": "Text", "value": 23 } } diff --git a/test/unit/ngsiv2/contextRequests/timeInstantMeasures3.json b/test/unit/ngsiv2/contextRequests/timeInstantMeasures3.json index 83b4145b4..bafa4ed61 100644 --- a/test/unit/ngsiv2/contextRequests/timeInstantMeasures3.json +++ b/test/unit/ngsiv2/contextRequests/timeInstantMeasures3.json @@ -6,7 +6,7 @@ "value": "111222" }, "pressure":{ - "type": "string", + "type": "Text", "value": "20" }, "TimeInstant":{ diff --git a/test/unit/ngsiv2/contextRequests/unknownMeasures.json b/test/unit/ngsiv2/contextRequests/unknownMeasures.json index 55d1f864c..e2ffad3aa 100644 --- a/test/unit/ngsiv2/contextRequests/unknownMeasures.json +++ b/test/unit/ngsiv2/contextRequests/unknownMeasures.json @@ -6,7 +6,7 @@ "value": "32" }, "weight":{ - "type": "string", + "type": "Text", "value": "87" } } diff --git a/test/unit/ngsiv2/contextRequests/unknownMeasures2.json b/test/unit/ngsiv2/contextRequests/unknownMeasures2.json index b7b611810..8d28f5023 100644 --- a/test/unit/ngsiv2/contextRequests/unknownMeasures2.json +++ b/test/unit/ngsiv2/contextRequests/unknownMeasures2.json @@ -6,7 +6,7 @@ "value": "33" }, "weight":{ - "type": "string", + "type": "Text", "value": "89" } } diff --git a/test/unit/ngsiv2/contextRequests/unprovisionedDevice.json b/test/unit/ngsiv2/contextRequests/unprovisionedDevice.json index 31c74e221..31afe9c32 100644 --- a/test/unit/ngsiv2/contextRequests/unprovisionedDevice.json +++ b/test/unit/ngsiv2/contextRequests/unprovisionedDevice.json @@ -2,11 +2,11 @@ "id":"TheLightType:JSON_UNPROVISIONED", "type":"TheLightType", "humidity":{ - "type": "string", + "type": "Text", "value": "32" }, "temperature":{ - "type": "string", + "type": "Text", "value": "87" } } diff --git a/test/unit/ngsiv2/contextRequests/unprovisionedDevice2.json b/test/unit/ngsiv2/contextRequests/unprovisionedDevice2.json index bd2aa561f..f29fa1e12 100644 --- a/test/unit/ngsiv2/contextRequests/unprovisionedDevice2.json +++ b/test/unit/ngsiv2/contextRequests/unprovisionedDevice2.json @@ -2,11 +2,11 @@ "id":"TheLightType:JSON_UNPROVISIONED", "type":"TheLightType", "humidity":{ - "type": "string", + "type": "Text", "value": "33" }, "temperature":{ - "type": "string", + "type": "Text", "value": "89" } } diff --git a/test/unit/ngsiv2/contextRequests/unprovisionedDevice3.json b/test/unit/ngsiv2/contextRequests/unprovisionedDevice3.json index a5493ad17..781e3417b 100644 --- a/test/unit/ngsiv2/contextRequests/unprovisionedDevice3.json +++ b/test/unit/ngsiv2/contextRequests/unprovisionedDevice3.json @@ -2,7 +2,7 @@ "id": "TheLightType:JSON_UNPROVISIONED", "type": "TheLightType", "h":{ - "type": "string", + "type": "Text", "value": "33" } } diff --git a/test/unit/ngsiv2/explicit_attributes-test.js b/test/unit/ngsiv2/explicit_attributes-test.js index bc23f61a7..ff9d7f72a 100755 --- a/test/unit/ngsiv2/explicit_attributes-test.js +++ b/test/unit/ngsiv2/explicit_attributes-test.js @@ -242,7 +242,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); @@ -434,7 +434,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); @@ -506,7 +506,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); @@ -652,7 +652,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); @@ -699,7 +699,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); @@ -771,7 +771,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); @@ -917,7 +917,7 @@ describe('explicitAttrs tests', function () { .post('/v2/entities?options=upsert', { id: 'Sensor:Temperature:JSON_UNPROVISIONED', type: 'Sensor:Temperature', - h: { type: 'string', value: '33' }, + h: { type: 'Text', value: '33' }, temperature: { type: 'Number', value: '89' } }) .reply(204); From 8e5ca24a795340ac3221b3d2b8a5a6a2bc1af336 Mon Sep 17 00:00:00 2001 From: Keshav-NEC Date: Thu, 1 Feb 2024 05:38:05 +0000 Subject: [PATCH 2/4] modified package.json --- CHANGES_NEXT_RELEASE | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index e69de29bb..9bf010993 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -0,0 +1 @@ +- Fix: DEFAULT_ATTRIBUTE_TYPE is changed to Text (#810) diff --git a/package.json b/package.json index 4bab80631..2a92291e9 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "body-parser-xml": "2.0.5", "dateformat": "3.0.3", "express": "4.18.1", - "iotagent-node-lib": "https://github.com/telefonicaid/iotagent-node-lib.git#master", + "iotagent-node-lib": "https://github.com/Keshav-NEC/iotagent-node-lib.git#Fix_for_1569", "logops": "2.1.2", "mqtt": "4.3.7", "sinon": "~6.1.0", From ab59c2029d1195ddbbae1a05e9a689ce42b7bc47 Mon Sep 17 00:00:00 2001 From: Keshav-NEC <102344018+Keshav-NEC@users.noreply.github.com> Date: Thu, 1 Feb 2024 13:17:23 +0530 Subject: [PATCH 3/4] Update CHANGES_NEXT_RELEASE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fermín Galán Márquez --- CHANGES_NEXT_RELEASE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 9bf010993..b95c121e5 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1 @@ -- Fix: DEFAULT_ATTRIBUTE_TYPE is changed to Text (#810) +- Fix: default attribute type changed from 'string' to 'Text' (#810) From 5f6fc33ab0c92202ac3afebd6dc4ca39ff97dd75 Mon Sep 17 00:00:00 2001 From: Keshav-NEC <102344018+Keshav-NEC@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:51:38 +0530 Subject: [PATCH 4/4] Update package.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fermín Galán Márquez --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2a92291e9..4bab80631 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "body-parser-xml": "2.0.5", "dateformat": "3.0.3", "express": "4.18.1", - "iotagent-node-lib": "https://github.com/Keshav-NEC/iotagent-node-lib.git#Fix_for_1569", + "iotagent-node-lib": "https://github.com/telefonicaid/iotagent-node-lib.git#master", "logops": "2.1.2", "mqtt": "4.3.7", "sinon": "~6.1.0",