iotagent-node-lib 2.15.1 → 2.19.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 +17 -1
- package/.readthedocs.yml +7 -0
- package/CHANGES_NEXT_RELEASE +0 -1
- package/README.md +1 -0
- package/doc/Contribution.md +60 -1
- package/doc/advanced-topics.md +136 -14
- package/doc/api.md +38 -22
- package/doc/apiary/iotagent.apib +1 -3
- package/doc/architecture.md +2 -2
- package/doc/config-basic-example.js +0 -1
- package/doc/deprecated.md +2 -2
- package/doc/development.md +13 -6
- package/doc/expressionLanguage.md +519 -277
- package/doc/getting-started.md +0 -1
- package/doc/howto.md +13 -17
- package/doc/installationguide.md +67 -69
- package/doc/usermanual.md +48 -16
- package/docker/Mosquitto/Dockerfile +4 -9
- package/docker/Mosquitto/README.md +2 -0
- package/docker/Mosquitto/startMosquitto.sh +18 -1
- package/lib/command/commandLine.js +1 -1
- package/lib/commonConfig.js +5 -14
- package/lib/errors.js +0 -16
- package/lib/fiware-iotagent-lib.js +5 -0
- package/lib/jexlTranformsMap.js +71 -0
- package/lib/model/Command.js +1 -1
- package/lib/model/Device.js +5 -2
- package/lib/model/Group.js +20 -2
- package/lib/model/dbConn.js +7 -1
- package/lib/plugins/attributeAlias.js +6 -13
- package/lib/plugins/bidirectionalData.js +2 -27
- package/lib/plugins/expressionParser.js +41 -17
- package/lib/plugins/expressionPlugin.js +21 -27
- package/lib/plugins/jexlParser.js +71 -67
- package/lib/plugins/multiEntity.js +68 -147
- package/lib/plugins/pluginUtils.js +12 -48
- package/lib/plugins/timestampProcessPlugin.js +1 -46
- package/lib/request-shim.js +111 -0
- package/lib/services/common/domain.js +2 -2
- package/lib/services/common/genericMiddleware.js +6 -2
- package/lib/services/common/iotManagerService.js +1 -1
- package/lib/services/common/securityServiceKeystone.js +1 -1
- package/lib/services/common/securityServiceOAuth2.js +3 -2
- package/lib/services/devices/deviceRegistryMongoDB.js +29 -22
- package/lib/services/devices/deviceService.js +56 -33
- package/lib/services/devices/devices-NGSI-LD.js +42 -14
- package/lib/services/devices/devices-NGSI-mixed.js +3 -3
- package/lib/services/devices/devices-NGSI-v2.js +48 -24
- package/lib/services/devices/registrationUtils.js +1 -134
- package/lib/services/groups/groupRegistryMemory.js +2 -0
- package/lib/services/groups/groupRegistryMongoDB.js +58 -76
- package/lib/services/groups/groupService.js +1 -1
- package/lib/services/ngsi/entities-NGSI-LD.js +205 -124
- package/lib/services/ngsi/entities-NGSI-v2.js +142 -32
- package/lib/services/ngsi/ngsiService.js +4 -6
- package/lib/services/ngsi/ngsiUtils.js +0 -21
- package/lib/services/ngsi/subscription-NGSI-LD.js +14 -5
- package/lib/services/ngsi/subscriptionService.js +1 -4
- package/lib/services/northBound/contextServer-NGSI-LD.js +7 -2
- package/lib/services/northBound/contextServer-NGSI-v2.js +25 -13
- package/lib/services/northBound/contextServer.js +1 -4
- package/lib/services/northBound/contextServerUtils.js +0 -81
- package/lib/services/northBound/deviceProvisioningServer.js +36 -9
- package/lib/services/northBound/northboundServer.js +2 -0
- package/lib/services/northBound/restUtils.js +2 -39
- package/lib/templates/updateDevice.json +4 -0
- package/lib/templates/updateDeviceLax.json +4 -0
- package/package.json +13 -13
- package/test/tools/utils.js +2 -0
- package/test/unit/examples/deviceProvisioningRequests/provisionAnotherDevice.json +1 -1
- package/test/unit/examples/deviceProvisioningRequests/provisionDeviceMissingParameters.json +1 -1
- package/test/unit/examples/deviceProvisioningRequests/provisionDuplicatedDev.json +1 -1
- package/test/unit/examples/deviceProvisioningRequests/provisionFullDevice.json +1 -1
- package/test/unit/examples/deviceProvisioningRequests/provisionNewDeviceMalformed1.json +1 -1
- package/test/unit/examples/groupProvisioningRequests/multipleGroupsCreation.json +1 -1
- package/test/unit/examples/iotamRequests/registrationEmpty.json +1 -1
- package/test/unit/examples/iotamRequests/registrationWithGroups.json +2 -2
- package/test/unit/examples/iotamRequests/registrationWithGroupsWithoutCB.json +2 -2
- package/test/unit/examples/iotamRequests/registrationWithStaticGroups.json +2 -2
- package/test/unit/expressions/jexlExpression-test.js +119 -0
- package/test/unit/general/config-multi-core-test.js +1 -1
- package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +30 -77
- package/test/unit/general/deviceService-test.js +19 -35
- package/test/unit/general/loglevel-api_test.js +8 -13
- package/test/unit/general/migration-test.js +1 -0
- package/test/unit/general/startup-test.js +3 -2
- package/test/unit/general/statistics-persistence_test.js +2 -2
- package/test/unit/general/statistics-service_test.js +2 -2
- package/test/unit/lazyAndCommands/commandRegistry_test.js +18 -18
- package/test/unit/memoryRegistry/deviceRegistryMemory_test.js +16 -24
- package/test/unit/mongodb/mongodb-connectionoptions-test.js +2 -2
- package/test/unit/mongodb/mongodb-group-registry-test.js +11 -11
- package/test/unit/mongodb/mongodb-registry-test.js +55 -131
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent1.json +1 -1
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent2.json +1 -1
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgent4.json +1 -1
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerIoTAgentCommands.json +1 -1
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDevice.json +1 -1
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDevice2.json +1 -1
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup.json +1 -1
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup2.json +1 -1
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup3.json +1 -1
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateCommands1.json +1 -1
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateIoTAgent1.json +1 -1
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateIoTAgent2.json +1 -1
- package/test/unit/ngsi-ld/examples/contextAvailabilityRequests/updateIoTAgent3.json +1 -1
- package/test/unit/ngsi-ld/examples/contextRequests/createMinimumProvisionedDevice.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/createProvisionedDevice.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/createProvisionedDeviceMultientity.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/createProvisionedDeviceWithGroupAndStatic.json +0 -14
- package/test/unit/ngsi-ld/examples/contextRequests/createProvisionedDeviceWithGroupAndStatic2.json +0 -14
- package/test/unit/ngsi-ld/examples/contextRequests/createProvisionedDeviceWithGroupAndStatic3.json +1 -15
- package/test/unit/ngsi-ld/examples/contextRequests/createTimeInstantMinimumDevice.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextAliasPlugin6.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextAutocast5.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin12a.json +7 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin13.json +13 -13
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin16.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin17.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin1a.json +18 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin29.json +18 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin31.json +15 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin32.json +17 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin33.json +18 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin34.json +17 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin4a.json +36 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin5.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin7.json +16 -16
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin8a.json +18 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextGeoproperties3.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin15.json +25 -0
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityTimestampPlugin1.json +6 -6
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityTimestampPlugin2.json +3 -3
- package/test/unit/ngsi-ld/examples/contextRequests/updateProvisionActiveAttributes1.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/updateProvisionCommands1.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/updateProvisionDeviceStatic.json +0 -7
- package/test/unit/ngsi-ld/examples/contextRequests/updateProvisionMinimumDevice.json +0 -7
- package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalSubscriptionRequest.json +20 -17
- package/test/unit/ngsi-ld/examples/subscriptionRequests/simpleSubscriptionRequest.json +18 -15
- package/test/unit/ngsi-ld/examples/subscriptionRequests/simpleSubscriptionRequest2.json +18 -15
- package/test/unit/ngsi-ld/expressions/expressionBasedTransformations-test.js +21 -21
- package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +1018 -0
- package/test/unit/ngsi-ld/general/config-jsonld-contexts-test.js +2 -2
- package/test/unit/ngsi-ld/general/contextBrokerOAuthSecurityAccess-test.js +24 -24
- package/test/unit/ngsi-ld/general/deviceService-test.js +7 -7
- package/test/unit/ngsi-ld/general/https-support-test.js +14 -13
- package/test/unit/ngsi-ld/general/iotam-autoregistration-test.js +8 -7
- package/test/unit/ngsi-ld/general/startup-test.js +2 -1
- package/test/unit/ngsi-ld/lazyAndCommands/active-devices-attribute-update-test.js +10 -8
- package/test/unit/ngsi-ld/lazyAndCommands/command-test.js +11 -12
- package/test/unit/ngsi-ld/lazyAndCommands/lazy-devices-test.js +25 -29
- package/test/unit/ngsi-ld/lazyAndCommands/polling-commands-test.js +16 -15
- package/test/unit/ngsi-ld/ngsiService/active-devices-test.js +18 -17
- package/test/unit/ngsi-ld/ngsiService/autocast-test.js +13 -12
- package/test/unit/ngsi-ld/ngsiService/geoproperties-test.js +10 -9
- package/test/unit/ngsi-ld/ngsiService/staticAttributes-test.js +3 -3
- package/test/unit/ngsi-ld/ngsiService/subscriptions-test.js +25 -24
- package/test/unit/ngsi-ld/plugins/alias-plugin_test.js +13 -12
- package/test/unit/ngsi-ld/plugins/bidirectional-plugin_test.js +27 -26
- package/test/unit/ngsi-ld/plugins/compress-timestamp-plugin_test.js +5 -5
- package/test/unit/ngsi-ld/plugins/event-plugin_test.js +3 -3
- package/test/unit/ngsi-ld/plugins/multientity-plugin_test.js +75 -14
- package/test/unit/ngsi-ld/plugins/timestamp-processing-plugin_test.js +3 -3
- package/test/unit/ngsi-ld/provisioning/device-provisioning-api_test.js +54 -53
- package/test/unit/ngsi-ld/provisioning/device-registration_test.js +20 -19
- package/test/unit/ngsi-ld/provisioning/device-update-registration_test.js +23 -22
- package/test/unit/ngsi-ld/provisioning/listProvisionedDevices-test.js +58 -70
- package/test/unit/ngsi-ld/provisioning/provisionDeviceMultientity-test.js +8 -7
- package/test/unit/ngsi-ld/provisioning/removeProvisionedDevice-test.js +19 -19
- package/test/unit/ngsi-ld/provisioning/singleConfigurationMode-test.js +18 -20
- package/test/unit/ngsi-ld/provisioning/updateProvisionedDevices-test.js +43 -49
- package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +16 -14
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/registerIoTAgent1.json +1 -1
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/registerIoTAgent2.json +1 -1
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/registerIoTAgent3.json +19 -0
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/registerIoTAgent4.json +1 -1
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/registerIoTAgent5.json +19 -0
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/registerIoTAgentCommands.json +1 -1
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/registerProvisionedDevice.json +1 -1
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/registerProvisionedDevice2.json +1 -1
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup.json +1 -1
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup2.json +1 -1
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup3.json +1 -1
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/updateCommands1.json +3 -3
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/updateIoTAgent1.json +3 -3
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/updateIoTAgent2.json +1 -1
- package/test/unit/ngsiv2/examples/contextAvailabilityRequests/updateIoTAgent3.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin1.json +17 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin11.json +5 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin12.json +2 -2
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin15.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin16.json +14 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin17.json +14 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin18.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin19.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin2.json +13 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin20.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin21.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin22.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin23.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin24.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin25.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin26.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin27.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin28.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin29.json +22 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin3.json +5 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin30.json +6 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin31.json +18 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin32.json +16 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin33.json +22 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34.json +12 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin4.json +12 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin5.json +5 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin6.json +5 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin7.json +5 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin8.json +17 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin9.json +5 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMiddleware1.json +10 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMiddleware2.json +10 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin1.json +2 -2
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin10.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin11.json +13 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin12.json +33 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin13.json +33 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin14.json +33 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin15.json +25 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin16.json +25 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin2.json +2 -2
- 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 +2 -2
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin9.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin1.json +8 -8
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin2.json +4 -4
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin3.json +1 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin4.json +2 -2
- package/test/unit/ngsiv2/examples/contextRequests/updateProvisionDevice.json +20 -0
- package/test/unit/ngsiv2/examples/subscriptionRequests/bidirectionalSubscriptionRequest.json +1 -1
- package/test/unit/ngsiv2/examples/subscriptionRequests/simpleSubscriptionRequest.json +1 -1
- package/test/unit/ngsiv2/examples/subscriptionRequests/simpleSubscriptionRequest2.json +1 -1
- package/test/unit/ngsiv2/expressions/expressionBasedTransformations-test.js +93 -60
- package/test/unit/ngsiv2/expressions/expressionCombinedTransformations-test.js +16 -16
- package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +548 -164
- package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +34 -33
- package/test/unit/ngsiv2/general/deviceService-test.js +15 -14
- package/test/unit/ngsiv2/general/https-support-test.js +14 -13
- package/test/unit/ngsiv2/general/iotam-autoregistration-test.js +8 -7
- package/test/unit/ngsiv2/general/startup-test.js +2 -1
- package/test/unit/ngsiv2/lazyAndCommands/active-devices-attribute-update-test.js +9 -7
- package/test/unit/ngsiv2/lazyAndCommands/command-test.js +13 -12
- package/test/unit/ngsiv2/lazyAndCommands/lazy-devices-test.js +323 -51
- package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +22 -20
- package/test/unit/ngsiv2/ngsiService/active-devices-test.js +114 -26
- package/test/unit/ngsiv2/ngsiService/autocast-test.js +16 -16
- package/test/unit/ngsiv2/ngsiService/geoproperties-test.js +39 -38
- package/test/unit/{ngsiService → ngsiv2/ngsiService}/queryDeviceInformationInCb-test.js +25 -54
- package/test/unit/ngsiv2/ngsiService/staticAttributes-test.js +5 -5
- package/test/unit/ngsiv2/ngsiService/subscriptions-test.js +25 -24
- package/test/unit/ngsiv2/plugins/alias-plugin_test.js +22 -22
- package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +27 -26
- package/test/unit/ngsiv2/plugins/compress-timestamp-plugin_test.js +7 -7
- package/test/unit/ngsiv2/plugins/event-plugin_test.js +4 -4
- package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +549 -24
- package/test/unit/ngsiv2/plugins/timestamp-processing-plugin_test.js +4 -4
- package/test/unit/{plugins → ngsiv2/plugins}/translation-inPlugins_test.js +25 -25
- package/test/unit/{provisioning → ngsiv2/provisioning}/device-group-api-test.js +44 -75
- package/test/unit/{provisioning/device-group-utils_test.js → ngsiv2/provisioning/device-group-utils-test.js} +15 -14
- package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +74 -73
- package/test/unit/ngsiv2/provisioning/device-registration_test.js +20 -19
- package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +30 -29
- package/test/unit/ngsiv2/provisioning/listProvisionedDevices-test.js +58 -69
- package/test/unit/ngsiv2/provisioning/provisionDeviceMultientity-test.js +8 -7
- package/test/unit/ngsiv2/provisioning/removeProvisionedDevice-test.js +19 -19
- package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +18 -19
- package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +49 -52
- package/test/unit/plugins/capture-configuration-inPlugins_test.js +6 -4
- package/test/unit/plugins/capture-provision-inPlugins_test.js +13 -23
- package/.nyc_output/016aca19-69bf-4681-9b41-2835c5131681.json +0 -1
- package/.nyc_output/processinfo/016aca19-69bf-4681-9b41-2835c5131681.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/lib/services/devices/devices-NGSI-v1.js +0 -293
- package/lib/services/devices/registrationUtils.js_avega +0 -589
- package/lib/services/ngsi/entities-NGSI-v1.js +0 -300
- package/lib/services/ngsi/subscription-NGSI-v1.js +0 -234
- package/lib/services/northBound/contextServer-NGSI-v1.js +0 -526
- package/lib/templates/notificationTemplateNgsi1.json +0 -75
- package/lib/templates/updateContextNgsi1.json +0 -50
- package/test/unit/examples/contextAvailabilityRequests/registerIoTAgent1.json +0 -21
- package/test/unit/examples/contextAvailabilityRequests/registerIoTAgent2.json +0 -21
- package/test/unit/examples/contextAvailabilityRequests/registerIoTAgent3.json +0 -25
- package/test/unit/examples/contextAvailabilityRequests/registerIoTAgent4.json +0 -22
- package/test/unit/examples/contextAvailabilityRequests/registerIoTAgentAttributeUpdates.json +0 -16
- package/test/unit/examples/contextAvailabilityRequests/registerIoTAgentCommands.json +0 -21
- package/test/unit/examples/contextAvailabilityRequests/registerNewDevice1.json +0 -21
- package/test/unit/examples/contextAvailabilityRequests/registerNewDevice2.json +0 -21
- package/test/unit/examples/contextAvailabilityRequests/registerProvisionedDevice.json +0 -25
- package/test/unit/examples/contextAvailabilityRequests/registerProvisionedDevice2.json +0 -21
- package/test/unit/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup.json +0 -33
- package/test/unit/examples/contextAvailabilityRequests/registerProvisionedDeviceWithGroup2.json +0 -33
- package/test/unit/examples/contextAvailabilityRequests/unregisterDevice1.json +0 -22
- package/test/unit/examples/contextAvailabilityRequests/unregisterDevice3.json +0 -26
- package/test/unit/examples/contextAvailabilityRequests/unregisterProvisionedDevice.json +0 -26
- package/test/unit/examples/contextAvailabilityRequests/updateCommands1.json +0 -22
- package/test/unit/examples/contextAvailabilityRequests/updateIoTAgent1.json +0 -22
- package/test/unit/examples/contextAvailabilityRequests/updateIoTAgent2.json +0 -26
- package/test/unit/examples/contextAvailabilityRequests/updateIoTAgent3.json +0 -22
- package/test/unit/examples/contextAvailabilityResponses/registerIoTAgent1Failed.json +0 -8
- package/test/unit/examples/contextAvailabilityResponses/registerIoTAgent1Success.json +0 -4
- package/test/unit/examples/contextAvailabilityResponses/registerNewDevice1Success.json +0 -4
- package/test/unit/examples/contextAvailabilityResponses/registerNewDevice2Success.json +0 -4
- package/test/unit/examples/contextAvailabilityResponses/registerProvisionedDeviceSuccess.json +0 -4
- package/test/unit/examples/contextAvailabilityResponses/unregisterDevice1Failed.json +0 -8
- package/test/unit/examples/contextAvailabilityResponses/unregisterDevice1Success.json +0 -4
- package/test/unit/examples/contextAvailabilityResponses/updateCommands1Success.json +0 -4
- package/test/unit/examples/contextAvailabilityResponses/updateIoTAgent1Success.json +0 -6
- package/test/unit/examples/contextProviderResponses/queryInformationResponse.json +0 -22
- package/test/unit/examples/contextProviderResponses/queryInformationResponseEmptyAttributes.json +0 -22
- package/test/unit/examples/contextProviderResponses/queryInformationStaticAttributesResponse.json +0 -27
- package/test/unit/examples/contextProviderResponses/updateInformationResponse.json +0 -22
- package/test/unit/examples/contextProviderResponses/updateInformationResponse2.json +0 -22
- package/test/unit/examples/contextRequests/contextSubscriptionRequest.json +0 -20
- package/test/unit/examples/contextRequests/contextSubscriptionRequest2.json +0 -20
- package/test/unit/examples/contextRequests/createBidirectionalDevice.json +0 -17
- package/test/unit/examples/contextRequests/createDatetimeProvisionedDevice.json +0 -17
- package/test/unit/examples/contextRequests/createGeopointProvisionedDevice.json +0 -17
- package/test/unit/examples/contextRequests/createMinimumProvisionedDevice.json +0 -17
- package/test/unit/examples/contextRequests/createProvisionedDevice.json +0 -32
- package/test/unit/examples/contextRequests/createProvisionedDeviceMultientity.json +0 -32
- package/test/unit/examples/contextRequests/createProvisionedDeviceWithGroup.json +0 -47
- package/test/unit/examples/contextRequests/createProvisionedDeviceWithGroupAndStatic.json +0 -52
- package/test/unit/examples/contextRequests/createProvisionedDeviceWithGroupAndStatic2.json +0 -52
- package/test/unit/examples/contextRequests/createTimeinstantDevice.json +0 -17
- package/test/unit/examples/contextRequests/queryContext1.json +0 -13
- package/test/unit/examples/contextRequests/queryContext2.json +0 -13
- package/test/unit/examples/contextRequests/queryContextAliasPlugin1.json +0 -10
- package/test/unit/examples/contextRequests/queryContextCompressTimestamp1.json +0 -13
- package/test/unit/examples/contextRequests/updateActiveAttributes.json +0 -11
- package/test/unit/examples/contextRequests/updateContext1.json +0 -22
- package/test/unit/examples/contextRequests/updateContext2.json +0 -22
- package/test/unit/examples/contextRequests/updateContext3.json +0 -17
- package/test/unit/examples/contextRequests/updateContext3WithStatic.json +0 -22
- package/test/unit/examples/contextRequests/updateContext4.json +0 -22
- package/test/unit/examples/contextRequests/updateContext5.json +0 -19
- package/test/unit/examples/contextRequests/updateContextAliasPlugin.json +0 -22
- package/test/unit/examples/contextRequests/updateContextAliasPlugin2.json +0 -17
- package/test/unit/examples/contextRequests/updateContextAppendMode.json +0 -22
- package/test/unit/examples/contextRequests/updateContextCommandError.json +0 -22
- package/test/unit/examples/contextRequests/updateContextCommandExpired.json +0 -22
- package/test/unit/examples/contextRequests/updateContextCommandFinish.json +0 -22
- package/test/unit/examples/contextRequests/updateContextCommandStatus.json +0 -17
- package/test/unit/examples/contextRequests/updateContextCompressTimestamp1.json +0 -22
- package/test/unit/examples/contextRequests/updateContextCompressTimestamp2.json +0 -29
- package/test/unit/examples/contextRequests/updateContextExpressionPlugin1.json +0 -17
- package/test/unit/examples/contextRequests/updateContextExpressionPlugin2.json +0 -27
- package/test/unit/examples/contextRequests/updateContextExpressionPlugin3.json +0 -17
- package/test/unit/examples/contextRequests/updateContextExpressionPlugin4.json +0 -17
- package/test/unit/examples/contextRequests/updateContextExpressionPlugin5.json +0 -27
- package/test/unit/examples/contextRequests/updateContextMiddleware1.json +0 -22
- package/test/unit/examples/contextRequests/updateContextMultiEntityPlugin3.json +0 -35
- package/test/unit/examples/contextRequests/updateContextMultientityPlugin1.json +0 -30
- package/test/unit/examples/contextRequests/updateContextMultientityPlugin2.json +0 -30
- package/test/unit/examples/contextRequests/updateContextProcessTimestamp1.json +0 -29
- package/test/unit/examples/contextRequests/updateContextStaticAttributes.json +0 -22
- package/test/unit/examples/contextRequests/updateContextTimestamp.json +0 -41
- package/test/unit/examples/contextRequests/updateContextTimestampOverride.json +0 -22
- package/test/unit/examples/contextRequests/updateContextTimestampOverrideWithoutMilis.json +0 -22
- package/test/unit/examples/contextRequests/updateContextTimestampTimezone.json +0 -41
- package/test/unit/examples/contextRequests/updateProvisionActiveAttributes1.json +0 -17
- package/test/unit/examples/contextRequests/updateProvisionCommands1.json +0 -27
- package/test/unit/examples/contextRequests/updateProvisionDeviceStatic.json +0 -38
- package/test/unit/examples/contextRequests/updateProvisionMinimumDevice.json +0 -17
- package/test/unit/examples/contextResponses/contextSubscriptionRequest2Success.json +0 -7
- package/test/unit/examples/contextResponses/contextSubscriptionRequestSuccess.json +0 -7
- package/test/unit/examples/contextResponses/createBidirectionalDeviceSuccess.json +0 -22
- package/test/unit/examples/contextResponses/createDatetimeProvisionedDeviceSuccess.json +0 -22
- package/test/unit/examples/contextResponses/createGeopointProvisionedDeviceSuccess.json +0 -22
- package/test/unit/examples/contextResponses/createProvisionedDeviceSuccess.json +0 -22
- package/test/unit/examples/contextResponses/createTimeinstantSuccess.json +0 -22
- package/test/unit/examples/contextResponses/queryContext1Success.json +0 -27
- package/test/unit/examples/contextResponses/queryContext2Error.json +0 -7
- package/test/unit/examples/contextResponses/queryContext2UnknownError.json +0 -6
- package/test/unit/examples/contextResponses/queryContext3Error.json +0 -34
- package/test/unit/examples/contextResponses/queryContextAliasPlugin1Success.json +0 -27
- package/test/unit/examples/contextResponses/queryContextCompressTimestamp1Success.json +0 -27
- package/test/unit/examples/contextResponses/updateActiveAttributesSuccess.json +0 -16
- package/test/unit/examples/contextResponses/updateContext1Failed.json +0 -7
- package/test/unit/examples/contextResponses/updateContext1Success.json +0 -27
- package/test/unit/examples/contextResponses/updateContext2Failed.json +0 -35
- package/test/unit/examples/contextResponses/updateContextAliasPlugin2Success.json +0 -27
- package/test/unit/examples/contextResponses/updateContextAliasPluginSuccess.json +0 -27
- package/test/unit/examples/contextResponses/updateContextCommandFinishSuccess.json +0 -27
- package/test/unit/examples/contextResponses/updateContextCommandStatusSuccess.json +0 -22
- package/test/unit/examples/contextResponses/updateContextCompressTimestamp1Success.json +0 -27
- package/test/unit/examples/contextResponses/updateContextCompressTimestamp2Success.json +0 -34
- package/test/unit/examples/contextResponses/updateContextEvents1Success.json +0 -27
- package/test/unit/examples/contextResponses/updateContextExpressionPlugin1Success.json +0 -22
- package/test/unit/examples/contextResponses/updateContextExpressionPlugin2Success.json +0 -22
- package/test/unit/examples/contextResponses/updateContextExpressionPlugin3Success.json +0 -22
- package/test/unit/examples/contextResponses/updateContextExpressionPlugin5Success.json +0 -32
- package/test/unit/examples/contextResponses/updateContextMultientityPlugin1Success.json +0 -40
- package/test/unit/examples/contextResponses/updateContextMultientityPlugin2Success.json +0 -40
- package/test/unit/examples/contextResponses/updateContextMultientityPlugin3Success.json +0 -40
- package/test/unit/examples/contextResponses/updateContextProcessTimestamp1Success.json +0 -27
- package/test/unit/examples/contextResponses/updateProvisionActiveAttributes1Success.json +0 -22
- package/test/unit/examples/contextResponses/updateProvisionCommands1Success.json +0 -32
- package/test/unit/examples/contextResponses/updateProvisionMinimumDeviceSuccess.json +0 -22
- package/test/unit/examples/subscriptionRequests/bidirectionalNotification.json +0 -24
- package/test/unit/examples/subscriptionRequests/bidirectionalSubscriptionRemove.json +0 -3
- package/test/unit/examples/subscriptionRequests/bidirectionalSubscriptionRequest.json +0 -22
- package/test/unit/examples/subscriptionRequests/errorNotification.json +0 -24
- package/test/unit/examples/subscriptionRequests/simpleNotification.json +0 -24
- package/test/unit/examples/subscriptionRequests/simpleSubscriptionRemove.json +0 -3
- package/test/unit/examples/subscriptionRequests/simpleSubscriptionRequest.json +0 -19
- package/test/unit/examples/subscriptionRequests/simpleSubscriptionRequest1.json +0 -19
- package/test/unit/examples/subscriptionResponses/bidirectionalSubscriptionSuccess.json +0 -6
- package/test/unit/examples/subscriptionResponses/simpleSubscriptionSuccess.json +0 -6
- package/test/unit/expressions/expressionBasedTransformations-test.js +0 -328
- package/test/unit/expressions/expressionCombinedTransformations-test.js +0 -306
- package/test/unit/expressions/jexlBasedTransformations-test.js +0 -334
- package/test/unit/general/contextBrokerOAuthSecurityAccess-test.js +0 -902
- package/test/unit/general/https-support-test.js +0 -286
- package/test/unit/general/iotam-autoregistration-test.js +0 -368
- package/test/unit/lazyAndCommands/active-devices-attribute-update-test.js +0 -168
- package/test/unit/lazyAndCommands/command-test.js +0 -341
- package/test/unit/lazyAndCommands/lazy-devices-test.js +0 -878
- package/test/unit/lazyAndCommands/polling-commands-test.js +0 -421
- package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin20.json +0 -25
- package/test/unit/ngsiService/active-devices-test.js +0 -692
- package/test/unit/ngsiService/staticAttributes-test.js +0 -148
- package/test/unit/ngsiService/subscriptions-test.js +0 -345
- package/test/unit/plugins/alias-plugin_test.js +0 -158
- package/test/unit/plugins/bidirectional-plugin_test.js +0 -564
- package/test/unit/plugins/compress-timestamp-plugin_test.js +0 -257
- package/test/unit/plugins/event-plugin_test.js +0 -119
- package/test/unit/plugins/multientity-plugin_test.js +0 -248
- package/test/unit/plugins/timestamp-processing-plugin_test.js +0 -119
- package/test/unit/provisioning/device-provisioning-api_test.js +0 -748
- package/test/unit/provisioning/device-registration_test.js +0 -432
- package/test/unit/provisioning/device-update-registration_test.js +0 -326
- package/test/unit/provisioning/listProvisionedDevices-test.js +0 -488
- package/test/unit/provisioning/provisionDeviceMultientity-test.js +0 -123
- package/test/unit/provisioning/removeProvisionedDevice-test.js +0 -244
- package/test/unit/provisioning/singleConfigurationMode-test.js +0 -346
- package/test/unit/provisioning/updateProvisionedDevices-test.js +0 -436
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
const iotAgentLib = require('../../../../lib/fiware-iotagent-lib');
|
|
29
29
|
const utils = require('../../../tools/utils');
|
|
30
|
+
const request = utils.request;
|
|
30
31
|
const should = require('should');
|
|
31
32
|
const logger = require('logops');
|
|
32
33
|
const nock = require('nock');
|
|
@@ -195,21 +196,21 @@ const iotAgentConfig = {
|
|
|
195
196
|
{
|
|
196
197
|
object_id: 'v1',
|
|
197
198
|
name: 'vol',
|
|
198
|
-
expression
|
|
199
|
+
expression: '${@v1*100}',
|
|
199
200
|
type: 'Number',
|
|
200
201
|
entity_name: 'WeatherStation1'
|
|
201
202
|
},
|
|
202
203
|
{
|
|
203
204
|
object_id: 'v2',
|
|
204
205
|
name: 'vol',
|
|
205
|
-
expression
|
|
206
|
+
expression: '${@v2*100}',
|
|
206
207
|
type: 'Number',
|
|
207
208
|
entity_name: 'WeatherStation2'
|
|
208
209
|
},
|
|
209
210
|
{
|
|
210
211
|
object_id: 'v',
|
|
211
212
|
name: 'vol',
|
|
212
|
-
expression
|
|
213
|
+
expression: '${@v*100}',
|
|
213
214
|
type: 'Number'
|
|
214
215
|
}
|
|
215
216
|
]
|
|
@@ -223,21 +224,61 @@ const iotAgentConfig = {
|
|
|
223
224
|
{
|
|
224
225
|
object_id: 'v1',
|
|
225
226
|
name: 'vol',
|
|
226
|
-
expression
|
|
227
|
+
expression: 'v1 * 100',
|
|
227
228
|
type: 'Number',
|
|
228
229
|
entity_name: 'WeatherStation1'
|
|
229
230
|
},
|
|
230
231
|
{
|
|
231
232
|
object_id: 'v2',
|
|
232
233
|
name: 'vol',
|
|
233
|
-
expression
|
|
234
|
+
expression: 'v2 * 100',
|
|
234
235
|
type: 'Number',
|
|
235
236
|
entity_name: 'WeatherStation2'
|
|
236
237
|
},
|
|
237
238
|
{
|
|
238
239
|
object_id: 'v',
|
|
239
240
|
name: 'vol',
|
|
240
|
-
expression
|
|
241
|
+
expression: 'v * 100',
|
|
242
|
+
type: 'Number'
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
WeatherStation9Jexl: {
|
|
247
|
+
commands: [],
|
|
248
|
+
type: 'WeatherStation',
|
|
249
|
+
expressionLanguage: 'jexl',
|
|
250
|
+
lazy: [],
|
|
251
|
+
static: [
|
|
252
|
+
{
|
|
253
|
+
name: 'st1',
|
|
254
|
+
type: 'Number',
|
|
255
|
+
value: 1
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: 'st2',
|
|
259
|
+
type: 'Number',
|
|
260
|
+
value: 2
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
active: [
|
|
264
|
+
{
|
|
265
|
+
object_id: 'v1',
|
|
266
|
+
name: 'vol',
|
|
267
|
+
expression: 'st1 * 100',
|
|
268
|
+
type: 'Number',
|
|
269
|
+
entity_name: 'WeatherStation1'
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
object_id: 'v2',
|
|
273
|
+
name: 'vol',
|
|
274
|
+
expression: 'st2 * 100',
|
|
275
|
+
type: 'Number',
|
|
276
|
+
entity_name: 'WeatherStation2'
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
object_id: 'v',
|
|
280
|
+
name: 'vol',
|
|
281
|
+
expression: 'v * 100',
|
|
241
282
|
type: 'Number'
|
|
242
283
|
}
|
|
243
284
|
]
|
|
@@ -293,11 +334,192 @@ const iotAgentConfig = {
|
|
|
293
334
|
],
|
|
294
335
|
type: 'SensorCommand',
|
|
295
336
|
lazy: []
|
|
337
|
+
},
|
|
338
|
+
WrongStation: {
|
|
339
|
+
commands: [],
|
|
340
|
+
type: 'WrongStation',
|
|
341
|
+
expressionLanguage: 'jexl',
|
|
342
|
+
lazy: [],
|
|
343
|
+
active: [
|
|
344
|
+
{
|
|
345
|
+
object_id: 'v1',
|
|
346
|
+
name: 'type',
|
|
347
|
+
type: 'string',
|
|
348
|
+
entity_name: 'WrongStation1'
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
object_id: 'v2',
|
|
352
|
+
name: 'id',
|
|
353
|
+
type: 'string',
|
|
354
|
+
entity_name: 'WrongStation1'
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
object_id: 'v',
|
|
358
|
+
name: 'vol',
|
|
359
|
+
type: 'Number',
|
|
360
|
+
entity_name: 'WrongStation1'
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
},
|
|
364
|
+
SharedIds1: {
|
|
365
|
+
commands: [],
|
|
366
|
+
type: 'ShareStation',
|
|
367
|
+
lazy: [],
|
|
368
|
+
active: [
|
|
369
|
+
{
|
|
370
|
+
object_id: 'v1',
|
|
371
|
+
name: 'volt1',
|
|
372
|
+
type: 'Number',
|
|
373
|
+
entity_name: 'WeatherStation1',
|
|
374
|
+
entity_type: 'Type1'
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
object_id: 'v2',
|
|
378
|
+
name: 'volt2',
|
|
379
|
+
type: 'Number',
|
|
380
|
+
entity_name: 'WeatherStation1',
|
|
381
|
+
entity_type: 'Type2'
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
object_id: 'v3',
|
|
385
|
+
name: 'extravolt2',
|
|
386
|
+
type: 'Number',
|
|
387
|
+
entity_name: 'WeatherStation1',
|
|
388
|
+
entity_type: 'Type2'
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
object_id: 'v',
|
|
392
|
+
name: 'vol',
|
|
393
|
+
type: 'Number'
|
|
394
|
+
}
|
|
395
|
+
]
|
|
396
|
+
},
|
|
397
|
+
SharedIds2: {
|
|
398
|
+
commands: [],
|
|
399
|
+
type: 'ShareStation',
|
|
400
|
+
lazy: [],
|
|
401
|
+
active: [
|
|
402
|
+
{
|
|
403
|
+
object_id: 'v1',
|
|
404
|
+
name: 'vol',
|
|
405
|
+
type: 'Number',
|
|
406
|
+
entity_name: 'WeatherStation1',
|
|
407
|
+
entity_type: 'Type1'
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
object_id: 'v2',
|
|
411
|
+
name: 'vol',
|
|
412
|
+
type: 'Number',
|
|
413
|
+
entity_name: 'WeatherStation1',
|
|
414
|
+
entity_type: 'Type2'
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
object_id: 'v3',
|
|
418
|
+
name: 'extravol',
|
|
419
|
+
type: 'Number',
|
|
420
|
+
entity_name: 'WeatherStation1',
|
|
421
|
+
entity_type: 'Type2'
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
object_id: 'v',
|
|
425
|
+
name: 'vol',
|
|
426
|
+
type: 'Number'
|
|
427
|
+
}
|
|
428
|
+
]
|
|
429
|
+
},
|
|
430
|
+
SharedIds3: {
|
|
431
|
+
commands: [],
|
|
432
|
+
type: 'ShareStation',
|
|
433
|
+
expressionLanguage: 'jexl',
|
|
434
|
+
lazy: [],
|
|
435
|
+
active: [
|
|
436
|
+
{
|
|
437
|
+
object_id: 'fakev1',
|
|
438
|
+
expression: 'v',
|
|
439
|
+
name: 'vol',
|
|
440
|
+
type: 'Number',
|
|
441
|
+
entity_name: 'WeatherStation1',
|
|
442
|
+
entity_type: 'Type1'
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
object_id: 'fakev2',
|
|
446
|
+
expression: 'v',
|
|
447
|
+
name: 'vol',
|
|
448
|
+
type: 'Number',
|
|
449
|
+
entity_name: 'WeatherStation1',
|
|
450
|
+
entity_type: 'Type2'
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
object_id: 'fakev3',
|
|
454
|
+
expression: 'v',
|
|
455
|
+
name: 'extravol',
|
|
456
|
+
type: 'Number',
|
|
457
|
+
entity_name: 'WeatherStation1',
|
|
458
|
+
entity_type: 'Type2'
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
object_id: 'v',
|
|
462
|
+
name: 'vol',
|
|
463
|
+
type: 'Number'
|
|
464
|
+
}
|
|
465
|
+
]
|
|
466
|
+
},
|
|
467
|
+
GPS: {
|
|
468
|
+
commands: [],
|
|
469
|
+
type: 'GPS',
|
|
470
|
+
lazy: [],
|
|
471
|
+
active: [
|
|
472
|
+
{
|
|
473
|
+
name: 'explicit',
|
|
474
|
+
type: 'number',
|
|
475
|
+
entity_name: 'SO5',
|
|
476
|
+
object_id: 'x'
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
name: 'explicit',
|
|
480
|
+
type: 'number',
|
|
481
|
+
entity_name: 'SO6',
|
|
482
|
+
object_id: 'y'
|
|
483
|
+
}
|
|
484
|
+
],
|
|
485
|
+
explicitAttrs: true
|
|
486
|
+
},
|
|
487
|
+
GPS2: {
|
|
488
|
+
commands: [],
|
|
489
|
+
type: 'GPS',
|
|
490
|
+
lazy: [],
|
|
491
|
+
active: [
|
|
492
|
+
{
|
|
493
|
+
name: 'foo',
|
|
494
|
+
type: 'text',
|
|
495
|
+
object_id: 'f'
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
name: 'attr1',
|
|
499
|
+
type: 'number',
|
|
500
|
+
entity_name: 'SO5',
|
|
501
|
+
object_id: 'x'
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
name: 'attr2',
|
|
505
|
+
type: 'number',
|
|
506
|
+
entity_name: 'SO6',
|
|
507
|
+
object_id: 'y'
|
|
508
|
+
}
|
|
509
|
+
],
|
|
510
|
+
static: [
|
|
511
|
+
{
|
|
512
|
+
name: 'bar',
|
|
513
|
+
type: 'text',
|
|
514
|
+
value: 'b'
|
|
515
|
+
}
|
|
516
|
+
],
|
|
517
|
+
explicitAttrs: '[ "attr1", "attr2" ]'
|
|
296
518
|
}
|
|
297
519
|
},
|
|
298
|
-
service: '
|
|
520
|
+
service: 'smartgondor',
|
|
299
521
|
subservice: 'gardens',
|
|
300
|
-
providerUrl: 'http://
|
|
522
|
+
providerUrl: 'http://smartgondor.com'
|
|
301
523
|
};
|
|
302
524
|
|
|
303
525
|
describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
@@ -339,7 +561,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
339
561
|
nock.cleanAll();
|
|
340
562
|
|
|
341
563
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
342
|
-
.matchHeader('fiware-service', '
|
|
564
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
343
565
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
344
566
|
.post(
|
|
345
567
|
'/v2/op/update',
|
|
@@ -372,7 +594,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
372
594
|
nock.cleanAll();
|
|
373
595
|
|
|
374
596
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
375
|
-
.matchHeader('fiware-service', '
|
|
597
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
376
598
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
377
599
|
.post(
|
|
378
600
|
'/v2/op/update',
|
|
@@ -410,7 +632,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
410
632
|
nock.cleanAll();
|
|
411
633
|
|
|
412
634
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
413
|
-
.matchHeader('fiware-service', '
|
|
635
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
414
636
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
415
637
|
.post(
|
|
416
638
|
'/v2/op/update',
|
|
@@ -449,7 +671,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
449
671
|
nock.cleanAll();
|
|
450
672
|
|
|
451
673
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
452
|
-
.matchHeader('fiware-service', '
|
|
674
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
453
675
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
454
676
|
.post(
|
|
455
677
|
'/v2/op/update',
|
|
@@ -492,7 +714,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
492
714
|
nock.cleanAll();
|
|
493
715
|
|
|
494
716
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
495
|
-
.matchHeader('fiware-service', '
|
|
717
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
496
718
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
497
719
|
.post(
|
|
498
720
|
'/v2/op/update',
|
|
@@ -535,7 +757,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
535
757
|
nock.cleanAll();
|
|
536
758
|
|
|
537
759
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
538
|
-
.matchHeader('fiware-service', '
|
|
760
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
539
761
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
540
762
|
.post(
|
|
541
763
|
'/v2/op/update',
|
|
@@ -554,7 +776,6 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
554
776
|
});
|
|
555
777
|
});
|
|
556
778
|
});
|
|
557
|
-
|
|
558
779
|
|
|
559
780
|
describe('When an update comes for a multientity defined with an expression (multi values / multiple entities / same attribute)', function () {
|
|
560
781
|
const values = [
|
|
@@ -579,7 +800,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
579
800
|
nock.cleanAll();
|
|
580
801
|
|
|
581
802
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
582
|
-
.matchHeader('fiware-service', '
|
|
803
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
583
804
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
584
805
|
.post(
|
|
585
806
|
'/v2/op/update',
|
|
@@ -599,6 +820,135 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
599
820
|
});
|
|
600
821
|
});
|
|
601
822
|
|
|
823
|
+
describe('When an update comes for a multientity with same entity_id and different entity_type with different attrs', function () {
|
|
824
|
+
const values = [
|
|
825
|
+
{
|
|
826
|
+
name: 'v',
|
|
827
|
+
type: 'Number',
|
|
828
|
+
value: 0
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
name: 'v1',
|
|
832
|
+
type: 'Number',
|
|
833
|
+
value: 1
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
name: 'v2',
|
|
837
|
+
type: 'Number',
|
|
838
|
+
value: 2
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
name: 'v3',
|
|
842
|
+
type: 'Number',
|
|
843
|
+
value: 3
|
|
844
|
+
}
|
|
845
|
+
];
|
|
846
|
+
|
|
847
|
+
beforeEach(function () {
|
|
848
|
+
nock.cleanAll();
|
|
849
|
+
|
|
850
|
+
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
851
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
852
|
+
.matchHeader('fiware-servicepath', 'gardens')
|
|
853
|
+
.post(
|
|
854
|
+
'/v2/op/update',
|
|
855
|
+
utils.readExampleFile(
|
|
856
|
+
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin12.json'
|
|
857
|
+
)
|
|
858
|
+
)
|
|
859
|
+
.reply(204);
|
|
860
|
+
});
|
|
861
|
+
|
|
862
|
+
it('should send the update value to three entities with different attribute names and different object_id', function (done) {
|
|
863
|
+
iotAgentLib.update('sh1', 'SharedIds1', '', values, function (error) {
|
|
864
|
+
should.not.exist(error);
|
|
865
|
+
contextBrokerMock.done();
|
|
866
|
+
done();
|
|
867
|
+
});
|
|
868
|
+
});
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
describe('When an update comes for a multientity with same entity_id and different entity_type whit shared attrs', function () {
|
|
872
|
+
const values = [
|
|
873
|
+
{
|
|
874
|
+
name: 'v',
|
|
875
|
+
type: 'Number',
|
|
876
|
+
value: 0
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
name: 'v1',
|
|
880
|
+
type: 'Number',
|
|
881
|
+
value: 1
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
name: 'v2',
|
|
885
|
+
type: 'Number',
|
|
886
|
+
value: 2
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
name: 'v3',
|
|
890
|
+
type: 'Number',
|
|
891
|
+
value: 3
|
|
892
|
+
}
|
|
893
|
+
];
|
|
894
|
+
|
|
895
|
+
beforeEach(function () {
|
|
896
|
+
nock.cleanAll();
|
|
897
|
+
|
|
898
|
+
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
899
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
900
|
+
.matchHeader('fiware-servicepath', 'gardens')
|
|
901
|
+
.post(
|
|
902
|
+
'/v2/op/update',
|
|
903
|
+
utils.readExampleFile(
|
|
904
|
+
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin13.json'
|
|
905
|
+
)
|
|
906
|
+
)
|
|
907
|
+
.reply(204);
|
|
908
|
+
});
|
|
909
|
+
|
|
910
|
+
it('should send the update value to three entities with same attribute names', function (done) {
|
|
911
|
+
iotAgentLib.update('sh2', 'SharedIds2', '', values, function (error) {
|
|
912
|
+
should.not.exist(error);
|
|
913
|
+
contextBrokerMock.done();
|
|
914
|
+
done();
|
|
915
|
+
});
|
|
916
|
+
});
|
|
917
|
+
});
|
|
918
|
+
|
|
919
|
+
describe('When an update comes for a multientity with same entity_id and different entity_type whit shared attrs and shared object_id', function () {
|
|
920
|
+
const values = [
|
|
921
|
+
{
|
|
922
|
+
name: 'v',
|
|
923
|
+
type: 'Number',
|
|
924
|
+
value: 0
|
|
925
|
+
}
|
|
926
|
+
];
|
|
927
|
+
|
|
928
|
+
beforeEach(function () {
|
|
929
|
+
nock.cleanAll();
|
|
930
|
+
|
|
931
|
+
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
932
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
933
|
+
.matchHeader('fiware-servicepath', 'gardens')
|
|
934
|
+
.post(
|
|
935
|
+
'/v2/op/update',
|
|
936
|
+
utils.readExampleFile(
|
|
937
|
+
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin14.json'
|
|
938
|
+
)
|
|
939
|
+
)
|
|
940
|
+
.reply(204);
|
|
941
|
+
});
|
|
942
|
+
|
|
943
|
+
it('should send the update value to three entities with same attribute names', function (done) {
|
|
944
|
+
iotAgentLib.update('sh3', 'SharedIds3', '', values, function (error) {
|
|
945
|
+
should.not.exist(error);
|
|
946
|
+
contextBrokerMock.done();
|
|
947
|
+
done();
|
|
948
|
+
});
|
|
949
|
+
});
|
|
950
|
+
});
|
|
951
|
+
|
|
602
952
|
describe('When an update comes for a multientity defined with an expression (multi values / multiple entities / same attribute) - JEXL', function () {
|
|
603
953
|
const values = [
|
|
604
954
|
{
|
|
@@ -622,7 +972,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
622
972
|
nock.cleanAll();
|
|
623
973
|
|
|
624
974
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
625
|
-
.matchHeader('fiware-service', '
|
|
975
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
626
976
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
627
977
|
.post(
|
|
628
978
|
'/v2/op/update',
|
|
@@ -642,6 +992,97 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
642
992
|
});
|
|
643
993
|
});
|
|
644
994
|
|
|
995
|
+
describe('When an update comes for a multientity defined with an expression (multi values / multiple entities / same attribute) - JEXL with static', function () {
|
|
996
|
+
const values = [
|
|
997
|
+
{
|
|
998
|
+
name: 'v',
|
|
999
|
+
type: 'Number',
|
|
1000
|
+
value: 0
|
|
1001
|
+
}
|
|
1002
|
+
];
|
|
1003
|
+
|
|
1004
|
+
beforeEach(function () {
|
|
1005
|
+
nock.cleanAll();
|
|
1006
|
+
|
|
1007
|
+
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1008
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
1009
|
+
.matchHeader('fiware-servicepath', 'gardens')
|
|
1010
|
+
.post(
|
|
1011
|
+
'/v2/op/update',
|
|
1012
|
+
utils.readExampleFile(
|
|
1013
|
+
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin10.json'
|
|
1014
|
+
)
|
|
1015
|
+
)
|
|
1016
|
+
.reply(204);
|
|
1017
|
+
});
|
|
1018
|
+
|
|
1019
|
+
it('should send the update value to the resulting value of the expression', function (done) {
|
|
1020
|
+
iotAgentLib.update('ws9', 'WeatherStation9Jexl', '', values, function (error) {
|
|
1021
|
+
should.not.exist(error);
|
|
1022
|
+
contextBrokerMock.done();
|
|
1023
|
+
done();
|
|
1024
|
+
});
|
|
1025
|
+
});
|
|
1026
|
+
});
|
|
1027
|
+
|
|
1028
|
+
beforeEach(function () {
|
|
1029
|
+
nock.cleanAll();
|
|
1030
|
+
|
|
1031
|
+
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1032
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
1033
|
+
.matchHeader('fiware-servicepath', 'gardens')
|
|
1034
|
+
.post(
|
|
1035
|
+
'/v2/op/update',
|
|
1036
|
+
utils.readExampleFile(
|
|
1037
|
+
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin11.json'
|
|
1038
|
+
)
|
|
1039
|
+
)
|
|
1040
|
+
.reply(204);
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1043
|
+
describe('When an update comes for a multientity whith a wrong mapping)', function () {
|
|
1044
|
+
const values = [
|
|
1045
|
+
{
|
|
1046
|
+
name: 'v',
|
|
1047
|
+
type: 'Number',
|
|
1048
|
+
value: 0
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
name: 'v1',
|
|
1052
|
+
type: 'Number',
|
|
1053
|
+
value: 1
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
name: 'v2',
|
|
1057
|
+
type: 'Number',
|
|
1058
|
+
value: 2
|
|
1059
|
+
}
|
|
1060
|
+
];
|
|
1061
|
+
|
|
1062
|
+
beforeEach(function () {
|
|
1063
|
+
nock.cleanAll();
|
|
1064
|
+
|
|
1065
|
+
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1066
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
1067
|
+
.matchHeader('fiware-servicepath', 'gardens')
|
|
1068
|
+
.post(
|
|
1069
|
+
'/v2/op/update',
|
|
1070
|
+
utils.readExampleFile(
|
|
1071
|
+
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin11.json'
|
|
1072
|
+
)
|
|
1073
|
+
)
|
|
1074
|
+
.reply(204);
|
|
1075
|
+
});
|
|
1076
|
+
|
|
1077
|
+
it('should send the update value to the resulting value of the expression overwriting wrong id and type mapped attributes', function (done) {
|
|
1078
|
+
iotAgentLib.update('ws11', 'WrongStation', '', values, function (error) {
|
|
1079
|
+
should.not.exist(error);
|
|
1080
|
+
contextBrokerMock.done();
|
|
1081
|
+
done();
|
|
1082
|
+
});
|
|
1083
|
+
});
|
|
1084
|
+
});
|
|
1085
|
+
|
|
645
1086
|
describe('When an update comes for a multientity measurement without type for one entity', function () {
|
|
646
1087
|
const values = [
|
|
647
1088
|
{
|
|
@@ -660,7 +1101,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
660
1101
|
nock.cleanAll();
|
|
661
1102
|
|
|
662
1103
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
663
|
-
.matchHeader('fiware-service', '
|
|
1104
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
664
1105
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
665
1106
|
.post(
|
|
666
1107
|
'/v2/op/update',
|
|
@@ -680,6 +1121,90 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
680
1121
|
});
|
|
681
1122
|
});
|
|
682
1123
|
|
|
1124
|
+
describe('When an update comes for a multientity measurement explicitAttrs for one entity', function () {
|
|
1125
|
+
const values = [
|
|
1126
|
+
{
|
|
1127
|
+
name: 'x',
|
|
1128
|
+
type: 'Number',
|
|
1129
|
+
value: 52
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
name: 'y',
|
|
1133
|
+
type: 'Number',
|
|
1134
|
+
value: 13
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
name: 'z',
|
|
1138
|
+
type: 'Number',
|
|
1139
|
+
value: 12
|
|
1140
|
+
}
|
|
1141
|
+
];
|
|
1142
|
+
|
|
1143
|
+
beforeEach(function () {
|
|
1144
|
+
nock.cleanAll();
|
|
1145
|
+
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1146
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
1147
|
+
.matchHeader('fiware-servicepath', 'gardens')
|
|
1148
|
+
.post(
|
|
1149
|
+
'/v2/op/update',
|
|
1150
|
+
utils.readExampleFile(
|
|
1151
|
+
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin15.json'
|
|
1152
|
+
)
|
|
1153
|
+
)
|
|
1154
|
+
.reply(204);
|
|
1155
|
+
});
|
|
1156
|
+
|
|
1157
|
+
it('should remove hidden attrs from the value', function (done) {
|
|
1158
|
+
iotAgentLib.update('gps1', 'GPS', '', values, function (error) {
|
|
1159
|
+
should.not.exist(error);
|
|
1160
|
+
contextBrokerMock.done();
|
|
1161
|
+
done();
|
|
1162
|
+
});
|
|
1163
|
+
});
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
describe('When an update comes for a multientity measurement explicitAttrs as jexl for one entity', function () {
|
|
1167
|
+
const values = [
|
|
1168
|
+
{
|
|
1169
|
+
name: 'x',
|
|
1170
|
+
type: 'Number',
|
|
1171
|
+
value: 52
|
|
1172
|
+
},
|
|
1173
|
+
{
|
|
1174
|
+
name: 'y',
|
|
1175
|
+
type: 'Number',
|
|
1176
|
+
value: 13
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
name: 'z',
|
|
1180
|
+
type: 'Number',
|
|
1181
|
+
value: 12
|
|
1182
|
+
}
|
|
1183
|
+
];
|
|
1184
|
+
|
|
1185
|
+
beforeEach(function () {
|
|
1186
|
+
nock.cleanAll();
|
|
1187
|
+
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
1188
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
1189
|
+
.matchHeader('fiware-servicepath', 'gardens')
|
|
1190
|
+
.post(
|
|
1191
|
+
'/v2/op/update',
|
|
1192
|
+
utils.readExampleFile(
|
|
1193
|
+
'./test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin16.json'
|
|
1194
|
+
)
|
|
1195
|
+
)
|
|
1196
|
+
.reply(204);
|
|
1197
|
+
});
|
|
1198
|
+
|
|
1199
|
+
it('should remove hidden attrs from the value', function (done) {
|
|
1200
|
+
iotAgentLib.update('gps1', 'GPS2', '', values, function (error) {
|
|
1201
|
+
should.not.exist(error);
|
|
1202
|
+
contextBrokerMock.done();
|
|
1203
|
+
done();
|
|
1204
|
+
});
|
|
1205
|
+
});
|
|
1206
|
+
});
|
|
1207
|
+
|
|
683
1208
|
describe(
|
|
684
1209
|
'When an update comes for a multientity measurement and there are attributes with' +
|
|
685
1210
|
' the same name but different alias and mapped to different CB entities',
|
|
@@ -696,7 +1221,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
696
1221
|
nock.cleanAll();
|
|
697
1222
|
|
|
698
1223
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
699
|
-
.matchHeader('fiware-service', '
|
|
1224
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
700
1225
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
701
1226
|
.post(
|
|
702
1227
|
'/v2/op/update',
|
|
@@ -748,7 +1273,7 @@ describe('NGSI-v2 - Multi-entity plugin', function () {
|
|
|
748
1273
|
nock.cleanAll();
|
|
749
1274
|
|
|
750
1275
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
751
|
-
.matchHeader('fiware-service', '
|
|
1276
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
752
1277
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
753
1278
|
.post(
|
|
754
1279
|
'/v2/op/update',
|
|
@@ -825,7 +1350,7 @@ describe('NGSI-v2 - Multi-entity plugin is executed before timestamp process plu
|
|
|
825
1350
|
|
|
826
1351
|
it('should send two context elements, one for each entity', function (done) {
|
|
827
1352
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
828
|
-
.matchHeader('fiware-service', '
|
|
1353
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
829
1354
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
830
1355
|
.post('/v2/op/update', function (body) {
|
|
831
1356
|
const expectedBody = utils.readExampleFile(
|
|
@@ -863,7 +1388,7 @@ describe('NGSI-v2 - Multi-entity plugin is executed before timestamp process plu
|
|
|
863
1388
|
|
|
864
1389
|
it('should send two context elements, one for each entity', function (done) {
|
|
865
1390
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
866
|
-
.matchHeader('fiware-service', '
|
|
1391
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
867
1392
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
868
1393
|
.post('/v2/op/update', function (body) {
|
|
869
1394
|
const expectedBody = utils.readExampleFile(
|
|
@@ -901,7 +1426,7 @@ describe('NGSI-v2 - Multi-entity plugin is executed before timestamp process plu
|
|
|
901
1426
|
|
|
902
1427
|
it('should propagate user provider timestamp to mapped entities', function (done) {
|
|
903
1428
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
904
|
-
.matchHeader('fiware-service', '
|
|
1429
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
905
1430
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
906
1431
|
.post(
|
|
907
1432
|
'/v2/op/update',
|
|
@@ -961,7 +1486,7 @@ describe('NGSI-v2 - Multi-entity plugin is executed for a command update for a r
|
|
|
961
1486
|
|
|
962
1487
|
it('Should send the update to the context broker', function (done) {
|
|
963
1488
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
964
|
-
.matchHeader('fiware-service', '
|
|
1489
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
965
1490
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
966
1491
|
.post(
|
|
967
1492
|
'/v2/op/update',
|