blob: e42de862b702b741267db5ac265d27a08694793b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
package org.openecomp.sdc.uici.tests.execute.service;
import static org.testng.AssertJUnit.assertTrue;
import java.util.Arrays;
import org.apache.http.HttpStatus;
import org.openecomp.sdc.uici.tests.datatypes.CanvasElement;
import org.openecomp.sdc.uici.tests.datatypes.CanvasManager;
import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum;
import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum;
import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest;
import org.openecomp.sdc.uici.tests.utilities.ArtifactUIUtils;
import org.openecomp.sdc.uici.tests.utilities.FileHandling;
import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils;
import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils;
import org.openecomp.sdc.uici.tests.utilities.RestCDUtils;
import org.openecomp.sdc.uici.tests.utilities.ServiceUIUtils;
import org.openecomp.sdc.uici.tests.verificator.ServiceVerificator;
import org.openecomp.sdc.uici.tests.verificator.VfVerificator;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
public class ServiceBasicTests extends SetupCDTest {
@Test
public void testCreateService() {
ServiceReqDetails createServiceInUI = ServiceUIUtils.createServiceInUI(getUser());
ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser());
}
@Test
public void testLinkTwoRI() {
// create 1st VF
ResourceReqDetails resourceOne = ResourceUIUtils.createResourceInUI(getUser());
assertTrue(RestCDUtils.getResource(resourceOne).getErrorCode() == HttpStatus.SC_OK);
// add LoadBalancer to resource
GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION);
CanvasManager canvasManager = CanvasManager.getCanvasManager();
canvasManager.createElementOnCanvas(LeftPanelCanvasItems.OBJECT_STORAGE);
GeneralUIUtils.checkIn();
// create 2nd VF
ResourceReqDetails resourceTwo = ResourceUIUtils.createResourceInUI(getUser());
assertTrue(RestCDUtils.getResource(resourceTwo).getErrorCode() == HttpStatus.SC_OK);
// add ObjectStorage to resource
GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION);
canvasManager = CanvasManager.getCanvasManager();
canvasManager.createElementOnCanvas(LeftPanelCanvasItems.LOAD_BALANCER);
GeneralUIUtils.checkIn();
// create service
ServiceReqDetails createServiceInUI = ServiceUIUtils.createServiceInUI(getUser());
// Verify Service is Created
ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser());
GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION);
canvasManager = CanvasManager.getCanvasManager();
// adding two resource instances
CanvasElement vfOne = canvasManager.createElementOnCanvas(resourceOne.getName());
CanvasElement vfTwo = canvasManager.createElementOnCanvas(resourceTwo.getName());
// link elements
canvasManager.linkElements(vfOne, vfTwo);
// check results
ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser());
ServiceVerificator.verifyLinkCreated(createServiceInUI, getUser());
}
/**
* This method tests the following: <br>
* 1. Import of VF <br>
* 2. Certification Of Vf <br>
* 3. Adding deployment artifact to VF <br>
* 4. Creation of Service <br>
* 5. Adding Vf instance to Service <br>
* 6. Service Certification <br>
* 7. Approving Service to distribution by Governor <br>
* 8. Making sure service is ready to distribute by ops <br>
*/
@Test
public void testBuildServiceForDistribution() {
ResourceReqDetails importedVf = ResourceUIUtils.importVfInUI(getUser(), FileHandling.getResourcesFilesPath(),
"valid_vf.csar");
GeneralUIUtils.waitForLoader(20);
// Verify Import
VfVerificator.verifyResourceIsCreated(importedVf);
// Create Deployment Artifact
ArtifactUIUtils.createDeploymentArtifactOnVf(FileHandling.getResourcesFilesPath() + "myYang.xml",
ArtifactTypeEnum.YANG_XML);
VfVerificator.verifyResourceContainsDeploymentArtifacts(importedVf,
Arrays.asList(new ArtifactTypeEnum[] { ArtifactTypeEnum.YANG_XML }));
// Submit For Testing Process VF
GeneralUIUtils.submitForTestingElement(importedVf.getName());
// Certify The VF
quitAndReLogin(UserRoleEnum.TESTER);
ResourceUIUtils.testAndAcceptElement(importedVf);
// Verify Certification
GeneralUIUtils.waitForLoader();
VfVerificator.verifyResourceIsCertified(importedVf);
// Create Service
quitAndReLogin(UserRoleEnum.DESIGNER);
ServiceReqDetails createServiceInUI = ServiceUIUtils.createServiceInUI(getUser());
ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser());
// Drag the VF To the Service
GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION);
CanvasManager canvasManager = CanvasManager.getCanvasManager();
canvasManager.createElementOnCanvas(importedVf.getName());
// Submit For Testing Process Service
GeneralUIUtils.submitForTestingElement(null);
// Certify The Service
quitAndReLogin(UserRoleEnum.TESTER);
ResourceUIUtils.testAndAcceptElement(createServiceInUI);
ServiceVerificator.verifyServiceCertified(createServiceInUI, getUser());
// Approve with governor
quitAndReLogin(UserRoleEnum.GOVERNOR);
ServiceUIUtils.approveServiceForDistribution(createServiceInUI);
// Log in with Ops and verify that can distribute
quitAndReLogin(UserRoleEnum.OPS);
GeneralUIUtils.getWebElementWaitForVisible(createServiceInUI.getName()).click();
WebElement distributeWebElement = GeneralUIUtils
.getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.DISTRIBUTE.getValue());
assertTrue(distributeWebElement != null);
}
}
|