iotagent-node-lib 3.1.0 → 3.3.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/ISSUE_TEMPLATE/bug_report.yml +134 -0
- package/.github/ISSUE_TEMPLATE/config.yml +16 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +55 -0
- package/.github/advanced-issue-labeler.yml +30 -0
- package/.github/workflows/issue-labeler.yml +43 -0
- package/CHANGES_NEXT_RELEASE +0 -2
- package/config.js +5 -5
- package/doc/api.md +1483 -298
- package/doc/deprecated.md +7 -1
- package/doc/development.md +120 -0
- package/doc/howto.md +58 -62
- package/doc/installationguide.md +3 -11
- package/doc/requirements.txt +1 -1
- package/docker/Mosquitto/Dockerfile +1 -1
- package/lib/commonConfig.js +7 -10
- package/lib/fiware-iotagent-lib.js +0 -10
- package/lib/jexlTranformsMap.js +2 -1
- package/lib/model/Device.js +0 -1
- package/lib/model/Group.js +0 -1
- package/lib/model/dbConn.js +1 -7
- package/lib/plugins/bidirectionalData.js +8 -26
- package/lib/plugins/expressionPlugin.js +8 -40
- package/lib/plugins/jexlParser.js +28 -0
- package/lib/services/commands/commandService.js +1 -1
- package/lib/services/common/iotManagerService.js +0 -1
- package/lib/services/devices/deviceRegistryMongoDB.js +10 -10
- package/lib/services/devices/deviceService.js +16 -20
- package/lib/services/devices/devices-NGSI-v2.js +2 -5
- package/lib/services/ngsi/entities-NGSI-LD.js +16 -60
- package/lib/services/ngsi/entities-NGSI-v2.js +179 -119
- package/lib/services/northBound/deviceProvisioningServer.js +17 -17
- package/lib/templates/createDevice.json +5 -6
- package/lib/templates/createDeviceLax.json +6 -8
- package/lib/templates/deviceGroup.json +1 -5
- package/lib/templates/updateDevice.json +9 -2
- package/lib/templates/updateDeviceLax.json +14 -5
- package/package.json +1 -1
- package/scripts/legacy_expression_tool/README.md +262 -0
- package/scripts/legacy_expression_tool/legacy_expression_tool.py +423 -0
- package/scripts/legacy_expression_tool/requirements.txt +3 -0
- package/test/unit/examples/deviceProvisioningRequests/provisionBidirectionalDevice.json +5 -5
- package/test/unit/examples/groupProvisioningRequests/bidirectionalGroup.json +4 -4
- package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +3 -13
- package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +0 -2
- package/test/unit/ngsi-ld/lazyAndCommands/merge-patch-test.js +31 -30
- package/test/unit/ngsi-ld/plugins/bidirectional-plugin_test.js +8 -8
- package/test/unit/ngsi-ld/plugins/custom-plugin_test.js +152 -0
- package/test/unit/ngsi-ld/plugins/multientity-plugin_test.js +1 -1
- package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +33 -37
- package/test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice4.json +5 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContext.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContext1.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContext3WithStatic.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContext4.json +4 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContext5.json +12 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContext6.json +10 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin1.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin2.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin3.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin4.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin5.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin6.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin7.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin8.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin9.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast1.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast2.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast3.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast4.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast5.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast6.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast7.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandError.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandExpired.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandFinish.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandStatus.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandStatus2.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCompressTimestamp1.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextCompressTimestamp2.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin1.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin11.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin12.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin13.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin2.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin29.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin3.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin30.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin31.json +2 -8
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin32.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin33.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin35.json +22 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin36.json +1 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin4.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin40.json +42 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin41.json +33 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin5.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin6.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin7.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin8.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin9.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionSkip.json +12 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityJexlExpressionPlugin1.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin1.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin10.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin11.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin12.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin13.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin14.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin15.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin16.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin17.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin2.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin25.json +37 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin3.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin4.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin5.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin6.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin7.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin8.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin9.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin1.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin2.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin3.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin4.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextProcessTimestamp.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributes.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributesMetadata.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestamp.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampFalse.json +12 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampFalseTimeInstant.json +12 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverride.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverrideWithoutMilis.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampTimezone.json +3 -1
- package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +355 -75
- package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +18 -51
- package/test/unit/ngsiv2/general/https-support-test.js +1 -5
- package/test/unit/ngsiv2/lazyAndCommands/command-test.js +4 -10
- package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +9 -26
- package/test/unit/ngsiv2/ngsiService/active-devices-test.js +143 -57
- package/test/unit/ngsiv2/ngsiService/autocast-test.js +14 -21
- package/test/unit/ngsiv2/ngsiService/staticAttributes-test.js +3 -5
- package/test/unit/ngsiv2/ngsiService/subscriptions-test.js +1 -10
- package/test/unit/ngsiv2/plugins/alias-plugin_test.js +20 -30
- package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +6 -69
- package/test/unit/ngsiv2/plugins/compress-timestamp-plugin_test.js +4 -6
- package/test/unit/ngsiv2/plugins/custom-plugin_test.js +150 -0
- package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +87 -16
- package/test/unit/ngsiv2/plugins/timestamp-processing-plugin_test.js +2 -3
- package/test/unit/ngsiv2/provisioning/device-group-api-test.js +2 -3
- package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +15 -55
- package/test/unit/ngsiv2/provisioning/device-registration_test.js +1 -7
- package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +2 -9
- package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +0 -11
- package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +0 -7
- package/test/unit/plugins/capture-provision-inPlugins_test.js +0 -6
- package/doc/advanced-topics.md +0 -626
- package/doc/expressionLanguage.md +0 -762
- package/lib/plugins/expressionParser.js +0 -205
- package/test/unit/expressions/expression-test.js +0 -197
- package/test/unit/ngsi-ld/expressions/expressionBasedTransformations-test.js +0 -882
- package/test/unit/ngsiv2/expressions/expressionBasedTransformations-test.js +0 -951
- package/test/unit/ngsiv2/expressions/expressionCombinedTransformations-test.js +0 -296
|
@@ -100,15 +100,6 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
100
100
|
)
|
|
101
101
|
)
|
|
102
102
|
.reply(201, null, { Location: '/v2/registrations/6319a7f5254b05844116584d' });
|
|
103
|
-
|
|
104
|
-
contextBrokerMock
|
|
105
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
106
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
107
|
-
.post(
|
|
108
|
-
'/v2/entities?options=upsert',
|
|
109
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createProvisionedDevice.json')
|
|
110
|
-
)
|
|
111
|
-
.reply(204);
|
|
112
103
|
});
|
|
113
104
|
|
|
114
105
|
const options = {
|
|
@@ -214,7 +205,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
214
205
|
});
|
|
215
206
|
});
|
|
216
207
|
|
|
217
|
-
it('should create the initial entity in the Context Broker', function (done) {
|
|
208
|
+
it('should not create the initial entity in the Context Broker', function (done) {
|
|
218
209
|
request(options, function (error, response, body) {
|
|
219
210
|
response.statusCode.should.equal(201);
|
|
220
211
|
iotAgentLib.listDevices('smartgondor', '/gardens', function (error, results) {
|
|
@@ -248,15 +239,6 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
248
239
|
|
|
249
240
|
beforeEach(function (done) {
|
|
250
241
|
nock.cleanAll();
|
|
251
|
-
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
252
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
253
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
254
|
-
.post(
|
|
255
|
-
'/v2/entities?options=upsert',
|
|
256
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createTimeinstantDevice.json')
|
|
257
|
-
)
|
|
258
|
-
.reply(204);
|
|
259
|
-
|
|
260
242
|
done();
|
|
261
243
|
});
|
|
262
244
|
|
|
@@ -292,15 +274,6 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
292
274
|
|
|
293
275
|
beforeEach(function (done) {
|
|
294
276
|
nock.cleanAll();
|
|
295
|
-
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
296
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
297
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
298
|
-
.post(
|
|
299
|
-
'/v2/entities?options=upsert',
|
|
300
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createTimeinstantDevice.json')
|
|
301
|
-
)
|
|
302
|
-
.reply(204);
|
|
303
|
-
|
|
304
277
|
done();
|
|
305
278
|
});
|
|
306
279
|
|
|
@@ -336,15 +309,6 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
336
309
|
|
|
337
310
|
beforeEach(function (done) {
|
|
338
311
|
nock.cleanAll();
|
|
339
|
-
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
340
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
341
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
342
|
-
.post(
|
|
343
|
-
'/v2/entities?options=upsert',
|
|
344
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/createExplicitAttrsDevice.json')
|
|
345
|
-
)
|
|
346
|
-
.reply(204);
|
|
347
|
-
|
|
348
312
|
done();
|
|
349
313
|
});
|
|
350
314
|
|
|
@@ -394,17 +358,6 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
394
358
|
|
|
395
359
|
beforeEach(function (done) {
|
|
396
360
|
nock.cleanAll();
|
|
397
|
-
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
398
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
399
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
400
|
-
.post(
|
|
401
|
-
'/v2/entities?options=upsert',
|
|
402
|
-
utils.readExampleFile(
|
|
403
|
-
'./test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice.json'
|
|
404
|
-
)
|
|
405
|
-
)
|
|
406
|
-
.reply(204);
|
|
407
|
-
|
|
408
361
|
done();
|
|
409
362
|
});
|
|
410
363
|
|
|
@@ -552,12 +505,12 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
552
505
|
done();
|
|
553
506
|
});
|
|
554
507
|
|
|
555
|
-
it('should store the device with static attributes provided in configuration', function (done) {
|
|
508
|
+
it('should not store the device with static attributes provided in configuration', function (done) {
|
|
556
509
|
request(groupCreation, function (error, response, body) {
|
|
557
510
|
request(options, function (error, response, body) {
|
|
558
511
|
iotAgentLib.listDevices('smartgondor', '/gardens', function (error, results) {
|
|
559
512
|
should.exist(results.devices[0].staticAttributes);
|
|
560
|
-
results.devices[0].staticAttributes
|
|
513
|
+
results.devices[0].staticAttributes.length.should.equal(0);
|
|
561
514
|
done();
|
|
562
515
|
});
|
|
563
516
|
});
|
|
@@ -692,12 +645,12 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
692
645
|
done();
|
|
693
646
|
});
|
|
694
647
|
|
|
695
|
-
it('should store the device with static attributes provided in
|
|
648
|
+
it('should store the device with static attributes provided in device but no in configuration', function (done) {
|
|
696
649
|
request(groupCreation, function (error, response, body) {
|
|
697
650
|
request(options, function (error, response, body) {
|
|
698
651
|
iotAgentLib.listDevices('smartgondor', '/gardens', function (error, results) {
|
|
699
652
|
should.exist(results.devices[0].staticAttributes);
|
|
700
|
-
results.devices[0].staticAttributes.length.should.equal(
|
|
653
|
+
results.devices[0].staticAttributes.length.should.equal(1);
|
|
701
654
|
done();
|
|
702
655
|
});
|
|
703
656
|
});
|
|
@@ -726,8 +679,15 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
726
679
|
apikey: '801230BJKL23Y9090DSFL123HJK09H324HV8732',
|
|
727
680
|
/*jshint camelcase: false */
|
|
728
681
|
entity_type: 'MicroLights',
|
|
729
|
-
entityNameExp: '
|
|
730
|
-
cbHost: 'http://192.168.1.1:1026'
|
|
682
|
+
entityNameExp: "id + '__' + suffix_st",
|
|
683
|
+
cbHost: 'http://192.168.1.1:1026',
|
|
684
|
+
static_attributes: [
|
|
685
|
+
{
|
|
686
|
+
name: 'suffix_st',
|
|
687
|
+
type: 'Text',
|
|
688
|
+
value: 'SUFFIX'
|
|
689
|
+
}
|
|
690
|
+
]
|
|
731
691
|
}
|
|
732
692
|
]
|
|
733
693
|
},
|
|
@@ -758,7 +718,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
|
|
|
758
718
|
request(options, function (error, response, body) {
|
|
759
719
|
iotAgentLib.listDevices('smartgondor', '/gardens', function (error, results) {
|
|
760
720
|
should.exist(results.devices[0].name);
|
|
761
|
-
results.devices[0].name.should.equal('
|
|
721
|
+
results.devices[0].name.should.equal('MicroLight1__SUFFIX');
|
|
762
722
|
done();
|
|
763
723
|
});
|
|
764
724
|
});
|
|
@@ -112,11 +112,7 @@ describe('NGSI-v2 - IoT Agent Device Registration', function () {
|
|
|
112
112
|
// This mock does not check the payload since the aim of the test is not to verify
|
|
113
113
|
// device provisioning functionality. Appropriate verification is done in tests under
|
|
114
114
|
// provisioning folder
|
|
115
|
-
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
116
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
117
|
-
.matchHeader('fiware-servicepath', 'gardens')
|
|
118
|
-
.post('/v2/entities?options=upsert')
|
|
119
|
-
.reply(204);
|
|
115
|
+
contextBrokerMock = nock('http://192.168.1.1:1026');
|
|
120
116
|
|
|
121
117
|
const nockBody = utils.readExampleFile(
|
|
122
118
|
'./test/unit/ngsiv2/examples/contextAvailabilityRequests/registerIoTAgent1.json'
|
|
@@ -279,7 +275,6 @@ describe('NGSI-v2 - IoT Agent Device Registration', function () {
|
|
|
279
275
|
// This mock does not check the payload since the aim of the test is not to verify
|
|
280
276
|
// device provisioning functionality. Appropriate verification is done in tests under
|
|
281
277
|
// provisioning folder
|
|
282
|
-
contextBrokerMock.post('/v2/entities?options=upsert').reply(204);
|
|
283
278
|
|
|
284
279
|
contextBrokerMock
|
|
285
280
|
.post('/v2/registrations')
|
|
@@ -288,7 +283,6 @@ describe('NGSI-v2 - IoT Agent Device Registration', function () {
|
|
|
288
283
|
// This mock does not check the payload since the aim of the test is not to verify
|
|
289
284
|
// device provisioning functionality. Appropriate verification is done in tests under
|
|
290
285
|
// provisioning folder
|
|
291
|
-
contextBrokerMock.post('/v2/entities?options=upsert').reply(204);
|
|
292
286
|
|
|
293
287
|
contextBrokerMock
|
|
294
288
|
.delete('/v2/registrations/6319a7f5254b05844116584d', '')
|
|
@@ -148,15 +148,6 @@ describe('NGSI-v2 - IoT Agent Device Update Registration', function () {
|
|
|
148
148
|
.post('/v2/registrations')
|
|
149
149
|
.reply(201, null, { Location: '/v2/registrations/6319a7f5254b05844116584d' });
|
|
150
150
|
|
|
151
|
-
// This mock does not check the payload since the aim of the test is not to verify
|
|
152
|
-
// device provisioning functionality. Appropriate verification is done in tests under
|
|
153
|
-
// provisioning folder
|
|
154
|
-
contextBrokerMock
|
|
155
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
156
|
-
.matchHeader('fiware-servicepath', 'gardens')
|
|
157
|
-
.post('/v2/entities?options=upsert')
|
|
158
|
-
.reply(204);
|
|
159
|
-
|
|
160
151
|
iotAgentLib.activate(iotAgentConfig, function (error) {
|
|
161
152
|
iotAgentLib.register(device1, function (error) {
|
|
162
153
|
done();
|
|
@@ -212,6 +203,7 @@ describe('NGSI-v2 - IoT Agent Device Update Registration', function () {
|
|
|
212
203
|
done();
|
|
213
204
|
});
|
|
214
205
|
});
|
|
206
|
+
|
|
215
207
|
it('should store the new values in the registry', function (done) {
|
|
216
208
|
iotAgentLib.updateRegister(deviceUpdated, false, function (error, data) {
|
|
217
209
|
iotAgentLib.getDevice(deviceUpdated.id, 'smartgondor', 'gardens', function (error, deviceResult) {
|
|
@@ -267,6 +259,7 @@ describe('NGSI-v2 - IoT Agent Device Update Registration', function () {
|
|
|
267
259
|
done();
|
|
268
260
|
});
|
|
269
261
|
});
|
|
262
|
+
|
|
270
263
|
it('should store the new values in the registry', function (done) {
|
|
271
264
|
iotAgentLib.updateRegister(deviceCommandUpdated, false, function (error, data) {
|
|
272
265
|
iotAgentLib.getDevice(
|
|
@@ -288,17 +288,6 @@ describe('NGSI-v2 - Provisioning API: Single service mode', function () {
|
|
|
288
288
|
)
|
|
289
289
|
.reply(201, null, { Location: '/v2/registrations/6319a7f5254b05844116584d' });
|
|
290
290
|
|
|
291
|
-
contextBrokerMock
|
|
292
|
-
.matchHeader('fiware-service', 'testservice')
|
|
293
|
-
.matchHeader('fiware-servicepath', '/testingPath')
|
|
294
|
-
.post(
|
|
295
|
-
'/v2/entities?options=upsert',
|
|
296
|
-
utils.readExampleFile(
|
|
297
|
-
'./test/unit/ngsiv2/examples/contextRequests/createProvisionedDeviceWithGroupAndStatic.json'
|
|
298
|
-
)
|
|
299
|
-
)
|
|
300
|
-
.reply(204);
|
|
301
|
-
|
|
302
291
|
request(groupCreation, done);
|
|
303
292
|
});
|
|
304
293
|
|
|
@@ -376,13 +376,6 @@ describe('NGSI-v2 - Device provisioning API: Update provisioned devices', functi
|
|
|
376
376
|
});
|
|
377
377
|
});
|
|
378
378
|
});
|
|
379
|
-
it('should create the initial values for the attributes in the Context Broker', function (done) {
|
|
380
|
-
request(optionsUpdate, function (error, response, body) {
|
|
381
|
-
should.not.exist(error);
|
|
382
|
-
contextBrokerMock.done();
|
|
383
|
-
done();
|
|
384
|
-
});
|
|
385
|
-
});
|
|
386
379
|
});
|
|
387
380
|
|
|
388
381
|
describe('When a device is updated to add static attributes', function () {
|
|
@@ -89,12 +89,6 @@ describe('NGSI-v2 - Data Mapping Plugins: device provision', function () {
|
|
|
89
89
|
)
|
|
90
90
|
.reply(201, null, { Location: '/v2/registrations/6319a7f5254b05844116584d' });
|
|
91
91
|
|
|
92
|
-
contextBrokerMock
|
|
93
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
94
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
95
|
-
.post('/v2/entities?options=upsert')
|
|
96
|
-
.reply(204);
|
|
97
|
-
|
|
98
92
|
iotAgentLib.activate(iotAgentConfig, function (error) {
|
|
99
93
|
iotAgentLib.clearAll(done);
|
|
100
94
|
});
|