re base code
[sdc.git] / ui-ci / src / main / java / org / openecomp / sdc / ci / tests / US / RemoveRestrictionOfDeploymentArtifacts.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.US;
22
23 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
24 import org.openecomp.sdc.ci.tests.datatypes.*;
25 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
26 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
27 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
28 import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
29 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
30 import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
31 import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
32 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
33 import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
34 import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
35 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
36 import org.testng.annotations.Test;
37
38 import java.util.ArrayList;
39 import java.util.List;
40
41
42 public class RemoveRestrictionOfDeploymentArtifacts extends SetupCDTest {
43         
44         private String folder ="";
45
46         // US833330 - Story [BE] - remove restriction of deployment artifacts
47         // Create service without resource instance and without deployment artifacts and verify it can submit for testing
48         @Test
49         public void createServiceWithoutRIAndArtifacts() throws Exception {
50                 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
51                 ServiceUIUtils.createService(serviceMetadata, getUser());
52                 //TODO Andrey should click on certify button
53                 ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
54         }
55         
56         
57         // US833330 - Story [BE] - remove restriction of deployment artifacts
58         // Create service with VL resource instance and without deployment artifacts and verify it can submit for testing
59         @Test
60         public void createServiceWithVlAndWithoutArtfiacts() throws Exception {
61                 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
62                 ServiceUIUtils.createService(serviceMetadata, getUser());
63                                 
64                 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();                    
65                 CanvasManager canvasManager = CanvasManager.getCanvasManager();
66                 canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
67                 canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
68                 canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
69
70                 ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
71         }
72         
73         // US833330 - Story [BE] - remove restriction of deployment artifacts
74         // Create service with VF with informational artifacts and verify it can submit for testing
75         @Test
76         public void createServiceWithInformationalArtifacts() throws Exception {
77                 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
78                 ResourceUIUtils.createVF(resourceMetaData, getUser());
79                 
80                 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
81                                 
82                 String filePath = FileHandling.getFilePath(folder);
83                 List<ArtifactInfo> informationalArtifactList = new ArrayList<ArtifactInfo>();
84                 informationalArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
85                 informationalArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "GUIDE"));
86                 for (ArtifactInfo informationalArtifact : informationalArtifactList) {
87                         InformationalArtifactPage.clickAddNewArtifact();
88                         ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact, new UploadArtifactPopup(true));
89                 }
90                 //TODO Andrey should click on certify button
91                 ResourceGeneralPage.clickCertifyButton(resourceMetaData.getName());
92                 
93                 /*reloginWithNewRole(UserRoleEnum.TESTER);
94                 GeneralUIUtils.findComponentAndClick(resourceMetaData.getName());
95                 TesterOperationPage.certifyComponent(resourceMetaData.getName());
96                 reloginWithNewRole(UserRoleEnum.DESIGNER);*/
97                 
98                 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
99                 ServiceUIUtils.createService(serviceMetadata, getUser());
100                 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
101                 CanvasManager canvasManager = CanvasManager.getCanvasManager();
102                 CanvasElement resourceInstance = canvasManager.createElementOnCanvas(resourceMetaData.getName());
103
104                 ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
105         }
106         
107         @Override
108         protected UserRoleEnum getRole() {
109                 return UserRoleEnum.DESIGNER;
110         }
111
112 }