2 * Copyright © 2016-2017 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 const {Then, When, Given} = require('cucumber');
17 const assert = require('assert');
18 const util = require('../cucumber-common/utils/Utils.js');
22 * @description Creates a new VLM with a random name and saves the id and versionId on the context item object and the context vlm object<br>
23 * Input data will be taken from the 'resources/json/createVLM.json' file.
24 *@exampleFile Example_VLM.feature
25 * @step I want to create a VLM
27 When('I want to create a VLM', function() {
28 let inputData = util.getJSONFromFile('resources/json/createVLM.json');
29 inputData.vendorName = util.random();
30 let path = '/vendor-license-models';
31 return util.request(this.context, 'POST', path, inputData).then(result => {
32 this.context.item ={id : result.data.itemId, versionId: result.data.version.id};
33 this.context.vlm = {id : result.data.itemId, name : inputData.vendorName};
39 * @exampleFile Example_VLM.feature
40 * @step I want to submit this VLM
42 Then('I want to submit this VLM', function() {
43 let inputData = {action: 'Submit'};
44 let path = '/vendor-license-models/' + this.context.item.id + '/versions/' + this.context.item.versionId + '/actions';
45 return util.request(this.context, 'PUT', path, inputData);
50 * @exampleFile DeleteVLMDraft.feature
51 * @step I want to delete this VLM
53 Then('I want to delete this VLM', function() {
54 let path = '/vendor-license-models/' + this.context.item.id ;
55 return util.request(this.context, 'DELETE', path);
61 * @exampleFile ArchiveItem.feature
62 * @step I want to list Archived VLMs
64 Then('I want to list Archived VLMs', function() {
65 let path = '/vendor-license-models/?Status=ARCHIVED';
66 return util.request(this.context, 'GET', path);
71 * @exampleFile ArchiveItem.feature
72 * @step I want to list Active VLMs
74 Then('I want to list Active VLMs', function() {
75 let path = '/vendor-license-models';
76 return util.request(this.context, 'GET', path);