From 67abaa5a2822d61030f132cf5b8fd94a031f830c Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Fri, 8 Nov 2024 10:25:50 +0100 Subject: [PATCH 1/3] add test case --- test/functional/testCases.js | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/functional/testCases.js b/test/functional/testCases.js index b2f850aa5..e8a07436f 100644 --- a/test/functional/testCases.js +++ b/test/functional/testCases.js @@ -542,6 +542,11 @@ const testCases = [ object_id: '.1.0.0.1', name: 'psBatteryVoltage', type: 'Number' + }, + { + object_id: 't', + name: 'value', + type: 'Number' } ], static_attributes: [] @@ -588,6 +593,41 @@ const testCases = [ value: 23.5 } } + }, + { + shouldName: + 'A - WHEN sending defined object_ids with special format names in attributes through http IT should send measures to Context Broker preserving value types, name mappings and metadatas', + type: 'single', + measure: { + url: 'http://localhost:' + config.http.port + '/iot/json', + method: 'POST', + qs: { + i: globalEnv.deviceId, + k: globalEnv.apikey + }, + json: { + a: false, + t: 10 + } + }, + expectation: { + id: globalEnv.entity_name, + type: globalEnv.entity_type, + attr_a: { + value: false, + type: 'Boolean', + metadata: { + accuracy: { + value: 0.8, + type: 'Float' + } + } + }, + value: { + type: 'Number', + value: 10 + } + } } ] }, From ac3f1949c316640c538cff2e0673f5c4a283d404 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Tue, 19 Nov 2024 17:52:30 +0100 Subject: [PATCH 2/3] add non defined attribute --- test/functional/testCases.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/functional/testCases.js b/test/functional/testCases.js index e8a07436f..f3ce66160 100644 --- a/test/functional/testCases.js +++ b/test/functional/testCases.js @@ -607,7 +607,8 @@ const testCases = [ }, json: { a: false, - t: 10 + t: 10, + fireDetectionThreshold: 10 } }, expectation: { @@ -626,6 +627,10 @@ const testCases = [ value: { type: 'Number', value: 10 + }, + fireDetectionThreshold: { + type: 'Text', + value: 10 } } } From 10167dfc332b363b41b715523371e505bde9507d Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Wed, 20 Nov 2024 08:37:43 +0100 Subject: [PATCH 3/3] update examples --- test/functional/testCases.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/test/functional/testCases.js b/test/functional/testCases.js index f3ce66160..6b9d4a45e 100644 --- a/test/functional/testCases.js +++ b/test/functional/testCases.js @@ -547,6 +547,15 @@ const testCases = [ object_id: 't', name: 'value', type: 'Number' + }, + { + name: 'fireDetectionThreshold', + type: 'Number' + }, + { + object_id: 'fireDetectionThreshold3', + name: 'fireDetectionThreshold3', + type: 'Number' } ], static_attributes: [] @@ -596,7 +605,7 @@ const testCases = [ }, { shouldName: - 'A - WHEN sending defined object_ids with special format names in attributes through http IT should send measures to Context Broker preserving value types, name mappings and metadatas', + 'B - WHEN sending defined object_ids with special format names in attributes through http IT should send measures to Context Broker preserving value types, name mappings and metadatas', type: 'single', measure: { url: 'http://localhost:' + config.http.port + '/iot/json', @@ -608,7 +617,9 @@ const testCases = [ json: { a: false, t: 10, - fireDetectionThreshold: 10 + fireDetectionThreshold: 10, + fireDetectionThreshold2: 20, + fireDetectionThreshold3: 30 } }, expectation: { @@ -629,8 +640,16 @@ const testCases = [ value: 10 }, fireDetectionThreshold: { - type: 'Text', + type: 'Number', value: 10 + }, + fireDetectionThreshold2: { + type: 'Text', + value: 20 + }, + fireDetectionThreshold3: { + type: 'Number', + value: 30 } } }