diff options
author | priyanshu <pagarwal@amdocs.com> | 2019-01-14 15:46:55 +0530 |
---|---|---|
committer | priyanshu <pagarwal@amdocs.com> | 2019-01-14 15:46:55 +0530 |
commit | 5b9d9a134778d4dc7bf45474ba13be6ba0c46282 (patch) | |
tree | a9dde66cc370513384670ad9587605795774bfbd /cucumber-js-test-apis-ci | |
parent | efc185c60153bed4988abbb159e2103ec7653f83 (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')
13 files changed, 263 insertions, 388 deletions
diff --git a/cucumber-js-test-apis-ci/features/InterfaceOperation/TestResourceInterfaceOperation.feature b/cucumber-js-test-apis-ci/features/InterfaceOperation/TestResourceInterfaceOperation.feature index ed09f2fb20..7a4105f443 100644 --- a/cucumber-js-test-apis-ci/features/InterfaceOperation/TestResourceInterfaceOperation.feature +++ b/cucumber-js-test-apis-ci/features/InterfaceOperation/TestResourceInterfaceOperation.feature @@ -4,25 +4,19 @@ Feature: Interface Operation Feature Given I want to create a VF Scenario: Test InterfaceOperation CRUD - #Create Operations + #Create Multiple operations Operations + When I want to create an Operation + When I want to create an Operation When I want to create an Operation - Then I want to check property "uniqueId" exists - And I want to create an Operation with workflow - Then I want to check property "uniqueId" exists - And I want to create an Operation - Then I want to check property "uniqueId" exists - When I want to create an Operation with input output - Then I want to check property "uniqueId" exists #List All Operations When I want to list Operations #Get Operation By OperationId When I want to get an Operation by Id - Then I want to check property "uniqueId" exists + #Update Operation When I want to update an Operation - Then I want to check property "uniqueId" exists #Delete Operation When I want to delete an Operation @@ -38,11 +32,8 @@ Feature: Interface Operation Feature Scenario: Test InterfaceOperation CREATE #Create Operations When I want to create an Operation - Then I want to check property "uniqueId" exists And I want to create an Operation - Then I want to check property "uniqueId" exists And I want to create an Operation - Then I want to check property "uniqueId" exists #List All Operations When I want to list Operations @@ -59,14 +50,11 @@ Feature: Interface Operation Feature Scenario: Test InterfaceOperation UPDATE #Create Operation When I want to create an Operation - Then I want to check property "uniqueId" exists #Get Operation By OperationId When I want to get an Operation by Id - Then I want to check property "uniqueId" exists #Update Operation When I want to update an Operation - Then I want to check property "uniqueId" exists #Checkin When I want to checkin this component @@ -80,11 +68,9 @@ Feature: Interface Operation Feature Scenario: Test InterfaceOperation DELETE #Create Operation When I want to create an Operation - Then I want to check property "uniqueId" exists #Get Operation By OperationId When I want to get an Operation by Id - Then I want to check property "uniqueId" exists #Delete Operation When I want to delete an Operation diff --git a/cucumber-js-test-apis-ci/features/InterfaceOperation/TestServiceInterfaceOperation.feature b/cucumber-js-test-apis-ci/features/InterfaceOperation/TestServiceInterfaceOperation.feature index 1ff0ba3f1b..72d56d5fc7 100644 --- a/cucumber-js-test-apis-ci/features/InterfaceOperation/TestServiceInterfaceOperation.feature +++ b/cucumber-js-test-apis-ci/features/InterfaceOperation/TestServiceInterfaceOperation.feature @@ -4,26 +4,19 @@ Feature: Interface Operation Feature Given I want to create a Service Scenario: Test InterfaceOperation CRUD - #Create Operations + #Create multiple operations Operations + When I want to create an Operation + When I want to create an Operation When I want to create an Operation - Then I want to check property "uniqueId" exists - And I want to create an Operation with workflow - Then I want to check property "uniqueId" exists - And I want to create an Operation - Then I want to check property "uniqueId" exists - When I want to create an Operation with input output - Then I want to check property "uniqueId" exists #List All Operations When I want to list Operations #Get Operation By OperationId When I want to get an Operation by Id - Then I want to check property "uniqueId" exists #Update Operation When I want to update an Operation - Then I want to check property "uniqueId" exists #Delete Operation When I want to delete an Operation diff --git a/cucumber-js-test-apis-ci/resources/json/createService.json b/cucumber-js-test-apis-ci/resources/json/createService.json new file mode 100644 index 0000000000..a76cc51dda --- /dev/null +++ b/cucumber-js-test-apis-ci/resources/json/createService.json @@ -0,0 +1,66 @@ +{ + "artifacts": {}, + "toscaArtifacts": {}, + "contactId": "cs0008", + "categories": [{ + "name": "Network L4+", + "normalizedName": "network l4+", + "uniqueId": "serviceNewCategory.network l4+", + "icons": ["network_l_4"], + "subcategories": null, + "version": null, + "ownerId": null, + "empty": false, + "type": null + }], + "description": "service1 for bdd", + "icon": "defaulticon", + "componentInstancesProperties": {}, + "componentInstancesAttributes": {}, + "name": "service1", + "tags": ["service1"], + "capabilities": {}, + "requirements": {}, + "deploymentArtifacts": {}, + "componentType": "SERVICE", + "projectCode": "010203", + "componentInstances": [], + "properties": [], + "inputs": [{ + "uniqueId": "03eeb10e-cf2a-41b8-9d8e-d2dbd094f9d4.test1_dasddas", + "type": "scalar-unit.size", + "required": false, + "definition": false, + "schema": { + "properties": {}, + "property": { + "type": "", + "required": false, + "definition": true, + "password": false, + "hidden": false, + "immutable": false, + "getInputProperty": false, + "empty": false + }, + "empty": false + }, + "password": false, + "name": "test1_dasddas", + "hidden": false, + "immutable": false, + "instanceUniqueId": "03eeb10e-cf2a-41b8-9d8e-d2dbd094f9d4", + "propertyId": "03eeb10e-cf2a-41b8-9d8e-d2dbd094f9d4.dasddas", + "parentUniqueId": "cs0008", + "schemaType": "", + "getInputProperty": false, + "ownerId": "cs0008", + "empty": false + }], + "attributes": [], + "forwardingPaths": {}, + "ecompGeneratedNaming": true, + "serviceApiArtifacts": {}, + "instantiationType": "A-la-carte", + "environmentContext": "General_Revenue-Bearing" +}
\ No newline at end of file diff --git a/cucumber-js-test-apis-ci/resources/json/createVFWithoutCSAR.json b/cucumber-js-test-apis-ci/resources/json/createVFWithoutCSAR.json new file mode 100644 index 0000000000..dd8764f625 --- /dev/null +++ b/cucumber-js-test-apis-ci/resources/json/createVFWithoutCSAR.json @@ -0,0 +1,76 @@ +{ + "artifacts": {}, + "toscaArtifacts": {}, + "contactId": "cs0008", + "categories": [{ + "name": "Generic", + "normalizedName": "generic", + "uniqueId": "REPLACE CATEGORY VSP", + "icons": null, + "subcategories": [ + { + "name": "Abstract", + "normalizedName": "abstract", + "uniqueId": "REPLACE SUBCATEGORY VSP", + "icons": [ + "objectStorage", + "compute" + ], + "groupings": null, + "ownerId": null, + "empty": false + } + ], + "ownerId": null, + "empty": false + }], + "description": "vf_for_bdd", + "icon": "defaulticon", + "componentInstancesProperties": {}, + "componentInstancesAttributes": {}, + "name": "vf_for_bdd", + "tags": ["vf_for_bdd"], + "capabilities": {}, + "requirements": {}, + "deploymentArtifacts": {}, + "componentType": "RESOURCE", + "vendorName": "vf_for_bdd", + "vendorRelease": "vf_for_bdd", + "componentInstances": [], + "inputs": [{ + "uniqueId": "testInputForBDD", + "type": "org.openecomp.datatypes.Naming", + "required": false, + "definition": false, + "defaultValue": null, + "description": null, + "schema": null, + "password": false, + "name": "abcdef", + "value": null, + "label": null, + "hidden": false, + "immutable": false, + "inputPath": null, + "status": null, + "inputId": null, + "instanceUniqueId": null, + "propertyId": null, + "annotations": null, + "parentUniqueId": "abcd", + "getInputValues": null, + "constraints": null, + "inputs": null, + "properties": null, + "getInputProperty": false, + "schemaType": null, + "schemaProperty": null, + "version": null, + "ownerId": null, + "empty": false + }], + "properties": [], + "attributes": [], + "groups": [], + "resourceType": "VF" +}
\ No newline at end of file diff --git a/cucumber-js-test-apis-ci/resources/json/interfaceOperation/createInterfaceOperations.json b/cucumber-js-test-apis-ci/resources/json/interfaceOperation/createInterfaceOperations.json new file mode 100644 index 0000000000..ee38f17974 --- /dev/null +++ b/cucumber-js-test-apis-ci/resources/json/interfaceOperation/createInterfaceOperations.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "interface1": { + "type": "interface1", + "operations": { + "delete": { + "name": "delete", + "description": "description", + "inputs": { + "listToscaDataDefinition": [{ + "name": "inp1", + "type": "string", + "inputId": "c4c6e35f-37d1-4fd5-943c-51257386a86c.nf_naming.instance_name", + "required": true + }] + }, + "outputs": { + "listToscaDataDefinition": [{ + "type": "string", + "required": true, + "name": "op1" + }] + }, + "workflowAssociationType": "NONE", + "workflowId": null, + "workflowVersionId": null + } + } + } + } +}
\ No newline at end of file diff --git a/cucumber-js-test-apis-ci/resources/json/interfaceOperation/updateInterfaceOperation.json b/cucumber-js-test-apis-ci/resources/json/interfaceOperation/updateInterfaceOperation.json new file mode 100644 index 0000000000..8821e7f837 --- /dev/null +++ b/cucumber-js-test-apis-ci/resources/json/interfaceOperation/updateInterfaceOperation.json @@ -0,0 +1,34 @@ +{ + "interfaces": { + "interface1": { + "type": "interface1", + "operations": { + "delete" : { + "name": "sshGV", + "description": "sshGV updated description" , + "inputs": { + "listToscaDataDefinition": [ + { + "name": "inputId_up", + "type": "string", + "inputId": "c4c6e35f-37d1-4fd5-943c-51257386a86c.nf_naming.instance_name", + "required": true + } + ] + }, + "outputs": { + "listToscaDataDefinition": [{ + "name": "outUp_up", + "type": "string", + "required": true + }] + }, + "uniqueId": "3f6b7144-2dec-48e2-80cb-c67e8bc1d7d2", + "workflowAssociationType": "NONE", + "workflowId": null, + "workflowVersionId": null + } + } + } + } +}
\ No newline at end of file diff --git a/cucumber-js-test-apis-ci/resources/json/operation/createOperation-with-workflow.json b/cucumber-js-test-apis-ci/resources/json/operation/createOperation-with-workflow.json deleted file mode 100644 index e9693adf2a..0000000000 --- a/cucumber-js-test-apis-ci/resources/json/operation/createOperation-with-workflow.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaceOperations": { - "operation": { - "description": "abcd description", - "inputParams": { - "listToscaDataDefinition": [ - { - "name": "inp1", - "type": "string", - "property": "97477d27-8fe2-45a1-83cb-83368ef2a402.nf_naming_code", - "mandatory": true - } - ] - }, - "outputParams": { - "listToscaDataDefinition": [ - { - "name": "op", - "mandatory": true, - "type": "String" - } - ] - }, - "operationType": "create", - "workflowAssociationType": "EXISTING", - "workflowId" : "workflowId", - "workflowVersionId" : "workflowVersionId" - } - } -}
\ No newline at end of file diff --git a/cucumber-js-test-apis-ci/resources/json/operation/createOperation.json b/cucumber-js-test-apis-ci/resources/json/operation/createOperation.json deleted file mode 100644 index 10c34ba8f2..0000000000 --- a/cucumber-js-test-apis-ci/resources/json/operation/createOperation.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "interfaceOperations": { - "operation": { - "description": "abcd description", - "inputParams": { - }, - "outputParams": { - }, - "operationType": "create", - "workflowId" : null, - "workflowVersionId" : null - } - } -}
\ No newline at end of file diff --git a/cucumber-js-test-apis-ci/resources/json/operation/createOperationWithInputOutput.json b/cucumber-js-test-apis-ci/resources/json/operation/createOperationWithInputOutput.json deleted file mode 100644 index 013d615999..0000000000 --- a/cucumber-js-test-apis-ci/resources/json/operation/createOperationWithInputOutput.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "interfaceOperations": { - "operation": { - "description": "abcd description", - "inputParams": { - "listToscaDataDefinition": [ - { - "name": "inp1", - "type": "string", - "property": "97477d27-8fe2-45a1-83cb-83368ef2a402.nf_naming_code", - "mandatory": true - } - ] - }, - "outputParams": { - "listToscaDataDefinition": [ - { - "name": "op", - "mandatory": true, - "type": "String" - } - ] - }, - "operationType": "create", - "workflowId" : null, - "workflowVersionId" : null - } - } -}
\ No newline at end of file diff --git a/cucumber-js-test-apis-ci/resources/json/operation/createService.json b/cucumber-js-test-apis-ci/resources/json/operation/createService.json deleted file mode 100644 index e7afe2aa21..0000000000 --- a/cucumber-js-test-apis-ci/resources/json/operation/createService.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "artifacts": { - - }, - "toscaArtifacts": { - - }, - "contactId": "cs0008", - "categories": [ - { - "name": "Network L4+", - "normalizedName": "network l4+", - "uniqueId": "serviceNewCategory.network l4+", - "icons": [ - "network_l_4" - ], - "subcategories": null, - "version": null, - "ownerId": null, - "empty": false, - "type": null - } - ], - "description": "service1 for bdd", - "icon": "defaulticon", - "componentInstancesProperties": { - - }, - "componentInstancesAttributes": { - - }, - "name": "service1", - "tags": [ - "service1" - ], - "capabilities": { - - }, - "requirements": { - - }, - "deploymentArtifacts": { - - }, - "componentType": "SERVICE", - "projectCode": "010203", - "componentInstances": [ - - ], - "properties": [ - - ], - - "inputs": [ - { - "uniqueId": "03eeb10e-cf2a-41b8-9d8e-d2dbd094f9d4.test1_dasddas", - "type": "scalar-unit.size", - "required": false, - "definition": false, - "schema": { - "properties": { - - }, - "property": { - "type": "", - "required": false, - "definition": true, - "password": false, - "hidden": false, - "immutable": false, - "getInputProperty": false, - "empty": false - }, - "empty": false - }, - "password": false, - "name": "test1_dasddas", - "hidden": false, - "immutable": false, - "instanceUniqueId": "03eeb10e-cf2a-41b8-9d8e-d2dbd094f9d4", - "propertyId": "03eeb10e-cf2a-41b8-9d8e-d2dbd094f9d4.dasddas", - "parentUniqueId": "cs0008", - "schemaType": "", - "getInputProperty": false, - "ownerId": "cs0008", - "empty": false - } - ], - - "attributes": [ - - ], - "forwardingPaths": { - - }, - "ecompGeneratedNaming": true, - "serviceApiArtifacts": { - - }, - "instantiationType": "A-la-carte", - "environmentContext": "General_Revenue-Bearing" -}
\ No newline at end of file diff --git a/cucumber-js-test-apis-ci/resources/json/operation/createVF.json b/cucumber-js-test-apis-ci/resources/json/operation/createVF.json deleted file mode 100644 index 6fe9688caa..0000000000 --- a/cucumber-js-test-apis-ci/resources/json/operation/createVF.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "artifacts": { - - }, - "toscaArtifacts": { - - }, - "contactId": "cs0008", - "categories": [ - { - "name": "Allotted Resource", - "normalizedName": "allotted resource", - "uniqueId": "resourceNewCategory.allotted resource", - "icons": null, - "subcategories": [ - { - "name": "Tunnel XConnect", - "normalizedName": "tunnel xconnect", - "uniqueId": "resourceNewCategory.allotted resource.tunnel xconnect", - "icons": [ - "tunnel_x_connect" - ], - "groupings": null, - "ownerId": null, - "empty": false - } - ], - "ownerId": null, - "empty": false - } - ], - "description": "sd", - "icon": "defaulticon", - "componentInstancesProperties": { - - }, - "componentInstancesAttributes": { - - }, - "name": "REPLACE", - "tags": [ - "REPLACE" - ], - "capabilities": { - - }, - "requirements": { - - }, - "deploymentArtifacts": { - - }, - "componentType": "RESOURCE", - "vendorName": "vendor", - "vendorRelease": "vendor release", - "componentInstances": [ - - ], - "inputs": [{ - "uniqueId": "abcdef", - "type": "org.openecomp.datatypes.Naming", - "required": false, - "definition": false, - "defaultValue": null, - "description": null, - "schema": null, - "password": false, - "name": "abcdef", - "value": null, - "label": null, - "hidden": false, - "immutable": false, - "inputPath": null, - "status": null, - "inputId": null, - "instanceUniqueId": null, - "propertyId": null, - "annotations": null, - "parentUniqueId": "abcd", - "getInputValues": null, - "constraints": null, - "inputs": null, - "properties": null, - "getInputProperty": false, - "schemaType": null, - "schemaProperty": null, - "version": null, - "ownerId": null, - "empty": false - } ], - "properties": [ - - ], - "attributes": [ - - ], - "groups": [ - - ], - "resourceType": "VF" -}
\ No newline at end of file diff --git a/cucumber-js-test-apis-ci/resources/json/operation/updateOperation.json b/cucumber-js-test-apis-ci/resources/json/operation/updateOperation.json deleted file mode 100644 index 698d38c612..0000000000 --- a/cucumber-js-test-apis-ci/resources/json/operation/updateOperation.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "interfaceOperations": { - "operation": { - "description": "create operation_Updated", - "inputParams": { - "listToscaDataDefinition": [ - { - "name": "inp1", - "type": "string", - "property": "97477d27-8fe2-45a1-83cb-83368ef2a402.nf_naming_code", - "mandatory": true - } - ] - }, - "outputParams": { - "listToscaDataDefinition": [ - { - "name": "op", - "mandatory": true, - "type": "String" - } - ] - }, - "operationType": "create", - "uniqueId": "REPLACE FROM CONTEXT" - } - } -}
\ No newline at end of file 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'); }); |