Increase junit TCs
[sdc.git] / ui-ci / src / main / java / org / openecomp / sdc / ci / tests / execute / sanity / VfDeploymentInformationalArtifacts.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.ci.tests.execute.sanity;
22
23 import org.openecomp.sdc.be.dao.api.ActionStatus;
24 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
25 import org.openecomp.sdc.be.model.User;
26 import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
27 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
28 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.Dashboard;
29 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
30 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
31 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
32 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
33 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
34 import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
35 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
36 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
37 import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
38 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
39 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
40 import org.openecomp.sdc.common.api.ArtifactTypeEnum;
41 import org.openqa.selenium.WebElement;
42 import org.testng.annotations.Test;
43
44 import java.util.ArrayList;
45 import java.util.List;
46
47 import static org.assertj.core.api.Assertions.assertThat;
48
49
50 public class VfDeploymentInformationalArtifacts extends SetupCDTest {
51
52
53     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
54     // START US824719
55     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
56
57     // US824719 - Import VSP - VF informational artifacts
58     // TC1434241 - Import VF Artifacts - Deployment Artifacts - One Artifact, One Type
59     @Test
60     public void importVfArtifactsDeploymentArtifactsOneArtifactOneType() throws Exception {
61         String fileName = "TC1434241.csar";
62         String folder = "US825779";
63
64         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
65         deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
66         deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
67         deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
68
69         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
70     }
71
72     // US824719 - Import VSP - VF informational artifacts
73     // TC1434245 - Import VF Artifacts - Deployment Artifacts - Multiple Artifacts, Multiple Types
74     @Test
75     public void importVfArtifactsDeploymentArtifactsMultipleArtifactsMultipleTypes() throws Exception {
76         String fileName = "TC1434245.csar";
77         String folder = "US825779";
78
79         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
80         deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
81         deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1"));
82
83         deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
84         deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
85         deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
86
87         deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
88         deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
89
90         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
91     }
92
93     // US824719 - Import VSP - VF informational artifacts
94     // TC1434247 - Import VF Artifacts - Informational Artifacts - One Artifact, One Type
95     @Test
96     public void importVfArtifactsInformationalArtifactsOneArtifactOneType() throws Exception {
97         String fileName = "TC1434247.csar";
98         String folder = "US825779";
99
100         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
101         deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
102         deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
103
104         List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
105         informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
106
107         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
108     }
109
110     // US824719 - Import VSP - VF informational artifacts
111     // TC1434248 -      Import VF Artifacts - Informational Artifacts - Multiple Artifacts, Multiple Types
112     @Test
113     public void importVfArtifactsInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception {
114         String fileName = "TC1434248.csar";
115         String folder = "US825779";
116
117         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
118         deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
119         deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
120
121         List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
122         informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
123         informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1"));
124         informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1"));
125
126         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
127     }
128
129     // US824719 - Import VSP - VF informational artifacts
130     // TC1434249 -      Import VF Artifacts - Deployment and Informational Artifacts - Multiple Artifacts, Multiple Types
131     @Test
132     public void importVfArtifactsDeploymentAndInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception {
133         String fileName = "TC1434249.csar";
134         String folder = "US825779";
135
136         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
137         deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
138         deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1"));
139         deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
140         deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
141         deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
142         deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
143         deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
144
145         List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
146         informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
147         informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1"));
148         informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1"));
149
150         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
151     }
152
153     // TODO: there is defect in flow: "Updated button enabled for artifact in invalid type folder"
154     // TODO: re-check it after defect fix
155     // US824719 - Import VSP - VF informational artifacts
156     // TC1438310 - Import VF Artifacts - Deployment Artifacts - Artifact Type Invalid
157     @Test
158     public void importVFArtifactsDeploymentArtifactsArtifactTypeInvalid() throws Exception {
159         String fileName = "DeploymentArtifactWithInvalidType.csar";
160         String folder = "US825779";
161
162         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
163         deploymentArtifacts.add(new ArtifactInfo(null, "ArtifactName.yaml", null, "ArtifactName", ArtifactTypeEnum.OTHER.getType(), "1"));
164         deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
165         deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
166
167         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
168     }
169
170     // US824719 - Import VSP - VF informational artifacts
171     // TC1438311 - Import VF Artifacts - Informational Artifacts - Artifact Type Invalid
172     @Test
173     public void importVfArtifactsInformationalArtifactsArtifactTypeInvalid() throws Exception {
174         String fileName = "InformationArtifactWithInvalidType.csar";
175         String folder = "US825779";
176
177         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
178         deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
179         deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
180
181         List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
182         informationalArtifacts.add(new ArtifactInfo(null, "ArtifactName.yaml", null, "ArtifactName", ArtifactTypeEnum.OTHER.getType(), "1"));
183
184         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
185     }
186
187     // US824719 - Import VSP - VF informational artifacts
188     // TC1438231 -      Import VF Artifacts - Deployment Artifacts - Artifact Name To Long
189     @Test
190     public void importVfArtifactsDeploymentArtifactsArtifactNameToLong() throws Exception {
191         String folder = "US825779";
192         ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
193
194         String fileName = "DeploymentArtifactWithLongName.csar";
195
196         importVfFromCsar(resourceMetaData, folder, fileName, getUser());
197
198         String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
199         String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
200         assertThat(errorMessage).contains(checkUIResponseOnError);
201     }
202
203     // US824719 - Import VSP - VF informational artifacts
204     // TC1438232 - Import VF Artifacts - Informational Artifacts - Artifact Name To Long
205     // TODO: make informational artifact name longer then 255
206     // TODO: windows/linux not allowed it
207     @Test(enabled = true)
208     public void importVfArtifactsInformationalArtifactsArtifactNameToLong() throws Exception {
209         String folder = "US825779";
210         ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
211
212         String fileName = "InformationArtifactWithLongName.csar";
213
214         importVfFromCsar(resourceMetaData, folder, fileName, getUser());
215
216         String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
217         String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
218         assertThat(errorMessage).contains(checkUIResponseOnError);
219     }
220
221     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
222     // END US824719
223     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
224
225
226     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
227     // START US825779
228     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
229
230     // US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
231     // TC1443954 - Update With Multiple Changes In Deployment And Informational Artifacts
232     @Test
233     public void updateWithMultipleChangesInDeploymentAndInformationalArtifacts() throws Exception {
234         String folder = "US825779";
235         String fileName = "ImportTC1443954.csar";
236
237         ArtifactInfo deploymentHeat1 = new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1");
238         ArtifactInfo deploymentHeat2 = new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1");
239         ArtifactInfo deploymentHeat3 = new ArtifactInfo(null, "heatartifactname3.yaml", null, "heatartifactname3", ArtifactTypeEnum.HEAT.getType(), "1");
240
241         ArtifactInfo deploymentHeatVol1 = new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1");
242         ArtifactInfo deploymentHeatVol2 = new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1");
243
244         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
245         deploymentArtifacts.add(deploymentHeat1);
246         deploymentArtifacts.add(deploymentHeat2);
247         deploymentArtifacts.add(deploymentHeat3);
248         deploymentArtifacts.add(deploymentHeatVol1);
249         deploymentArtifacts.add(deploymentHeatVol2);
250
251         ArtifactInfo infoGuide1 = new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1");
252         ArtifactInfo infoGuide2 = new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1");
253
254         ArtifactInfo infoOther1 = new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1");
255         ArtifactInfo infoOther2 = new ArtifactInfo(null, "artifactname2.txt", null, "artifactname2", ArtifactTypeEnum.OTHER.getType(), "1");
256         ArtifactInfo infoOther3 = new ArtifactInfo(null, "artifactname3.txt", null, "artifactname3", ArtifactTypeEnum.OTHER.getType(), "1");
257
258         List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
259         informationalArtifacts.add(infoGuide1);
260         informationalArtifacts.add(infoGuide2);
261         informationalArtifacts.add(infoOther1);
262         informationalArtifacts.add(infoOther2);
263         informationalArtifacts.add(infoOther3);
264
265         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
266
267         GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
268
269         fileName = "UpdateTC1443954.csar";
270
271         List<ArtifactInfo> informationalArtifactsNotExist = new ArrayList<ArtifactInfo>();
272         List<ArtifactInfo> deploymentArtifactsNotExist = new ArrayList<ArtifactInfo>();
273
274         // Changes in deployment artifacts
275         deploymentArtifactsNotExist.add(deploymentHeat1);
276         deploymentArtifactsNotExist.add(deploymentHeat2);
277         deploymentArtifacts.remove(deploymentHeat1);
278         deploymentArtifacts.remove(deploymentHeat2);
279         deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname4.yaml", null, "heatartifactname4", ArtifactTypeEnum.HEAT.getType(), "1"));
280         deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname5.yaml", null, "heatartifactname5", ArtifactTypeEnum.HEAT.getType(), "1"));
281         deploymentHeatVol1.setArtifactVersion("2");
282         deploymentHeatVol2.setArtifactVersion("2");
283
284         // Changes in informational artifacts
285         infoGuide1.setArtifactVersion("2");
286         infoOther1.setArtifactVersion("2");
287         informationalArtifactsNotExist.add(infoGuide2);
288         informationalArtifactsNotExist.add(infoOther2);
289         informationalArtifacts.remove(infoGuide2);
290         informationalArtifacts.remove(infoOther2);
291         informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact3.yml", null, "GuideInfoArtifact3", ArtifactTypeEnum.GUIDE.getType(), "1"));
292         informationalArtifacts.add(new ArtifactInfo(null, "artifactname4.txt", null, "artifactname4", ArtifactTypeEnum.OTHER.getType(), "1"));
293
294         updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, deploymentArtifactsNotExist, informationalArtifactsNotExist);
295     }
296
297
298     // US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
299     // TC1444206 - Update With Existed Deployment Artifact By Artifact With Different Type
300     @Test
301     public void updateWithExistedDeploymentArtifactByArtifactWithDifferentType() throws Exception {
302         String folder = "US825779";
303         String fileName = "ImportTC1444206.csar";
304         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
305         deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
306         deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
307         deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
308
309         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
310
311         GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
312
313         fileName = "UpdateTC1444206.csar";
314         String filePath = FileHandling.getFilePath(folder);
315
316         ResourceUIUtils.updateVfWithCsar(filePath, fileName);
317
318         String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
319         String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_EXIST.name());
320         assertThat(errorMessage).contains(checkUIResponseOnError);
321     }
322
323     // US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
324     // TC1444207 - Update With Existed Informational Artifact By Artifact With Different Type
325     @Test
326     public void updateWithExistedInformationalArtifactByArtifactWithDifferentType() throws Exception {
327         String folder = "US825779";
328         String fileName = "ImportTC1444207.csar";
329
330         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
331         deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
332         deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
333
334         List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
335         informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
336
337         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
338
339         GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
340
341         fileName = "UpdateTC1444207.csar";
342         String filePath = FileHandling.getFilePath(folder);
343
344         ResourceUIUtils.updateVfWithCsar(filePath, fileName);
345
346         String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
347         String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_EXIST.name());
348         assertThat(errorMessage).contains(checkUIResponseOnError);
349     }
350
351
352     // US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
353     // TC1444208 - Update With Existed Informational Artifact By Deployment Artifact With Different Type
354     @Test
355     public void updateWithExistedInformationalArtifactByDeploymentArtifactWithDifferentType() throws Exception {
356         String folder = "US825779";
357         String fileName = "ImportTC1444208.csar";
358
359         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
360         deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
361         deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
362         deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
363
364         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
365
366         GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
367
368         fileName = "UpdateTC1444208.csar";
369         String filePath = FileHandling.getFilePath(folder);
370
371         ResourceUIUtils.updateVfWithCsar(filePath, fileName);
372
373         String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
374         String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_EXIST.name());
375         assertThat(errorMessage).contains(checkUIResponseOnError);
376     }
377
378     // US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
379     // TC1444520 - Update Deployment Artifact With Name To Long
380     @Test
381     public void updateDeploymentArtifactWithNameToLong() throws Exception {
382         String folder = "US825779";
383
384         String fileName = "ImportTC1444520.csar";
385
386         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, null, null);
387
388         GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
389
390         fileName = "UpdateTC1444520.csar";
391         String filePath = FileHandling.getFilePath(folder);
392
393         ResourceUIUtils.updateVfWithCsar(filePath, fileName);
394
395         String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
396         String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
397         assertThat(errorMessage).contains(checkUIResponseOnError);
398     }
399
400     // US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
401     // TC1444521 - Update Informational Artifact With Name To Long
402     @Test
403     public void updateInformationalArtifactWithNameToLong() throws Exception {
404
405         String folder = "US825779";
406         String fileName = "ImportTC1444521.csar";
407
408         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, null, null);
409
410         GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
411
412         fileName = "UpdateTC1444521.csar";
413         String filePath = FileHandling.getFilePath(folder);
414
415         ResourceUIUtils.updateVfWithCsar(filePath, fileName);
416
417         String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
418         String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
419         assertThat(errorMessage).contains(checkUIResponseOnError);
420     }
421
422     // US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
423     // TC1444531 - Update Informational Artifact With Invalid Type
424     @Test
425     public void updateInformationalArtifactWithInvalidType() throws Exception {
426         String folder = "US825779";
427         String fileName = "ImportTC1444531.csar";
428
429         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, null, null);
430
431         GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
432
433         fileName = "UpdateTC1444531.csar";
434
435         List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
436         informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
437
438         updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, null, informationalArtifacts, null, null);
439     }
440
441
442     @Test
443     public void importValidInformationalArtifactInInvalidFolerTest_TC1438313() throws Exception {
444         String fileName = "ValidArtifactNameInInvalidFolder.csar";
445         String folder = "US824719";
446
447         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
448         deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
449         deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
450
451         importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
452     }
453
454     @Test
455     public void updateValidInformationalArtifactInInvalidFolerTest_TC1444533() throws Exception {
456         String fileName = "ImportTC1444533.csar";
457         String folder = "US824719";
458         String filePath = FileHandling.getFilePath(folder);
459
460         ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
461         ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
462
463         String updatedCsarFileName = "UpdateTC1444533.csar";
464
465         List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
466         deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "2"));
467         deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "4"));
468
469         updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, updatedCsarFileName, deploymentArtifacts, null, null, null);
470     }
471
472
473     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
474     // END US825779
475     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
476
477
478     public void updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(String folder, String fileName,
479                                                                                              List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> informationalArtifacts,
480                                                                                              List<ArtifactInfo> deploymentArtifactsNotExist, List<ArtifactInfo> informationalArtifactsNotExist) throws Exception {
481         String filePath = FileHandling.getFilePath(folder);
482         ResourceUIUtils.updateVfWithCsar(filePath, fileName);
483
484         validateDeploymentArtifactPage(deploymentArtifacts, null);
485         validateInformationalArtifactPage(informationalArtifacts, null);
486
487         ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
488
489         validateDeploymentArtifactInComposition(deploymentArtifacts, null);
490         validateInformationalArtifactInComposition(informationalArtifacts, null);
491
492     }
493
494
495     public void importVfFromCsar(ResourceReqDetails resourceMetaData, String folder, String fileName, User user) {
496         String filePath = FileHandling.getFilePath(folder);
497         GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
498         // Insert file to the browse dialog
499         WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
500         browseWebElement.sendKeys(filePath + fileName);
501
502         // Fill the general page fields.
503         GeneralUIUtils.waitForLoader();
504         ResourceUIUtils.fillResourceGeneralInformationPage(resourceMetaData, getUser(), true);
505         GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
506     }
507
508
509     public void importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(String fileName, String folder, List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> informationalArtifacts) throws Exception {
510         String filePath = FileHandling.getFilePath(folder);
511         ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
512         ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
513
514         validateDeploymentArtifactPage(deploymentArtifacts, null);
515         validateInformationalArtifactPage(informationalArtifacts, null);
516
517         ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
518
519         validateDeploymentArtifactInComposition(deploymentArtifacts, null);
520         validateInformationalArtifactInComposition(informationalArtifacts, null);
521     }
522
523     public void validateInformationalArtifactInComposition(List<ArtifactInfo> informationalArtifacts, List<ArtifactInfo> informationalArtifactsNotExist) throws Exception {
524         CompositionPage.showInformationArtifactTab();
525         // Composition informational
526         if (informationalArtifacts != null && informationalArtifacts.size() > 0) {
527             validateEachArtifactOnCompositionRightMenuInformationPage(informationalArtifacts);
528         }
529         if (informationalArtifactsNotExist != null && informationalArtifactsNotExist.size() > 0) {
530             validateEachArtifactNotExistOnCompositionRightMenuInformationPage(informationalArtifactsNotExist);
531         }
532     }
533
534     public void validateDeploymentArtifactInComposition(List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> deploymentArtifactsNotExist) throws Exception {
535         CompositionPage.showDeploymentArtifactTab();
536         // Composition deployment
537         if (deploymentArtifacts != null && deploymentArtifacts.size() > 0) {
538             validateEachArtifactOnCompositionRightMenuDeploymentPage(deploymentArtifacts);
539         }
540         if (deploymentArtifactsNotExist != null && deploymentArtifactsNotExist.size() > 0) {
541             validateEachArtifactNotExistOnCompositionRightMenuDeploymentPage(deploymentArtifactsNotExist);
542         }
543     }
544
545     public void validateInformationalArtifactPage(List<ArtifactInfo> informationalArtifacts, List<ArtifactInfo> informationalArtifactsNotExist) {
546         ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
547         // Informational page
548         if (informationalArtifacts != null && informationalArtifacts.size() > 0) {
549             validateEachArtifactInformationPage(informationalArtifacts);
550         }
551         if (informationalArtifactsNotExist != null && informationalArtifactsNotExist.size() > 0) {
552             validateEachArtifactNotExistInformationPage(informationalArtifactsNotExist);
553         }
554     }
555
556     public void validateDeploymentArtifactPage(List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> deploymentArtifactsNotExist) {
557         ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
558         // Deployment page
559         if (deploymentArtifacts != null && deploymentArtifacts.size() > 0) {
560             validateEachArtifactOnDeploymentPage(deploymentArtifacts);
561         }
562         if (deploymentArtifactsNotExist != null && deploymentArtifactsNotExist.size() > 0) {
563             validateEachArtifactNotExistOnDeploymentPage(deploymentArtifactsNotExist);
564         }
565     }
566
567     // TODO: add validation that if not editable / deleteable then button should not appear
568     public void validateEachArtifactOnDeploymentPage(List<ArtifactInfo> artifactInfoList) {
569         for (ArtifactInfo artifact : artifactInfoList) {
570             String type = artifact.getArtifactType();
571             String label = artifact.getArtifactLabel();
572             String version = artifact.getArtifactVersion();
573
574             if (type.equals(ArtifactTypeEnum.HEAT.getType()) || type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) || type.equals(ArtifactTypeEnum.HEAT_NET.getType())) {
575                 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(label, null, version, type, true, false, false, true);
576             } else {
577                 ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(label, null, version, type, true, true, true, false);
578             }
579         }
580     }
581
582     public void validateEachArtifactNotExistOnDeploymentPage(List<ArtifactInfo> artifactInfoList) {
583         for (ArtifactInfo artifact : artifactInfoList) {
584             ArtifactUIUtils.validateNotExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel());
585         }
586     }
587
588     public void validateEachArtifactInformationPage(List<ArtifactInfo> artifactInfoList) {
589         for (ArtifactInfo artifact : artifactInfoList) {
590             ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel(), null, artifact.getArtifactVersion(), artifact.getArtifactType(), true, true, true, false);
591         }
592     }
593
594     public void validateEachArtifactNotExistInformationPage(List<ArtifactInfo> artifactInfoList) {
595         for (ArtifactInfo artifact : artifactInfoList) {
596             ArtifactUIUtils.validateNotExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel());
597         }
598     }
599
600     public void validateEachArtifactOnCompositionRightMenuDeploymentPage(List<ArtifactInfo> artifactInfoList) {
601         for (ArtifactInfo artifact : artifactInfoList) {
602
603             String type = artifact.getArtifactType();
604             String label = artifact.getArtifactLabel();
605             String filename = artifact.getFilename();
606
607             if (type.equals(ArtifactTypeEnum.HEAT.getType()) || type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) || type.equals(ArtifactTypeEnum.HEAT_NET.getType())) {
608                 ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(filename, label, false, true, true, false);
609             } else {
610                 ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(filename, label, true, false, true, true);
611             }
612         }
613     }
614
615     public void validateEachArtifactNotExistOnCompositionRightMenuDeploymentPage(List<ArtifactInfo> artifactInfoList) {
616         for (ArtifactInfo artifact : artifactInfoList) {
617             ArtifactUIUtils.validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getArtifactLabel());
618         }
619     }
620
621     // TODO: there is defect in this flow
622     // TODO: change isEditable to false when defect fix
623     public void validateEachArtifactOnCompositionRightMenuInformationPage(List<ArtifactInfo> artifactInfoList) {
624         for (ArtifactInfo artifact : artifactInfoList) {
625             ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getFilename(), artifact.getArtifactLabel(), true, false, true, true);
626         }
627     }
628
629     public void validateEachArtifactNotExistOnCompositionRightMenuInformationPage(List<ArtifactInfo> artifactInfoList) {
630         for (ArtifactInfo artifact : artifactInfoList) {
631             ArtifactUIUtils.validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getArtifactLabel());
632         }
633     }
634
635
636     @Override
637     protected UserRoleEnum getRole() {
638         return UserRoleEnum.DESIGNER;
639     }
640
641 }