summaryrefslogtreecommitdiffstats
path: root/openecomp-bdd
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-bdd')
-rw-r--r--openecomp-bdd/.gitignore1
-rw-r--r--openecomp-bdd/config.json14
-rw-r--r--openecomp-bdd/plugins/README.md10
-rw-r--r--openecomp-bdd/pom.xml33
-rw-r--r--openecomp-bdd/resources/jenkinsConfig.json14
-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
9 files changed, 87 insertions, 29 deletions
diff --git a/openecomp-bdd/.gitignore b/openecomp-bdd/.gitignore
index ce33f6687d..316e39847a 100644
--- a/openecomp-bdd/.gitignore
+++ b/openecomp-bdd/.gitignore
@@ -8,3 +8,4 @@ node_modules
.npmrc
npm-debug.log
devConfig.json
+jenkinsConfig.json
diff --git a/openecomp-bdd/config.json b/openecomp-bdd/config.json
index e1907a2ae6..c28bc9d390 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 118e02974b..956fe77276 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 69eadf36a5..e73bb69c78 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 0000000000..02ae0daa87
--- /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 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;