iotagent-node-lib 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/doc/api.md +23 -80
- package/doc/deprecated.md +4 -0
- package/doc/howto.md +58 -62
- package/doc/installationguide.md +0 -5
- package/doc/requirements.txt +1 -1
- package/docker/Mosquitto/Dockerfile +1 -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/services/common/iotManagerService.js +0 -1
- package/lib/services/devices/deviceRegistryMongoDB.js +10 -10
- package/lib/services/devices/deviceService.js +14 -19
- package/lib/services/devices/devices-NGSI-v2.js +2 -5
- package/lib/services/ngsi/entities-NGSI-LD.js +3 -3
- package/lib/services/ngsi/entities-NGSI-v2.js +34 -11
- package/lib/services/northBound/deviceProvisioningServer.js +0 -3
- 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/package.json +1 -1
- package/scripts/legacy_expression_tool/README.md +262 -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 +3 -13
- package/test/unit/ngsi-ld/lazyAndCommands/merge-patch-test.js +31 -30
- 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 +10 -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 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin11.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin12.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin13.json +3 -1
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin2.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin29.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin3.json +2 -0
- 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 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin5.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin6.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin7.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin8.json +2 -0
- package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin9.json +2 -0
- 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 +1 -1
- 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 +133 -75
- package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +18 -51
- package/test/unit/ngsiv2/general/https-support-test.js +1 -5
- 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 +143 -57
- 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 +1 -10
- package/test/unit/ngsiv2/plugins/alias-plugin_test.js +20 -30
- package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +0 -63
- 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 +5 -53
- package/test/unit/ngsiv2/provisioning/device-registration_test.js +1 -7
- package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +2 -9
- package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +0 -11
- package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +0 -7
- package/test/unit/plugins/capture-provision-inPlugins_test.js +0 -6
|
@@ -60,6 +60,23 @@ const iotAgentConfig = {
|
|
|
60
60
|
}
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
|
+
LightNoTimestamp: {
|
|
64
|
+
commands: [],
|
|
65
|
+
type: 'Light',
|
|
66
|
+
lazy: [
|
|
67
|
+
{
|
|
68
|
+
name: 'temperature',
|
|
69
|
+
type: 'centigrades'
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
timestamp: false,
|
|
73
|
+
active: [
|
|
74
|
+
{
|
|
75
|
+
name: 'pressure',
|
|
76
|
+
type: 'Hgmm'
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
63
80
|
BrokenLight: {
|
|
64
81
|
commands: [],
|
|
65
82
|
lazy: [
|
|
@@ -175,11 +192,10 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
175
192
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
176
193
|
.matchHeader('fiware-service', 'smartgondor')
|
|
177
194
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
178
|
-
.
|
|
179
|
-
'/v2/entities
|
|
195
|
+
.post(
|
|
196
|
+
'/v2/entities?options=upsert',
|
|
180
197
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext.json')
|
|
181
198
|
)
|
|
182
|
-
.query({ type: 'Light' })
|
|
183
199
|
.reply(204);
|
|
184
200
|
|
|
185
201
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
@@ -192,22 +208,53 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
192
208
|
done();
|
|
193
209
|
});
|
|
194
210
|
});
|
|
211
|
+
});
|
|
195
212
|
|
|
196
|
-
|
|
197
|
-
|
|
213
|
+
describe('When the IoT Agent receives new information and the timestamp flag is on', function () {
|
|
214
|
+
let modifiedValues;
|
|
215
|
+
|
|
216
|
+
beforeEach(function (done) {
|
|
217
|
+
const time = new Date(1438760101468); // 2015-08-05T07:35:01.468+00:00
|
|
218
|
+
|
|
219
|
+
modifiedValues = [
|
|
198
220
|
{
|
|
199
|
-
name: '
|
|
200
|
-
type: '
|
|
201
|
-
value:
|
|
221
|
+
name: 'state',
|
|
222
|
+
type: 'boolean',
|
|
223
|
+
value: true
|
|
202
224
|
},
|
|
203
225
|
{
|
|
204
|
-
name: '
|
|
205
|
-
type: '
|
|
206
|
-
value:
|
|
226
|
+
name: 'dimming',
|
|
227
|
+
type: 'number',
|
|
228
|
+
value: 87
|
|
207
229
|
}
|
|
208
230
|
];
|
|
209
231
|
|
|
210
|
-
|
|
232
|
+
timekeeper.freeze(time);
|
|
233
|
+
|
|
234
|
+
nock.cleanAll();
|
|
235
|
+
|
|
236
|
+
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
237
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
238
|
+
.matchHeader('fiware-servicepath', 'gardens')
|
|
239
|
+
.post(
|
|
240
|
+
'/v2/entities?options=upsert',
|
|
241
|
+
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextTimestamp.json')
|
|
242
|
+
)
|
|
243
|
+
.reply(204);
|
|
244
|
+
|
|
245
|
+
iotAgentConfig.timestamp = true;
|
|
246
|
+
iotAgentLib.activate(iotAgentConfig, done);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
afterEach(function (done) {
|
|
250
|
+
delete iotAgentConfig.timestamp;
|
|
251
|
+
timekeeper.reset();
|
|
252
|
+
|
|
253
|
+
done();
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it('should add the timestamp to the entity and all the attributes', function (done) {
|
|
257
|
+
iotAgentLib.update('light1', 'Light', '', modifiedValues, function (error) {
|
|
211
258
|
should.not.exist(error);
|
|
212
259
|
contextBrokerMock.done();
|
|
213
260
|
done();
|
|
@@ -215,12 +262,10 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
215
262
|
});
|
|
216
263
|
});
|
|
217
264
|
|
|
218
|
-
describe('When the IoT Agent receives new information and the timestamp flag is
|
|
265
|
+
describe('When the IoT Agent receives new information and the timestamp flag is false', function () {
|
|
219
266
|
let modifiedValues;
|
|
220
267
|
|
|
221
268
|
beforeEach(function (done) {
|
|
222
|
-
const time = new Date(1438760101468); // 2015-08-05T07:35:01.468+00:00
|
|
223
|
-
|
|
224
269
|
modifiedValues = [
|
|
225
270
|
{
|
|
226
271
|
name: 'state',
|
|
@@ -234,6 +279,57 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
234
279
|
}
|
|
235
280
|
];
|
|
236
281
|
|
|
282
|
+
nock.cleanAll();
|
|
283
|
+
|
|
284
|
+
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
285
|
+
.matchHeader('fiware-service', 'smartgondor')
|
|
286
|
+
.matchHeader('fiware-servicepath', 'gardens')
|
|
287
|
+
.post(
|
|
288
|
+
'/v2/entities?options=upsert',
|
|
289
|
+
utils.readExampleFile(
|
|
290
|
+
'./test/unit/ngsiv2/examples/contextRequests/updateContextTimestampFalse.json'
|
|
291
|
+
)
|
|
292
|
+
)
|
|
293
|
+
.reply(204);
|
|
294
|
+
|
|
295
|
+
iotAgentConfig.timestamp = false;
|
|
296
|
+
iotAgentLib.activate(iotAgentConfig, done);
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
afterEach(function (done) {
|
|
300
|
+
delete iotAgentConfig.timestamp;
|
|
301
|
+
|
|
302
|
+
done();
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it('should not add the timestamp to the entity and the attributes', function (done) {
|
|
306
|
+
iotAgentLib.update('lightNoTimestamp1', 'LightNoTimestamp', '', modifiedValues, function (error) {
|
|
307
|
+
should.not.exist(error);
|
|
308
|
+
contextBrokerMock.done();
|
|
309
|
+
done();
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
describe('When the IoT Agent receives new information and the timestamp flag is false but the measure contains timeInstant', function () {
|
|
315
|
+
let modifiedValues;
|
|
316
|
+
|
|
317
|
+
beforeEach(function (done) {
|
|
318
|
+
const time = new Date(1438760101468); // 2015-08-05T07:35:01.468+00:00
|
|
319
|
+
|
|
320
|
+
modifiedValues = [
|
|
321
|
+
{
|
|
322
|
+
name: 'state',
|
|
323
|
+
type: 'boolean',
|
|
324
|
+
value: true
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
name: 'TimeInstant',
|
|
328
|
+
type: 'DateTime',
|
|
329
|
+
value: '2015-12-14T08:06:01.468Z'
|
|
330
|
+
}
|
|
331
|
+
];
|
|
332
|
+
|
|
237
333
|
timekeeper.freeze(time);
|
|
238
334
|
|
|
239
335
|
nock.cleanAll();
|
|
@@ -241,14 +337,15 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
241
337
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
242
338
|
.matchHeader('fiware-service', 'smartgondor')
|
|
243
339
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
244
|
-
.
|
|
245
|
-
'/v2/entities
|
|
246
|
-
utils.readExampleFile(
|
|
340
|
+
.post(
|
|
341
|
+
'/v2/entities?options=upsert',
|
|
342
|
+
utils.readExampleFile(
|
|
343
|
+
'./test/unit/ngsiv2/examples/contextRequests/updateContextTimestampFalseTimeInstant.json'
|
|
344
|
+
)
|
|
247
345
|
)
|
|
248
|
-
.query({ type: 'Light' })
|
|
249
346
|
.reply(204);
|
|
250
347
|
|
|
251
|
-
iotAgentConfig.timestamp =
|
|
348
|
+
iotAgentConfig.timestamp = false;
|
|
252
349
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
253
350
|
});
|
|
254
351
|
|
|
@@ -259,8 +356,8 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
259
356
|
done();
|
|
260
357
|
});
|
|
261
358
|
|
|
262
|
-
it('should add the timestamp to the entity
|
|
263
|
-
iotAgentLib.update('
|
|
359
|
+
it('should add the timestamp attribute to the entity but not as attribute metadata', function (done) {
|
|
360
|
+
iotAgentLib.update('lightNoTimestamp1', 'LightNoTimestamp', '', modifiedValues, function (error) {
|
|
264
361
|
should.not.exist(error);
|
|
265
362
|
contextBrokerMock.done();
|
|
266
363
|
done();
|
|
@@ -332,13 +429,12 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
332
429
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
333
430
|
.matchHeader('fiware-service', 'smartgondor')
|
|
334
431
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
335
|
-
.
|
|
336
|
-
'/v2/entities
|
|
432
|
+
.post(
|
|
433
|
+
'/v2/entities?options=upsert',
|
|
337
434
|
utils.readExampleFile(
|
|
338
435
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverrideWithoutMilis.json'
|
|
339
436
|
)
|
|
340
437
|
)
|
|
341
|
-
.query({ type: 'Light' })
|
|
342
438
|
.reply(204);
|
|
343
439
|
|
|
344
440
|
iotAgentConfig.timestamp = true;
|
|
@@ -361,7 +457,7 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
361
457
|
});
|
|
362
458
|
});
|
|
363
459
|
|
|
364
|
-
describe('When the IoT Agent receives new information, the timestamp flag is
|
|
460
|
+
describe('When the IoT Agent receives new information, the timestamp flag is on and timezone is defined', function () {
|
|
365
461
|
let modifiedValues;
|
|
366
462
|
|
|
367
463
|
beforeEach(function (done) {
|
|
@@ -387,13 +483,12 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
387
483
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
388
484
|
.matchHeader('fiware-service', 'smartgondor')
|
|
389
485
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
390
|
-
.
|
|
391
|
-
'/v2/entities
|
|
486
|
+
.post(
|
|
487
|
+
'/v2/entities?options=upsert',
|
|
392
488
|
utils.readExampleFile(
|
|
393
489
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextTimestampTimezone.json'
|
|
394
490
|
)
|
|
395
491
|
)
|
|
396
|
-
.query({ type: 'Light' })
|
|
397
492
|
.reply(204);
|
|
398
493
|
|
|
399
494
|
iotAgentConfig.timestamp = true;
|
|
@@ -444,13 +539,12 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
444
539
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
445
540
|
.matchHeader('fiware-service', 'smartgondor')
|
|
446
541
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
447
|
-
.
|
|
448
|
-
'/v2/entities
|
|
542
|
+
.post(
|
|
543
|
+
'/v2/entities?options=upsert',
|
|
449
544
|
utils.readExampleFile(
|
|
450
545
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverride.json'
|
|
451
546
|
)
|
|
452
547
|
)
|
|
453
|
-
.query({ type: 'Light' })
|
|
454
548
|
.reply(204);
|
|
455
549
|
|
|
456
550
|
iotAgentConfig.timestamp = true;
|
|
@@ -499,13 +593,12 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
499
593
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
500
594
|
.matchHeader('fiware-service', 'smartgondor')
|
|
501
595
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
502
|
-
.
|
|
503
|
-
'/v2/entities
|
|
596
|
+
.post(
|
|
597
|
+
'/v2/entities?options=upsert',
|
|
504
598
|
utils.readExampleFile(
|
|
505
599
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverride.json'
|
|
506
600
|
)
|
|
507
601
|
)
|
|
508
|
-
.query({ type: 'Light' })
|
|
509
602
|
.reply(204);
|
|
510
603
|
|
|
511
604
|
iotAgentConfig.timestamp = true;
|
|
@@ -554,11 +647,10 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
554
647
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
555
648
|
.matchHeader('fiware-service', 'smartgondor')
|
|
556
649
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
557
|
-
.
|
|
558
|
-
'/v2/entities
|
|
650
|
+
.post(
|
|
651
|
+
'/v2/entities?options=upsert',
|
|
559
652
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext.json')
|
|
560
653
|
)
|
|
561
|
-
.query({ type: 'Light' })
|
|
562
654
|
.reply(
|
|
563
655
|
413,
|
|
564
656
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextResponses/updateContext1Failed.json')
|
|
@@ -587,11 +679,10 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
587
679
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
588
680
|
.matchHeader('fiware-service', 'smartgondor')
|
|
589
681
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
590
|
-
.
|
|
591
|
-
'/v2/entities
|
|
682
|
+
.post(
|
|
683
|
+
'/v2/entities?options=upsert',
|
|
592
684
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext.json')
|
|
593
685
|
)
|
|
594
|
-
.query({ type: 'Light' })
|
|
595
686
|
.reply(
|
|
596
687
|
400,
|
|
597
688
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextResponses/updateContext2Failed.json')
|
|
@@ -617,11 +708,10 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
617
708
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
618
709
|
.matchHeader('fiware-service', 'smartgondor')
|
|
619
710
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
620
|
-
.
|
|
621
|
-
'/v2/entities
|
|
711
|
+
.post(
|
|
712
|
+
'/v2/entities?options=upsert',
|
|
622
713
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext.json')
|
|
623
714
|
)
|
|
624
|
-
.query({ type: 'Light' })
|
|
625
715
|
.reply(
|
|
626
716
|
500,
|
|
627
717
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextResponses/updateContext2Failed.json')
|
|
@@ -650,11 +740,10 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
650
740
|
contextBrokerMock = nock('http://192.168.1.1:3024')
|
|
651
741
|
.matchHeader('fiware-service', 'smartgondor')
|
|
652
742
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
653
|
-
.
|
|
654
|
-
'/v2/entities
|
|
655
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/
|
|
743
|
+
.post(
|
|
744
|
+
'/v2/entities?options=upsert',
|
|
745
|
+
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext5.json')
|
|
656
746
|
)
|
|
657
|
-
.query({ type: 'Humidity' })
|
|
658
747
|
.reply(204);
|
|
659
748
|
|
|
660
749
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
@@ -684,13 +773,12 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
684
773
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
685
774
|
.matchHeader('fiware-service', 'smartgondor')
|
|
686
775
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
687
|
-
.
|
|
688
|
-
'/v2/entities
|
|
776
|
+
.post(
|
|
777
|
+
'/v2/entities?options=upsert',
|
|
689
778
|
utils.readExampleFile(
|
|
690
779
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributes.json'
|
|
691
780
|
)
|
|
692
781
|
)
|
|
693
|
-
.query({ type: 'Motion' })
|
|
694
782
|
.reply(204);
|
|
695
783
|
|
|
696
784
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
@@ -720,13 +808,12 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
720
808
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
721
809
|
.matchHeader('fiware-service', 'smartgondor')
|
|
722
810
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
723
|
-
.
|
|
724
|
-
'/v2/entities
|
|
811
|
+
.post(
|
|
812
|
+
'/v2/entities?options=upsert',
|
|
725
813
|
utils.readExampleFile(
|
|
726
814
|
'./test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributesMetadata.json'
|
|
727
815
|
)
|
|
728
816
|
)
|
|
729
|
-
.query({ type: 'Lamp' })
|
|
730
817
|
.reply(204);
|
|
731
818
|
|
|
732
819
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
@@ -748,10 +835,9 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
748
835
|
.matchHeader('fiware-service', 'smartgondor')
|
|
749
836
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
750
837
|
.post(
|
|
751
|
-
'/v2/entities
|
|
838
|
+
'/v2/entities?options=upsert',
|
|
752
839
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext.json')
|
|
753
840
|
)
|
|
754
|
-
.query({ type: 'Light' })
|
|
755
841
|
.reply(204);
|
|
756
842
|
|
|
757
843
|
iotAgentConfig.appendMode = true;
|
|
@@ -784,7 +870,7 @@ describe('NGSI-v2 - Active attributes test', function () {
|
|
|
784
870
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
785
871
|
.patch(
|
|
786
872
|
'/v2/entities/light1/attrs',
|
|
787
|
-
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/
|
|
873
|
+
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContext6.json')
|
|
788
874
|
)
|
|
789
875
|
.query({ type: 'Light' })
|
|
790
876
|
.reply(204);
|
|
@@ -107,11 +107,10 @@ describe('NGSI-v2 - JSON native types autocast test', function () {
|
|
|
107
107
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
108
108
|
.matchHeader('fiware-service', 'smartgondor')
|
|
109
109
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
110
|
-
.
|
|
111
|
-
'/v2/entities
|
|
110
|
+
.post(
|
|
111
|
+
'/v2/entities?options=upsert',
|
|
112
112
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAutocast1.json')
|
|
113
113
|
)
|
|
114
|
-
.query({ type: 'Light' })
|
|
115
114
|
.reply(204);
|
|
116
115
|
|
|
117
116
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
@@ -141,11 +140,10 @@ describe('NGSI-v2 - JSON native types autocast test', function () {
|
|
|
141
140
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
142
141
|
.matchHeader('fiware-service', 'smartgondor')
|
|
143
142
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
144
|
-
.
|
|
145
|
-
'/v2/entities
|
|
143
|
+
.post(
|
|
144
|
+
'/v2/entities?options=upsert',
|
|
146
145
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAutocast2.json')
|
|
147
146
|
)
|
|
148
|
-
.query({ type: 'Light' })
|
|
149
147
|
.reply(204);
|
|
150
148
|
|
|
151
149
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
@@ -175,11 +173,10 @@ describe('NGSI-v2 - JSON native types autocast test', function () {
|
|
|
175
173
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
176
174
|
.matchHeader('fiware-service', 'smartgondor')
|
|
177
175
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
178
|
-
.
|
|
179
|
-
'/v2/entities
|
|
176
|
+
.post(
|
|
177
|
+
'/v2/entities?options=upsert',
|
|
180
178
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAutocast3.json')
|
|
181
179
|
)
|
|
182
|
-
.query({ type: 'Light' })
|
|
183
180
|
.reply(204);
|
|
184
181
|
|
|
185
182
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
@@ -209,11 +206,10 @@ describe('NGSI-v2 - JSON native types autocast test', function () {
|
|
|
209
206
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
210
207
|
.matchHeader('fiware-service', 'smartgondor')
|
|
211
208
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
212
|
-
.
|
|
213
|
-
'/v2/entities
|
|
209
|
+
.post(
|
|
210
|
+
'/v2/entities?options=upsert',
|
|
214
211
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAutocast4.json')
|
|
215
212
|
)
|
|
216
|
-
.query({ type: 'Light' })
|
|
217
213
|
.reply(204);
|
|
218
214
|
|
|
219
215
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
@@ -243,11 +239,10 @@ describe('NGSI-v2 - JSON native types autocast test', function () {
|
|
|
243
239
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
244
240
|
.matchHeader('fiware-service', 'smartgondor')
|
|
245
241
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
246
|
-
.
|
|
247
|
-
'/v2/entities
|
|
242
|
+
.post(
|
|
243
|
+
'/v2/entities?options=upsert',
|
|
248
244
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAutocast5.json')
|
|
249
245
|
)
|
|
250
|
-
.query({ type: 'Light' })
|
|
251
246
|
.reply(204);
|
|
252
247
|
|
|
253
248
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
@@ -277,11 +272,10 @@ describe('NGSI-v2 - JSON native types autocast test', function () {
|
|
|
277
272
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
278
273
|
.matchHeader('fiware-service', 'smartgondor')
|
|
279
274
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
280
|
-
.
|
|
281
|
-
'/v2/entities
|
|
275
|
+
.post(
|
|
276
|
+
'/v2/entities?options=upsert',
|
|
282
277
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAutocast6.json')
|
|
283
278
|
)
|
|
284
|
-
.query({ type: 'Light' })
|
|
285
279
|
.reply(204);
|
|
286
280
|
|
|
287
281
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
@@ -311,11 +305,10 @@ describe('NGSI-v2 - JSON native types autocast test', function () {
|
|
|
311
305
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
312
306
|
.matchHeader('fiware-service', 'smartgondor')
|
|
313
307
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
314
|
-
.
|
|
315
|
-
'/v2/entities
|
|
308
|
+
.post(
|
|
309
|
+
'/v2/entities?options=upsert',
|
|
316
310
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAutocast7.json')
|
|
317
311
|
)
|
|
318
|
-
.query({ type: 'Light' })
|
|
319
312
|
.reply(204);
|
|
320
313
|
|
|
321
314
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
@@ -112,20 +112,18 @@ describe('NGSI-v2 - Static attributes test', function () {
|
|
|
112
112
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
113
113
|
.matchHeader('fiware-service', 'smartgondor')
|
|
114
114
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
115
|
-
.
|
|
116
|
-
.query({ type: 'Light' })
|
|
115
|
+
.post('/v2/entities?options=upsert')
|
|
117
116
|
.times(4)
|
|
118
117
|
.reply(204)
|
|
119
|
-
.
|
|
118
|
+
.post('/v2/entities?options=upsert', function (body) {
|
|
120
119
|
let metadatas = 0;
|
|
121
120
|
for (const i in body) {
|
|
122
121
|
if (body[i].metadata) {
|
|
123
122
|
metadatas += Object.keys(body[i].metadata).length;
|
|
124
123
|
}
|
|
125
124
|
}
|
|
126
|
-
return metadatas === Object.keys(body).length - 1;
|
|
125
|
+
return metadatas === Object.keys(body).length - 1 - 2;
|
|
127
126
|
})
|
|
128
|
-
.query({ type: 'Light' })
|
|
129
127
|
.reply(204);
|
|
130
128
|
|
|
131
129
|
iotAgentLib.activate(iotAgentConfig, done);
|
|
@@ -64,16 +64,7 @@ describe('NGSI-v2 - Subscription tests', function () {
|
|
|
64
64
|
nock.cleanAll();
|
|
65
65
|
|
|
66
66
|
iotAgentLib.activate(iotAgentConfig, function () {
|
|
67
|
-
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
68
|
-
.matchHeader('fiware-service', 'smartgondor')
|
|
69
|
-
.matchHeader('fiware-servicepath', '/gardens')
|
|
70
|
-
.post(
|
|
71
|
-
'/v2/entities?options=upsert',
|
|
72
|
-
utils.readExampleFile(
|
|
73
|
-
'./test/unit/ngsiv2/examples/contextRequests/createMinimumProvisionedDevice.json'
|
|
74
|
-
)
|
|
75
|
-
)
|
|
76
|
-
.reply(204);
|
|
67
|
+
contextBrokerMock = nock('http://192.168.1.1:1026');
|
|
77
68
|
|
|
78
69
|
contextBrokerMock
|
|
79
70
|
.matchHeader('fiware-service', 'smartgondor')
|
|
@@ -146,11 +146,10 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
|
|
|
146
146
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
147
147
|
.matchHeader('fiware-service', 'smartgondor')
|
|
148
148
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
149
|
-
.
|
|
150
|
-
'/v2/entities
|
|
149
|
+
.post(
|
|
150
|
+
'/v2/entities?options=upsert',
|
|
151
151
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin1.json')
|
|
152
152
|
)
|
|
153
|
-
.query({ type: 'Light' })
|
|
154
153
|
.reply(204);
|
|
155
154
|
});
|
|
156
155
|
|
|
@@ -177,11 +176,10 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
|
|
|
177
176
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
178
177
|
.matchHeader('fiware-service', 'smartgondor')
|
|
179
178
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
180
|
-
.
|
|
181
|
-
'/v2/entities
|
|
179
|
+
.post(
|
|
180
|
+
'/v2/entities?options=upsert',
|
|
182
181
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin2.json')
|
|
183
182
|
)
|
|
184
|
-
.query({ type: 'Light' })
|
|
185
183
|
.reply(204);
|
|
186
184
|
});
|
|
187
185
|
|
|
@@ -208,11 +206,10 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
|
|
|
208
206
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
209
207
|
.matchHeader('fiware-service', 'smartgondor')
|
|
210
208
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
211
|
-
.
|
|
212
|
-
'/v2/entities
|
|
209
|
+
.post(
|
|
210
|
+
'/v2/entities?options=upsert',
|
|
213
211
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin3.json')
|
|
214
212
|
)
|
|
215
|
-
.query({ type: 'Light' })
|
|
216
213
|
.reply(204);
|
|
217
214
|
});
|
|
218
215
|
|
|
@@ -240,11 +237,10 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
|
|
|
240
237
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
241
238
|
.matchHeader('fiware-service', 'smartgondor')
|
|
242
239
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
243
|
-
.
|
|
244
|
-
'/v2/entities
|
|
240
|
+
.post(
|
|
241
|
+
'/v2/entities?options=upsert',
|
|
245
242
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin3.json')
|
|
246
243
|
)
|
|
247
|
-
.query({ type: 'Light' })
|
|
248
244
|
.reply(204);
|
|
249
245
|
});
|
|
250
246
|
|
|
@@ -272,11 +268,10 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
|
|
|
272
268
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
273
269
|
.matchHeader('fiware-service', 'smartgondor')
|
|
274
270
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
275
|
-
.
|
|
276
|
-
'/v2/entities
|
|
271
|
+
.post(
|
|
272
|
+
'/v2/entities?options=upsert',
|
|
277
273
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin4.json')
|
|
278
274
|
)
|
|
279
|
-
.query({ type: 'Light' })
|
|
280
275
|
.reply(204);
|
|
281
276
|
});
|
|
282
277
|
|
|
@@ -304,11 +299,10 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
|
|
|
304
299
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
305
300
|
.matchHeader('fiware-service', 'smartgondor')
|
|
306
301
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
307
|
-
.
|
|
308
|
-
'/v2/entities
|
|
302
|
+
.post(
|
|
303
|
+
'/v2/entities?options=upsert',
|
|
309
304
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin5.json')
|
|
310
305
|
)
|
|
311
|
-
.query({ type: 'Light' })
|
|
312
306
|
.reply(204);
|
|
313
307
|
});
|
|
314
308
|
|
|
@@ -336,11 +330,10 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
|
|
|
336
330
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
337
331
|
.matchHeader('fiware-service', 'smartgondor')
|
|
338
332
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
339
|
-
.
|
|
340
|
-
'/v2/entities
|
|
333
|
+
.post(
|
|
334
|
+
'/v2/entities?options=upsert',
|
|
341
335
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin6.json')
|
|
342
336
|
)
|
|
343
|
-
.query({ type: 'Light' })
|
|
344
337
|
.reply(204);
|
|
345
338
|
});
|
|
346
339
|
|
|
@@ -368,11 +361,10 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
|
|
|
368
361
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
369
362
|
.matchHeader('fiware-service', 'smartgondor')
|
|
370
363
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
371
|
-
.
|
|
372
|
-
'/v2/entities
|
|
364
|
+
.post(
|
|
365
|
+
'/v2/entities?options=upsert',
|
|
373
366
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin7.json')
|
|
374
367
|
)
|
|
375
|
-
.query({ type: 'Light' })
|
|
376
368
|
.reply(204);
|
|
377
369
|
});
|
|
378
370
|
|
|
@@ -400,11 +392,10 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
|
|
|
400
392
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
401
393
|
.matchHeader('fiware-service', 'smartgondor')
|
|
402
394
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
403
|
-
.
|
|
404
|
-
'/v2/entities
|
|
395
|
+
.post(
|
|
396
|
+
'/v2/entities?options=upsert',
|
|
405
397
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin8.json')
|
|
406
398
|
)
|
|
407
|
-
.query({ type: 'Light' })
|
|
408
399
|
.reply(204);
|
|
409
400
|
});
|
|
410
401
|
|
|
@@ -432,11 +423,10 @@ describe('NGSI-v2 - Attribute alias plugin', function () {
|
|
|
432
423
|
contextBrokerMock = nock('http://192.168.1.1:1026')
|
|
433
424
|
.matchHeader('fiware-service', 'smartgondor')
|
|
434
425
|
.matchHeader('fiware-servicepath', 'gardens')
|
|
435
|
-
.
|
|
436
|
-
'/v2/entities
|
|
426
|
+
.post(
|
|
427
|
+
'/v2/entities?options=upsert',
|
|
437
428
|
utils.readExampleFile('./test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin9.json')
|
|
438
429
|
)
|
|
439
|
-
.query({ type: 'Light' })
|
|
440
430
|
.reply(204);
|
|
441
431
|
});
|
|
442
432
|
|