From 041deed2807a01df01867e4d237df8ff5980cf34 Mon Sep 17 00:00:00 2001 From: ilanap Date: Tue, 20 Feb 2018 11:57:12 +0200 Subject: Fix for adding BDD config changes Change-Id: I62f79a56a73ff8a546ecef407c3966b93de23a2e Issue-ID: SDC-990 Signed-off-by: ilanap --- openecomp-bdd/stepDefinitions/General_Steps.js | 9 --------- openecomp-bdd/stepDefinitions/Utils.js | 4 ++++ openecomp-bdd/stepDefinitions/world.js | 20 ++++++++------------ 3 files changed, 12 insertions(+), 21 deletions(-) (limited to 'openecomp-bdd') diff --git a/openecomp-bdd/stepDefinitions/General_Steps.js b/openecomp-bdd/stepDefinitions/General_Steps.js index bf35cb8499..13c03f7848 100644 --- a/openecomp-bdd/stepDefinitions/General_Steps.js +++ b/openecomp-bdd/stepDefinitions/General_Steps.js @@ -45,15 +45,6 @@ Given('Response Data:', function (docString) { this.context.responseData = JSON.parse(docString); }); -/** - * @module ContextData - * @description Sets the server for the test. overrides configuration. - * @step Server with IP - **/ -Given('Server host {string}', function (string) { - this.setServer(string); -}); - /** * @module ContextData * @description Copy a property from the response data to context Item/VLM/VSP data, example: vsp.componentId diff --git a/openecomp-bdd/stepDefinitions/Utils.js b/openecomp-bdd/stepDefinitions/Utils.js index 4a54ebe3a7..46534072f2 100644 --- a/openecomp-bdd/stepDefinitions/Utils.js +++ b/openecomp-bdd/stepDefinitions/Utils.js @@ -25,6 +25,8 @@ function _request(context, method, path, data, isBinary=false, type='onboarding' url: server + path, headers: context.headers }; + console.log('--> Calling REST ' + options.method +' url: ' + options.url); + return new Promise(function (resolve, reject) { if (method === 'POST' || method === 'PUT') { if (isBinary) { @@ -106,6 +108,8 @@ function download(context, path, filePath, callback, type='onboarding') { url: server + path, headers: context.headers }; + console.log('--> Calling REST download url: ' + options.url); + var file = fs.createWriteStream(filePath); var r = request(options).pipe(file); r.on('error', function (err) { diff --git a/openecomp-bdd/stepDefinitions/world.js b/openecomp-bdd/stepDefinitions/world.js index fd7250548d..75f93afb89 100644 --- a/openecomp-bdd/stepDefinitions/world.js +++ b/openecomp-bdd/stepDefinitions/world.js @@ -60,23 +60,19 @@ class CustomWorld { this.context.defaultServerType = 'onboarding'; - this.context.prefix = config.prefix; - this.context.port = config.port; - this.context.protocol = config.protocol; - - this.setServer = function(server) { - this.context.server = server; - }; + this.config = config; let context = this.context; this.context.getUrlForType = (function(type) { - var that = context; + var _server = context.server; + var _config = config; return function(type) { - let typeData = that[type]; - return (config.protocol + '://' + - that.server + ':' + + let typeData = _config[type]; + let _url = _config.protocol + '://' + + _server + ':' + typeData.port + '/' + - typeData.prefix); + typeData.prefix; + return _url; } })(); -- cgit 1.2.3-korg