aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-bdd/stepDefinitions
diff options
context:
space:
mode:
authorilanap <ilanap@amdocs.com>2018-04-25 13:39:19 +0300
committerilanap <ilanap@amdocs.com>2018-04-25 13:39:19 +0300
commitad3c41b5693b4f0b2a151e9c3221551e24f8264d (patch)
tree61eb7da7c28eb49c79a7df3991cf0e41c67dcf42 /openecomp-bdd/stepDefinitions
parentc3c481660d3494fccfafcd3bacd3f5b8cd3ecd8e (diff)
Fix for BDD multiple servers
Change-Id: Ibfc9813e471d4ac2509ee5e62828a07661cc704e Issue-ID: SDC-1262 Signed-off-by: ilanap <ilanap@amdocs.com>
Diffstat (limited to 'openecomp-bdd/stepDefinitions')
-rw-r--r--openecomp-bdd/stepDefinitions/Collaboration_Steps.js2
-rw-r--r--openecomp-bdd/stepDefinitions/Utils.js4
-rw-r--r--openecomp-bdd/stepDefinitions/VF_steps.js2
-rw-r--r--openecomp-bdd/stepDefinitions/world.js36
4 files changed, 26 insertions, 18 deletions
diff --git a/openecomp-bdd/stepDefinitions/Collaboration_Steps.js b/openecomp-bdd/stepDefinitions/Collaboration_Steps.js
index 5b5062cf34..c4de758300 100644
--- a/openecomp-bdd/stepDefinitions/Collaboration_Steps.js
+++ b/openecomp-bdd/stepDefinitions/Collaboration_Steps.js
@@ -109,5 +109,5 @@ When('I want to get the permissions for this Item', function() {
* @step I want to set the user to {string}
**/
When('I want to set the user to {string}', function(string) {
- this.context.headers.USER_ID = string;
+ this.context.headers['onboarding'].USER_ID = string;
});
diff --git a/openecomp-bdd/stepDefinitions/Utils.js b/openecomp-bdd/stepDefinitions/Utils.js
index 46534072f2..66e959f6e5 100644
--- a/openecomp-bdd/stepDefinitions/Utils.js
+++ b/openecomp-bdd/stepDefinitions/Utils.js
@@ -23,7 +23,7 @@ function _request(context, method, path, data, isBinary=false, type='onboarding'
let options = {
method: method,
url: server + path,
- headers: context.headers
+ headers: context.headers[type]
};
console.log('--> Calling REST ' + options.method +' url: ' + options.url);
@@ -106,7 +106,7 @@ function download(context, path, filePath, callback, type='onboarding') {
let options = {
method: 'GET',
url: server + path,
- headers: context.headers
+ headers: context.headers[type]
};
console.log('--> Calling REST download url: ' + options.url);
diff --git a/openecomp-bdd/stepDefinitions/VF_steps.js b/openecomp-bdd/stepDefinitions/VF_steps.js
index 268c371687..3411a25fcb 100644
--- a/openecomp-bdd/stepDefinitions/VF_steps.js
+++ b/openecomp-bdd/stepDefinitions/VF_steps.js
@@ -29,7 +29,7 @@ Then('I want to create a VF for this Item', function () {
return util.request(this.context, 'GET', '/vendor-software-products/' + this.context.item.id + '/versions/' + this.context.item.versionId).then(result => {
this.context.inputData = util.getJSONFromFile('resources/json/createVF.json');
// start replacing stuff
- this.context.inputData.contactId = this.context.headers["USER_ID"];
+ this.context.inputData.contactId = this.context.headers['vf']["USER_ID"];
this.context.inputData.categories[0].uniqueId = result.data.category;
this.context.inputData.categories[0].subcategories[0].uniqueId = result.data.subCategory;
this.context.inputData.description = result.data.description;
diff --git a/openecomp-bdd/stepDefinitions/world.js b/openecomp-bdd/stepDefinitions/world.js
index 75f93afb89..0ffcc8e39c 100644
--- a/openecomp-bdd/stepDefinitions/world.js
+++ b/openecomp-bdd/stepDefinitions/world.js
@@ -14,13 +14,24 @@
* limitations under the License.
*/
const { setWorldConstructor } = require('cucumber');
-const config = require('../config.json');
-let localDevConfig = {};
+const _ = require('lodash');
+
+let config = require('../config.json');
+let localConfig = {};
try {
- localDevConfig = require('../devConfig.json');
-} catch (e) {}
+ localConfig = require('../devConfig.json');
+} catch (e) {
+ try {
+ localConfig = require('../jenkinsConfig.json');
+ } catch (e) {
+ console.error("no env configuration was found!");
+ }
+}
+
+config = _.merge(config, localConfig);
var {setDefaultTimeout} = require('cucumber');
+
/**
* @module Context
* @description Context that is used per feature file and can be accessed as 'this.context' in all steps.<Br>
@@ -38,15 +49,12 @@ class CustomWorld {
constructor(options) {
this.context = {};
this.context.headers = {};
- if (localDevConfig.user) {
- this.context.headers['USER_ID'] = localDevConfig.user;
- } else {
- this.context.headers['USER_ID'] = process.env.USER;
- }
- if (localDevConfig.server) {
- this.context.server = localDevConfig.server;
- } else {
- this.context.server = process.env.SERVER;
+ let typeName;
+ for (typeName in config) {
+ this.context.headers[typeName] = {};
+ if (config[typeName].user) {
+ this.context.headers[typeName]['USER_ID'] = config[typeName].user;
+ }
}
this.context.vlm = {id: null, versionId: null};
@@ -69,7 +77,7 @@ class CustomWorld {
return function(type) {
let typeData = _config[type];
let _url = _config.protocol + '://' +
- _server + ':' +
+ typeData.server + ':' +
typeData.port + '/' +
typeData.prefix;
return _url;