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

include refactor node lib send update from the scratch #765

Merged
merged 7 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- Fix: binary data representation when sending data through HTTP & MQTT (#690)
- Fix: ensure service and subservice from device in logs about error proccesing message
- Remove: legacy code about unused parsedMessageError flag
- Remove: legacy code about unused parsedMessageError flag
3 changes: 1 addition & 2 deletions test/deviceProvisioning/provisionDeviceTimeinstant2.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
},
{
"type": "DateTime",
"name": "TimeInstant",
"object_id": "t"
"name": "TimeInstant"
}
],
"entity_type": "sensor",
Expand Down
16 changes: 8 additions & 8 deletions test/unit/ngsiv2/HTTP_reveice_measures-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ describe('HTTP: Measure reception ', function () {
url: 'http://localhost:' + config.http.port + '/iot/json',
method: 'POST',
json: {
humidity: '111222',
h: '111222',
pressure: '20',
TimeInstant: '20200222T222222'
TimeInstant: '2020-02-22T22:22:22Z'
},
headers: {
'fiware-service': 'smartgondor',
Expand Down Expand Up @@ -217,9 +217,9 @@ describe('HTTP: Measure reception ', function () {
url: 'http://localhost:' + config.http.port + '/iot/json',
method: 'POST',
json: {
humidity: '111222',
h: '111222',
pressure: '20',
TimeInstant: '20200222T222222'
TimeInstant: '2020-02-22T22:22:22Z'
},
headers: {
'fiware-service': 'smartgondor',
Expand Down Expand Up @@ -280,7 +280,7 @@ describe('HTTP: Measure reception ', function () {
url: 'http://localhost:' + config.http.port + '/iot/json',
method: 'POST',
json: {
humidity: '111222',
h: '111222',
pressure: '20'
},
headers: {
Expand All @@ -290,7 +290,7 @@ describe('HTTP: Measure reception ', function () {
qs: {
i: 'dev0130101',
k: '1234',
t: '20200222T222222'
t: '2020-02-22T22:22:22Z'
}
};
const provisionOptions = {
Expand Down Expand Up @@ -343,7 +343,7 @@ describe('HTTP: Measure reception ', function () {
url: 'http://localhost:' + config.http.port + '/iot/json',
method: 'POST',
json: {
humidity: '111222',
h: '111222',
pressure: '20'
},
headers: {
Expand All @@ -353,7 +353,7 @@ describe('HTTP: Measure reception ', function () {
qs: {
i: 'dev0130101',
k: '1234',
t: '20200222T222222'
t: '2020-02-22T22:22:22Z'
}
};
const provisionOptions = {
Expand Down
17 changes: 9 additions & 8 deletions test/unit/ngsiv2/HTTP_reveice_measures-test2.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ describe('HTTP: Measure reception ', function () {
method: 'POST',
json: [
{
humidity: '111222',
TimeInstant: '20200222T222222'
h: '111222',
TimeInstant: '2020-02-22T22:22:22Z'
},
{
humidity: '111333',
TimeInstant: '20200222T222222'
h: '111333',
TimeInstant: '2020-02-22T22:22:22Z'
}
],
headers: {
Expand Down Expand Up @@ -254,10 +254,11 @@ describe('HTTP: Measure reception ', function () {
method: 'POST',
json: [
{
humidity: '111222'
h: '111222'

},
{
humidity: '111333'
h: '111333'
}
],
headers: {
Expand All @@ -266,8 +267,8 @@ describe('HTTP: Measure reception ', function () {
},
qs: {
i: 'dev0130101',
k: '1234',
t: '20200222T222222'
k: '1234' ,
t:'2020-02-22T22:22:22Z'
}
};
const provisionOptions = {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/ngsiv2/MQTT_receive_measures-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ describe('MQTT: Measure reception ', function () {
const values = {
humidity: '32',
temperature: '87',
TimeInstant: '20071103T131805'
TimeInstant: '2007-11-03T13:18:05Z'
};

mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function (error) {
Expand All @@ -282,7 +282,7 @@ describe('MQTT: Measure reception ', function () {
const values = {
humidity: '32',
temperature: '87',
TimeInstant: '20071103T131805'
TimeInstant: '2007-11-03T13:18:05Z'
};

mqttClient.publish('json/1234/MQTT_2/attrs', JSON.stringify(values), null, function (error) {
Expand Down
8 changes: 4 additions & 4 deletions test/unit/ngsiv2/MQTT_receive_measures-test2.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,12 @@ describe('MQTT: Measure reception ', function () {
{
humidity: '32',
temperature: '87',
TimeInstant: '20071103T131805'
TimeInstant: '2007-11-03T13:18:05Z'
},
{
humidity: '33',
temperature: '89',
TimeInstant: '20071103T131805'
TimeInstant: '2007-11-03T13:18:06Z'
}
];

Expand All @@ -378,12 +378,12 @@ describe('MQTT: Measure reception ', function () {
{
humidity: '32',
temperature: '87',
TimeInstant: '20071103T131805'
TimeInstant: '2007-11-03T13:18:05Z'
},
{
humidity: '33',
temperature: '89',
TimeInstant: '20071103T131805'
TimeInstant: '2007-11-03T13:18:06Z'
}
];

Expand Down
3 changes: 1 addition & 2 deletions test/unit/ngsiv2/attribute-alias_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const config = require('./config-test.js');
const nock = require('nock');
const iotAgentLib = require('iotagent-node-lib');
const async = require('async');

const utils = require('../../utils');
const request = utils.request;
let contextBrokerMock;
Expand Down Expand Up @@ -90,7 +89,7 @@ describe('Attribute alias', function () {
const values = {
humidity: '32',
temperature: '87',
tt: '20071103T131805'
tt: '2007-03-11T12:18:05.000Z'
};

mqttClient.publish('/json/1234/MQTT_2/attrs', JSON.stringify(values), null, function (error) {
Expand Down
10 changes: 3 additions & 7 deletions test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"id":"Second MQTT Device",
"type":"AnMQTTDevice",
"type":"AnMQTTDevice",
"humidity":{
"type": "degrees",
"value": "32"
"value": "32"
},
"temperature":{
"type": "celsius",
"value": "87"
"value": "87"
},
"luminosity": {
"type": "Integer",
Expand All @@ -33,9 +33,5 @@
"enabled": {
"type": "Boolean",
"value": true
},
"alive": {
"type": "Null",
"value": null
}
}
10 changes: 3 additions & 7 deletions test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes2.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"id":"Second MQTT Device",
"type":"AnMQTTDevice",
"type":"AnMQTTDevice",
"humidity":{
"type": "degrees",
"value": "33"
"value": "33"
},
"temperature":{
"type": "celsius",
"value": "89"
"value": "89"
},
"luminosity": {
"type": "Integer",
Expand All @@ -33,9 +33,5 @@
"enabled": {
"type": "Boolean",
"value": true
},
"alive": {
"type": "Null",
"value": null
}
}
10 changes: 2 additions & 8 deletions test/unit/ngsiv2/contextRequests/timeInstantMeasures.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@
"type":"sensor",
"humidity":{
"type": "percent",
"value": "111222",
"metadata": {
"TimeInstant":{
"type": "DateTime",
"value": "+002020-02-22T22:22:22"
}
}
"value": "111222"
},
"TimeInstant":{
"type": "DateTime",
"value": "+002020-02-22T22:22:22"
"value": "2020-02-22T22:22:22Z"
}
}
13 changes: 3 additions & 10 deletions test/unit/ngsiv2/contextRequests/timeInstantMeasures2.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
{
"id":"e0130101",
"type":"sensor",
"type":"sensor",
"humidity":{
"type": "percent",
"value": "111333",
"metadata": {
"TimeInstant":{
"type": "DateTime",
"value": "+002020-02-22T22:22:22"
}
}
"value": "111333"
},

"TimeInstant":{
"type": "DateTime",
"value": "+002020-02-22T22:22:22"
"value": "2020-02-22T22:22:22Z"
}
}
18 changes: 3 additions & 15 deletions test/unit/ngsiv2/contextRequests/timeInstantMeasures3.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,14 @@
"type":"sensor",
"humidity":{
"type": "percent",
"value": "111222",
"metadata": {
"TimeInstant":{
"type": "DateTime",
"value": "+002020-02-22T22:22:22"
}
}
"value": "111222"
},
"pressure":{
"type": "string",
"value": "20",
"metadata": {
"TimeInstant":{
"type": "DateTime",
"value": "+002020-02-22T22:22:22"
}
}
"value": "20"
},
"TimeInstant":{
"type": "DateTime",
"value": "+002020-02-22T22:22:22"
"value": "2020-02-22T22:22:22Z"
}
}
12 changes: 3 additions & 9 deletions test/unit/ngsiv2/contextRequests/timeInstantMeasuresB.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
{
"id":"e0130101",
"type":"sensor",
"type":"sensor",
"TimeInstant":{
"type": "DateTime",
"value": "+002020-02-22T22:22:22"
"value": "2020-02-22T22:22:22Z"
},
"humidity":{
"type": "percent",
"value": "111222",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "+002020-02-22T22:22:22"
}
}
"value": "111222"
}
}
4 changes: 2 additions & 2 deletions test/unit/ngsiv2/contextRequests/timestampAliasMeasure.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id":"Second MQTT Device",
"type":"AnMQTTDevice",
"type":"AnMQTTDevice",
"humidity":{
"type":"degrees",
"value":"32"
Expand All @@ -11,6 +11,6 @@
},
"TimeInstant":{
"type":"DateTime",
"value": "+002007-11-03T13:18:05"
"value": "2007-03-11T12:18:05.000Z"
}
}
18 changes: 3 additions & 15 deletions test/unit/ngsiv2/contextRequests/timestampMeasure.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,14 @@
"type":"AnMQTTDevice",
"humidity":{
"type": "degrees",
"value": "32",
"metadata": {
"TimeInstant":{
"type": "DateTime",
"value": "+002007-11-03T13:18:05"
}
}
"value": "32"
},
"temperature":{
"type": "celsius",
"value": "87",
"metadata": {
"TimeInstant":{
"type": "DateTime",
"value": "+002007-11-03T13:18:05"
}
}
"value": "87"
},
"TimeInstant":{
"type": "DateTime",
"value": "+002007-11-03T13:18:05"
"value": "2007-11-03T13:18:05Z"
}
}
Loading
Loading