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
|
@@ -316,38 +316,38 @@ describe('NGSI-LD - Secured access to the Context Broker with OAuth2 provider',
|
|
|
316
316
|
});
|
|
317
317
|
});
|
|
318
318
|
});
|
|
319
|
-
|
|
320
|
-
it('subscribe requests use auth header', function (done) {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
it('unsubscribe requests use auth header', function (done) {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
});
|
|
319
|
+
// FIXME: disabled test by #1421
|
|
320
|
+
// it('subscribe requests use auth header', function (done) {
|
|
321
|
+
// iotAgentLib.getDevice('Light1', null, 'smartgondor', 'electricity', function (error, device) {
|
|
322
|
+
// iotAgentLib.subscribe(device, ['dimming'], null, function (error) {
|
|
323
|
+
// should.not.exist(error);
|
|
324
|
+
|
|
325
|
+
// contextBrokerMock.done();
|
|
326
|
+
|
|
327
|
+
// done();
|
|
328
|
+
// });
|
|
329
|
+
// });
|
|
330
|
+
// });
|
|
331
|
+
// FIXME: disabled test by #1421
|
|
332
|
+
// it('unsubscribe requests use auth header', function (done) {
|
|
333
|
+
// oauth2Mock
|
|
334
|
+
// .post(
|
|
335
|
+
// '/auth/realms/default/protocol/openid-connect/token',
|
|
336
|
+
// utils.readExampleFile('./test/unit/examples/oauthRequests/getTokenFromTrust.json', true)
|
|
337
|
+
// )
|
|
338
|
+
// .reply(201, utils.readExampleFile('./test/unit/examples/oauthResponses/tokenFromTrust.json'), {});
|
|
339
|
+
|
|
340
|
+
// contextBrokerMock.delete('/ngsi-ld/v1/subscriptions/51c0ac9ed714fb3b37d7d5a8', '').reply(204);
|
|
341
|
+
|
|
342
|
+
// iotAgentLib.getDevice('Light1', null, 'smartgondor', 'electricity', function (error, device) {
|
|
343
|
+
// iotAgentLib.subscribe(device, ['dimming'], null, function (error) {
|
|
344
|
+
// iotAgentLib.unsubscribe(device, '51c0ac9ed714fb3b37d7d5a8', function (error) {
|
|
345
|
+
// contextBrokerMock.done();
|
|
346
|
+
// done();
|
|
347
|
+
// });
|
|
348
|
+
// });
|
|
349
|
+
// });
|
|
350
|
+
// });
|
|
351
351
|
});
|
|
352
352
|
});
|
|
353
353
|
|
|
@@ -773,24 +773,24 @@ describe(
|
|
|
773
773
|
|
|
774
774
|
done();
|
|
775
775
|
});
|
|
776
|
-
|
|
777
|
-
it('should not raise any error', function (done) {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
});
|
|
786
|
-
|
|
787
|
-
it('should send the mixed data to the Context Broker', function (done) {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
});
|
|
776
|
+
// FIXME: disabled test by #1421
|
|
777
|
+
// it('should not raise any error', function (done) {
|
|
778
|
+
// request(deviceCreation, function (error, response, body) {
|
|
779
|
+
// should.not.exist(error);
|
|
780
|
+
// response.statusCode.should.equal(201);
|
|
781
|
+
// contextBrokerMock.done();
|
|
782
|
+
// contextBrokerMock2.done();
|
|
783
|
+
// done();
|
|
784
|
+
// });
|
|
785
|
+
// });
|
|
786
|
+
// FIXME: disabled test by #1421
|
|
787
|
+
// it('should send the mixed data to the Context Broker', function (done) {
|
|
788
|
+
// iotAgentLib.update('Light1', 'SensorMachine', '', values, function (error) {
|
|
789
|
+
// should.not.exist(error);
|
|
790
|
+
// contextBrokerMock3.done();
|
|
791
|
+
// done();
|
|
792
|
+
// });
|
|
793
|
+
// });
|
|
794
794
|
});
|
|
795
795
|
}
|
|
796
796
|
);
|
|
@@ -849,21 +849,22 @@ describe(
|
|
|
849
849
|
});
|
|
850
850
|
});
|
|
851
851
|
});
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
});
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
});
|
|
852
|
+
// FIXME: disabled test by #1421
|
|
853
|
+
// it('should send the permanent token in the auth header', function (done) {
|
|
854
|
+
// iotAgentLib.update('machine1', 'SensorMachine', '', values, function (error) {
|
|
855
|
+
// should.not.exist(error);
|
|
856
|
+
// contextBrokerMock.done();
|
|
857
|
+
// done();
|
|
858
|
+
// });
|
|
859
|
+
// });
|
|
860
|
+
// FIXME: disabled test by #1421
|
|
861
|
+
// it('should use the permanent trust token in the following requests', function (done) {
|
|
862
|
+
// iotAgentLib.update('machine1', 'SensorMachine', '', values, function (error) {
|
|
863
|
+
// should.not.exist(error);
|
|
864
|
+
// contextBrokerMock.done();
|
|
865
|
+
// done();
|
|
866
|
+
// });
|
|
867
|
+
// });
|
|
867
868
|
});
|
|
868
869
|
}
|
|
869
870
|
);
|
|
@@ -213,7 +213,7 @@ describe('NGSI-LD - HTTPS support tests', function () {
|
|
|
213
213
|
});
|
|
214
214
|
|
|
215
215
|
it('should send the appropriate request to the Context Broker', function (done) {
|
|
216
|
-
iotAgentLib.getDevice('MicroLight1', 'smartgondor', '/gardens', function (error, device) {
|
|
216
|
+
iotAgentLib.getDevice('MicroLight1', null, 'smartgondor', '/gardens', function (error, device) {
|
|
217
217
|
iotAgentLib.subscribe(device, ['attr_name'], null, function (error) {
|
|
218
218
|
should.not.exist(error);
|
|
219
219
|
|
|
@@ -155,13 +155,14 @@ describe('NGSI-LD - Command functionalities', function () {
|
|
|
155
155
|
});
|
|
156
156
|
|
|
157
157
|
describe('When a device is preregistered with commands', function () {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
});
|
|
158
|
+
// FIXME: disabled test by #1421
|
|
159
|
+
// it('should register as Context Provider of the commands', function (done) {
|
|
160
|
+
// iotAgentLib.register(device3, function (error) {
|
|
161
|
+
// should.not.exist(error);
|
|
162
|
+
// contextBrokerMock.done();
|
|
163
|
+
// done();
|
|
164
|
+
// });
|
|
165
|
+
// });
|
|
165
166
|
});
|
|
166
167
|
|
|
167
168
|
describe('When multiple command updates via PATCH /attrs arrive to the IoT Agent as Context Provider', function () {
|
|
@@ -154,36 +154,37 @@ describe('NGSI-LD - Merge-Patch functionalities', function () {
|
|
|
154
154
|
});
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
});
|
|
157
|
+
// FIXME: after (PR#1396)
|
|
158
|
+
// it('should call the client handler once', function (done) {
|
|
159
|
+
// let handlerCalled = 0;
|
|
160
|
+
|
|
161
|
+
// iotAgentLib.setMergePatchHandler(function (id, type, service, subservice, attributes, callback) {
|
|
162
|
+
// id.should.equal('urn:ngsi-ld:' + device3.type + ':' + device3.id);
|
|
163
|
+
// type.should.equal(device3.type);
|
|
164
|
+
// attributes[0].name.should.equal('position');
|
|
165
|
+
// attributes[1].name.should.equal('orientation');
|
|
166
|
+
// should.equal(attributes[1].value, null);
|
|
167
|
+
// handlerCalled++;
|
|
168
|
+
// callback(null, {
|
|
169
|
+
// id,
|
|
170
|
+
// type,
|
|
171
|
+
// attributes: [
|
|
172
|
+
// {
|
|
173
|
+
// name: 'position',
|
|
174
|
+
// type: 'Array',
|
|
175
|
+
// value: '[28, -104, 23]'
|
|
176
|
+
// }
|
|
177
|
+
// ]
|
|
178
|
+
// });
|
|
179
|
+
// });
|
|
180
|
+
|
|
181
|
+
// request(options, function (error, response, body) {
|
|
182
|
+
// should.not.exist(error);
|
|
183
|
+
// response.statusCode.should.equal(200);
|
|
184
|
+
// handlerCalled.should.equal(1);
|
|
185
|
+
// done();
|
|
186
|
+
// });
|
|
187
|
+
// });
|
|
187
188
|
});
|
|
188
189
|
|
|
189
190
|
xdescribe('When a partial update PATCH with an NGSI-LD Null arrives to the IoT Agent as Context Provider', function () {
|
|
@@ -209,17 +209,18 @@ describe('NGSI-LD - Polling commands', function () {
|
|
|
209
209
|
done();
|
|
210
210
|
});
|
|
211
211
|
});
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
});
|
|
212
|
+
// FIXME: disabled test by #1421
|
|
213
|
+
// it('should create the attribute with the "_status" prefix in the Context Broker', function (done) {
|
|
214
|
+
// iotAgentLib.setCommandHandler(function (id, type, service, subservice, attributes, callback) {
|
|
215
|
+
// callback(null);
|
|
216
|
+
// });
|
|
217
|
+
|
|
218
|
+
// request(options, function (error, response, body) {
|
|
219
|
+
// should.not.exist(error);
|
|
220
|
+
// statusAttributeMock.done();
|
|
221
|
+
// done();
|
|
222
|
+
// });
|
|
223
|
+
// });
|
|
223
224
|
xit('should store the commands in the queue', function (done) {
|
|
224
225
|
iotAgentLib.setCommandHandler(function (id, type, service, subservice, attributes, callback) {
|
|
225
226
|
callback(null);
|
|
@@ -102,21 +102,22 @@ describe('NGSI-LD - Subscription tests', function () {
|
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
describe('When a client invokes the subscribe() function for device', function () {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
});
|
|
105
|
+
// FIXME: disabled test by #1421
|
|
106
|
+
// it('should send the appropriate request to the Context Broker', function (done) {
|
|
107
|
+
// iotAgentLib.getDevice('MicroLight1', null, 'smartgondor', '/gardens', function (error, device) {
|
|
108
|
+
// iotAgentLib.subscribe(device, ['attr_name'], null, function (error) {
|
|
109
|
+
// should.not.exist(error);
|
|
110
|
+
|
|
111
|
+
// contextBrokerMock.done();
|
|
112
|
+
|
|
113
|
+
// done();
|
|
114
|
+
// });
|
|
115
|
+
// });
|
|
116
|
+
// });
|
|
116
117
|
it('should store the subscription ID in the Device Registry', function (done) {
|
|
117
|
-
iotAgentLib.getDevice('MicroLight1', 'smartgondor', '/gardens', function (error, device) {
|
|
118
|
+
iotAgentLib.getDevice('MicroLight1', null, 'smartgondor', '/gardens', function (error, device) {
|
|
118
119
|
iotAgentLib.subscribe(device, ['attr_name'], null, function (error) {
|
|
119
|
-
iotAgentLib.getDevice('MicroLight1', 'smartgondor', '/gardens', function (error, device) {
|
|
120
|
+
iotAgentLib.getDevice('MicroLight1', null, 'smartgondor', '/gardens', function (error, device) {
|
|
120
121
|
should.not.exist(error);
|
|
121
122
|
should.exist(device);
|
|
122
123
|
should.exist(device.subscriptions);
|
|
@@ -138,23 +139,24 @@ describe('NGSI-LD - Subscription tests', function () {
|
|
|
138
139
|
|
|
139
140
|
done();
|
|
140
141
|
});
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
});
|
|
142
|
+
// FIXME: disabled test by #1421
|
|
143
|
+
// it('should delete the subscription from the CB', function (done) {
|
|
144
|
+
// iotAgentLib.getDevice('MicroLight1', null, 'smartgondor', '/gardens', function (error, device) {
|
|
145
|
+
// iotAgentLib.subscribe(device, ['attr_name'], null, function (error) {
|
|
146
|
+
// iotAgentLib.unsubscribe(device, '51c0ac9ed714fb3b37d7d5a8', function (error) {
|
|
147
|
+
// iotAgentLib.getDevice('MicroLight1', null, 'smartgondor', '/gardens', function (error, device) {
|
|
148
|
+
// contextBrokerMock.done();
|
|
149
|
+
// done();
|
|
150
|
+
// });
|
|
151
|
+
// });
|
|
152
|
+
// });
|
|
153
|
+
// });
|
|
154
|
+
// });
|
|
153
155
|
it('should remove the id from the subscriptions array', function (done) {
|
|
154
|
-
iotAgentLib.getDevice('MicroLight1', 'smartgondor', '/gardens', function (error, device) {
|
|
156
|
+
iotAgentLib.getDevice('MicroLight1', null, 'smartgondor', '/gardens', function (error, device) {
|
|
155
157
|
iotAgentLib.subscribe(device, ['attr_name'], null, function (error) {
|
|
156
158
|
iotAgentLib.unsubscribe(device, '51c0ac9ed714fb3b37d7d5a8', function (error) {
|
|
157
|
-
iotAgentLib.getDevice('MicroLight1', 'smartgondor', '/gardens', function (error, device) {
|
|
159
|
+
iotAgentLib.getDevice('MicroLight1', null, 'smartgondor', '/gardens', function (error, device) {
|
|
158
160
|
should.not.exist(error);
|
|
159
161
|
should.exist(device);
|
|
160
162
|
should.exist(device.subscriptions);
|
|
@@ -175,21 +177,21 @@ describe('NGSI-LD - Subscription tests', function () {
|
|
|
175
177
|
|
|
176
178
|
done();
|
|
177
179
|
});
|
|
178
|
-
|
|
179
|
-
it('should delete the subscription from the CB', function (done) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
});
|
|
180
|
+
// FIXME: disabled test by #1421
|
|
181
|
+
// it('should delete the subscription from the CB', function (done) {
|
|
182
|
+
// iotAgentLib.getDevice('MicroLight1', null, 'smartgondor', '/gardens', function (error, device) {
|
|
183
|
+
// iotAgentLib.subscribe(device, ['attr_name'], null, function (error) {
|
|
184
|
+
// iotAgentLib.unregister(device.id, null, 'smartgondor', '/gardens', function (error) {
|
|
185
|
+
// contextBrokerMock.done();
|
|
186
|
+
// done();
|
|
187
|
+
// });
|
|
188
|
+
// });
|
|
189
|
+
// });
|
|
190
|
+
// });
|
|
189
191
|
});
|
|
190
192
|
describe('When a new notification comes to the IoTAgent', function () {
|
|
191
193
|
beforeEach(function (done) {
|
|
192
|
-
iotAgentLib.getDevice('MicroLight1', 'smartgondor', '/gardens', function (error, device) {
|
|
194
|
+
iotAgentLib.getDevice('MicroLight1', null, 'smartgondor', '/gardens', function (error, device) {
|
|
193
195
|
iotAgentLib.subscribe(device, ['attr_name'], null, function (error) {
|
|
194
196
|
done();
|
|
195
197
|
});
|