aboutsummaryrefslogtreecommitdiffstats
path: root/cucumber-js-test-apis-ci/stepDefinitions
diff options
context:
space:
mode:
authorpriyanshu <pagarwal@amdocs.com>2019-01-14 15:46:55 +0530
committerpriyanshu <pagarwal@amdocs.com>2019-01-14 15:46:55 +0530
commit5b9d9a134778d4dc7bf45474ba13be6ba0c46282 (patch)
treea9dde66cc370513384670ad9587605795774bfbd /cucumber-js-test-apis-ci/stepDefinitions
parentefc185c60153bed4988abbb159e2103ec7653f83 (diff)
Interface operation feature enhancements
1. API restructuring to enhance model and provide more capabilities. 2. Allowed multiple interface creation under same resource/service. 3. Enhanced validations to align with updated model. 4. API restructuring to align UI model with Tosca model. 5. Enhanced Junit and code coverage. 6. Added BDD and CI-API tests. Change-Id: I2d8ac8a6154fd9be8254836ba0da1540210031c0 Issue-ID: SDC-1999 Signed-off-by: priyanshu <pagarwal@amdocs.com>
Diffstat (limited to 'cucumber-js-test-apis-ci/stepDefinitions')
-rw-r--r--cucumber-js-test-apis-ci/stepDefinitions/InterfaceOperationSteps.js105
1 files changed, 49 insertions, 56 deletions
diff --git a/cucumber-js-test-apis-ci/stepDefinitions/InterfaceOperationSteps.js b/cucumber-js-test-apis-ci/stepDefinitions/InterfaceOperationSteps.js
index 408db9e9f8..abfad80ae4 100644
--- a/cucumber-js-test-apis-ci/stepDefinitions/InterfaceOperationSteps.js
+++ b/cucumber-js-test-apis-ci/stepDefinitions/InterfaceOperationSteps.js
@@ -19,10 +19,11 @@ const util = require('./Utils.js');
When('I want to create a VF', function() {
- let inputData = util.getJSONFromFile('resources/json/operation/createVF.json');
+ let inputData = util.getJSONFromFile('resources/json/createVFWithoutCSAR.json');
- inputData.name = util.random();
- inputData.tags[0] = util.random();
+ var resourceName = util.random();
+ inputData.name = resourceName;
+ inputData.tags[0] = resourceName;
var type = "resources";
let path = '/catalog/' + type;
@@ -32,10 +33,11 @@ When('I want to create a VF', function() {
});
When('I want to create a Service', function() {
- let inputData = util.getJSONFromFile('resources/json/operation/createService.json');
+ let inputData = util.getJSONFromFile('resources/json/createService.json');
- inputData.name = util.random();
- inputData.tags[0] = util.random();
+ var serviceName = util.random();
+ inputData.name = serviceName;
+ inputData.tags[0] = serviceName;
var type = "services";
let path = '/catalog/' + type;
@@ -54,47 +56,57 @@ function makeType() {
return text;
}
-When('I want to create an Operation with input output', function() {
+When('I want to create an Operation', function() {
let path = '/catalog/' + this.context.component.type + '/' + this.context.component.uniqueId + '/interfaceOperations';
- let inputData = util.getJSONFromFile('resources/json/operation/createOperationWithInputOutput.json');
-
- inputData.interfaceOperations.operation.inputParams.listToscaDataDefinition[0].name = util.random();
- inputData.interfaceOperations.operation.inputParams.listToscaDataDefinition[0].property = this.context.component.id;
- inputData.interfaceOperations.operation.outputParams.listToscaDataDefinition[0].name = util.random();
- inputData.interfaceOperations.operation.operationType = makeType();
- inputData.interfaceOperations.operation.description = makeType();
+ let inputData = util.getJSONFromFile('resources/json/interfaceoperation/createInterfaceOperations.json');
+ var operationName = makeType();
+ var interfaceType = makeType();
+ inputData.interfaces.interface1.type = interfaceType;
+ inputData.interfaces.interface1.operations.delete.name = operationName;
+ inputData.interfaces.interface1.operations.delete.inputs.listToscaDataDefinition[0].name = util.random();
+ inputData.interfaces.interface1.operations.delete.inputs.listToscaDataDefinition[0].inputId = this.context.component.id;
+ inputData.interfaces.interface1.operations.delete.outputs.listToscaDataDefinition[0].name = util.random();
+ inputData.interfaces.interface1.operations.delete.description = operationName + " description";
return util.request(this.context, 'POST', path, inputData, false, 'catalog').then(result => {
- this.context.operation = {uniqueId : result.data.uniqueId, operationType : result.data.operationType};
+ {intOperations = result.data.interfaces[0].operations};
+ this.context.interface = { interfaceUniqueId : result.data.interfaces[0].uniqueId,
+ interfaceType : result.data.interfaces[0].type,
+ operationUniqueId : Object.keys(intOperations)[0]
+ };
});
});
-When('I want to create an Operation', function() {
- let path = '/catalog/' + this.context.component.type + '/' + this.context.component.uniqueId + '/interfaceOperations';
- let inputData = util.getJSONFromFile('resources/json/operation/createOperation.json');
- inputData.interfaceOperations.operation.operationType = makeType();
- inputData.interfaceOperations.operation.description = makeType();
+When('I want to update an Operation', function () {
+ let inputData = util.getJSONFromFile('resources/json/interfaceoperation/updateInterfaceOperation.json');
+ let path = '/catalog/'+ this.context.component.type + '/'+ this.context.component.uniqueId +'/interfaceOperations';
+ inputData.interfaces.interface1.operations.delete.uniqueId = this.context.interface.operationUniqueId;
+ inputData.interfaces.interface1.type=this.context.interface.interfaceType;
+ inputData.interfaces.interface1.operations.delete.inputs.listToscaDataDefinition[0].name = util.random();
+ inputData.interfaces.interface1.operations.delete.inputs.listToscaDataDefinition[0].inputId = this.context.component.id;
+ inputData.interfaces.interface1.operations.delete.outputs.listToscaDataDefinition[0].name = util.random();
- return util.request(this.context, 'POST', path, inputData, false, 'catalog').then(result => {
- this.context.operation = {uniqueId : result.data.uniqueId, operationType : result.data.operationType};
+ return util.request(this.context, 'PUT', path, inputData, false, 'catalog').then((result)=> {
+ {intOperations = result.data.interfaces[0].operations};
+ this.context.interface = { interfaceUniqueId : result.data.interfaces[0].uniqueId,
+ interfaceType : result.data.interfaces[0].type,
+ operationUniqueId : Object.keys(intOperations)[0]
+ };
});
});
-When('I want to create an Operation with workflow', function() {
- let path = '/catalog/' + this.context.component.type + '/' + this.context.component.uniqueId + '/interfaceOperations';
- let inputData = util.getJSONFromFile('resources/json/operation/createOperation-with-workflow.json');
+When('I want to get an Operation by Id', function () {
+ let path = '/catalog/'+ this.context.component.type + '/' + this.context.component.uniqueId + '/interfaces/' +
+ this.context.interface.interfaceUniqueId + '/operations/' +this.context.interface.operationUniqueId ;
+ return util.request(this.context, 'GET', path, null, false, 'catalog').then((result)=> {
- inputData.interfaceOperations.operation.inputParams.listToscaDataDefinition[0].name = util.random();
- inputData.interfaceOperations.operation.inputParams.listToscaDataDefinition[0].property = this.context.component.id;
- inputData.interfaceOperations.operation.outputParams.listToscaDataDefinition[0].name = util.random();
- inputData.interfaceOperations.operation.operationType = makeType();
- inputData.interfaceOperations.operation.description = makeType();
- inputData.interfaceOperations.operation.workflowId = makeType();
- inputData.interfaceOperations.operation.workflowVersionId = makeType();
+ {intOperations = result.data.interfaces[0].operations};
+ this.context.interface = { interfaceUniqueId : result.data.interfaces[0].uniqueId,
+ interfaceType : result.data.interfaces[0].type,
+ operationUniqueId : Object.keys(intOperations)[0]
+ };
+ });
- return util.request(this.context, 'POST', path, inputData, false, 'catalog').then(result => {
- this.context.operation = {uniqueId : result.data.uniqueId, operationType : result.data.operationType};
-});
});
When('I want to list Operations', function () {
@@ -103,29 +115,10 @@ When('I want to list Operations', function () {
});
});
-When('I want to get an Operation by Id', function () {
- let path = '/catalog/'+ this.context.component.type + '/' + this.context.component.uniqueId + '/interfaceOperations/' + this.context.operation.uniqueId;
- return util.request(this.context, 'GET', path, null, false, 'catalog').then((result)=> {
- this.context.operation = {uniqueId : result.data.uniqueId, operationType : result.data.operationType};
-});
-});
-
-When('I want to update an Operation', function () {
- let inputData = util.getJSONFromFile('resources/json/operation/updateOperation.json');
- let path = '/catalog/'+ this.context.component.type + '/'+ this.context.component.uniqueId +'/interfaceOperations';
- inputData.interfaceOperations.operation.uniqueId = this.context.operation.uniqueId;
- inputData.interfaceOperations.operation.operationType = this.context.operation.operationType;
- inputData.interfaceOperations.operation.inputParams.listToscaDataDefinition[0].name = util.random();
- inputData.interfaceOperations.operation.inputParams.listToscaDataDefinition[0].property = this.context.component.id;
- inputData.interfaceOperations.operation.outputParams.listToscaDataDefinition[0].name = util.random();
- return util.request(this.context, 'PUT', path, inputData, false, 'catalog').then((result)=> {
- this.context.operation = {uniqueId : result.data.uniqueId, operationType : result.data.operationType};
-});
-});
-
When('I want to delete an Operation', function() {
- let path = '/catalog/'+ this.context.component.type + '/'+ this.context.component.uniqueId +'/interfaceOperations/' + this.context.operation.uniqueId;
+ let path = '/catalog/'+ this.context.component.type + '/'+ this.context.component.uniqueId +'/interfaces/' +
+ this.context.interface.interfaceUniqueId + '/operations/' +this.context.interface.operationUniqueId ;
return util.request(this.context, 'DELETE', path, null, false, 'catalog');
});