From 2c7e506449990936d4d3c1592177cd2589165a0d Mon Sep 17 00:00:00 2001 From: German Toro del Valle Date: Wed, 26 Oct 2016 15:37:59 +0200 Subject: [PATCH] Support the importing of NPM packages in attribute-function-interpolator --- CHANGES_NEXT_RELEASE | 1 + README.md | 5 + bin/fiwareDeviceSimulatorCLI | 4 + bin/fiwareDeviceSimulatorTranspilerCLI | 2 +- lib/errors/fdsErrors.js | 12 ++ lib/fiwareDeviceSimulator.js | 120 +++++++++++++----- .../attributeFunctionInterpolator.js | 11 +- .../fiwareDeviceSimulatorTranspiler.js | 4 +- .../fiwareDeviceSimulatorValidator.js | 30 ++++- package.json | 2 + test/unit/fiwareDeviceSimulator_test.js | 4 +- .../attributeFunctionInterpolator_test.js | 34 +++++ .../fiwareDeviceSimulatorTranspiler_test.js | 48 +++---- 13 files changed, 213 insertions(+), 64 deletions(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index e69de29..23cd3e8 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -0,0 +1 @@ +- [FEATURE] Support the importing of NPM packages in attribute-function-interpolator interpolators diff --git a/README.md b/README.md index e93e16e..5a42a93 100644 --- a/README.md +++ b/README.md @@ -244,6 +244,7 @@ An example simulation configuration file is shown next to give you a glimpse of The simulation configuration file accepts the following JSON properties or entries: * **exports**: The FIWARE Device Simulation provides a templating mechanism to avoid repeating text into simulation configuration files as well as to facilitate the edition of these files. More information about this templating mechanism just after the description of the rest of the properties which may be used in a simulation configuration file. +* **require**: An array of names and/or paths of NPM packages to be required before running the simulation. This property is related to the `attribute-function-interpolator` detailed below. It makes it possible to `require()` these NPM packages directly in the code associated to these `attribute-function-interpolator`. * **domain**: Includes information about the service and subservice (i.e., service path) to use in the requests. It is mandatory in case any `entities` are included in the simulation configuration (see below). * **service**: The service to use in the requests. * **subservice**: The subservice (i.e., service path) to use in the requests. @@ -334,6 +335,10 @@ The simulation configuration file accepts the following JSON properties or entri * A valid attribute value using the `text-rotation-interpolator` is: `"text-rotation-interpolator({\"units\": \"seconds\", \"text\": [[0,\"PENDING\"],[15,\"REQUESTED\"],[30,[[50,\"COMPLETED\"],[50,\"ERROR\"]]],[45,\"REMOVED\"]]})"`. For example, according to this text rotation interpolation specification, if the current time seconds is between 0 and 15 it will return the value `PENDING`, if it is between 15 and 30 it will return the value `REQUESTED`, if it is between 30 and 45 it will return the value `COMPLETED` with a probability of 50% and `ERROR` with a probability of 50%. 8. **`attribute-function-interpolator`**: It returns the result of the evaluation of some Javascript code. This code may include references to any entity's attributes values stored in the Context Broker. This interpolator accepts a string (properly escaped) with the Javascript code to evaluate. In this Javascript code, references to entity's attribute values may be included using the notation: `${{:#:}{}}`, substituting the ``, `` and ``, inluding the `:#:` separator) is optional and can be omited, in which case the entity type will not be considered when retrieving the entity and the corresponding attribute value from the Context Broker. * A valid attribute value using the `attribute-function-interpolator` is: `"attribute-function-interpolator(${{Entity:001}{active:001}} + Math.pow(${{Entity:002}{active:001}},2))"`. + * An advanced feature incorporated to the `attribute-function-interpolator` is the possibility to `require` packages directly in the Javascript code to be evaluated. Obviously, all the capabilities related to referencing entity attributes are supported too in this case. To use it, please follow the next steps: + 1. Include a `require` property in your simulation configuration file setting its value to an array including the names and/or paths of the NPM packages you will be using in any of your `attribute-function-interpolator` interpolators. These packages will be required before proceding with the simulation and made available to your `attribute-function-interpolator` code which uses them. For example: `"require": ["postfix-calculate"]`. + 2. The result of the evaluation of your code should be assigned to the `module.exports` property (this is due to the fact that this functionality leans on the [`eval` NPM package](https://www.npmjs.com/package/eval) which imposes this restriction). + * A valid attribute value using this advanced mode of the `attribute-function-interpolator` is: `"attribute-function-interpolator(var postfixCalculate = require('postfix-calculate'); module.exports = postfixCalculate('${{Entity:001}{active:001}} 1 +');)"`, where the result of the evaluation (this is, the value assigned to `module.exports`) will be the result of adding 1 to the value of the `active:001` attribute of the `Entity:001` entity, according to the [`postfix-calculate` NPM](https://www.npmjs.com/package/postfix-calculate) functionality. * **metadata**: Array of metadata information to be associated to the attribute on the update. Each metadata array entry is an object including 3 properties: * **name**: The metadata name. * **type**: The metadata type. diff --git a/bin/fiwareDeviceSimulatorCLI b/bin/fiwareDeviceSimulatorCLI index 179b97a..0f92526 100755 --- a/bin/fiwareDeviceSimulatorCLI +++ b/bin/fiwareDeviceSimulatorCLI @@ -107,6 +107,10 @@ function executeCommand() { logops.debug('update-request event:', ev); }); + progressEmitter.on('info', function(ev) { + logops.info('info event:', ev.message); + }); + progressEmitter.on('error', function(ev) { logops.error('error event:', ev); }); diff --git a/bin/fiwareDeviceSimulatorTranspilerCLI b/bin/fiwareDeviceSimulatorTranspilerCLI index 418e75b..42f893d 100755 --- a/bin/fiwareDeviceSimulatorTranspilerCLI +++ b/bin/fiwareDeviceSimulatorTranspilerCLI @@ -71,7 +71,7 @@ function executeCommand() { return logops.error('The output file path (\'' + outputConfigurationFilePath + '\') already exists'); } - fiwareDeviceSimulatorTranspiler.compose(require(inputConfigurationFilePath), function(err, newConfigurationObj) { + fiwareDeviceSimulatorTranspiler.transpile(require(inputConfigurationFilePath), function(err, newConfigurationObj) { if (err) { return logops.error('Error when transpiling the simulation configuration file (\'' + inputConfigurationFilePath + '\'): ' + err); diff --git a/lib/errors/fdsErrors.js b/lib/errors/fdsErrors.js index 1e1d987..fbeb8ca 100644 --- a/lib/errors/fdsErrors.js +++ b/lib/errors/fdsErrors.js @@ -45,6 +45,17 @@ function NGSIVersionNotSupported(message) { } NGSIVersionNotSupported.prototype = Object.create(Error.prototype); +/** + * Package not imported error + * @param {String} message Human-readable description of the error + */ +function PackageNotImported(message) { + Error.call(this, message); + this.name = 'PackageNotImported'; + this.message = message; +} +PackageNotImported.prototype = Object.create(Error.prototype); + /** * Protocol not supported error * @param {String} message Human-readable description of the error @@ -92,6 +103,7 @@ ValueResolutionError.prototype = Object.create(Error.prototype); module.exports = { InvalidInterpolationSpec: InvalidInterpolationSpec, NGSIVersionNotSupported: NGSIVersionNotSupported, + PackageNotImported: PackageNotImported, ProtocolNotSupported: ProtocolNotSupported, SimulationConfigurationNotValid: SimulationConfigurationNotValid, TokenNotAvailable: TokenNotAvailable, diff --git a/lib/fiwareDeviceSimulator.js b/lib/fiwareDeviceSimulator.js index 944bfd0..1ae98ad 100644 --- a/lib/fiwareDeviceSimulator.js +++ b/lib/fiwareDeviceSimulator.js @@ -28,6 +28,7 @@ var async = require('async'); var EventEmitter = require('events').EventEmitter; var lolex = require('lolex'); var mqtt = require('mqtt'); +var npmInstall = require('npm-install-package'); var scheduler = require('node-schedule'); var request = require('request'); var time = require('time'); @@ -317,6 +318,19 @@ function emitScheduled(schedule, elementType, element, attributes) { eventEmitter.emit('update-scheduled', event2Emit); } +/** + * Emits an "info" event + * @param {Object} info The information to emit + */ +function emitInfo(info) { + eventEmitter.emit( + 'info', + { + message: info + } + ); +} + /** * Emits an "error" event * @param {Object} err The error to emit @@ -1155,6 +1169,53 @@ function onTokenResponse(err, response, body) { /* jshint camelcase: true */ } +/** + * Transpiles a simulation configuration into another simulation configuration resolving the possible import() + * directives + * @param {Object} configuration The input simulation configuration + * @param {Function} callback The callback + */ +function transpile(configuration, callback) { + emitInfo('Starting the simulation configuration transpiling...'); + fiwareDeviceSimulatorTranspiler.transpile(configuration, function(err, newConfiguration) { + if (err) { + return process.nextTick(callback.bind(null, err)); + } + emitInfo('Simulation configuration transpiling successfully completed!'); + return process.nextTick(callback.bind(null, err, newConfiguration)); + }); +} + +/** + * Imports the packages included in the require property of the simulation configuration + * @param {Object} configuration The simulation configuration + * @param {Function} callback The callback + */ +function importPackages(configuration, callback) { + if (configuration.require) { + emitInfo('Requiring the following NPM packages: ' + configuration.require); + npmInstall( + configuration.require, + { + cache: true, + silent: true + }, + function(err) { + var error; + if (err) { + error = new fdsErrors.PackageNotImported('Some of the packages included in the \'require\' list (' + + configuration.require + ') could not be imported'); + } + emitInfo('NPM packages (' + configuration.require + ') successfully required and available!'); + delete configuration.require; + return process.nextTick(callback.bind(null, error, configuration)); + } + ); + } else { + process.nextTick(callback.bind(null, null, configuration)); + } +} + /** * Starts a simulation according to certain simulation configuration * @param {Object} config A JSON simulation configuration Object @@ -1200,44 +1261,43 @@ function start(config, theFromDate, theToDate, interval, margin, theDelay) { realFromDate = null; isEnded = false; cancelAllJobs(); - fiwareDeviceSimulatorTranspiler.compose(config, function(err, newConfig) { + async.waterfall([ + // Needed to be able to return the eventEmitter and start emitting events + function(callback) { + return process.nextTick(callback); + }, + async.apply(transpile, config), + fiwareDeviceSimulatorValidator.validateConfiguration, + importPackages + ], function(err, newConfig) { if (err) { process.nextTick(function notifySimulationConfigurationError() { emitError(err); end(); }); } else { - fiwareDeviceSimulatorValidator.validateConfiguration(newConfig, function(err) { - if (err) { - process.nextTick(function notifySimulationConfigurationError() { - emitError(err); - end(); - }); + if (theFromDate) { + clock = lolex.install(theFromDate.getTime()); + } + configuration = newConfig; + maximumNotRespondedUpdateRequests = margin; + delay = theDelay; + progressInfoInterval = interval; + fromDate = theFromDate; + toDate = theToDate; + if (configuration.authentication) { + if (configuration.authentication.retry) { + process.nextTick( + async.retry.bind(null, configuration.authentication.retry, requestToken, onTokenResponse)); + nextTick(); } else { - if (theFromDate) { - clock = lolex.install(theFromDate.getTime()); - } - configuration = newConfig; - maximumNotRespondedUpdateRequests = margin; - delay = theDelay; - progressInfoInterval = interval; - fromDate = theFromDate; - toDate = theToDate; - if (configuration.authentication) { - if (configuration.authentication.retry) { - process.nextTick( - async.retry.bind(null, configuration.authentication.retry, requestToken, onTokenResponse)); - nextTick(); - } else { - process.nextTick(requestToken.bind(null, onTokenResponse)); - nextTick(); - } - } else { - process.nextTick(scheduleJobs); - nextTick(); - } + process.nextTick(requestToken.bind(null, onTokenResponse)); + nextTick(); } - }); + } else { + process.nextTick(scheduleJobs); + nextTick(); + } } }); return eventEmitter; diff --git a/lib/interpolators/attributeFunctionInterpolator.js b/lib/interpolators/attributeFunctionInterpolator.js index 60d3b9e..c560a23 100644 --- a/lib/interpolators/attributeFunctionInterpolator.js +++ b/lib/interpolators/attributeFunctionInterpolator.js @@ -26,6 +26,7 @@ var ROOT_PATH = require('app-root-path'); var async = require('async'); var deasync = require('deasync'); +var _eval = require('eval'); var request = require('request'); var fdsErrors = require(ROOT_PATH + '/lib/errors/fdsErrors'); @@ -223,17 +224,21 @@ module.exports = function(interpolationSpec, theDomainConf, theContextBrokerConf }); }); - /* jshint evil: true */ var evaluatedValue; try { - evaluatedValue = eval(evalStr); + if (evalStr.indexOf('module.exports') !== -1) { + evaluatedValue = _eval(evalStr, true); + } else { + /* jshint evil: true */ + evaluatedValue = eval(evalStr); + /* jshint evil: false */ + } } catch (exception) { return callback( new fdsErrors.ValueResolutionError('Error when evaluating the Javascript code ' + 'for an attribute-function-interpolator resolution with spec: \'' + interpolationSpec + '\'')); } callback(null, evaluatedValue); - /* jshint evil: false */ }); } diff --git a/lib/transpilers/fiwareDeviceSimulatorTranspiler.js b/lib/transpilers/fiwareDeviceSimulatorTranspiler.js index a96c801..d9a313a 100644 --- a/lib/transpilers/fiwareDeviceSimulatorTranspiler.js +++ b/lib/transpilers/fiwareDeviceSimulatorTranspiler.js @@ -214,7 +214,7 @@ function replacer(match) { * @param {Object} configuration The original configuration * @param {Function} callback The callback */ -function compose(configuration, callback) { +function transpile(configuration, callback) { var configurationStr, newConfigurationStr, newConfigurationObj; @@ -238,5 +238,5 @@ function compose(configuration, callback) { } module.exports = { - compose: compose + transpile: transpile }; diff --git a/lib/validators/fiwareDeviceSimulatorValidator.js b/lib/validators/fiwareDeviceSimulatorValidator.js index ee9381e..0ee19fb 100644 --- a/lib/validators/fiwareDeviceSimulatorValidator.js +++ b/lib/validators/fiwareDeviceSimulatorValidator.js @@ -49,6 +49,29 @@ function isEntities(simulationConfiguration) { return false; } +/** + * Checks if the require information is valid + * @param {Object} simulationConfiguration The simulation configuration object + * @param {Function} callback The callback + */ +function validateRequire(simulationConfiguration, callback) { + if (simulationConfiguration.require) { + if (Array.isArray(simulationConfiguration.require)) { + for (var ii = 0; ii < simulationConfiguration.require.length; ii++) { + if (typeof simulationConfiguration.require[ii] !== 'string') { + return callback(new fdsErrors.SimulationConfigurationNotValid('The \'require\' configuration information ' + + 'is not an array of NPM packages names')); + } + } + return setImmediate(callback); + } else { + return callback(new fdsErrors.SimulationConfigurationNotValid('The \'require\' configuration information ' + + 'is not an array of NPM packages names')); + } + } + return setImmediate(callback); +} + /** * Checks if the domain information is included * @param {Object} simulationConfiguration The simulation configuration object @@ -613,7 +636,7 @@ function validateAttribute(attributeType, parentType, parentIndex, attribute, at async.apply(validateSchedule, attribute.schedule, parentType, parentIndex) ], function(err) { if (err) { - callback(err); + return callback(err); } else { if (attribute.metadata) { if (!Array.isArray(attribute.metadata)) { @@ -778,13 +801,16 @@ function validateEntitiesConfiguration(simulationConfiguration, callback) { function validateConfiguration(theSimulationConfiguration, callback) { simulationConfiguration = theSimulationConfiguration; async.series([ + async.apply(validateRequire, simulationConfiguration), async.apply(validateDomain, simulationConfiguration), async.apply(validateContextBrokerConfiguration, simulationConfiguration), async.apply(validateAuthenticationConfiguration, simulationConfiguration), async.apply(validateIoTAConfiguration, simulationConfiguration), async.apply(validateEntitiesConfiguration, simulationConfiguration), async.apply(validateDevicesConfiguration, simulationConfiguration) - ], callback); + ], function(err) { + return setImmediate(callback.bind(null, err, simulationConfiguration)); + }); } module.exports = { diff --git a/package.json b/package.json index 96cdf1e..0b71f79 100644 --- a/package.json +++ b/package.json @@ -49,12 +49,14 @@ "async": "^2.0.1", "commander": "^2.9.0", "deasync": "^0.1.8", + "eval": "^0.1.1", "humanize-duration": "^3.9.1", "linear-interpolator": "^1.0.2", "logops": "^1.0.1", "lolex": "^1.5.1", "mqtt": "^1.14.0", "node-schedule": "^1.2.0", + "npm-install-package": "^1.1.0", "request": "^2.74.0", "time": "^0.11.4", "turf-along": "^3.0.12", diff --git a/test/unit/fiwareDeviceSimulator_test.js b/test/unit/fiwareDeviceSimulator_test.js index e3eeb1e..e709995 100644 --- a/test/unit/fiwareDeviceSimulator_test.js +++ b/test/unit/fiwareDeviceSimulator_test.js @@ -5444,7 +5444,7 @@ describe('fiwareDeviceSimulator tests', function() { describe('authorization', function() { beforeEach(function(done) { - fiwareDeviceSimulatorTranspiler.compose(simulationConfiguration, function(err, newSimulationConfiguration) { + fiwareDeviceSimulatorTranspiler.transpile(simulationConfiguration, function(err, newSimulationConfiguration) { if (err) { return done(err); } @@ -5518,7 +5518,7 @@ describe('fiwareDeviceSimulator tests', function() { function simulationTestSuite(type, options){ beforeEach(function(done) { simulationConfiguration = require(ROOT_PATH + '/test/unit/configurations/simulation-configuration.json'); - fiwareDeviceSimulatorTranspiler.compose(simulationConfiguration, function(err, newSimulationConfiguration) { + fiwareDeviceSimulatorTranspiler.transpile(simulationConfiguration, function(err, newSimulationConfiguration) { if (err) { return done(err); } diff --git a/test/unit/interpolators/attributeFunctionInterpolator_test.js b/test/unit/interpolators/attributeFunctionInterpolator_test.js index 7be839a..2d11302 100644 --- a/test/unit/interpolators/attributeFunctionInterpolator_test.js +++ b/test/unit/interpolators/attributeFunctionInterpolator_test.js @@ -363,6 +363,40 @@ describe('attributeFunctionInterpolator tests', function() { } ); + it('should interpolate if packages are required in the interpolation specification', function(done) { + try { + var + attributeFunctionInterpolatorFunction = + attributeFunctionInterpolator( + 'var linearInterpolator = require("' + ROOT_PATH + '/lib/interpolators/linearInterpolator"); ' + + 'module.exports = linearInterpolator([[0,0],[10,10]])(5);', + domain, contextBroker); + should(attributeFunctionInterpolatorFunction(token)).equal(5); + done(); + } catch(exception) { + done(exception); + } + }); + + it('should throw an error if the packages required in the interpolation specification are not evailable', + function(done) { + try { + var + attributeFunctionInterpolatorFunction = + attributeFunctionInterpolator( + 'var linearInterpolator = require("' + ROOT_PATH + '/lib/interpolators/NON-EXISTENT"); ' + + 'module.exports = linearInterpolator([[0,0],[10,10]])(5);', + domain, contextBroker); + should(attributeFunctionInterpolatorFunction(token)).equal(5); + done(new Error('It should throw an ValueResolutionError error')); + done(); + } catch(exception) { + should(exception).be.an.instanceof(fdsErrors.ValueResolutionError); + done(); + } + } + ); + it('should throw an error if a invalid Javascript code with a reference to an entity attribute is passed as the ' + 'interpolation specification', function(done) { diff --git a/test/unit/transpilers/fiwareDeviceSimulatorTranspiler_test.js b/test/unit/transpilers/fiwareDeviceSimulatorTranspiler_test.js index a65b551..2fcf770 100644 --- a/test/unit/transpilers/fiwareDeviceSimulatorTranspiler_test.js +++ b/test/unit/transpilers/fiwareDeviceSimulatorTranspiler_test.js @@ -31,7 +31,7 @@ var fiwareDeviceSimulatorTranspiler = require(ROOT_PATH + '/lib/transpilers/fiwa describe('fiwareDeviceSimulatorTranspiler tests', function() { it('should not import anything if no template is included', function() { - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { should: 'not-transform-anything' }, @@ -44,7 +44,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { it('should throw an error if a template cannot be resolved', function(done) { try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { property: 'import(inexistent-template)' }, @@ -60,7 +60,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { it('should import a string template if defined in the exports property', function(done) { try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { exports: { template: 'template-value' @@ -80,7 +80,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { it('should import a string template if defined in an external template file', function(done) { try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { property: 'import(test/unit/templates/template-string)' }, @@ -97,7 +97,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { it('should import a number template if defined in the exports property', function(done) { try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { exports: { template: 666 @@ -117,7 +117,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { it('should import a number template if defined in an external template file', function(done) { try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { property: 'import(test/unit/templates/template-number)' }, @@ -134,7 +134,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { it('should import an array template if defined in the exports property', function(done) { try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { exports: { template: [1, 2, 3] @@ -156,7 +156,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { it('should import an array template if defined in an external template file', function(done) { try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { property: 'import(test/unit/templates/template-array)' }, @@ -175,7 +175,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { it('should import an object template if defined in the exports property', function(done) { try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { exports: { template: { @@ -201,7 +201,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { it('should import an object template if defined in an external template file', function(done) { try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { property: 'import(test/unit/templates/template-object)' }, @@ -222,7 +222,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { exports: { template: [ @@ -256,7 +256,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { entities: [ { @@ -282,7 +282,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { exports: { template: [ @@ -317,7 +317,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { entities: [ { @@ -345,7 +345,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { exports: { template: [ @@ -385,7 +385,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { entities: [ { @@ -417,7 +417,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { exports: { template: [ @@ -457,7 +457,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { entities: [ { @@ -489,7 +489,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { exports: { template: [ @@ -529,7 +529,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { entities: [ { @@ -562,7 +562,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { exports: { template: [ @@ -602,7 +602,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { entities: [ { @@ -635,7 +635,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { exports: { 'template-1': [ @@ -741,7 +741,7 @@ describe('fiwareDeviceSimulatorTranspiler tests', function() { function (done) { /* jshint camelcase: false */ try{ - fiwareDeviceSimulatorTranspiler.compose( + fiwareDeviceSimulatorTranspiler.transpile( { entities: [ {