Fix for BDD multiple servers

Change-Id: Ibfc9813e471d4ac2509ee5e62828a07661cc704e
Issue-ID: SDC-1262
Signed-off-by: ilanap <ilanap@amdocs.com>
diff --git a/openecomp-bdd/.gitignore b/openecomp-bdd/.gitignore
index ce33f66..316e398 100644
--- a/openecomp-bdd/.gitignore
+++ b/openecomp-bdd/.gitignore
@@ -8,3 +8,4 @@
 .npmrc
 npm-debug.log
 devConfig.json
+jenkinsConfig.json
diff --git a/openecomp-bdd/config.json b/openecomp-bdd/config.json
index e1907a2..c28bc9d 100644
--- a/openecomp-bdd/config.json
+++ b/openecomp-bdd/config.json
@@ -3,14 +3,20 @@
 
   "onboarding" : {
     "port" : 8285,
-    "prefix" : "sdc1/feProxy/onboarding-api/v1.0"
+    "prefix" : "sdc1/feProxy/onboarding-api/v1.0",
+    "server" : "onboarding.server",
+    "user" : "user"
   },
   "vf" : {
     "port" : 8285,
-    "prefix" : "sdc1/feProxy/rest/v1"
+    "prefix" : "sdc1/feProxy/rest/v1",
+    "server" : "vf.server",
+    "user" : "user"
   },
   "activity_spec" : {
     "port" : 8080,
-    "prefix" : "activity-spec-api/v1.0"
+    "prefix" : "activity-spec-api/v1.0",
+    "server" : "activity_spec.server",
+    "user" : "user"
   }
-}
\ No newline at end of file
+}
diff --git a/openecomp-bdd/plugins/README.md b/openecomp-bdd/plugins/README.md
index 118e029..956fe77 100644
--- a/openecomp-bdd/plugins/README.md
+++ b/openecomp-bdd/plugins/README.md
@@ -3,13 +3,9 @@
 This is the documentation for using the BDD testing framework for SDC.<br>
 The Modules on the left contains all steps for particalar aress and/or explanations of what they do.<br>
 <br><br>
-<h3>How to set the server</h3>
-<li> Create a "devConfig.json" file under the openecomp-bdd directory with the following content and replace the placeholders:
-{
-  "server": "[YOUR_SERVER]",
-  "user": "[USER_ID_FOR_APPLICATION]"
-}
-<li> Or set the SERVER and USER environment variables and it will override the configuration file
+<h3>How to set the server configuration</h3>
+<li> Copy the config.json to devConfig.json
+<li> Replace the server and user values with the correct values
 <h3>How to run with Maven</h3>
 <li>"mvn install" will install npm if needed, download all modules and create the documentation under the "docs" folder
 <li>"mvn test-and-report" will run all  tests in the features folder and create an HTML report under the "reports" folder
diff --git a/openecomp-bdd/pom.xml b/openecomp-bdd/pom.xml
index 69eadf3..e73bb69 100644
--- a/openecomp-bdd/pom.xml
+++ b/openecomp-bdd/pom.xml
@@ -47,6 +47,13 @@
                                   <include>**/*</include>
                                 </includes>
                               </fileset>
+                                <fileset>
+                                    <directory>${basedir}</directory>
+                                    <includes>
+                                        <include>jenkinsConfig.json</include>
+                                    </includes>
+                                </fileset>
+
                             </filesets>
                         </configuration>
                     </execution>
@@ -114,6 +121,32 @@
                 </executions>
             </plugin>
 
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <version>2.6</version>
+                <executions>
+                    <execution>
+                        <id>copy-config</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${basedir}</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${basedir}/resources</directory>
+                                    <includes>
+                                        <include>jenkinsConfig.json</include>
+                                    </includes>
+                                    <filtering>true</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
         </plugins>
     </build>
 
diff --git a/openecomp-bdd/resources/jenkinsConfig.json b/openecomp-bdd/resources/jenkinsConfig.json
new file mode 100644
index 0000000..02ae0da
--- /dev/null
+++ b/openecomp-bdd/resources/jenkinsConfig.json
@@ -0,0 +1,14 @@
+{
+  "onboarding" : {
+    "user": "${onboardingUser}",
+    "server": "${onboardingServer}"
+  },
+  "vf" : {
+    "user": "${vfUser}",
+    "server": "${vfServer}"
+  },
+  "activity_spec" : {
+    "user": "${activitySpecUser}",
+    "server": "${activitySpecServer}"
+  }
+}
diff --git a/openecomp-bdd/stepDefinitions/Collaboration_Steps.js b/openecomp-bdd/stepDefinitions/Collaboration_Steps.js
index 5b5062c..c4de758 100644
--- a/openecomp-bdd/stepDefinitions/Collaboration_Steps.js
+++ b/openecomp-bdd/stepDefinitions/Collaboration_Steps.js
@@ -109,5 +109,5 @@
  * @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 4653407..66e959f 100644
--- a/openecomp-bdd/stepDefinitions/Utils.js
+++ b/openecomp-bdd/stepDefinitions/Utils.js
@@ -23,7 +23,7 @@
 	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 @@
 	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 268c371..3411a25 100644
--- a/openecomp-bdd/stepDefinitions/VF_steps.js
+++ b/openecomp-bdd/stepDefinitions/VF_steps.js
@@ -29,7 +29,7 @@
 	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 75f93af..0ffcc8e 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 @@
 	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 @@
 			return function(type) {
 				let typeData = _config[type];
 				let _url = _config.protocol + '://' +
-					_server + ':' +
+					typeData.server + ':' +
 					typeData.port + '/' +
 					typeData.prefix;
 				return _url;