From 3f55e8e7cff615f2f97d3e0d5def0c2f0d80cea5 Mon Sep 17 00:00:00 2001 From: shrikantawachar Date: Sat, 14 Jul 2018 00:18:09 +0530 Subject: Enhancement in md5 field of Image Implementation and Flow tests Change-Id: I4c7e3dfe077ba43317cf0b06b0ea4d85bfb50da8 Issue-ID: SDC-1502 Signed-off-by: shrikantawachar --- .../features/UserFeedback/TestMD5.feature | 69 ++++++++++++++++++++++ openecomp-bdd/resources/json/createManualVSP.json | 17 ++++++ openecomp-bdd/stepDefinitions/InputData_steps.js | 11 ++++ .../stepDefinitions/Questionnaire_steps.js | 19 ++++++ openecomp-bdd/stepDefinitions/VSP_steps.js | 7 ++- 5 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 openecomp-bdd/features/UserFeedback/TestMD5.feature create mode 100644 openecomp-bdd/resources/json/createManualVSP.json (limited to 'openecomp-bdd') diff --git a/openecomp-bdd/features/UserFeedback/TestMD5.feature b/openecomp-bdd/features/UserFeedback/TestMD5.feature new file mode 100644 index 0000000000..2a7f87eecb --- /dev/null +++ b/openecomp-bdd/features/UserFeedback/TestMD5.feature @@ -0,0 +1,69 @@ +# Copyright © 2018 European Support Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Feature: User Feedback - Test MD5 + + Scenario: Test MD5 + + When I want to create a VLM + Then I want to copy to property "licensingVersion" from response data path "version.id" + + #create feature group + When I want to create input data + Then I want to update the input property "name" with value "FG1" + Then I want to update the input property "manufacturerReferenceNumber" with value "1234" + Then I want to update the input property "partNumber" with value "999" + Then I want to create for path "/vendor-license-models/{item.id}/versions/{item.versionId}/feature-groups" with the input data from the context + Then I want to copy to property "featureGroupId" from response data path "value" + + #create license agreements + When I want to create input data + Then I want to update the input property "name" with value "LA" + Then I want to update the input property "licenseTerm.choice" with value "Unlimited" + Then I want to update the input property "addedFeatureGroupsIds[0]" from property "featureGroupId" + Then I want to create for path "/vendor-license-models/{item.id}/versions/{item.versionId}/license-agreements" with the input data from the context + Then I want to copy to property "licenseAgreement" from response data path "value" + + When I want to create a VSP with onboarding type Manual + Then I want to make sure this Item has status "Draft" + + When I want to add a component + + #create image + When I want to create input data + Then I want to update the input property "fileName" with value "Image_1" + Then I want to create for path "/vendor-software-products/{vsp.id}/versions/{vsp.versionId}/components/{componentId}/images" with the input data from the context + + #update image questionnaire + Then I want to get the questionnaire for this path "/vendor-software-products/{vsp.id}/versions/{vsp.versionId}/components/{componentId}/images/{responseData.id}/questionnaire" + And I want to update this questionnaire with value "md5" for property "5555555555555555555555555555555555555555555555555555555555555" + And I want to update this questionnaire with value "version" for property "1" + And I want to update this questionnaire + + #create compute flavor + When I want to create input data + Then I want to update the input property "name" with value "ComputeFlavor1" + When I want to create for path "/vendor-software-products/{vsp.id}/versions/{vsp.versionId}/components/{componentId}/compute-flavors" with the input data from the context + Then I want to copy to property "computeFlavorId" from response data path "id" + + #create deployment flavor with Component , compute flavor associations + When I want to create input data + Then I want to update the input property "model" with value "DeploymentFlavorModel" + Then I want to update the input property "componentComputeAssociations[0].componentId" from property "componentId" + Then I want to update the input property "componentComputeAssociations[0].computeFlavorId" from property "computeFlavorId" + Then I want to update the input property "featureGroupId" from property "featureGroupId" + Then I want to create for path "/vendor-software-products/{vsp.id}/versions/{vsp.versionId}/deployment-flavors" with the input data from the context + + Then I want the following to fail + When I want to submit this VSP diff --git a/openecomp-bdd/resources/json/createManualVSP.json b/openecomp-bdd/resources/json/createManualVSP.json new file mode 100644 index 0000000000..9ce14f545d --- /dev/null +++ b/openecomp-bdd/resources/json/createManualVSP.json @@ -0,0 +1,17 @@ +{ + "vendorId":"REPLACE", + "name": "RANDOM", + "category":"resourceNewCategory.generic", + "subCategory":"resourceNewCategory.generic.abstract", + "onboardingMethod":"Manual", + "description":"for testing", + "vendorName":"REPLACE", + "icon":"icon", + "licensingVersion": "REPLACE", + "licensingData":{ + "licenseAgreement": "REPLACE", + "featureGroups": [ + "REPLACE" + ] + } +} diff --git a/openecomp-bdd/stepDefinitions/InputData_steps.js b/openecomp-bdd/stepDefinitions/InputData_steps.js index 73695d0e7f..57a374b9bb 100644 --- a/openecomp-bdd/stepDefinitions/InputData_steps.js +++ b/openecomp-bdd/stepDefinitions/InputData_steps.js @@ -62,6 +62,17 @@ Then('I want to update the input property {string} with value {string}', functio _.set(this.context.inputData, string, string2); }); +/** + * @module InputData + * @description sets the input property on the input data to the value from property + * @exampleFile TestMD5.feature + * @step I want to update the input property {string} from property {string} + **/ +Then('I want to update the input property {string} from property {string}', function(string, string2) { + let val = _.get(this.context, string2); + _.set(this.context.inputData, string, val); +}); + /** * @module InputData * @description removes a property from the input data object diff --git a/openecomp-bdd/stepDefinitions/Questionnaire_steps.js b/openecomp-bdd/stepDefinitions/Questionnaire_steps.js index c794734735..2e169fadc8 100644 --- a/openecomp-bdd/stepDefinitions/Questionnaire_steps.js +++ b/openecomp-bdd/stepDefinitions/Questionnaire_steps.js @@ -18,6 +18,11 @@ const assert = require('assert'); const util = require('./Utils.js'); const _ = require('lodash'); +function getPath(path, context) { + let compiled = _.template(path); + return compiled(context); +} + /** * @module Questionnaire * @description Gets the questionnaire for the current item and saves it on the context @@ -48,6 +53,20 @@ Then('I want to get the questionnaire for this component', function () { }); }); +/** + * @module Questionnaire + * @description Gets the questionnaire from path and saves it on the context + * @exampleFile TestMD5.feature + * @step I want to get the questionnaire for this path {string} + **/ +Then('I want to get the questionnaire for this path {string}', function (string) { + let path = getPath(string, this.context); + return util.request(this.context, 'GET', path).then(result => { + this.context.qdata = JSON.parse(result.data.data); + this.context.qschema = result.data.schema; + this.context.qurl = path; + }); +}); /** * @module Questionnaire diff --git a/openecomp-bdd/stepDefinitions/VSP_steps.js b/openecomp-bdd/stepDefinitions/VSP_steps.js index 1f753fef5e..b9b928a7f6 100644 --- a/openecomp-bdd/stepDefinitions/VSP_steps.js +++ b/openecomp-bdd/stepDefinitions/VSP_steps.js @@ -48,11 +48,14 @@ When('I want to create a VSP with onboarding type {string}', function(string) { * @exampleFile Example_VSP.feature * @step I want to create a VSP with onboarding type {string} **/ -When('I want to create a VSP', function() { - let inputData = util.getJSONFromFile('resources/json/createVSP.json'); +When('I want to create a VSP with onboarding type Manual', function() { + let inputData = util.getJSONFromFile('resources/json/createManualVSP.json'); inputData.vendorName = this.context.vlm.name; inputData.vendorId = this.context.vlm.id; inputData.name = util.random(); + inputData.licensingVersion = this.context.licensingVersion; + inputData.licensingData.licenseAgreement = this.context.licenseAgreement; + inputData.licensingData.featureGroups[0] = this.context.featureGroupId; let path = '/vendor-software-products'; return util.request(this.context, 'POST', path, inputData).then(result => { this.context.item = {id : result.data.itemId, versionId: result.data.version.id}; -- cgit 1.2.3-korg