iotagent-node-lib 2.24.0 → 2.25.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 (32) hide show
  1. package/.github/workflows/ci.yml +6 -7
  2. package/CHANGES_NEXT_RELEASE +1 -0
  3. package/doc/advanced-topics.md +23 -1
  4. package/doc/apiary/iotagent.apib +5 -5
  5. package/doc/deprecated.md +10 -7
  6. package/doc/expressionLanguage.md +44 -34
  7. package/doc/getting-started.md +1 -1
  8. package/examples/TTOpen-service.json +1 -1
  9. package/lib/fiware-iotagent-lib.js +2 -1
  10. package/lib/jexlTranformsMap.js +12 -1
  11. package/lib/plugins/jexlParser.js +2 -2
  12. package/lib/services/devices/deviceService.js +19 -1
  13. package/lib/services/devices/devices-NGSI-v2.js +3 -1
  14. package/lib/services/northBound/restUtils.js +3 -5
  15. package/lib/templates/deviceGroup.json +1 -1
  16. package/package.json +2 -2
  17. package/test/unit/examples/deviceProvisioningRequests/provisionNewDeviceEmpty.json +43 -0
  18. package/test/unit/examples/mongoCollections/configurations.json +3 -3
  19. package/test/unit/expressions/jexlExpression-test.js +29 -8
  20. package/test/unit/general/deviceService-test.js +31 -29
  21. package/test/unit/memoryRegistry/deviceRegistryMemory_test.js +25 -24
  22. package/test/unit/mongodb/mongodb-group-registry-test.js +3 -3
  23. package/test/unit/mongodb/mongodb-registry-test.js +30 -21
  24. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin30.json +11 -0
  25. package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +18 -4
  26. package/test/unit/ngsi-ld/general/deviceService-test.js +31 -29
  27. package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +0 -3
  28. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityJexlExpressionPlugin1.json +22 -0
  29. package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +21 -6
  30. package/test/unit/ngsiv2/general/deviceService-test.js +25 -23
  31. package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +58 -0
  32. package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +25 -6
@@ -450,7 +450,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
450
450
  apikey: '801230BJKL23Y9090DSFL123HJK09H324HV8732',
451
451
  /*jshint camelcase: false */
452
452
  entity_type: 'MicroLights',
453
- cbroker: 'http://192.168.1.1:1026',
453
+ cbHost: 'http://192.168.1.1:1026',
454
454
  explicitAttrs: true
455
455
  }
456
456
  ]
@@ -516,7 +516,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
516
516
  apikey: '801230BJKL23Y9090DSFL123HJK09H324HV8732',
517
517
  /*jshint camelcase: false */
518
518
  entity_type: 'MicroLights',
519
- cbroker: 'http://192.168.1.1:1026',
519
+ cbHost: 'http://192.168.1.1:1026',
520
520
  explicitAttrs: true,
521
521
  static_attributes: [
522
522
  {
@@ -589,7 +589,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
589
589
  apikey: '801230BJKL23Y9090DSFL123HJK09H324HV8732',
590
590
  /*jshint camelcase: false */
591
591
  entity_type: 'MicroLights',
592
- cbroker: 'http://192.168.1.1:1026',
592
+ cbHost: 'http://192.168.1.1:1026',
593
593
  explicitAttrs: true
594
594
  }
595
595
  ]
@@ -656,7 +656,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
656
656
  apikey: '801230BJKL23Y9090DSFL123HJK09H324HV8732',
657
657
  /*jshint camelcase: false */
658
658
  entity_type: 'MicroLights',
659
- cbroker: 'http://192.168.1.1:1026',
659
+ cbHost: 'http://192.168.1.1:1026',
660
660
  explicitAttrs: true,
661
661
  static_attributes: [
662
662
  {
@@ -726,7 +726,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
726
726
  /*jshint camelcase: false */
727
727
  entity_type: 'MicroLights',
728
728
  entityNameExp: 'EntityNameByExp',
729
- cbroker: 'http://192.168.1.1:1026'
729
+ cbHost: 'http://192.168.1.1:1026'
730
730
  }
731
731
  ]
732
732
  },
@@ -790,7 +790,7 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
790
790
  apikey: '801230BJKL23Y9090DSFL123HJK09H324HV8732',
791
791
  /*jshint camelcase: false */
792
792
  entity_type: 'MicroLights',
793
- cbroker: 'http://192.168.1.1:1026',
793
+ cbHost: 'http://192.168.1.1:1026',
794
794
  explicitAttrs: true,
795
795
  static_attributes: [
796
796
  {
@@ -1385,4 +1385,23 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
1385
1385
  });
1386
1386
  });
1387
1387
  });
1388
+ describe('When a device provisioning request arrives to the Agent without device_id', function () {
1389
+ const options = {
1390
+ url: 'http://localhost:' + iotAgentConfig.server.port + '/iot/devices',
1391
+ headers: {
1392
+ 'fiware-service': 'smartgondor',
1393
+ 'fiware-servicepath': '/gardens'
1394
+ },
1395
+ method: 'POST',
1396
+ json: utils.readExampleFile('./test/unit/examples/deviceProvisioningRequests/provisionNewDeviceEmpty.json')
1397
+ };
1398
+
1399
+ it('should return a 400 error', function (done) {
1400
+ request(options, function (error, response, body) {
1401
+ should.not.exist(error);
1402
+ response.statusCode.should.equal(400);
1403
+ done();
1404
+ });
1405
+ });
1406
+ });
1388
1407
  });