iotagent-node-lib 3.2.0 → 3.4.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/README.md +10 -11
- package/doc/README.md +16 -0
- package/doc/admin.md +565 -0
- package/doc/api.md +32 -85
- package/doc/deprecated.md +16 -10
- package/doc/{architecture.md → devel/architecture.md} +3 -3
- package/doc/{Contribution.md → devel/contribution-guidelines.md} +43 -35
- package/doc/devel/development.md +1879 -0
- package/doc/{northboundinteractions.md → devel/northboundinteractions.md} +18 -33
- package/doc/index.md +3 -5
- package/doc/requirements.txt +1 -1
- package/docker/Mosquitto/Dockerfile +1 -1
- package/docker/Mosquitto/README.md +1 -0
- package/lib/commonConfig.js +0 -5
- package/lib/fiware-iotagent-lib.js +1 -1
- 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/jexlParser.js +1 -1
- package/lib/request-shim.js +2 -2
- package/lib/services/commands/commandService.js +1 -1
- package/lib/services/common/genericMiddleware.js +1 -1
- package/lib/services/common/iotManagerService.js +0 -1
- package/lib/services/devices/deviceRegistryMemory.js +2 -2
- package/lib/services/devices/deviceRegistryMongoDB.js +32 -19
- package/lib/services/devices/deviceService.js +44 -43
- package/lib/services/devices/devices-NGSI-LD.js +14 -2
- package/lib/services/devices/devices-NGSI-mixed.js +0 -2
- package/lib/services/devices/devices-NGSI-v2.js +23 -104
- package/lib/services/groups/groupService.js +1 -1
- package/lib/services/ngsi/entities-NGSI-LD.js +3 -3
- package/lib/services/ngsi/entities-NGSI-v2.js +28 -19
- package/lib/services/northBound/deviceProvisioningServer.js +14 -8
- package/lib/templates/createDevice.json +0 -4
- package/lib/templates/createDeviceLax.json +0 -4
- package/lib/templates/deviceGroup.json +1 -5
- package/lib/templates/updateDevice.json +4 -0
- package/lib/templates/updateDeviceLax.json +11 -0
- package/mkdocs.yml +6 -11
- package/package.json +3 -3
- package/scripts/legacy_expression_tool/README.md +280 -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/provisionMinimumDevice4.json +0 -1
- package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +5 -15
- package/test/unit/mongodb/mongodb-registry-test.js +1 -1
- package/test/unit/ngsi-ld/general/contextBrokerOAuthSecurityAccess-test.js +66 -65
- package/test/unit/ngsi-ld/general/https-support-test.js +1 -1
- package/test/unit/ngsi-ld/lazyAndCommands/command-test.js +8 -7
- package/test/unit/ngsi-ld/lazyAndCommands/merge-patch-test.js +31 -30
- package/test/unit/ngsi-ld/lazyAndCommands/polling-commands-test.js +12 -11
- package/test/unit/ngsi-ld/ngsiService/subscriptions-test.js +41 -39
- package/test/unit/ngsi-ld/provisioning/device-provisioning-api_test.js +122 -122
- package/test/unit/ngsi-ld/provisioning/device-registration_test.js +28 -28
- package/test/unit/ngsi-ld/provisioning/device-update-registration_test.js +18 -17
- package/test/unit/ngsi-ld/provisioning/singleConfigurationMode-test.js +7 -7
- package/test/unit/ngsi-ld/provisioning/updateProvisionedDevices-test.js +8 -7
- package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +33 -37
- 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 +12 -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 -12
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin11.json +2 -4
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin12.json +2 -4
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin13.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin2.json +2 -12
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin29.json +2 -12
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin3.json +2 -4
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin30.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin31.json +2 -0
- 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 +2 -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 +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin41.json +1 -10
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin5.json +2 -4
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin6.json +2 -4
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin7.json +2 -4
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin8.json +2 -12
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin9.json +2 -4
- 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 +2 -6
- 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 +144 -85
- package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +20 -53
- package/test/unit/ngsiv2/general/https-support-test.js +2 -6
- package/test/unit/ngsiv2/lazyAndCommands/command-test.js +4 -10
- package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +8 -24
- package/test/unit/ngsiv2/ngsiService/active-devices-test.js +146 -65
- 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 +11 -20
- package/test/unit/ngsiv2/plugins/alias-plugin_test.js +20 -30
- package/test/unit/ngsiv2/plugins/compress-timestamp-plugin_test.js +4 -6
- package/test/unit/ngsiv2/plugins/custom-plugin_test.js +1 -2
- package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +3 -5
- 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 +13 -156
- package/test/unit/ngsiv2/provisioning/device-registration_test.js +9 -13
- package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +4 -10
- package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +0 -11
- package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +0 -8
- package/test/unit/plugins/capture-provision-inPlugins_test.js +0 -6
- package/.nyc_output/33364de2-1199-4ec2-b33c-cae063ef8cc4.json +0 -1
- package/.nyc_output/processinfo/33364de2-1199-4ec2-b33c-cae063ef8cc4.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/doc/config-basic-example.js +0 -20
- package/doc/development.md +0 -285
- package/doc/howto.md +0 -645
- package/doc/installationguide.md +0 -370
- package/doc/operations.md +0 -127
- package/doc/usermanual.md +0 -900
- package/lib/plugins/bidirectionalData.js +0 -356
- package/test/unit/ngsi-ld/plugins/bidirectional-plugin_test.js +0 -697
- package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +0 -599
- /package/doc/{NorthboundInteractions.postman_collection → devel/NorthboundInteractions.postman_collection} +0 -0
- /package/doc/{echo.js → devel/echo.js} +0 -0
- /package/doc/{finalResult.js → devel/finalResult.js} +0 -0
|
@@ -412,6 +412,49 @@ const iotAgentConfig = {
|
|
|
412
412
|
}
|
|
413
413
|
],
|
|
414
414
|
explicitAttrs: '[ ]'
|
|
415
|
+
},
|
|
416
|
+
skipvalue: {
|
|
417
|
+
commands: [],
|
|
418
|
+
type: 'skipvalue',
|
|
419
|
+
lazy: [],
|
|
420
|
+
active: [
|
|
421
|
+
{
|
|
422
|
+
name: 'alwaysSkip',
|
|
423
|
+
type: 'Number',
|
|
424
|
+
skipValue: true,
|
|
425
|
+
expression: 'true'
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
name: 'neverSkip',
|
|
429
|
+
type: 'Number',
|
|
430
|
+
skipValue: true,
|
|
431
|
+
expression: 'false'
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
name: 'skip',
|
|
435
|
+
type: 'Number',
|
|
436
|
+
skipValue: 33,
|
|
437
|
+
expression: 'condition'
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
object_id: 'condition',
|
|
441
|
+
name: 'condition',
|
|
442
|
+
type: 'Number'
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
object_id: 'nonProgressAtt1',
|
|
446
|
+
name: 'nonProgressatt1',
|
|
447
|
+
type: 'Number',
|
|
448
|
+
expression: 'nonexistent * 2'
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
object_id: 'nonProgressAtt2',
|
|
452
|
+
name: 'nonProgressatt2',
|
|
453
|
+
type: 'Number',
|
|
454
|
+
expression: 'nonexistent * 2',
|
|
455
|
+
skipValue: null
|
|
456
|
+
}
|
|
457
|
+
]
|
|
415
458
|
}
|
|
416
459
|
},
|
|
417
460
|
service: 'smartgondor',
|
|
@@ -537,13 +580,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
537
580
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
538
581
|
.matchHeader('fiware-service', 'smartgondor')
|
|
539
582
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
540
|
-
.
|
|
541
|
-
'/v2/entities
|
|
583
|
+
.post(
|
|
584
|
+
'/v2/entities?options=upsert',
|
|
542
585
|
utils.readExampleFile(
|
|
543
586
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin30.json'
|
|
544
587
|
)
|
|
545
588
|
)
|
|
546
|
-
.query({ type: 'Light' })
|
|
547
589
|
.reply(204);
|
|
548
590
|
});
|
|
549
591
|
|
|
@@ -577,13 +619,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
577
619
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
578
620
|
.matchHeader('fiware-service', 'smartgondor')
|
|
579
621
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
580
|
-
.
|
|
581
|
-
'/v2/entities
|
|
622
|
+
.post(
|
|
623
|
+
'/v2/entities?options=upsert',
|
|
582
624
|
utils.readExampleFile(
|
|
583
625
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin2.json'
|
|
584
626
|
)
|
|
585
627
|
)
|
|
586
|
-
.query({ type: 'WeatherStation' })
|
|
587
628
|
.reply(204);
|
|
588
629
|
});
|
|
589
630
|
|
|
@@ -618,13 +659,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
618
659
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
619
660
|
.matchHeader('fiware-service', 'smartgondor')
|
|
620
661
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
621
|
-
.
|
|
622
|
-
'/v2/entities
|
|
662
|
+
.post(
|
|
663
|
+
'/v2/entities?options=upsert',
|
|
623
664
|
utils.readExampleFile(
|
|
624
665
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin4.json'
|
|
625
666
|
)
|
|
626
667
|
)
|
|
627
|
-
.query({ type: 'WeatherStation' })
|
|
628
668
|
.reply(204);
|
|
629
669
|
});
|
|
630
670
|
|
|
@@ -653,13 +693,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
653
693
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
654
694
|
.matchHeader('fiware-service', 'smartgondor')
|
|
655
695
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
656
|
-
.
|
|
657
|
-
'/v2/entities
|
|
696
|
+
.post(
|
|
697
|
+
'/v2/entities?options=upsert',
|
|
658
698
|
utils.readExampleFile(
|
|
659
699
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin11.json'
|
|
660
700
|
)
|
|
661
701
|
)
|
|
662
|
-
.query({ type: 'Light' })
|
|
663
702
|
.reply(204);
|
|
664
703
|
});
|
|
665
704
|
|
|
@@ -688,13 +727,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
688
727
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
689
728
|
.matchHeader('fiware-service', 'smartgondor')
|
|
690
729
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
691
|
-
.
|
|
692
|
-
'/v2/entities
|
|
730
|
+
.post(
|
|
731
|
+
'/v2/entities?options=upsert',
|
|
693
732
|
utils.readExampleFile(
|
|
694
733
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin1.json'
|
|
695
734
|
)
|
|
696
735
|
)
|
|
697
|
-
.query({ type: 'WeatherStation' })
|
|
698
736
|
.reply(204);
|
|
699
737
|
});
|
|
700
738
|
|
|
@@ -724,13 +762,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
724
762
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
725
763
|
.matchHeader('fiware-service', 'smartgondor')
|
|
726
764
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
727
|
-
.
|
|
728
|
-
'/v2/entities
|
|
765
|
+
.post(
|
|
766
|
+
'/v2/entities?options=upsert',
|
|
729
767
|
utils.readExampleFile(
|
|
730
768
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin3.json'
|
|
731
769
|
)
|
|
732
770
|
)
|
|
733
|
-
.query({ type: 'Light' })
|
|
734
771
|
.reply(204);
|
|
735
772
|
});
|
|
736
773
|
|
|
@@ -760,13 +797,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
760
797
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
761
798
|
.matchHeader('fiware-service', 'smartgondor')
|
|
762
799
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
763
|
-
.
|
|
764
|
-
'/v2/entities
|
|
800
|
+
.post(
|
|
801
|
+
'/v2/entities?options=upsert',
|
|
765
802
|
utils.readExampleFile(
|
|
766
803
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin8.json'
|
|
767
804
|
)
|
|
768
805
|
)
|
|
769
|
-
.query({ type: 'WeatherStation' })
|
|
770
806
|
.reply(204);
|
|
771
807
|
});
|
|
772
808
|
|
|
@@ -796,13 +832,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
796
832
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
797
833
|
.matchHeader('fiware-service', 'smartgondor')
|
|
798
834
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
799
|
-
.
|
|
800
|
-
'/v2/entities
|
|
835
|
+
.post(
|
|
836
|
+
'/v2/entities?options=upsert',
|
|
801
837
|
utils.readExampleFile(
|
|
802
838
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin5.json'
|
|
803
839
|
)
|
|
804
840
|
)
|
|
805
|
-
.query({ type: 'Light' })
|
|
806
841
|
.reply(204);
|
|
807
842
|
});
|
|
808
843
|
|
|
@@ -832,13 +867,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
832
867
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
833
868
|
.matchHeader('fiware-service', 'smartgondor')
|
|
834
869
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
835
|
-
.
|
|
836
|
-
'/v2/entities
|
|
870
|
+
.post(
|
|
871
|
+
'/v2/entities?options=upsert',
|
|
837
872
|
utils.readExampleFile(
|
|
838
873
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin9.json'
|
|
839
874
|
)
|
|
840
875
|
)
|
|
841
|
-
.query({ type: 'Light' })
|
|
842
876
|
.reply(204);
|
|
843
877
|
});
|
|
844
878
|
|
|
@@ -867,13 +901,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
867
901
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
868
902
|
.matchHeader('fiware-service', 'smartgondor')
|
|
869
903
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
870
|
-
.
|
|
871
|
-
'/v2/entities
|
|
904
|
+
.post(
|
|
905
|
+
'/v2/entities?options=upsert',
|
|
872
906
|
utils.readExampleFile(
|
|
873
907
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin6.json'
|
|
874
908
|
)
|
|
875
909
|
)
|
|
876
|
-
.query({ type: 'Light' })
|
|
877
910
|
.reply(204);
|
|
878
911
|
});
|
|
879
912
|
|
|
@@ -903,13 +936,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
903
936
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
904
937
|
.matchHeader('fiware-service', 'smartgondor')
|
|
905
938
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
906
|
-
.
|
|
907
|
-
'/v2/entities
|
|
939
|
+
.post(
|
|
940
|
+
'/v2/entities?options=upsert',
|
|
908
941
|
utils.readExampleFile(
|
|
909
942
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin7.json'
|
|
910
943
|
)
|
|
911
944
|
)
|
|
912
|
-
.query({ type: 'Light' })
|
|
913
945
|
.reply(204);
|
|
914
946
|
});
|
|
915
947
|
|
|
@@ -933,24 +965,11 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
933
965
|
|
|
934
966
|
beforeEach(function () {
|
|
935
967
|
nock.cleanAll();
|
|
936
|
-
|
|
937
|
-
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
938
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
939
|
-
.matchHeader('fiware-servicepath', 'gardens')
|
|
940
|
-
.patch(
|
|
941
|
-
'/v2/entities/light1/attrs',
|
|
942
|
-
utils.readExampleFile(
|
|
943
|
-
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin12.json'
|
|
944
|
-
)
|
|
945
|
-
)
|
|
946
|
-
.query({ type: 'Light' })
|
|
947
|
-
.reply(204);
|
|
948
968
|
});
|
|
949
969
|
|
|
950
970
|
it('should apply the expression before sending the values', function (done) {
|
|
951
971
|
iotAgentLib.update('light1', 'Light', '', values, function (error) {
|
|
952
972
|
should.not.exist(error);
|
|
953
|
-
contextBrokerMock.done();
|
|
954
973
|
done();
|
|
955
974
|
});
|
|
956
975
|
});
|
|
@@ -971,13 +990,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
971
990
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
972
991
|
.matchHeader('fiware-service', 'smartgondor')
|
|
973
992
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
974
|
-
.
|
|
975
|
-
'/v2/entities
|
|
993
|
+
.post(
|
|
994
|
+
'/v2/entities?options=upsert',
|
|
976
995
|
utils.readExampleFile(
|
|
977
996
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin13.json'
|
|
978
997
|
)
|
|
979
998
|
)
|
|
980
|
-
.query({ type: 'Light' })
|
|
981
999
|
.reply(204);
|
|
982
1000
|
});
|
|
983
1001
|
|
|
@@ -1010,13 +1028,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
1010
1028
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1011
1029
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1012
1030
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1013
|
-
.
|
|
1014
|
-
'/v2/entities
|
|
1031
|
+
.post(
|
|
1032
|
+
'/v2/entities?options=upsert',
|
|
1015
1033
|
utils.readExampleFile(
|
|
1016
1034
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin13.json'
|
|
1017
1035
|
)
|
|
1018
1036
|
)
|
|
1019
|
-
.query({ type: 'Light' })
|
|
1020
1037
|
.reply(204);
|
|
1021
1038
|
});
|
|
1022
1039
|
|
|
@@ -1044,13 +1061,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
1044
1061
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1045
1062
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1046
1063
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1047
|
-
.
|
|
1048
|
-
'/v2/entities
|
|
1064
|
+
.post(
|
|
1065
|
+
'/v2/entities?options=upsert',
|
|
1049
1066
|
utils.readExampleFile(
|
|
1050
1067
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin29.json'
|
|
1051
1068
|
)
|
|
1052
1069
|
)
|
|
1053
|
-
.query({ type: 'WeatherStation' })
|
|
1054
1070
|
.reply(204);
|
|
1055
1071
|
});
|
|
1056
1072
|
|
|
@@ -1077,13 +1093,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
1077
1093
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1078
1094
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1079
1095
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1080
|
-
.
|
|
1081
|
-
'/v2/entities
|
|
1096
|
+
.post(
|
|
1097
|
+
'/v2/entities?options=upsert',
|
|
1082
1098
|
utils.readExampleFile(
|
|
1083
1099
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin31.json'
|
|
1084
1100
|
)
|
|
1085
1101
|
)
|
|
1086
|
-
.query({ type: 'WeatherStation' })
|
|
1087
1102
|
.reply(204);
|
|
1088
1103
|
});
|
|
1089
1104
|
|
|
@@ -1122,13 +1137,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
1122
1137
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1123
1138
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1124
1139
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1125
|
-
.
|
|
1126
|
-
'/v2/entities
|
|
1140
|
+
.post(
|
|
1141
|
+
'/v2/entities?options=upsert',
|
|
1127
1142
|
utils.readExampleFile(
|
|
1128
1143
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin32.json'
|
|
1129
1144
|
)
|
|
1130
1145
|
)
|
|
1131
|
-
.query({ type: 'GPS' })
|
|
1132
1146
|
.reply(204);
|
|
1133
1147
|
});
|
|
1134
1148
|
|
|
@@ -1167,13 +1181,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
1167
1181
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1168
1182
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1169
1183
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1170
|
-
.
|
|
1171
|
-
'/v2/entities
|
|
1184
|
+
.post(
|
|
1185
|
+
'/v2/entities?options=upsert',
|
|
1172
1186
|
utils.readExampleFile(
|
|
1173
1187
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin35.json'
|
|
1174
1188
|
)
|
|
1175
1189
|
)
|
|
1176
|
-
.query({ type: 'GPS' })
|
|
1177
1190
|
.reply(204);
|
|
1178
1191
|
});
|
|
1179
1192
|
|
|
@@ -1217,13 +1230,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
1217
1230
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1218
1231
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1219
1232
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1220
|
-
.
|
|
1221
|
-
'/v2/entities
|
|
1233
|
+
.post(
|
|
1234
|
+
'/v2/entities?options=upsert',
|
|
1222
1235
|
utils.readExampleFile(
|
|
1223
1236
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin41.json'
|
|
1224
1237
|
)
|
|
1225
1238
|
)
|
|
1226
|
-
.query({ type: 'GPS' })
|
|
1227
1239
|
.reply(204);
|
|
1228
1240
|
});
|
|
1229
1241
|
|
|
@@ -1262,13 +1274,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
1262
1274
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1263
1275
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1264
1276
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1265
|
-
.
|
|
1266
|
-
'/v2/entities
|
|
1277
|
+
.post(
|
|
1278
|
+
'/v2/entities?options=upsert',
|
|
1267
1279
|
utils.readExampleFile(
|
|
1268
1280
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34.json'
|
|
1269
1281
|
)
|
|
1270
1282
|
)
|
|
1271
|
-
.query({ type: 'GPS' })
|
|
1272
1283
|
.reply(204);
|
|
1273
1284
|
});
|
|
1274
1285
|
|
|
@@ -1307,13 +1318,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
1307
1318
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1308
1319
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1309
1320
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1310
|
-
.
|
|
1311
|
-
'/v2/entities
|
|
1321
|
+
.post(
|
|
1322
|
+
'/v2/entities?options=upsert',
|
|
1312
1323
|
utils.readExampleFile(
|
|
1313
1324
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34.json'
|
|
1314
1325
|
)
|
|
1315
1326
|
)
|
|
1316
|
-
.query({ type: 'GPS' })
|
|
1317
1327
|
.reply(204);
|
|
1318
1328
|
});
|
|
1319
1329
|
|
|
@@ -1357,13 +1367,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
1357
1367
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1358
1368
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1359
1369
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1360
|
-
.
|
|
1361
|
-
'/v2/entities
|
|
1370
|
+
.post(
|
|
1371
|
+
'/v2/entities?options=upsert',
|
|
1362
1372
|
utils.readExampleFile(
|
|
1363
1373
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin36.json'
|
|
1364
1374
|
)
|
|
1365
1375
|
)
|
|
1366
|
-
.query({ type: 'GPS' })
|
|
1367
1376
|
.reply(204);
|
|
1368
1377
|
});
|
|
1369
1378
|
|
|
@@ -1397,13 +1406,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
1397
1406
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1398
1407
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1399
1408
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1400
|
-
.
|
|
1401
|
-
'/v2/entities
|
|
1409
|
+
.post(
|
|
1410
|
+
'/v2/entities?options=upsert',
|
|
1402
1411
|
utils.readExampleFile(
|
|
1403
1412
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin36.json'
|
|
1404
1413
|
)
|
|
1405
1414
|
)
|
|
1406
|
-
.query({ type: 'GPS' })
|
|
1407
1415
|
.reply(204);
|
|
1408
1416
|
});
|
|
1409
1417
|
|
|
@@ -1432,13 +1440,12 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
1432
1440
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1433
1441
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1434
1442
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1435
|
-
.
|
|
1436
|
-
'/v2/entities
|
|
1443
|
+
.post(
|
|
1444
|
+
'/v2/entities?options=upsert',
|
|
1437
1445
|
utils.readExampleFile(
|
|
1438
1446
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34.json'
|
|
1439
1447
|
)
|
|
1440
1448
|
)
|
|
1441
|
-
.query({ type: 'GPS' })
|
|
1442
1449
|
.reply(204);
|
|
1443
1450
|
});
|
|
1444
1451
|
|
|
@@ -1487,6 +1494,59 @@ describe('Java expression language (JEXL) based transformations plugin', functio
|
|
|
1487
1494
|
});
|
|
1488
1495
|
});
|
|
1489
1496
|
});
|
|
1497
|
+
|
|
1498
|
+
describe('When using skipValue is expression in a device', function () {
|
|
1499
|
+
// Case: Expression which results is sent as a new attribute
|
|
1500
|
+
const values = [
|
|
1501
|
+
{
|
|
1502
|
+
name: 'alwaysSkip',
|
|
1503
|
+
type: 'Number',
|
|
1504
|
+
value: 1
|
|
1505
|
+
},
|
|
1506
|
+
{
|
|
1507
|
+
name: 'neverSkip',
|
|
1508
|
+
type: 'Number',
|
|
1509
|
+
value: 2
|
|
1510
|
+
},
|
|
1511
|
+
{
|
|
1512
|
+
name: 'skip',
|
|
1513
|
+
type: 'Number',
|
|
1514
|
+
value: 3
|
|
1515
|
+
},
|
|
1516
|
+
{
|
|
1517
|
+
name: 'condition',
|
|
1518
|
+
type: 'Number',
|
|
1519
|
+
value: 33
|
|
1520
|
+
}
|
|
1521
|
+
];
|
|
1522
|
+
|
|
1523
|
+
beforeEach(function () {
|
|
1524
|
+
nock.cleanAll();
|
|
1525
|
+
|
|
1526
|
+
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1527
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
1528
|
+
.matchHeader('fiware-servicepath', 'gardens')
|
|
1529
|
+
.post(
|
|
1530
|
+
'/v2/entities?options=upsert',
|
|
1531
|
+
utils.readExampleFile(
|
|
1532
|
+
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionSkip.json'
|
|
1533
|
+
)
|
|
1534
|
+
)
|
|
1535
|
+
.reply(204);
|
|
1536
|
+
});
|
|
1537
|
+
|
|
1538
|
+
afterEach(function (done) {
|
|
1539
|
+
done();
|
|
1540
|
+
});
|
|
1541
|
+
|
|
1542
|
+
it('should not propagate skipped values', function (done) {
|
|
1543
|
+
iotAgentLib.update('skip1', 'skipvalue', '', values, function (error) {
|
|
1544
|
+
should.not.exist(error);
|
|
1545
|
+
contextBrokerMock.done();
|
|
1546
|
+
done();
|
|
1547
|
+
});
|
|
1548
|
+
});
|
|
1549
|
+
});
|
|
1490
1550
|
});
|
|
1491
1551
|
|
|
1492
1552
|
describe('Java expression language (JEXL) based transformations plugin - Timestamps', function () {
|
|
@@ -1535,13 +1595,12 @@ describe('Java expression language (JEXL) based transformations plugin - Timesta
|
|
|
1535
1595
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1536
1596
|
.matchHeader('fiware-service', 'smartgondor')
|
|
1537
1597
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
1538
|
-
.
|
|
1539
|
-
'/v2/entities
|
|
1598
|
+
.post(
|
|
1599
|
+
'/v2/entities?options=upsert',
|
|
1540
1600
|
utils.readExampleFile(
|
|
1541
1601
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin33.json'
|
|
1542
1602
|
)
|
|
1543
1603
|
)
|
|
1544
|
-
.query({ type: 'GPS' })
|
|
1545
1604
|
.reply(204);
|
|
1546
1605
|
});
|
|
1547
1606
|
|