Skip to content

Commit

Permalink
provide device id in typeInformation
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroVega committed Aug 7, 2024
1 parent 1a09eef commit 9d7ff89
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
9 changes: 7 additions & 2 deletions test/functional/functional-tests-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,17 @@ describe('FUNCTIONAL TESTS AUTO', function () {
if (testCase.loglevel) {
logger.setLevel(testCase.loglevel);
}
let type = testUtils.groupToIoTAConfigType(
let confType = testUtils.groupToIoTAConfigType(
testCase.provision.json.services[0],
testCase.provision.headers['fiware-service'],
testCase.provision.headers['fiware-servicepath']
);
config.iota.types[type.name] = type.type;
// Inject device id into config as real typeInformation
if (testCase.should[0] && testCase.should[0].measure.qs.i) {
confType.type['id'] = testCase.should[0].measure.qs.i;
}
config.iota.types[confType.name] = confType.type;

iotAgentLib.activate(config.iota, function (error) {
done(error);
});
Expand Down
22 changes: 16 additions & 6 deletions test/functional/testCases.js
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,7 @@ const testCases = [
object_id: 'a',
name: 'attr_a',
type: 'Text',
expression: 'a+":"+service+subservice+type'
expression: 'a+":"+service+subservice+id+type'
}
]
}
Expand Down Expand Up @@ -1815,7 +1815,12 @@ const testCases = [
id: globalEnv.entity_name,
type: globalEnv.entity_type,
attr_a: {
value: 'text:' + globalEnv.service + globalEnv.servicePath + globalEnv.entity_type,
value:
'text:' +
globalEnv.service +
globalEnv.servicePath +
globalEnv.deviceId +
globalEnv.entity_type,
type: 'Text'
}
}
Expand Down Expand Up @@ -1852,7 +1857,7 @@ const testCases = [
object_id: 'c',
name: 'attr_c',
type: 'Text',
expression: 'c+":"+service+subservice+type'
expression: 'c+":"+service+subservice+id+type'
},
{
object_id: 'd',
Expand Down Expand Up @@ -1916,7 +1921,12 @@ const testCases = [
},
attr_c: {
type: 'Text',
value: 'text:' + globalEnv.service + globalEnv.servicePath + globalEnv.entity_type
value:
'text:' +
globalEnv.service +
globalEnv.servicePath +
globalEnv.deviceId +
globalEnv.entity_type
},
attr_d: {
type: 'Float',
Expand Down Expand Up @@ -4191,7 +4201,7 @@ const testCases = [
type: 'Number',
entity_name: 'TestType:TestDevice2',
entity_type: 'TestType',
expression: 'type+":"+(t*2*static_a)' // Only type is used as JEXL context attr due to #1523
expression: 'type+":"+(t*2*static_a)'
}
],
static_attributes: [
Expand Down Expand Up @@ -4277,7 +4287,7 @@ const testCases = [
object_id: 't',
name: 'temperature',
type: 'Number',
entity_name: 'type+":"+(t*2*static_a)', // Only type is used as JEXL context attr due to #1523
entity_name: 'type+":"+(t*2*static_a)',
entity_type: 'TestType'
}
],
Expand Down

0 comments on commit 9d7ff89

Please sign in to comment.