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.
Files changed (163) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +134 -0
  2. package/.github/ISSUE_TEMPLATE/config.yml +16 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.yml +55 -0
  4. package/.github/advanced-issue-labeler.yml +30 -0
  5. package/.github/workflows/issue-labeler.yml +43 -0
  6. package/CHANGES_NEXT_RELEASE +0 -2
  7. package/config.js +5 -5
  8. package/doc/api.md +1483 -298
  9. package/doc/deprecated.md +7 -1
  10. package/doc/development.md +120 -0
  11. package/doc/howto.md +58 -62
  12. package/doc/installationguide.md +3 -11
  13. package/doc/requirements.txt +1 -1
  14. package/docker/Mosquitto/Dockerfile +1 -1
  15. package/lib/commonConfig.js +7 -10
  16. package/lib/fiware-iotagent-lib.js +0 -10
  17. package/lib/jexlTranformsMap.js +2 -1
  18. package/lib/model/Device.js +0 -1
  19. package/lib/model/Group.js +0 -1
  20. package/lib/model/dbConn.js +1 -7
  21. package/lib/plugins/bidirectionalData.js +8 -26
  22. package/lib/plugins/expressionPlugin.js +8 -40
  23. package/lib/plugins/jexlParser.js +28 -0
  24. package/lib/services/commands/commandService.js +1 -1
  25. package/lib/services/common/iotManagerService.js +0 -1
  26. package/lib/services/devices/deviceRegistryMongoDB.js +10 -10
  27. package/lib/services/devices/deviceService.js +16 -20
  28. package/lib/services/devices/devices-NGSI-v2.js +2 -5
  29. package/lib/services/ngsi/entities-NGSI-LD.js +16 -60
  30. package/lib/services/ngsi/entities-NGSI-v2.js +179 -119
  31. package/lib/services/northBound/deviceProvisioningServer.js +17 -17
  32. package/lib/templates/createDevice.json +5 -6
  33. package/lib/templates/createDeviceLax.json +6 -8
  34. package/lib/templates/deviceGroup.json +1 -5
  35. package/lib/templates/updateDevice.json +9 -2
  36. package/lib/templates/updateDeviceLax.json +14 -5
  37. package/package.json +1 -1
  38. package/scripts/legacy_expression_tool/README.md +262 -0
  39. package/scripts/legacy_expression_tool/legacy_expression_tool.py +423 -0
  40. package/scripts/legacy_expression_tool/requirements.txt +3 -0
  41. package/test/unit/examples/deviceProvisioningRequests/provisionBidirectionalDevice.json +5 -5
  42. package/test/unit/examples/groupProvisioningRequests/bidirectionalGroup.json +4 -4
  43. package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +3 -13
  44. package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +0 -2
  45. package/test/unit/ngsi-ld/lazyAndCommands/merge-patch-test.js +31 -30
  46. package/test/unit/ngsi-ld/plugins/bidirectional-plugin_test.js +8 -8
  47. package/test/unit/ngsi-ld/plugins/custom-plugin_test.js +152 -0
  48. package/test/unit/ngsi-ld/plugins/multientity-plugin_test.js +1 -1
  49. package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +33 -37
  50. package/test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice4.json +5 -1
  51. package/test/unit/ngsiv2/examples/contextRequests/updateContext.json +2 -0
  52. package/test/unit/ngsiv2/examples/contextRequests/updateContext1.json +3 -1
  53. package/test/unit/ngsiv2/examples/contextRequests/updateContext3WithStatic.json +2 -0
  54. package/test/unit/ngsiv2/examples/contextRequests/updateContext4.json +4 -1
  55. package/test/unit/ngsiv2/examples/contextRequests/updateContext5.json +12 -0
  56. package/test/unit/ngsiv2/examples/contextRequests/updateContext6.json +10 -0
  57. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin1.json +2 -0
  58. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin2.json +3 -1
  59. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin3.json +3 -1
  60. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin4.json +3 -1
  61. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin5.json +3 -1
  62. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin6.json +3 -1
  63. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin7.json +3 -1
  64. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin8.json +3 -1
  65. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin9.json +3 -1
  66. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast1.json +2 -0
  67. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast2.json +2 -0
  68. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast3.json +3 -1
  69. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast4.json +3 -1
  70. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast5.json +3 -1
  71. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast6.json +3 -1
  72. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast7.json +3 -1
  73. package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandError.json +3 -1
  74. package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandExpired.json +3 -1
  75. package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandFinish.json +3 -1
  76. package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandStatus.json +2 -0
  77. package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandStatus2.json +2 -0
  78. package/test/unit/ngsiv2/examples/contextRequests/updateContextCompressTimestamp1.json +3 -1
  79. package/test/unit/ngsiv2/examples/contextRequests/updateContextCompressTimestamp2.json +3 -1
  80. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin1.json +2 -0
  81. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin11.json +2 -0
  82. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin12.json +2 -0
  83. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin13.json +3 -1
  84. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin2.json +2 -0
  85. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin29.json +2 -0
  86. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin3.json +2 -0
  87. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin30.json +2 -0
  88. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin31.json +2 -8
  89. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin32.json +2 -0
  90. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin33.json +2 -0
  91. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34.json +2 -0
  92. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin35.json +22 -0
  93. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin36.json +1 -0
  94. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin4.json +2 -0
  95. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin40.json +42 -0
  96. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin41.json +33 -0
  97. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin5.json +2 -0
  98. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin6.json +2 -0
  99. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin7.json +2 -0
  100. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin8.json +2 -0
  101. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin9.json +2 -0
  102. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionSkip.json +12 -0
  103. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityJexlExpressionPlugin1.json +1 -1
  104. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin1.json +1 -1
  105. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin10.json +1 -1
  106. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin11.json +1 -1
  107. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin12.json +1 -1
  108. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin13.json +1 -1
  109. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin14.json +1 -1
  110. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin15.json +1 -1
  111. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin16.json +1 -1
  112. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin17.json +1 -1
  113. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin2.json +1 -1
  114. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin25.json +37 -0
  115. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin3.json +1 -1
  116. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin4.json +1 -1
  117. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin5.json +1 -1
  118. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin6.json +1 -1
  119. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin7.json +1 -1
  120. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin8.json +1 -1
  121. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin9.json +1 -1
  122. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin1.json +1 -1
  123. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin2.json +1 -1
  124. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin3.json +1 -1
  125. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin4.json +2 -0
  126. package/test/unit/ngsiv2/examples/contextRequests/updateContextProcessTimestamp.json +2 -0
  127. package/test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributes.json +2 -0
  128. package/test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributesMetadata.json +3 -1
  129. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestamp.json +3 -1
  130. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampFalse.json +12 -0
  131. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampFalseTimeInstant.json +12 -0
  132. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverride.json +2 -0
  133. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverrideWithoutMilis.json +2 -0
  134. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampTimezone.json +3 -1
  135. package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +355 -75
  136. package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +18 -51
  137. package/test/unit/ngsiv2/general/https-support-test.js +1 -5
  138. package/test/unit/ngsiv2/lazyAndCommands/command-test.js +4 -10
  139. package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +9 -26
  140. package/test/unit/ngsiv2/ngsiService/active-devices-test.js +143 -57
  141. package/test/unit/ngsiv2/ngsiService/autocast-test.js +14 -21
  142. package/test/unit/ngsiv2/ngsiService/staticAttributes-test.js +3 -5
  143. package/test/unit/ngsiv2/ngsiService/subscriptions-test.js +1 -10
  144. package/test/unit/ngsiv2/plugins/alias-plugin_test.js +20 -30
  145. package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +6 -69
  146. package/test/unit/ngsiv2/plugins/compress-timestamp-plugin_test.js +4 -6
  147. package/test/unit/ngsiv2/plugins/custom-plugin_test.js +150 -0
  148. package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +87 -16
  149. package/test/unit/ngsiv2/plugins/timestamp-processing-plugin_test.js +2 -3
  150. package/test/unit/ngsiv2/provisioning/device-group-api-test.js +2 -3
  151. package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +15 -55
  152. package/test/unit/ngsiv2/provisioning/device-registration_test.js +1 -7
  153. package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +2 -9
  154. package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +0 -11
  155. package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +0 -7
  156. package/test/unit/plugins/capture-provision-inPlugins_test.js +0 -6
  157. package/doc/advanced-topics.md +0 -626
  158. package/doc/expressionLanguage.md +0 -762
  159. package/lib/plugins/expressionParser.js +0 -205
  160. package/test/unit/expressions/expression-test.js +0 -197
  161. package/test/unit/ngsi-ld/expressions/expressionBasedTransformations-test.js +0 -882
  162. package/test/unit/ngsiv2/expressions/expressionBasedTransformations-test.js +0 -951
  163. 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[0].name.should.equal('bootstrapServer');
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 configuration as well as device', function (done) {
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(2);
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: 'EntityNameByExp',
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('EntityNameByExp');
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
  });