diff options
Diffstat (limited to 'integration-tests/src')
8 files changed, 137 insertions, 29 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/ComponentReqDetails.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/ComponentReqDetails.java index cff2ea8ebe..7d1da5da97 100644 --- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/ComponentReqDetails.java +++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/ComponentReqDetails.java @@ -32,6 +32,7 @@ public abstract class ComponentReqDetails { protected String name; protected String description; protected List<String> tags = new ArrayList<>(); + protected List<String> models = new ArrayList<>(); protected String contactId; protected String icon; protected String uniqueId; @@ -269,4 +270,12 @@ public abstract class ComponentReqDetails { this.invariantUUID = invariantUUID; } + public List<String> getModels() { + return models; + } + + public void setModels(List<String> models) { + this.models = models; + } + } diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/ServiceReqDetails.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/ServiceReqDetails.java index 9c8199e69e..b18d5da982 100644 --- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/ServiceReqDetails.java +++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/ServiceReqDetails.java @@ -20,13 +20,13 @@ package org.onap.sdc.backend.ci.tests.datatypes; +import java.util.ArrayList; +import java.util.Collections; import org.onap.sdc.backend.ci.tests.datatypes.enums.ServiceInstantiationType; +import org.onap.sdc.frontend.ci.tests.datatypes.ModelName; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import java.util.ArrayList; -import java.util.Collections; - public class ServiceReqDetails extends ComponentReqDetails { protected String serviceType = "MyServiceType"; @@ -94,7 +94,7 @@ public class ServiceReqDetails extends ComponentReqDetails { categoryDefinition.setIcons(Collections.singletonList(icon)); categories = new ArrayList<>(); categories.add(categoryDefinition); - + models.add(ModelName.DEFAULT_MODEL_NAME.getName()); } public ServiceReqDetails(Service service) { @@ -110,6 +110,7 @@ public class ServiceReqDetails extends ComponentReqDetails { this.uniqueId = service.getUniqueId(); this.UUID = service.getUUID(); this.version = service.getVersion(); + this.models = Collections.singletonList(service.getModel()); } diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ServiceCreateData.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ServiceCreateData.java index 834522c6f1..a479d2581e 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ServiceCreateData.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ServiceCreateData.java @@ -34,6 +34,7 @@ public class ServiceCreateData { private String description; private String contactId; private Boolean hasGeneratedNaming; + private String model; private String namingPolicy; private String serviceType; private String serviceRole; diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiModelUiTests.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiModelUiTests.java index ce3254f296..e1825df7e7 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiModelUiTests.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiModelUiTests.java @@ -22,6 +22,7 @@ package org.onap.sdc.frontend.ci.tests.execute.sanity; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; @@ -34,18 +35,25 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; +import org.onap.sdc.backend.ci.tests.datatypes.enums.ComponentType; import org.onap.sdc.backend.ci.tests.datatypes.enums.PackageTypeEnum; +import org.onap.sdc.backend.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory; import org.onap.sdc.frontend.ci.tests.datatypes.CategorySelect; +import org.onap.sdc.frontend.ci.tests.datatypes.ComponentData; import org.onap.sdc.frontend.ci.tests.datatypes.ComponentProperty; import org.onap.sdc.frontend.ci.tests.datatypes.ModelName; +import org.onap.sdc.frontend.ci.tests.datatypes.ServiceCreateData; import org.onap.sdc.frontend.ci.tests.datatypes.VspCreateData; import org.onap.sdc.frontend.ci.tests.datatypes.VspOnboardingProcedure; import org.onap.sdc.frontend.ci.tests.exception.UnzipException; import org.onap.sdc.frontend.ci.tests.execute.setup.DriverFactory; +import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions; import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest; +import org.onap.sdc.frontend.ci.tests.flow.AddNodeToCompositionFlow; import org.onap.sdc.frontend.ci.tests.flow.CheckComponentPropertiesFlow; import org.onap.sdc.frontend.ci.tests.flow.CreateResourceFromVspFlow; +import org.onap.sdc.frontend.ci.tests.flow.CreateServiceFlow; import org.onap.sdc.frontend.ci.tests.flow.CreateVlmFlow; import org.onap.sdc.frontend.ci.tests.flow.CreateVspFlow; import org.onap.sdc.frontend.ci.tests.flow.DownloadCsarArtifactFlow; @@ -54,8 +62,12 @@ import org.onap.sdc.frontend.ci.tests.flow.exception.UiTestFlowRuntimeException; import org.onap.sdc.frontend.ci.tests.pages.ComponentPage; import org.onap.sdc.frontend.ci.tests.pages.ResourceCreatePage; import org.onap.sdc.frontend.ci.tests.pages.ResourcePropertiesAssignmentPage; +import org.onap.sdc.frontend.ci.tests.pages.ServiceComponentPage; +import org.onap.sdc.frontend.ci.tests.pages.ServiceCreatePage; import org.onap.sdc.frontend.ci.tests.pages.TopNavComponent; +import org.onap.sdc.frontend.ci.tests.pages.component.workspace.CompositionPage; import org.onap.sdc.frontend.ci.tests.pages.component.workspace.ToscaArtifactsPage; +import org.onap.sdc.frontend.ci.tests.pages.home.HomePage; import org.onap.sdc.frontend.ci.tests.utilities.FileHandling; import org.openqa.selenium.WebDriver; import org.slf4j.Logger; @@ -68,16 +80,19 @@ public class EtsiModelUiTests extends SetupCDTest { private static final Logger LOGGER = LoggerFactory.getLogger(EtsiModelUiTests.class); private WebDriver webDriver; + private String resourceName; @Test public void etsiNetworkServiceTest() throws UnzipException { webDriver = DriverFactory.getDriver(); createVlm(); - final String resourceName = createVsp(); + resourceName = createVsp(); ResourceCreatePage resourceCreatePage = importVsp(resourceName); resourceCreatePage = createVf(resourceName, resourceCreatePage); resourceCreatePage.isLoaded(); + resourceCreatePage.certifyComponent(); + ExtentTestActions.takeScreenshot(Status.INFO, "resource-certified", String.format("Resource '%s' was certified", resourceName)); final ResourcePropertiesAssignmentPage resourcePropertiesAssignmentPage = checkVfProperties(resourceCreatePage); resourcePropertiesAssignmentPage.isLoaded(); final DownloadCsarArtifactFlow downloadCsarArtifactFlow = downloadCsarArtifact(resourcePropertiesAssignmentPage); @@ -89,6 +104,28 @@ public class EtsiModelUiTests extends SetupCDTest { toscaArtifactsPage.goToHomePage(); } + @Test(dependsOnMethods = "etsiNetworkServiceTest") + public void createServiceWithModel() throws UnzipException { + webDriver = DriverFactory.getDriver(); + final ServiceCreateData serviceCreateData = createServiceFormData(); + createService(serviceCreateData); + //adding vf to composition + ComponentPage componentPage = loadComponentPage(); + componentPage = addVfToComposition(resourceName, serviceCreateData, componentPage); + componentPage.isLoaded(); + componentPage.certifyComponent(); + ExtentTestActions.takeScreenshot(Status.INFO, "service-certified", String.format("Service '%s' was certified", + serviceCreateData.getName())); + + final DownloadCsarArtifactFlow downloadCsarArtifactFlow = downloadCsarArtifact(componentPage); + final ToscaArtifactsPage toscaArtifactsPage = downloadCsarArtifactFlow.getLandedPage() + .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ToscaArtifactsPage")); + assertThat("No artifact download was found", toscaArtifactsPage.getDownloadedArtifactList(), not(empty())); + final String downloadedCsarName = toscaArtifactsPage.getDownloadedArtifactList().get(0); + checkCsarPackage(resourceName, downloadedCsarName); + toscaArtifactsPage.goToHomePage(); + } + private ResourcePropertiesAssignmentPage checkVfProperties(final ComponentPage componentPage) { final Set<ComponentProperty<?>> componentPropertySet = Set.of( new ComponentProperty<>("descriptor_id", "descriptor_id"), @@ -191,5 +228,59 @@ public class EtsiModelUiTests extends SetupCDTest { return new Yaml().load(new String(mainDefinitionFileBytes)); } + private ServiceCreateData createServiceFormData() { + final ServiceCreateData serviceCreateData = new ServiceCreateData(); + serviceCreateData.setRandomName("CI-Service-For-Model"); + serviceCreateData.setModel(ModelName.ETSI_SOL001_v2_5_1.getName()); + serviceCreateData.setCategory(ServiceCategoriesEnum.ETSI_NFV_NETWORK_SERVICE.getValue()); + serviceCreateData.setDescription("aDescription"); + return serviceCreateData; + } + + private ServiceCreatePage createService(final ServiceCreateData serviceCreateData) { + final CreateServiceFlow createServiceFlow = new CreateServiceFlow(webDriver, serviceCreateData); + return createServiceFlow.run(new HomePage(webDriver)) + .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ServiceCreatePage")); + } + /** + * Loads Component Page + * + * @return ComponentPage + */ + private ComponentPage loadComponentPage() { + final ComponentPage componentPage = Optional.of(new ComponentPage(webDriver)) + .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected ComponentPage")); + componentPage.isLoaded(); + return componentPage; + } + + private ServiceComponentPage addVfToComposition(final String resourceName, final ServiceCreateData serviceCreateData, + final ComponentPage componentPage) { + final ComponentData parentComponent = new ComponentData(); + parentComponent.setName(serviceCreateData.getName()); + parentComponent.setVersion("0.1"); + parentComponent.setComponentType(ComponentType.SERVICE); + final ComponentData resourceToAdd = new ComponentData(); + resourceToAdd.setName(resourceName); + resourceToAdd.setVersion("1.0"); + resourceToAdd.setComponentType(ComponentType.RESOURCE); + CompositionPage compositionPage = componentPage.goToComposition(); + AddNodeToCompositionFlow addNodeToCompositionFlow = addNodeToComposition(parentComponent, resourceToAdd, compositionPage); + addNodeToCompositionFlow.getCreatedComponentInstance() + .orElseThrow(() -> new UiTestFlowRuntimeException("Could not get the created component instance")); + final ServiceComponentPage serviceComponentPage = compositionPage.goToServiceGeneral(); + serviceComponentPage.isLoaded(); + return serviceComponentPage; + } + + + public AddNodeToCompositionFlow addNodeToComposition(final ComponentData parentComponent, final ComponentData resourceToAdd, + CompositionPage compositionPage) { + + final AddNodeToCompositionFlow addNodeToCompositionFlow = new AddNodeToCompositionFlow(webDriver, parentComponent, resourceToAdd); + addNodeToCompositionFlow.run(compositionPage); + return addNodeToCompositionFlow; + } + } diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java index 936fa6ee85..061fb183f3 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiNetworkServiceUiTests.java @@ -38,12 +38,13 @@ import java.util.Set; import org.apache.commons.io.FilenameUtils; import org.junit.jupiter.api.Assertions; import org.onap.sdc.backend.ci.tests.datatypes.enums.ComponentType; -import org.onap.sdc.backend.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.onap.sdc.backend.ci.tests.datatypes.enums.PackageTypeEnum; +import org.onap.sdc.backend.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory; import org.onap.sdc.frontend.ci.tests.datatypes.CategorySelect; import org.onap.sdc.frontend.ci.tests.datatypes.ComponentData; import org.onap.sdc.frontend.ci.tests.datatypes.ComponentProperty; +import org.onap.sdc.frontend.ci.tests.datatypes.ModelName; import org.onap.sdc.frontend.ci.tests.datatypes.ServiceCreateData; import org.onap.sdc.frontend.ci.tests.datatypes.VspCreateData; import org.onap.sdc.frontend.ci.tests.datatypes.VspOnboardingProcedure; @@ -295,6 +296,7 @@ public class EtsiNetworkServiceUiTests extends SetupCDTest { private ServiceCreateData createServiceFormData() { final ServiceCreateData serviceCreateData = new ServiceCreateData(); serviceCreateData.setRandomName("EtsiNfvNetworkService"); + serviceCreateData.setModel(ModelName.DEFAULT_MODEL_NAME.getName()); serviceCreateData.setCategory(ServiceCategoriesEnum.ETSI_NFV_NETWORK_SERVICE.getValue()); serviceCreateData.setEtsiVersion("2.5.1"); serviceCreateData.setDescription("aDescription"); diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiOnboardVnfCnfUiTests.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiOnboardVnfCnfUiTests.java index 40b6990a67..23f5c84ebc 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiOnboardVnfCnfUiTests.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/EtsiOnboardVnfCnfUiTests.java @@ -34,6 +34,7 @@ import org.onap.sdc.backend.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory; import org.onap.sdc.frontend.ci.tests.datatypes.CategorySelect; import org.onap.sdc.frontend.ci.tests.datatypes.ComponentData; +import org.onap.sdc.frontend.ci.tests.datatypes.ModelName; import org.onap.sdc.frontend.ci.tests.datatypes.ServiceCreateData; import org.onap.sdc.frontend.ci.tests.datatypes.VspCreateData; import org.onap.sdc.frontend.ci.tests.datatypes.VspOnboardingProcedure; @@ -165,6 +166,7 @@ public class EtsiOnboardVnfCnfUiTests extends SetupCDTest { private ServiceCreateData createServiceFormData() { final ServiceCreateData serviceCreateData = new ServiceCreateData(); serviceCreateData.setRandomName(ElementFactory.addRandomSuffixToName(ElementFactory.getServicePrefix())); + serviceCreateData.setModel(ModelName.DEFAULT_MODEL_NAME.getName()); serviceCreateData.setCategory(ServiceCategoriesEnum.E2E_SERVICE.getValue()); serviceCreateData.setDescription("aDescription"); return serviceCreateData; diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/Service.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/Service.java index dd953deec2..1b3e8d3da9 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/Service.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/Service.java @@ -20,34 +20,34 @@ package org.onap.sdc.frontend.ci.tests.execute.sanity; +import static org.assertj.core.api.Assertions.assertThat; +import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertTrue; + import com.aventstack.extentreports.Status; +import java.awt.AWTException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.onap.sdc.backend.ci.tests.datatypes.ResourceReqDetails; +import org.onap.sdc.backend.ci.tests.datatypes.ServiceReqDetails; import org.onap.sdc.backend.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.onap.sdc.backend.ci.tests.datatypes.enums.NormativeTypesEnum; import org.onap.sdc.backend.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.onap.sdc.backend.ci.tests.datatypes.enums.ServiceCategoriesEnum; +import org.onap.sdc.backend.ci.tests.datatypes.enums.UserRoleEnum; import org.onap.sdc.backend.ci.tests.utils.general.AtomicOperationUtils; import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory; import org.onap.sdc.backend.ci.tests.utils.rest.ResourceRestUtils; import org.onap.sdc.backend.ci.tests.utils.validation.ErrorValidationUtils; -import org.onap.sdc.frontend.ci.tests.verificator.DeploymentViewVerificator; -import org.onap.sdc.frontend.ci.tests.verificator.ServiceVerificator; -import org.onap.sdc.frontend.ci.tests.verificator.VfVerificator; -import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.User; import org.onap.sdc.frontend.ci.tests.datatypes.ArtifactInfo; import org.onap.sdc.frontend.ci.tests.datatypes.CanvasElement; import org.onap.sdc.frontend.ci.tests.datatypes.CanvasManager; import org.onap.sdc.frontend.ci.tests.datatypes.DataTestIdEnum; import org.onap.sdc.frontend.ci.tests.datatypes.LifeCycleStateEnum; -import org.onap.sdc.backend.ci.tests.datatypes.ResourceReqDetails; -import org.onap.sdc.backend.ci.tests.datatypes.ServiceReqDetails; +import org.onap.sdc.frontend.ci.tests.datatypes.ModelName; import org.onap.sdc.frontend.ci.tests.datatypes.TopMenuButtonsEnum; -import org.onap.sdc.backend.ci.tests.datatypes.enums.UserRoleEnum; import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest; import org.onap.sdc.frontend.ci.tests.pages.CompositionPage; import org.onap.sdc.frontend.ci.tests.pages.DeploymentArtifactPage; @@ -64,6 +64,16 @@ import org.onap.sdc.frontend.ci.tests.utilities.FileHandling; import org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils; import org.onap.sdc.frontend.ci.tests.utilities.ResourceUIUtils; import org.onap.sdc.frontend.ci.tests.utilities.ServiceUIUtils; +import org.onap.sdc.frontend.ci.tests.verificator.DeploymentViewVerificator; +import org.onap.sdc.frontend.ci.tests.verificator.ServiceVerificator; +import org.onap.sdc.frontend.ci.tests.verificator.VfVerificator; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.GroupDefinition; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.AssertJUnit; @@ -71,15 +81,6 @@ import org.testng.TestException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.awt.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.testng.AssertJUnit.assertFalse; -import static org.testng.AssertJUnit.assertTrue; - public class Service extends SetupCDTest { private static final String DESCRIPTION = "kuku"; @@ -146,6 +147,7 @@ public class Service extends SetupCDTest { serviceMetadata.setProjectCode("654321"); serviceMetadata.setContactId("cs6543"); serviceMetadata.getTags().addAll(Arrays.asList("updatedTag", "oneMoreUpdatedTag", "lastOne UpdatedTag")); + serviceMetadata.setModels(Collections.singletonList(ModelName.DEFAULT_MODEL_NAME.getName())); ServiceUIUtils.setServiceCategory(serviceMetadata, ServiceCategoriesEnum.VOIP); ServiceUIUtils.fillServiceGeneralPage(serviceMetadata); GeneralPageElements.clickCreateButton(); diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/SetupCDTest.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/SetupCDTest.java index 8d82ec08a2..246af561c8 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/SetupCDTest.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/SetupCDTest.java @@ -181,7 +181,7 @@ public abstract class SetupCDTest extends DriverFactory { LOGGER.info(msg); getExtendTest().log(Status.INFO, msg); quitDriver(); - } else if (!getUser().getRole().toLowerCase().equals(UserRoleEnum.ADMIN.name().toLowerCase())) { + } else if (!UserRoleEnum.ADMIN.name().equalsIgnoreCase(getUser().getRole())) { boolean navigateToHomePageSuccess = HomePage.navigateToHomePage(); if (!navigateToHomePageSuccess) { final String msg = "Navigating to homepage failed, reopening driver"; |