2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.ci.tests.US;
23 import java.util.ArrayList;
24 import java.util.List;
26 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
27 import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
28 import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
29 import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
30 import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
31 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
32 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
33 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
34 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
35 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
36 import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
37 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
38 import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
39 import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
40 import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
41 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
42 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
43 import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
44 import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
45 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
46 import org.testng.annotations.Test;
49 public class RemoveRestrictionOfDeploymentArtifacts extends SetupCDTest {
51 private String folder ="";
53 // US833330 - Story [BE] - remove restriction of deployment artifacts
54 // Create service without resource instance and without deployment artifacts and verify it can submit for testing
56 public void createServiceWithoutRIAndArtifacts() throws Exception {
57 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
58 ServiceUIUtils.createService(serviceMetadata, getUser());
59 ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
63 // US833330 - Story [BE] - remove restriction of deployment artifacts
64 // Create service with VL resource instance and without deployment artifacts and verify it can submit for testing
66 public void createServiceWithVlAndWithoutArtfiacts() throws Exception {
67 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
68 ServiceUIUtils.createService(serviceMetadata, getUser());
70 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
71 CanvasManager canvasManager = CanvasManager.getCanvasManager();
72 canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
73 canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
74 canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
76 ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
79 // US833330 - Story [BE] - remove restriction of deployment artifacts
80 // Create service with VF with informational artifacts and verify it can submit for testing
82 public void createServiceWithInformationalArtifacts() throws Exception {
83 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
84 ResourceUIUtils.createResource(resourceMetaData, getUser());
86 ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
88 String filePath = FileHandling.getFilePath(folder);
89 List<ArtifactInfo> informationalArtifactList = new ArrayList<ArtifactInfo>();
90 informationalArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
91 informationalArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "GUIDE"));
92 for (ArtifactInfo informationalArtifact : informationalArtifactList) {
93 InformationalArtifactPage.clickAddNewArtifact();
94 ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact, new UploadArtifactPopup(true));
96 ResourceGeneralPage.clickSubmitForTestingButton(resourceMetaData.getName());
98 reloginWithNewRole(UserRoleEnum.TESTER);
99 GeneralUIUtils.findComponentAndClick(resourceMetaData.getName());
100 TesterOperationPage.certifyComponent(resourceMetaData.getName());
101 reloginWithNewRole(UserRoleEnum.DESIGNER);
103 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
104 ServiceUIUtils.createService(serviceMetadata, getUser());
105 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
106 CanvasManager canvasManager = CanvasManager.getCanvasManager();
107 CanvasElement resourceInstance = canvasManager.createElementOnCanvas(resourceMetaData.getName());
109 ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
113 protected UserRoleEnum getRole() {
114 return UserRoleEnum.DESIGNER;