Skip to content

Commit

Permalink
Merge pull request #1636 from telefonicaid/fix/access_service_service…
Browse files Browse the repository at this point in the history
…path_jexl_functional_test

access to id, service and subservice in jexl context for functional test
  • Loading branch information
mapedraza authored Aug 9, 2024
2 parents 3b80414 + 9d7ff89 commit c8642f9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
13 changes: 9 additions & 4 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.fiwareService,
testCase.provision.headers.fiwareServicepath
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
8 changes: 4 additions & 4 deletions test/functional/functional-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ describe('FUNCTIONAL TESTS', function () {
beforeEach(function (done) {
let type = testUtils.groupToIoTAConfigType(
provision.json.services[0],
provision.headers.fiwareService,
provision.headers.fiwareServicepath
provision.headers['fiware-service'],
provision.headers['fiware-servicepath']
);
config.iota.types[type.name] = type.type;
iotAgentLib.activate(config.iota, function (error) {
Expand Down Expand Up @@ -214,8 +214,8 @@ describe('FUNCTIONAL TESTS', function () {
beforeEach(function (done) {
let type = testUtils.groupToIoTAConfigType(
provision.json.services[0],
provision.headers.fiwareService,
provision.headers.fiwareServicepath
provision.headers['fiware-service'],
provision.headers['fiware-servicepath']
);
config.iota.types[type.name] = type.type;
iotAgentLib.activate(config.iota, function (error) {
Expand Down
6 changes: 2 additions & 4 deletions test/functional/testCases.js
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,6 @@ const testCases = [
},
{
describeName: '0170 - Simple group with active attribute + JEXL expression referencing context attributes',
skip: 'lib', // Explanation in #1523
provision: {
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
method: 'POST',
Expand Down Expand Up @@ -1923,7 +1922,6 @@ const testCases = [
},
{
describeName: '0180 - Simple group with active attributes + JEXL multiples expressions at same time',
skip: 'lib', // Explanation in #1523
provision: {
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
method: 'POST',
Expand Down Expand Up @@ -4296,7 +4294,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 @@ -4382,7 +4380,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 c8642f9

Please sign in to comment.