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