1 package org.openecomp.sdc.ci.tests.verificator;
\r
3 import com.aventstack.extentreports.Status;
\r
4 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
\r
5 import org.openecomp.sdc.ci.tests.datatypes.PortMirroringEnum;
\r
6 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
\r
7 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
\r
8 import org.openecomp.sdc.ci.tests.utilities.PortMirroringUtils;
\r
9 import org.openqa.selenium.By;
\r
11 import java.awt.datatransfer.UnsupportedFlavorException;
\r
12 import java.io.IOException;
\r
14 import static org.testng.Assert.assertTrue;
\r
16 public class PortMirroringVerificator {
\r
18 public static void checkProxyServiceName(String serviceName, String instanceId)
\r
20 String serviceActualName = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionRightPanel.COMPONENT_TITLE.getValue()).getText();
\r
21 String serviceExpectedName = PortMirroringUtils.createProxyInstanceServiceName(serviceName,instanceId);
\r
22 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifying the instance name is %s", serviceExpectedName));
\r
23 assertTrue(serviceActualName.equalsIgnoreCase(serviceExpectedName));
\r
26 public static void checkProxyServiceType()
\r
28 String serviceActualName = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionRightPanel_GenerInfo.TYPE.getValue()).getText();
\r
29 SetupCDTest.getExtendTest().log(Status.INFO, "Verifying the instance type is Service Proxy");
\r
30 assertTrue(serviceActualName.equalsIgnoreCase(PortMirroringEnum.SERVICE_PROXY_TYPE.getValue()));
\r
33 public static void validatingProxyServiceNameAndType(String serviceName, String instanceId)
\r
35 checkProxyServiceName(serviceName, instanceId);
\r
36 checkProxyServiceType();
\r
39 public static void validateGeneralInfo()
\r
41 String type = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionRightPanel_GenerInfo.TYPE.getValue()).getText();
\r
42 String resourceType = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionRightPanel_GenerInfo.RESOURCE_TYPE.getValue()).getText();
\r
43 String category = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionRightPanel_GenerInfo.CATEGORY.getValue()).getText();
\r
44 String subCategory = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionRightPanel_GenerInfo.SUB_CATEGORY.getValue()).getText();
\r
46 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifying the type equals %s", PortMirroringEnum.TYPE.getValue()));
\r
47 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifying the resource type equals %s", PortMirroringEnum.RESOURCE_TYPE.getValue()));
\r
48 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifying the category equals %s", PortMirroringEnum.CATEGORY.getValue()));
\r
49 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifying the sub category equals %s", PortMirroringEnum.SUB_CATEGORY.getValue()));
\r
51 assertTrue(type.equalsIgnoreCase(PortMirroringEnum.TYPE.getValue()));
\r
52 assertTrue(resourceType.equalsIgnoreCase(PortMirroringEnum.RESOURCE_TYPE.getValue()));
\r
53 assertTrue(category.equalsIgnoreCase(PortMirroringEnum.CATEGORY.getValue()));
\r
54 assertTrue(subCategory.equalsIgnoreCase(PortMirroringEnum.SUB_CATEGORY.getValue()));
\r
57 public static void validateReqsAndCapsTabExist()
\r
59 SetupCDTest.getExtendTest().log(Status.INFO, "Verifying tab reqs and caps exist for PMC element");
\r
60 GeneralUIUtils.getWebElementBy(By.xpath(DataTestIdEnum.CompositionRightPanel.REQS_AND_CAPS_TAB_XPATH.getValue())).click();
\r
63 public static void validateElementName(String expectedName)
\r
65 String serviceActualName = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionRightPanel.COMPONENT_TITLE.getValue()).getText();
\r
66 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifying the instance name is %s", expectedName));
\r
67 assertTrue(serviceActualName.equalsIgnoreCase(expectedName));
\r
70 public static void validateLinkProperties() throws IOException, UnsupportedFlavorException {
\r
71 SetupCDTest.getExtendTest().log(Status.INFO, "Validate Link properties values");
\r
72 String actualNetworkRole = GeneralUIUtils.getTextValueFromWebElementByXpath(PortMirroringEnum.NETWORK_ROLE_XPATH.getValue());
\r
73 String actualNfcType = GeneralUIUtils.getTextValueFromWebElementByXpath(PortMirroringEnum.NFC_TYPE_XPATH.getValue());
\r
74 String actualPpsCapacity = GeneralUIUtils.getTextValueFromWebElementByXpath(PortMirroringEnum.PPS_CAPACITY_XPATH.getValue());
\r
75 String actualNfType = GeneralUIUtils.getTextValueFromWebElementByXpath(PortMirroringEnum.NF_TYPE_XPATH.getValue());
\r
77 assertTrue(actualNetworkRole.equalsIgnoreCase(PortMirroringEnum.NETWORK_ROLE_VALUE.getValue()));
\r
78 assertTrue(actualNfcType.equalsIgnoreCase(PortMirroringEnum.NFC_TYPE_VALUE.getValue()));
\r
79 assertTrue(actualPpsCapacity.equalsIgnoreCase(PortMirroringEnum.PPS_CAPACITY_VALUE.getValue()));
\r
80 assertTrue(actualNfType.equalsIgnoreCase(PortMirroringEnum.NF_TYPE_VALUE.getValue()));
\r