iotagent-node-lib 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +1 -0
- package/CHANGES_NEXT_RELEASE +2 -0
- package/docker-compose-dev.yml +1 -1
- package/lib/services/ngsi/entities-NGSI-LD.js +2 -16
- package/lib/services/ngsi/entities-NGSI-v2.js +4 -16
- package/package.json +2 -2
- package/test/unit/general/config-multi-core-test.js +2 -1
- package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +2 -1
- package/test/unit/general/deviceService-test.js +2 -1
- package/test/unit/general/loglevel-api_test.js +2 -1
- package/test/unit/general/startup-test.js +2 -1
- package/test/unit/general/statistics-persistence_test.js +1 -0
- package/test/unit/general/statistics-service_test.js +1 -0
- package/test/unit/lazyAndCommands/commandRegistry_test.js +1 -0
- package/test/unit/memoryRegistry/deviceRegistryMemory_test.js +1 -0
- package/test/unit/mongodb/mongodb-connectionoptions-test.js +1 -0
- package/test/unit/mongodb/mongodb-group-registry-test.js +1 -0
- package/test/unit/mongodb/mongodb-registry-test.js +2 -1
- package/test/unit/ngsi-ld/expressions/expressionBasedTransformations-test.js +2 -1
- package/test/unit/ngsi-ld/general/config-jsonld-contexts-test.js +2 -1
- package/test/unit/ngsi-ld/general/contextBrokerOAuthSecurityAccess-test.js +2 -1
- package/test/unit/ngsi-ld/general/deviceService-test.js +2 -1
- package/test/unit/ngsi-ld/general/https-support-test.js +2 -1
- package/test/unit/ngsi-ld/general/iotam-autoregistration-test.js +2 -1
- package/test/unit/ngsi-ld/general/startup-test.js +3 -2
- package/test/unit/ngsi-ld/lazyAndCommands/active-devices-attribute-update-test.js +2 -1
- package/test/unit/ngsi-ld/lazyAndCommands/command-test.js +5 -7
- package/test/unit/ngsi-ld/lazyAndCommands/lazy-devices-test.js +8 -6
- package/test/unit/ngsi-ld/lazyAndCommands/merge-patch-test.js +18 -22
- package/test/unit/ngsi-ld/lazyAndCommands/polling-commands-test.js +2 -1
- package/test/unit/ngsi-ld/ngsiService/active-devices-test.js +2 -1
- package/test/unit/ngsi-ld/ngsiService/autocast-test.js +2 -1
- package/test/unit/ngsi-ld/ngsiService/geoproperties-test.js +2 -1
- package/test/unit/ngsi-ld/ngsiService/languageProperties-test.js +32 -34
- package/test/unit/ngsi-ld/ngsiService/staticAttributes-test.js +2 -1
- package/test/unit/ngsi-ld/ngsiService/subscriptions-test.js +2 -1
- package/test/unit/ngsi-ld/ngsiService/unsupported-endpoints-test.js +11 -15
- package/test/unit/ngsi-ld/plugins/alias-plugin_test.js +2 -1
- package/test/unit/ngsi-ld/plugins/bidirectional-plugin_test.js +2 -1
- package/test/unit/ngsi-ld/plugins/compress-timestamp-plugin_test.js +2 -1
- package/test/unit/ngsi-ld/plugins/multientity-plugin_test.js +2 -1
- package/test/unit/ngsi-ld/plugins/timestamp-processing-plugin_test.js +2 -1
- package/test/unit/ngsi-ld/provisioning/device-provisioning-api_test.js +1 -0
- package/test/unit/ngsi-ld/provisioning/device-registration_test.js +2 -1
- package/test/unit/ngsi-ld/provisioning/device-update-registration_test.js +15 -12
- package/test/unit/ngsi-ld/provisioning/listProvisionedDevices-test.js +1 -0
- package/test/unit/ngsi-ld/provisioning/provisionDeviceMultientity-test.js +1 -0
- package/test/unit/ngsi-ld/provisioning/removeProvisionedDevice-test.js +1 -0
- package/test/unit/ngsi-ld/provisioning/singleConfigurationMode-test.js +1 -0
- package/test/unit/ngsi-ld/provisioning/updateProvisionedDevices-test.js +1 -0
- package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +13 -7
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin32.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextProcessTimestamp.json +7 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverride.json +7 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverrideWithoutMilis.json +7 -1
- package/test/unit/ngsiv2/expressions/expressionBasedTransformations-test.js +2 -1
- package/test/unit/ngsiv2/expressions/expressionCombinedTransformations-test.js +4 -2
- package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +4 -2
- package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +2 -1
- package/test/unit/ngsiv2/general/deviceService-test.js +2 -1
- package/test/unit/ngsiv2/general/https-support-test.js +2 -1
- package/test/unit/ngsiv2/general/iotam-autoregistration-test.js +2 -1
- package/test/unit/ngsiv2/general/startup-test.js +2 -1
- package/test/unit/ngsiv2/lazyAndCommands/active-devices-attribute-update-test.js +2 -1
- package/test/unit/ngsiv2/lazyAndCommands/command-test.js +2 -1
- package/test/unit/ngsiv2/lazyAndCommands/lazy-devices-test.js +8 -6
- package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +2 -1
- package/test/unit/ngsiv2/ngsiService/active-devices-test.js +3 -2
- package/test/unit/ngsiv2/ngsiService/autocast-test.js +2 -1
- package/test/unit/ngsiv2/ngsiService/queryDeviceInformationInCb-test.js +2 -1
- package/test/unit/ngsiv2/ngsiService/staticAttributes-test.js +2 -1
- package/test/unit/ngsiv2/ngsiService/subscriptions-test.js +2 -1
- package/test/unit/ngsiv2/plugins/alias-plugin_test.js +2 -1
- package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +2 -1
- package/test/unit/ngsiv2/plugins/compress-timestamp-plugin_test.js +2 -1
- package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +2 -1
- package/test/unit/ngsiv2/plugins/timestamp-processing-plugin_test.js +2 -1
- package/test/unit/ngsiv2/provisioning/device-group-api-test.js +1 -0
- package/test/unit/ngsiv2/provisioning/device-group-utils-test.js +1 -0
- package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +1 -0
- package/test/unit/ngsiv2/provisioning/device-registration_test.js +2 -1
- package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +15 -12
- package/test/unit/ngsiv2/provisioning/listProvisionedDevices-test.js +1 -0
- package/test/unit/ngsiv2/provisioning/provisionDeviceMultientity-test.js +1 -0
- package/test/unit/ngsiv2/provisioning/removeProvisionedDevice-test.js +1 -0
- package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +1 -0
- package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +1 -0
- package/test/unit/plugins/capture-configuration-inPlugins_test.js +2 -1
- package/test/unit/plugins/capture-provision-inPlugins_test.js +2 -1
|
@@ -40,7 +40,8 @@ const iotAgentConfig = {
|
|
|
40
40
|
jsonLdContext: 'http://context.json-ld'
|
|
41
41
|
},
|
|
42
42
|
server: {
|
|
43
|
-
port: 4041
|
|
43
|
+
port: 4041,
|
|
44
|
+
host: 'localhost'
|
|
44
45
|
},
|
|
45
46
|
types: {},
|
|
46
47
|
service: 'smartgondor',
|
|
@@ -48,7 +49,6 @@ const iotAgentConfig = {
|
|
|
48
49
|
providerUrl: 'http://smartgondor.com'
|
|
49
50
|
};
|
|
50
51
|
|
|
51
|
-
|
|
52
52
|
const iotAgentConfigWithLimitedSupport = {
|
|
53
53
|
contextBroker: {
|
|
54
54
|
host: '192.168.1.1',
|
|
@@ -58,10 +58,11 @@ const iotAgentConfigWithLimitedSupport = {
|
|
|
58
58
|
},
|
|
59
59
|
server: {
|
|
60
60
|
port: 4041,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
host: 'localhost',
|
|
62
|
+
ldSupport: {
|
|
63
|
+
null: false,
|
|
64
|
+
datasetId: false
|
|
65
|
+
}
|
|
65
66
|
},
|
|
66
67
|
types: {
|
|
67
68
|
Robot: {
|
|
@@ -91,7 +92,6 @@ const device = {
|
|
|
91
92
|
service: 'smartgondor'
|
|
92
93
|
};
|
|
93
94
|
|
|
94
|
-
|
|
95
95
|
describe('NGSI-LD - Unsupported Endpoints', function () {
|
|
96
96
|
beforeEach(function (done) {
|
|
97
97
|
iotAgentLib.activate(iotAgentConfig, function () {
|
|
@@ -153,7 +153,6 @@ describe('NGSI-LD - Unsupported Endpoints', function () {
|
|
|
153
153
|
});
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
-
|
|
157
156
|
it('PUT /entities/<entity-id> includes an NGSI-LD Null should return a valid NSGI-LD error message', function (done) {
|
|
158
157
|
const options = {
|
|
159
158
|
url:
|
|
@@ -162,7 +161,7 @@ describe('NGSI-LD - Unsupported Endpoints', function () {
|
|
|
162
161
|
'/ngsi-ld/v1/entities/urn:ngsi-ld:entity/attrs/att',
|
|
163
162
|
method: 'PUT',
|
|
164
163
|
json: {
|
|
165
|
-
|
|
164
|
+
value: 'urn:ngsi-ld:null'
|
|
166
165
|
},
|
|
167
166
|
headers: {
|
|
168
167
|
'fiware-service': 'smartgondor',
|
|
@@ -194,7 +193,6 @@ describe('NGSI-LD - Limiting Support', function () {
|
|
|
194
193
|
.post('/ngsi-ld/v1/entityOperations/upsert/')
|
|
195
194
|
.reply(204);
|
|
196
195
|
|
|
197
|
-
|
|
198
196
|
iotAgentLib.activate(iotAgentConfigWithLimitedSupport, function () {
|
|
199
197
|
iotAgentLib.clearAll(function () {
|
|
200
198
|
done();
|
|
@@ -217,7 +215,7 @@ describe('NGSI-LD - Limiting Support', function () {
|
|
|
217
215
|
'/ngsi-ld/v1/entities/urn:ngsi-ld:Robot:r2d2/attrs/position',
|
|
218
216
|
method: 'PATCH',
|
|
219
217
|
json: {
|
|
220
|
-
|
|
218
|
+
value: 'urn:ngsi-ld:null'
|
|
221
219
|
},
|
|
222
220
|
headers: {
|
|
223
221
|
'fiware-service': 'smartgondor',
|
|
@@ -235,9 +233,8 @@ describe('NGSI-LD - Limiting Support', function () {
|
|
|
235
233
|
done();
|
|
236
234
|
});
|
|
237
235
|
});
|
|
238
|
-
|
|
239
236
|
});
|
|
240
|
-
});
|
|
237
|
+
});
|
|
241
238
|
describe('When sending a payload including a datasetId when datasetIds are unsupported ', function () {
|
|
242
239
|
it('should return a valid NSGI-LD error message', function (done) {
|
|
243
240
|
const options = {
|
|
@@ -276,7 +273,6 @@ describe('NGSI-LD - Limiting Support', function () {
|
|
|
276
273
|
done();
|
|
277
274
|
});
|
|
278
275
|
});
|
|
279
|
-
|
|
280
276
|
});
|
|
281
|
-
});
|
|
277
|
+
});
|
|
282
278
|
});
|
|
@@ -40,7 +40,8 @@ const iotAgentConfig = {
|
|
|
40
40
|
jsonLdContext: 'http://context.json-ld'
|
|
41
41
|
},
|
|
42
42
|
server: {
|
|
43
|
-
port: 4041
|
|
43
|
+
port: 4041,
|
|
44
|
+
host: 'localhost'
|
|
44
45
|
},
|
|
45
46
|
types: {
|
|
46
47
|
Light: {
|
|
@@ -244,17 +245,19 @@ describe('NGSI-LD - IoT Agent Device Update Registration', function () {
|
|
|
244
245
|
});
|
|
245
246
|
it('should store the new values in the registry', function (done) {
|
|
246
247
|
iotAgentLib.updateRegister(deviceCommandUpdated, false, function (error, data) {
|
|
247
|
-
iotAgentLib.getDevice(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
248
|
+
iotAgentLib.getDevice(
|
|
249
|
+
deviceCommandUpdated.id,
|
|
250
|
+
'smartgondor',
|
|
251
|
+
'gardens',
|
|
252
|
+
function (error, deviceResult) {
|
|
253
|
+
should.not.exist(error);
|
|
254
|
+
should.exist(deviceResult);
|
|
255
|
+
deviceResult.internalId.should.equal(deviceUpdated.internalId);
|
|
256
|
+
deviceResult.commands[0].name.should.equal('move');
|
|
257
|
+
deviceResult.active[0].name.should.equal('temperature');
|
|
258
|
+
done();
|
|
259
|
+
}
|
|
260
|
+
);
|
|
258
261
|
});
|
|
259
262
|
});
|
|
260
263
|
});
|
|
@@ -40,6 +40,7 @@ const iotAgentConfig = {
|
|
|
40
40
|
server: {
|
|
41
41
|
name: 'testAgent',
|
|
42
42
|
port: 4041,
|
|
43
|
+
host: 'localhost',
|
|
43
44
|
baseRoot: '/'
|
|
44
45
|
},
|
|
45
46
|
types: {},
|
|
@@ -268,13 +269,18 @@ describe('Mixed Mode: ngsiVersion test', function () {
|
|
|
268
269
|
});
|
|
269
270
|
});
|
|
270
271
|
it('should operate using NGSI-v2', function (done) {
|
|
271
|
-
iotAgentLib.update(
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
272
|
+
iotAgentLib.update(
|
|
273
|
+
'light2',
|
|
274
|
+
'Device',
|
|
275
|
+
'v2-test',
|
|
276
|
+
values,
|
|
277
|
+
{ ngsiVersion: 'v2', type: 'Device' },
|
|
278
|
+
function (error) {
|
|
279
|
+
should.not.exist(error);
|
|
280
|
+
contextBrokerMock.done();
|
|
281
|
+
done();
|
|
282
|
+
}
|
|
283
|
+
);
|
|
278
284
|
});
|
|
279
285
|
});
|
|
280
286
|
});
|
|
@@ -38,7 +38,8 @@ const iotAgentConfigJexl = {
|
|
|
38
38
|
ngsiVersion: 'v2'
|
|
39
39
|
},
|
|
40
40
|
server: {
|
|
41
|
-
port: 4041
|
|
41
|
+
port: 4041,
|
|
42
|
+
host: 'localhost'
|
|
42
43
|
},
|
|
43
44
|
defaultExpressionLanguage: 'jexl',
|
|
44
45
|
types: {
|
|
@@ -83,7 +84,8 @@ const iotAgentConfigLegacy = {
|
|
|
83
84
|
ngsiVersion: 'v2'
|
|
84
85
|
},
|
|
85
86
|
server: {
|
|
86
|
-
port: 4041
|
|
87
|
+
port: 4041,
|
|
88
|
+
host: 'localhost'
|
|
87
89
|
},
|
|
88
90
|
types: {
|
|
89
91
|
WeatherStationLegacy: {
|
|
@@ -41,7 +41,8 @@ const iotAgentConfig = {
|
|
|
41
41
|
},
|
|
42
42
|
defaultExpressionLanguage: 'jexl',
|
|
43
43
|
server: {
|
|
44
|
-
port: 4041
|
|
44
|
+
port: 4041,
|
|
45
|
+
host: 'localhost'
|
|
45
46
|
},
|
|
46
47
|
types: {
|
|
47
48
|
Light: {
|
|
@@ -389,7 +390,8 @@ const iotAgentConfigTS = {
|
|
|
389
390
|
},
|
|
390
391
|
defaultExpressionLanguage: 'jexl',
|
|
391
392
|
server: {
|
|
392
|
-
port: 4041
|
|
393
|
+
port: 4041,
|
|
394
|
+
host: 'localhost'
|
|
393
395
|
},
|
|
394
396
|
types: {
|
|
395
397
|
GPS: {
|
|
@@ -45,7 +45,8 @@ const iotAgentConfig = {
|
|
|
45
45
|
ngsiVersion: 'v2'
|
|
46
46
|
},
|
|
47
47
|
server: {
|
|
48
|
-
port: 4041
|
|
48
|
+
port: 4041,
|
|
49
|
+
host: 'localhost'
|
|
49
50
|
},
|
|
50
51
|
types: {
|
|
51
52
|
Light: {
|
|
@@ -343,11 +344,12 @@ describe('NGSI-v2 - IoT Agent Lazy Devices', function () {
|
|
|
343
344
|
.post('/v2/entities?options=upsert')
|
|
344
345
|
.reply(204);
|
|
345
346
|
|
|
346
|
-
async.series(
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
347
|
+
async.series(
|
|
348
|
+
[apply(iotAgentLib.activate, iotAgentConfig), apply(iotAgentLib.register, device1)],
|
|
349
|
+
function (error) {
|
|
350
|
+
done();
|
|
351
|
+
}
|
|
352
|
+
);
|
|
351
353
|
});
|
|
352
354
|
|
|
353
355
|
it('should not give any error', function (done) {
|
|
@@ -40,7 +40,8 @@ const iotAgentConfig = {
|
|
|
40
40
|
ngsiVersion: 'v2'
|
|
41
41
|
},
|
|
42
42
|
server: {
|
|
43
|
-
port: 4041
|
|
43
|
+
port: 4041,
|
|
44
|
+
host: 'localhost'
|
|
44
45
|
},
|
|
45
46
|
types: {
|
|
46
47
|
Light: {
|
|
@@ -463,7 +464,7 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
463
464
|
done();
|
|
464
465
|
});
|
|
465
466
|
|
|
466
|
-
it('should not override the received instant and should
|
|
467
|
+
it('should not override the received instant and should add metadatas for this request', function (done) {
|
|
467
468
|
iotAgentLib.update('light1', 'Light', '', modifiedValues, function (error) {
|
|
468
469
|
should.not.exist(error);
|
|
469
470
|
contextBrokerMock.done();
|