aboutsummaryrefslogtreecommitdiffstats
path: root/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US')
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/AddComponentInstancesArtifactsInCsar.java340
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java227
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/Inputs.java214
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/MIBsArtifactsOnResourceInstance.java267
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/NewArtifactTypeGuide.java121
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java116
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/Testing.java141
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/VfModule.java165
8 files changed, 1591 insertions, 0 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/AddComponentInstancesArtifactsInCsar.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/AddComponentInstancesArtifactsInCsar.java
new file mode 100644
index 0000000000..439cfa67a7
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/AddComponentInstancesArtifactsInCsar.java
@@ -0,0 +1,340 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.frontend.ci.tests.US;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.http.HttpStatus;
+import org.onap.sdc.backend.ci.tests.datatypes.ArtifactReqDetails;
+import org.onap.sdc.backend.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.onap.sdc.backend.ci.tests.datatypes.VendorLicenseModel;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.onap.sdc.backend.ci.tests.datatypes.http.RestResponse;
+import org.onap.sdc.frontend.ci.tests.pages.HomePage;
+import org.onap.sdc.frontend.ci.tests.pages.ToscaArtifactsPage;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.onap.sdc.backend.ci.tests.datatypes.ResourceReqDetails;
+import org.onap.sdc.backend.ci.tests.datatypes.VendorSoftwareProductObject;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.UserRoleEnum;
+import org.onap.sdc.backend.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
+import org.onap.sdc.frontend.ci.tests.pages.ResourceGeneralPage;
+import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
+import org.onap.sdc.frontend.ci.tests.utilities.OnboardingUiUtils;
+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.general.VendorLicenseModelRestUtils;
+import org.onap.sdc.backend.ci.tests.utils.general.VendorSoftwareProductRestUtils;
+import org.onap.sdc.backend.ci.tests.utils.rest.ArtifactRestUtils;
+import org.onap.sdc.backend.ci.tests.utils.rest.ResponseParser;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class AddComponentInstancesArtifactsInCsar extends SetupCDTest {
+
+ public static final String DEPLOYMENT = "Deployment";
+ public static final String INFORMATIONAL = "Informational";
+ private String filePath;
+
+ @BeforeClass
+ public void beforeClass() {
+ filePath = System.getProperty("filePath");
+ if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+ filePath = FileHandling.getResourcesFilesPath() + "AddComponentInstancesArtifactsInCsar" + File.separator;
+ } else if (filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")) {
+ filePath = FileHandling.getBasePath() + File.separator + "src/test/resources/Files" + File.separator + "AddComponentInstancesArtifactsInCsar" + File.separator;
+ }
+ }
+
+ // US847439 - Story [BE] - Add Component Instance's artifacts in CSAR
+ // TC1521795 - VF CSAR - The Flow
+ @Test
+ public void vfAndServiceCsarTheFlow() throws Exception {
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ String vnfFile = "FDNT.zip";
+ String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip";
+
+ VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ VendorSoftwareProductObject createVSP = VendorSoftwareProductRestUtils.createVSP(resourceReqDetails, vnfFile, filePath, getUser(),
+ vendorLicenseModel);
+ String vspName = createVSP.getName();
+ resourceMetaData.setName(vspName);
+ VendorSoftwareProductRestUtils.addVFCArtifacts(filePath, snmpFile, null, createVSP, getUser());
+ VendorSoftwareProductRestUtils.prepareVspForUse(getUser(), createVSP, true);
+
+ HomePage.showVspRepository();
+ OnboardingUiUtils.importVSP(createVSP);
+ resourceMetaData.setVersion("0.1");
+ Resource vfResource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), resourceMetaData.getVersion());
+
+ Map<String, Object> artifacts = getArtifactsOfComponentAndComponentsInstance(vfResource);
+
+ List<ImmutablePair<ComponentInstance, ArtifactDefinition>> artifactsUploadedToComponentInstance = new LinkedList<>();
+ Random random = new Random();
+ final int randomIntForLoop = random.nextInt(10) + 10;
+ for (int i = 0; i < randomIntForLoop; i++) {
+ ImmutablePair<ComponentInstance, ArtifactDefinition> uploadArtifactOnRandomVfc = uploadArtifactOnRandomRI(vfResource);
+
+ if (uploadArtifactOnRandomVfc.getRight().getArtifactName() != null) {
+ artifactsUploadedToComponentInstance.add(uploadArtifactOnRandomVfc);
+ }
+ }
+
+ if (!artifactsUploadedToComponentInstance.isEmpty()) {
+ Map<String, Object> artifactsOfResourceInstance = getArtifactsOfResourceInstance(artifactsUploadedToComponentInstance);
+ artifacts.put("Resources", artifactsOfResourceInstance);
+ }
+
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+ ToscaArtifactsPage.downloadCsar();
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
+ Map<String, Object> combineHeatArtifacstWithFolderArtifacsToMap = ArtifactFromCsar.getVFCArtifacts(latestFilefromDir.getAbsolutePath());
+
+ compareArtifactFromFileStructureToArtifactsFromJavaObject(artifacts, combineHeatArtifacstWithFolderArtifacsToMap);
+
+ }
+
+ public void compareArtifactFromFileStructureToArtifactsFromJavaObject(Map<String, Object> artifactFromJavaObject, Map<String, Object> artifactsFromFileStructure) {
+ for (String key : artifactFromJavaObject.keySet()) {
+ if ((!key.equals(DEPLOYMENT)) && (!key.equals(INFORMATIONAL))) {
+ Map<String, Object> newArtifactFromJavaObject = (Map<String, Object>) artifactFromJavaObject.get(key);
+ Map<String, Object> newArtifactsFromFileStructure = (Map<String, Object>) artifactsFromFileStructure.get(key);
+ compareArtifactFromFileStructureToArtifactsFromJavaObject(newArtifactFromJavaObject, newArtifactsFromFileStructure);
+ } else {
+ compareArtifacts(artifactFromJavaObject.get(key), artifactsFromFileStructure.get(key));
+ }
+ }
+ }
+
+
+ private void compareArtifacts(Object artifactFromJavaObject, Object artifactsFromFileStructure) {
+ Map<String, List<String>> artifactsMap = (Map<String, List<String>>) artifactFromJavaObject;
+ List<HeatMetaFirstLevelDefinition> artifactsList = (List<HeatMetaFirstLevelDefinition>) artifactsFromFileStructure;
+
+ for (HeatMetaFirstLevelDefinition heatMetaFirstLevelDefinition : artifactsList) {
+ Assert.assertTrue(artifactsMap.get(heatMetaFirstLevelDefinition.getType()).contains(heatMetaFirstLevelDefinition.getFileName()),
+ "Expected that artifacts will be the same. Not exists: " + heatMetaFirstLevelDefinition.getFileName() + " of type: " + heatMetaFirstLevelDefinition.getType());
+ }
+
+ for (String key : artifactsMap.keySet()) {
+ List<String> artifacts = artifactsMap.get(key);
+
+ for (HeatMetaFirstLevelDefinition heatMetaFirstLevelDefinition : artifactsList) {
+ if (heatMetaFirstLevelDefinition.getType().equals(key)) {
+ if (artifacts.contains(heatMetaFirstLevelDefinition.getFileName())) {
+ artifacts.remove(heatMetaFirstLevelDefinition.getFileName());
+ }
+ }
+ }
+
+ Assert.assertEquals(artifacts.size(), 0, "Expected that all artifacts equal. There is artifacts which not equal: " + artifacts.toString());
+ }
+ }
+
+
+ public Map<String, Object> getArtifactsOfResourceInstance(List<ImmutablePair<ComponentInstance, ArtifactDefinition>> riList) {
+ Map<String, Object> artifacts = new HashMap<>();
+
+ for (ImmutablePair<ComponentInstance, ArtifactDefinition> ri : riList) {
+ ArtifactDefinition artifactDefinition = ri.getRight();
+ ComponentInstance componentInstance = ri.getLeft();
+ if (artifacts.containsKey(componentInstance.getNormalizedName())) {
+ if (((Map<String, ArrayList<String>>) ((Map<String, Object>) artifacts.get(componentInstance.getNormalizedName())).get(DEPLOYMENT)).containsKey(artifactDefinition.getArtifactType())) {
+
+ ((Map<String, ArrayList<String>>) ((Map<String, Object>) artifacts.get(componentInstance.getNormalizedName())).get(DEPLOYMENT)).get(artifactDefinition.getArtifactType()).add(artifactDefinition.getArtifactName());
+
+ } else {
+ ArrayList<String> list = new ArrayList<>();
+ list.add(artifactDefinition.getArtifactName());
+ ((Map<String, ArrayList<String>>) ((Map<String, Object>) artifacts.get(componentInstance.getNormalizedName())).get(DEPLOYMENT)).put(artifactDefinition.getArtifactType(), list);
+ }
+
+ } else {
+ try {
+
+
+ ArrayList<String> list = new ArrayList<>();
+ list.add(artifactDefinition.getArtifactName());
+
+ Map<String, ArrayList<String>> map = new HashMap<>();
+ map.put(artifactDefinition.getArtifactType(), list);
+
+ Map<String, Map<String, ArrayList<String>>> addMap = new HashMap<>();
+ addMap.put(DEPLOYMENT, map);
+
+ artifacts.put(componentInstance.getNormalizedName(), addMap);
+ } catch (Exception e) {
+ Assert.fail("Artifact name is null for componentInstance: " + componentInstance.getNormalizedName());
+ }
+ }
+ }
+ return artifacts;
+ }
+
+ public Map<String, Object> getArtifactsOfComponentAndComponentsInstance(Component component) {
+ Map<String, Object> artifacts = getArtifactsOfComponent(component);
+
+ for (ComponentInstance componentInstance : component.getComponentInstances()) {
+ Map<String, Object> artifactsOfComponentInstance = getArtifactsOfComponentInstance(componentInstance);
+ if (!artifactsOfComponentInstance.isEmpty()) {
+ artifacts.put(componentInstance.getToscaComponentName() + "." + componentInstance.getComponentVersion(), artifactsOfComponentInstance);
+ }
+ }
+
+ return artifacts;
+ }
+
+ public Map<String, Object> getArtifactsOfComponentInstance(ComponentInstance componentInstance) {
+ Map<String, Object> map = new HashMap<>();
+
+ if (componentInstance.getArtifacts() != null) {
+ Map<String, Object> informationalArtifacts = getArtifacts(componentInstance.getArtifacts());
+ if (!informationalArtifacts.isEmpty()) {
+ map.put(INFORMATIONAL, informationalArtifacts);
+ }
+ }
+
+ if (componentInstance.getDeploymentArtifacts() != null) {
+ Map<String, Object> deploymentArtifacts = getArtifacts(componentInstance.getDeploymentArtifacts());
+ if (!deploymentArtifacts.isEmpty()) {
+ map.put(DEPLOYMENT, deploymentArtifacts);
+ }
+ }
+
+ return map;
+ }
+
+ public Map<String, Object> getArtifactsOfComponent(Component component) {
+ Map<String, Object> map = new HashMap<>();
+
+ if (component.getArtifacts() != null) {
+ Map<String, Object> informationalArtifacts = getArtifacts(component.getArtifacts());
+ if (!informationalArtifacts.isEmpty()) {
+ map.put(INFORMATIONAL, informationalArtifacts);
+ }
+ }
+
+ if (component.getDeploymentArtifacts() != null) {
+ Map<String, Object> deploymentArtifacts = getArtifacts(component.getDeploymentArtifacts());
+ if (!deploymentArtifacts.isEmpty()) {
+ map.put(DEPLOYMENT, deploymentArtifacts);
+ }
+ }
+
+ return map;
+ }
+
+ public Map<String, Object> getArtifacts(Map<String, ArtifactDefinition> artifacts) {
+ Map<String, Object> map = new HashMap<>();
+
+ for (String artifact : artifacts.keySet()) {
+ ArtifactDefinition artifactDefinition = artifacts.get(artifact);
+ if ((artifactDefinition.getEsId() != null) && (!artifactDefinition.getEsId().equals("")) && (!artifactDefinition.getArtifactType().equals("HEAT_ENV"))) {
+ if (map.containsKey(artifactDefinition.getArtifactType())) {
+ ((List<String>) map.get(artifactDefinition.getArtifactType())).add(artifactDefinition.getArtifactName());
+ } else {
+ ArrayList<String> list = new ArrayList<>();
+ list.add(artifactDefinition.getArtifactName());
+ map.put(artifactDefinition.getArtifactType(), list);
+ }
+ }
+ }
+
+ return map;
+ }
+
+ public ImmutablePair<ComponentInstance, ArtifactDefinition> uploadArtifactOnRandomRI(Component component) throws Exception {
+ ArtifactReqDetails artifactReqDetails = getRandomArtifact();
+ Random random = new Random();
+ int randInt = random.nextInt(component.getComponentInstances().size());
+ User defaultUser = ElementFactory.getDefaultUser(getRole());
+ ComponentInstance componentInstance = component.getComponentInstances().get(randInt);
+
+ RestResponse uploadArtifactRestResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(component, defaultUser, artifactReqDetails, componentInstance);
+
+ // Check response of external API
+ Integer responseCode = uploadArtifactRestResponse.getErrorCode();
+ Assert.assertEquals(responseCode, (Integer) HttpStatus.SC_OK, "Response code is not correct.");
+
+ ImmutablePair<ComponentInstance, ArtifactDefinition> pair = ImmutablePair.of(componentInstance, ResponseParser.convertArtifactDefinitionResponseToJavaObject(uploadArtifactRestResponse.getResponse()));
+
+ return pair;
+ }
+
+ public ImmutablePair<ComponentInstance, ArtifactDefinition> uploadArtifactOnRandomRI(Resource resource) throws Exception {
+ ArtifactReqDetails artifactReqDetails = getRandomVfcArtifact();
+ Random random = new Random();
+ int randInt = random.nextInt(resource.getComponentInstances().size());
+ User defaultUser = ElementFactory.getDefaultUser(getRole());
+ ComponentInstance componentInstance = resource.getComponentInstances().get(randInt);
+
+ RestResponse uploadArtifactRestResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(resource, defaultUser, artifactReqDetails, componentInstance);
+ // Check response of external API
+ Integer responseCode = uploadArtifactRestResponse.getErrorCode();
+ Assert.assertEquals(responseCode, (Integer) HttpStatus.SC_OK, "Response code is not correct.");
+ ImmutablePair<ComponentInstance, ArtifactDefinition> pair = ImmutablePair.of(componentInstance, ResponseParser.convertArtifactDefinitionResponseToJavaObject(uploadArtifactRestResponse.getResponse()));
+ return pair;
+ }
+
+ public ArtifactReqDetails getRandomArtifact() throws Exception {
+ List<String> artifactsTypeList = Arrays.asList("Other");
+ return getRandomArtifact(artifactsTypeList);
+ }
+
+ public ArtifactReqDetails getRandomVfcArtifact() throws Exception {
+ List<String> vfcArtifactsTypeList = Arrays.asList(
+ ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType(),
+ ArtifactTypeEnum.DCAE_INVENTORY_JSON.getType(),
+ ArtifactTypeEnum.DCAE_INVENTORY_POLICY.getType(),
+ ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType(),
+ ArtifactTypeEnum.DCAE_INVENTORY_BLUEPRINT.getType(),
+ ArtifactTypeEnum.DCAE_INVENTORY_EVENT.getType(),
+ ArtifactTypeEnum.SNMP_POLL.getType(),
+ ArtifactTypeEnum.SNMP_TRAP.getType());
+ return getRandomArtifact(vfcArtifactsTypeList);
+ }
+
+ public ArtifactReqDetails getRandomArtifact(List<String> artifactType) throws Exception {
+ Random random = new Random();
+ return ElementFactory.getArtifactByType("ci", artifactType.get(random.nextInt(artifactType.size())), true, false);
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java
new file mode 100644
index 0000000000..11a3a8e062
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java
@@ -0,0 +1,227 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.frontend.ci.tests.US;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Resource;
+import org.onap.sdc.frontend.ci.tests.datatypes.DataTestIdEnum;
+import org.onap.sdc.backend.ci.tests.datatypes.ResourceReqDetails;
+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.utilities.FileHandling;
+import org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils;
+import org.onap.sdc.frontend.ci.tests.utilities.ResourceUIUtils;
+import org.onap.sdc.backend.ci.tests.utils.general.AtomicOperationUtils;
+import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.common.api.ArtifactTypeEnum;
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+public class ImportUpdateInformationalDeploymentArtifacts extends SetupCDTest {
+
+ private String folder = "US747946";
+
+ // US747946 - Import artifacts to component instances
+ // TC1407822 - Import VFC Artifacts - Deployment Artifacts - Multiple Artifacts, Multiple Types
+ @Test
+ public void importVfvArtifactsDeploymentArtifactsMultipleArtifactsMultipleTypes() throws Exception {
+
+ String filePath = FileHandling.getFilePath(folder);
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ String fileName = "TC1407822.csar";
+
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+
+ List<String> snmpPollArtifactList = Stream
+ .of("base_cgi_frwl.mib", "base_vIECCF_volume.yml", "node_userdata_script.sh", "vendor-license-model.xml")
+ .collect(Collectors.toList());
+ List<String> snmpTrapArtifactList = Stream
+ .of("module_1_ixlt.mib", "module_1_ixlt.yaml")
+ .collect(Collectors.toList());
+
+
+ List<ArtifactDefinition> filteredArtifactNames =
+ //Stream of component Instances
+ resource.getComponentInstances().stream()
+ //filter out all nulls
+ .filter(e -> e.getDeploymentArtifacts() != null)
+ //Stream of all the artifacts on all the component instances
+ .flatMap(e -> e.getDeploymentArtifacts().values().stream())
+ //filter relevant artifact types
+ .filter(e -> e.getArtifactType().equals(ArtifactTypeEnum.SNMP_TRAP.getType()) || e.getArtifactType().equals(ArtifactTypeEnum.SNMP_POLL.getType()))
+ //collect to list
+ .collect(Collectors.toList());
+
+ assertTrue("Not contain all SNMP TRAP artifacts.", filteredArtifactNames.stream()
+ .filter(e -> e.getArtifactType().equals(ArtifactTypeEnum.SNMP_TRAP.getType()))
+ .map(e -> e.getArtifactName())
+ .collect(Collectors.toList())
+ .containsAll(snmpTrapArtifactList));
+
+ assertTrue("Not contain all SNMP POLL artifacts.", filteredArtifactNames.stream()
+ .filter(e -> e.getArtifactType().equals(ArtifactTypeEnum.SNMP_POLL.getType()))
+ .map(e -> e.getArtifactName())
+ .collect(Collectors.toList())
+ .containsAll(snmpPollArtifactList));
+
+ filteredArtifactNames.stream()
+ .map(e -> e.getArtifactDisplayName())
+ .collect(Collectors.toList())
+ .forEach(e -> {
+ assertTrue("Wrong artifact appear on deployment artifact UI page.",
+ !GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + e));
+ });
+
+ }
+
+ // TODO: Note there is performance issue with this CSAR
+ // US747946 - Import artifacts to component instances
+ // TC1407998 - Import VFC Artifacts - Deployment & Informational Artifacts - Multiple VFCs
+ @Test
+ public void importVfcArtifactsDeploymentAndInformationalArtifactsMultipleVfcs() throws Exception {
+
+ String filePath = FileHandling.getFilePath(folder);
+ String fileName = "TC1407998.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+
+ resource.getComponentInstances().forEach(e -> {
+
+ if (e.getToscaComponentName().endsWith("heat.cm")) {
+ Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("PS_DEPL_Poll1.mib", "PS_DEPL_Poll2.xml", "PS_DEPL_Poll3.yaml"));
+ put(ArtifactTypeEnum.SNMP_TRAP.getType(), Arrays.asList("PS_DEPL_Trap1.mib", "PS_DEPL_Trap2.xml", "PS_DEPL_Trap3.sh", "PS_DEPL_Trap4.yml"));
+ }
+ };
+ validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.cm");
+
+ } else if (e.getToscaComponentName().endsWith("heat.sm")) {
+ Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("SM_DEPL_Poll1.mib", "SM_DEPL_Poll2.mib", "SM_DEPL_Poll3.xml"));
+ put(ArtifactTypeEnum.SNMP_TRAP.getType(), Arrays.asList("SM_DEPL_Trap1.mib", "SM_DEPL_Trap2.xml"));
+ }
+ };
+ validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.sm");
+ }
+ });
+
+ }
+
+ // US747946 - Import artifacts to component instances
+ // TC1410352 - Import VFC Artifacts - Deployment Artifacts - Extra folder Under VFC-Identification
+ @Test
+ public void importVfcArtifactsDeploymentArtifactsExtraFolderUnderVfcIdentification() throws Exception {
+
+ String filePath = FileHandling.getFilePath(folder);
+ String fileName = "TC1410352.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+
+ resource.getComponentInstances().forEach(e -> {
+
+ if (e.getToscaComponentName().endsWith("heat.ltm")) {
+ Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("Poll1.mib", "Poll2.xml", "Poll3.sh", "Poll4.yml"));
+ put(ArtifactTypeEnum.SNMP_TRAP.getType(), Arrays.asList("Trap1.mib", "Trap2.yaml"));
+ }
+ };
+ validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.ltm");
+ }
+ });
+ }
+
+
+ // US747946 - Import artifacts to component instances
+ // TC1410352 - Import VFC Artifacts - Deployment Artifacts - Invalid Artifact Type
+ @Test
+ public void importVfcArtifactsDeploymentArtifactsInvalidArtifactType() throws Exception {
+
+ String filePath = FileHandling.getFilePath(folder);
+ String fileName = "TC1425032.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+
+ resource.getComponentInstances().forEach(e -> {
+
+ if (e.getToscaComponentName().endsWith("heat.ltm")) {
+ Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("DeploySNMPPoll1.mib", "DeploySNMPPoll2.yml", "DeploySNMPPoll3.sh", "DeploySNMPPoll4.xml"));
+ put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("DeploySNMPTrapB1.mib", "DeploySNMPTrapB2.yaml"));
+ }
+ };
+ validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.ltm");
+ }
+ });
+ }
+
+ private void validateDeploymentArtifactOnComponetInstance(ComponentInstance instance, Map<String, List<String>> artifactsMap, String endswith) {
+ if (instance.getToscaComponentName().endsWith(endswith)) {
+ Set<String> types = artifactsMap.keySet();
+
+ Map<String, List<ArtifactDefinition>> collect = instance.getDeploymentArtifacts().values().stream()
+ .filter(a -> types.contains(a.getArtifactType()))
+ .collect(Collectors.groupingBy(e -> e.getArtifactType()));
+
+ types.forEach(m -> {
+ if (collect.containsKey(m)) {
+ List<String> found = collect.get(m).stream().map(e -> e.getArtifactName()).collect(Collectors.toList());
+ boolean isValid = found.containsAll(artifactsMap.get(m)) && artifactsMap.get(m).containsAll(found);
+ assertTrue("Not contain all artifact of type: " + m, isValid);
+ } else {
+ assertTrue("Contains deployment artifact which not in provided list", false);
+ }
+ });
+ }
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/Inputs.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/Inputs.java
new file mode 100644
index 0000000000..f340043eb5
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/Inputs.java
@@ -0,0 +1,214 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.frontend.ci.tests.US;
+
+import org.onap.sdc.backend.ci.tests.datatypes.ServiceReqDetails;
+import org.onap.sdc.frontend.ci.tests.pages.CompositionPage;
+import org.onap.sdc.frontend.ci.tests.pages.DeploymentArtifactPage;
+import org.onap.sdc.frontend.ci.tests.pages.InputsPage;
+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.backend.ci.tests.datatypes.enums.UserRoleEnum;
+import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
+import org.onap.sdc.frontend.ci.tests.pages.PropertyPopup;
+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.ServiceUIUtils;
+import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.TestException;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Inputs extends SetupCDTest {
+
+ private static final String DESCRIPTION = "kuku";
+ private static final String ARTIFACT_LABEL = "artifact3";
+ private static final String ARTIFACT_LABEL_UPDATE = "artifactUpdate";
+ private static final String GET_ARTIFACT_LIST_BY_CLASS_NAME = "i-sdc-designer-sidebar-section-content-item-artifact";
+ private static final String HEAT_FILE_YAML_NAME = "Heat-File.yaml";
+ private static final String HEAT_FILE_YAML_UPDATE_NAME = "Heat-File-Update.yaml";
+ private String filePath;
+
+ @BeforeMethod
+ public void beforeTest() {
+ filePath = FileHandling.getFilePath("");
+ }
+
+ // TODO: There is defect that imported VFC checkin not appear in service until refresh
+ // TODO: add support for CP (there is no normative CP's with complex properties which can be selected - import one) - importVFCWithComplexProperty.yml
+ // TC1508249
+ // Delete Input declared from VLi/CPi in service level - Deleting an Input that was declared from Complex property.
+ @Test
+ public void deletingAnInputThatWasDeclaredFromComplexProperty() throws Exception {
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata);
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ Map<String, List<String>> resourceInstanceToProperty = new HashMap<>();
+ CompositionPage.searchForElement("ExtVL");
+ CanvasElement computeElement = canvasManager.createElementOnCanvas("ExtVL");
+ canvasManager.clickOnCanvaElement(computeElement);
+ resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), Arrays.asList("network_homing", "instance_node_target"));
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+ DeploymentArtifactPage.getLeftMenu().moveToInputsScreen();
+
+
+ for (String element : resourceInstanceToProperty.keySet()) {
+ String propertyName = resourceInstanceToProperty.get(element).get(0);
+ String innerPropertyName = resourceInstanceToProperty.get(element).get(1);
+ String dataTestIdPropertyCheckbox = DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + propertyName;
+
+ GeneralUIUtils.clickOnElementByText(element);
+ GeneralUIUtils.ultimateWait();
+
+ InputsPage.clickOnProperty(propertyName);
+
+ PropertyPopup propertyPopup = new PropertyPopup();
+ propertyPopup.selectPropertyRadioButton(innerPropertyName);
+ propertyPopup.clickSave();
+
+ InputsPage.clickOnAddInputButton();
+
+ // Verify that input checkbox selected
+ verifyPropertyCheckBoxSelected(dataTestIdPropertyCheckbox);
+
+ InputsPage.deleteServiceInput(element, propertyName + "_" + innerPropertyName);
+
+ // Trying to find deleted service input
+ try {
+ InputsPage.getServiceInput(element, propertyName + "_" + innerPropertyName);
+ assert false;
+ } catch (TestException e) {
+ System.out.println("Verfied that service input deleted");
+ }
+
+ // Verify that input checkbox not selected
+ verifyPropertyCheckBoxNotSelected(dataTestIdPropertyCheckbox);
+
+ GeneralUIUtils.clickOnElementByText(element);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ }
+
+
+ // TC1508248
+ // Delete inputs who come from CP/VL properties
+ @Test
+ public void deleteInputsWhoComeFromCpVlProperties() throws Exception {
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata);
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ Map<String, String> resourceInstanceToProperty = new HashMap<>();
+ CompositionPage.searchForElement("ExtVL");
+ CanvasElement computeElement = canvasManager.createElementOnCanvas("ExtVL");
+ canvasManager.clickOnCanvaElement(computeElement);
+ resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), "network_role");
+
+ CompositionPage.searchForElement("ExtCP");
+ computeElement = canvasManager.createElementOnCanvas("ExtCP");
+ canvasManager.clickOnCanvaElement(computeElement);
+ resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), "order");
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+ DeploymentArtifactPage.getLeftMenu().moveToInputsScreen();
+
+
+ for (String element : resourceInstanceToProperty.keySet()) {
+ GeneralUIUtils.clickOnElementByText(element);
+ GeneralUIUtils.ultimateWait();
+
+ WebElement webElementByTestID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + resourceInstanceToProperty.get(element));
+ InputsPage.clickOnVFInputCheckbox(webElementByTestID);
+
+ InputsPage.clickOnAddInputButton();
+
+ // Verify that input checkbox selected
+ verifyPropertyCheckBoxSelected(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + resourceInstanceToProperty.get(element));
+
+ InputsPage.deleteServiceInput(element, resourceInstanceToProperty.get(element));
+
+ // Trying to find deleted service input
+ try {
+ InputsPage.getServiceInput(element, resourceInstanceToProperty.get(element));
+ assert false;
+ } catch (TestException e) {
+ System.out.println("Verfied that service input deleted");
+ }
+
+ // Verify that input checkbox not selected
+ verifyPropertyCheckBoxNotSelected(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + resourceInstanceToProperty.get(element));
+
+ GeneralUIUtils.clickOnElementByText(element);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ }
+
+
+ public String verifyPropertyCheckBox(String dataTestId) {
+ WebElement webElementByTestID = GeneralUIUtils.getWebElementByTestID(dataTestId);
+ webElementByTestID = webElementByTestID.findElement(By.className("tlv-checkbox-i"));
+ if (webElementByTestID.getAttribute("checked") == null) {
+ return "false";
+ }
+ return "true";
+ }
+
+ public void verifyPropertyCheckBoxSelected(String dataTestId) {
+ if (!verifyPropertyCheckBox(dataTestId).equals("true")) {
+ Assert.assertEquals(true, false, "Expected that checkbox will be selected.");
+ }
+ }
+
+ public void verifyPropertyCheckBoxNotSelected(String dataTestId) {
+ if (!verifyPropertyCheckBox(dataTestId).equals("false")) {
+ Assert.assertEquals(false, true, "Expected that checkbox will not be selected.");
+ }
+ }
+
+ public String getNormalizedName(String notNormalizedName) {
+ String normalizedName = notNormalizedName.toLowerCase();
+ normalizedName = normalizedName.replaceAll(" ", "");
+
+ return normalizedName;
+ }
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/MIBsArtifactsOnResourceInstance.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/MIBsArtifactsOnResourceInstance.java
new file mode 100644
index 0000000000..f2b743a5a8
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/MIBsArtifactsOnResourceInstance.java
@@ -0,0 +1,267 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.frontend.ci.tests.US;
+
+import org.apache.commons.io.FileUtils;
+import org.onap.sdc.backend.ci.tests.datatypes.http.RestResponse;
+import org.onap.sdc.frontend.ci.tests.pages.CompositionPage;
+import org.onap.sdc.frontend.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+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.backend.ci.tests.datatypes.ResourceReqDetails;
+import org.onap.sdc.backend.ci.tests.datatypes.ServiceReqDetails;
+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.ResourceGeneralPage;
+import org.onap.sdc.frontend.ci.tests.pages.UploadArtifactPopup;
+import org.onap.sdc.frontend.ci.tests.utilities.ArtifactUIUtils;
+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.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.ArtifactRestUtils;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+
+public class MIBsArtifactsOnResourceInstance extends SetupCDTest {
+
+ private String folder = "";
+
+ @DataProvider(name = "mibsArtifactCRUDUi")
+ public static Object[][] dataProviderMibsArtifactCRUDUi() {
+ return new Object[][]{
+ {"mibsvFW_VFC.yml", ResourceTypeEnum.VFC},
+ {"mibsVL.yml", ResourceTypeEnum.VL},
+ {"mibsCP.yml", ResourceTypeEnum.CP}
+ };
+ }
+
+ // US820414
+ // Artifact UI CRUD on VFC/VL/CP
+ // TODO: Change download validation from download artifact via external API to UI
+ @Test(dataProvider = "mibsArtifactCRUDUi")
+ public void mibsArtifactCRUDUi(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ setLog(fileName);
+ String filePath = FileHandling.getFilePath(folder);
+
+ // import Resource
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
+ ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser());
+
+ // get resourceUUID from BE
+ String resourceUUID = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1").getUUID();
+
+ // 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL.
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "SNMP_TRAP"));
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "SNMP_POLL"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true));
+
+ assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+
+ String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + deploymentArtifact.getArtifactLabel()).getText();
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(deploymentArtifact.getArtifactLabel(), null, "1", deploymentArtifact.getArtifactType(), true, true, true, false);
+
+ // Verify that uploaded correct file by download artifact via external api
+ RestResponse restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID, artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE.toString());
+ File file = new File(deploymentArtifact.getFilepath() + deploymentArtifact.getFilename());
+
+ String readFileToString = FileUtils.readFileToString(file);
+ Assert.assertEquals(restResponse.getResponse(), readFileToString);
+
+ DeploymentArtifactPage.clickEditArtifact(deploymentArtifact.getArtifactLabel());
+ UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true);
+ artifactPopup.loadFile(filePath, "CP.yml");
+ artifactPopup.clickDoneButton();
+
+ assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+ Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + deploymentArtifact.getArtifactLabel()).getText(), artifactUUID);
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(deploymentArtifact.getArtifactLabel(), null, "2", deploymentArtifact.getArtifactType(), true, true, true, false);
+
+ // Verify that updated correct file by download artifact via external api
+ artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + deploymentArtifact.getArtifactLabel()).getText();
+ restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID, artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE.toString());
+ file = new File(deploymentArtifact.getFilepath() + "CP.yml");
+ readFileToString = FileUtils.readFileToString(file);
+ Assert.assertEquals(restResponse.getResponse(), readFileToString);
+
+ DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifact.getArtifactLabel());
+ DeploymentArtifactPage.clickOK();
+
+ assertTrue("No artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(0));
+ }
+
+ }
+
+ @DataProvider(name = "mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption")
+ public static Object[][] dataProviderMibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption() {
+ return new Object[][]{
+// {"mibs1vFW_VFC.yml", ResourceTypeEnum.VFC},
+ // TODO: delete comment below when we will have support for VL on canvas
+// {"mibs1VL.yml", ResourceTypeEnum.VL},
+ {"mibs1CP.yml", ResourceTypeEnum.CP}
+ };
+ }
+
+ // US820414
+ // Import VFC/VL/CP, upload MIBs artifacts then drag it on VF & verify that deployment artifact have only download option
+ @Test(dataProvider = "mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption")
+ public void mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
+
+// if(resourceTypeEnum.equals(ResourceTypeEnum.CP)){
+// throw new SkipException("Open bug 322930");
+// }
+
+ setLog(fileName);
+
+ String filePath = FileHandling.getFilePath(folder);
+
+ // import Resource
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
+ ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser());
+
+ // 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL.
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "SNMP_TRAP"));
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "SNMP_POLL"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true));
+ }
+ assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+
+ // 3. Check-in DataProvider resource.
+ ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName());
+
+ // 4. Create VF.
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
+
+ // 5. Click on composition.
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ // 6. Drag created DataProvider resource to canvas.
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(resourceMetaData.getName());
+ CanvasElement resourceInstance = vfCanvasManager.createElementOnCanvas(resourceMetaData.getName());
+
+ // 7. Click on DataProvider resource.
+ vfCanvasManager.clickOnCanvaElement(resourceInstance);
+
+ // 8. Click on deployment artifacts in right menu.
+ CompositionPage.showDeploymentArtifactTab();
+
+ // 9. Verify that each uploaded MIBs artifacts shows in deployment artifacts.
+ // 10. Verify that only have download option.
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ // Hover over webelement -> check that only dowload button displayed
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel());
+ Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + deploymentArtifact.getArtifactLabel()).isDisplayed(), true);
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + deploymentArtifact.getArtifactLabel()), false);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel());
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), false);
+ }
+
+
+ }
+
+ // US820414
+ // Create VF, upload MIBs artifacts then drag it on service & verify that deployment artifact have only download option
+ @Test
+ public void mibsArtifacsOnVFInstanceShouldOnlyHaveDownloadOption() throws Exception {
+ String filePath = FileHandling.getFilePath(folder);
+
+ // 1. Create VF.
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createVF(resourceMetaData, getUser());
+
+ // 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL.
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "SNMP_TRAP"));
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "SNMP_POLL"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true));
+ }
+ assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+
+ // 3. Check-in VF.
+ ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName());
+
+ // 4. Create service.
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata);
+
+ // 5. Click on composition.
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ // 6. Drag created DataProvider s to canvas.
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(resourceMetaData.getName());
+ CanvasElement resourceInstance = canvasManager.createElementOnCanvas(resourceMetaData.getName());
+
+ // 7. Click on DataProvider resource.
+ canvasManager.clickOnCanvaElement(resourceInstance);
+
+ // 8. Click on deployment artifacts in right menu.
+ CompositionPage.showDeploymentArtifactTab();
+
+ // 9. Verify that each uploaded MIBs artifacts shows in deployment artifacts.
+ // 10. Verify that only have download option.
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ // Hover over webelement -> check that only dowload button displayed
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel());
+ Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + deploymentArtifact.getArtifactLabel()).isDisplayed(), true);
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + deploymentArtifact.getArtifactLabel()), false);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel());
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), false);
+ }
+ }
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/NewArtifactTypeGuide.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/NewArtifactTypeGuide.java
new file mode 100644
index 0000000000..61ac2347b2
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/NewArtifactTypeGuide.java
@@ -0,0 +1,121 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.frontend.ci.tests.US;
+
+import org.onap.sdc.frontend.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.onap.sdc.frontend.ci.tests.datatypes.ArtifactInfo;
+import org.onap.sdc.frontend.ci.tests.datatypes.DataTestIdEnum;
+import org.onap.sdc.backend.ci.tests.datatypes.ResourceReqDetails;
+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.InformationalArtifactPage;
+import org.onap.sdc.frontend.ci.tests.pages.ResourceGeneralPage;
+import org.onap.sdc.frontend.ci.tests.pages.UploadArtifactPopup;
+import org.onap.sdc.frontend.ci.tests.utilities.ArtifactUIUtils;
+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.backend.ci.tests.utils.general.ElementFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+
+public class NewArtifactTypeGuide extends SetupCDTest {
+
+ private String folder = "";
+
+ // US820276
+ // Upload information artifact of type GUIDE to VF
+ @Test
+ public void crudGuideInformationArtifactForVf() throws Exception {
+ String filePath = FileHandling.getFilePath(folder);
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createVF(resourceMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE");
+
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact);
+
+ assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+
+ String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText();
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "1", informationArtifact.getArtifactType(), true, true, true, false);
+
+ InformationalArtifactPage.clickEditArtifact(informationArtifact.getArtifactLabel());
+ UploadArtifactPopup artifactPopup = new UploadArtifactPopup();
+ artifactPopup.loadFile(filePath, "CP.yml");
+ artifactPopup.clickDoneButton();
+
+ assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+ Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(), artifactUUID);
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "2", informationArtifact.getArtifactType(), true, true, true, false);
+
+ InformationalArtifactPage.clickDeleteArtifact(informationArtifact.getArtifactLabel());
+ InformationalArtifactPage.clickOK();
+ }
+
+ // US820276
+ // Upload information artifact of type GUIDE to VFC
+ @Test
+ public void crudGuideInformationArtifactForVfc() throws Exception {
+ String filePath = FileHandling.getFilePath(folder);
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VFC, getUser());
+ ResourceUIUtils.importVfc(resourceMetaData, filePath, "guidevFW_VFC.yml", getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE");
+
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact);
+
+ assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+ String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText();
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "1", informationArtifact.getArtifactType(), true, true, true, false);
+
+ InformationalArtifactPage.clickEditArtifact(informationArtifact.getArtifactLabel());
+ UploadArtifactPopup artifactPopup = new UploadArtifactPopup();
+ artifactPopup.loadFile(filePath, "CP.yml");
+ artifactPopup.clickDoneButton();
+
+ assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+ Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(), artifactUUID);
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "2", informationArtifact.getArtifactType(), true, true, true, false);
+
+ InformationalArtifactPage.clickDeleteArtifact(informationArtifact.getArtifactLabel());
+ InformationalArtifactPage.clickOK();
+ }
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java
new file mode 100644
index 0000000000..877c6d50c0
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.frontend.ci.tests.US;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+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.LeftPanelCanvasItems;
+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.UserRoleEnum;
+import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
+import org.onap.sdc.frontend.ci.tests.pages.InformationalArtifactPage;
+import org.onap.sdc.frontend.ci.tests.pages.ResourceGeneralPage;
+import org.onap.sdc.frontend.ci.tests.pages.UploadArtifactPopup;
+import org.onap.sdc.frontend.ci.tests.utilities.ArtifactUIUtils;
+import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
+import org.onap.sdc.frontend.ci.tests.utilities.ResourceUIUtils;
+import org.onap.sdc.frontend.ci.tests.utilities.ServiceUIUtils;
+import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class RemoveRestrictionOfDeploymentArtifacts extends SetupCDTest {
+
+ private String folder = "";
+
+ // US833330 - Story [BE] - remove restriction of deployment artifacts
+ // Create service without resource instance and without deployment artifacts and verify it can submit for testing
+ @Test
+ public void createServiceWithoutRIAndArtifacts() throws Exception {
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata);
+ //TODO Andrey should click on certify button
+ ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+ }
+
+
+ // US833330 - Story [BE] - remove restriction of deployment artifacts
+ // Create service with VL resource instance and without deployment artifacts and verify it can submit for testing
+ @Test
+ public void createServiceWithVlAndWithoutArtfiacts() throws Exception {
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata);
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
+ canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
+ canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
+
+ ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+ }
+
+ // US833330 - Story [BE] - remove restriction of deployment artifacts
+ // Create service with VF with informational artifacts and verify it can submit for testing
+ @Test
+ public void createServiceWithInformationalArtifacts() throws Exception {
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createVF(resourceMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ String filePath = FileHandling.getFilePath(folder);
+ List<ArtifactInfo> informationalArtifactList = new ArrayList<ArtifactInfo>();
+ informationalArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+ informationalArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "GUIDE"));
+ for (ArtifactInfo informationalArtifact : informationalArtifactList) {
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact, new UploadArtifactPopup(true));
+ }
+ //TODO Andrey should click on certify button
+ ResourceGeneralPage.clickCertifyButton(resourceMetaData.getName());
+
+ /*reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(resourceMetaData.getName());
+ TesterOperationPage.certifyComponent(resourceMetaData.getName());
+ reloginWithNewRole(UserRoleEnum.DESIGNER);*/
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata);
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CanvasElement resourceInstance = canvasManager.createElementOnCanvas(resourceMetaData.getName());
+
+ ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/Testing.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/Testing.java
new file mode 100644
index 0000000000..d6c4a9f81c
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/Testing.java
@@ -0,0 +1,141 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.frontend.ci.tests.US;
+
+import org.openecomp.sdc.be.model.DataTypeDefinition;
+import org.onap.sdc.backend.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.onap.sdc.backend.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition;
+import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
+import org.onap.sdc.backend.ci.tests.utils.ToscaParserUtils;
+import org.testng.Assert;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+
+public class Testing {
+ private static void validateNodeTemplatesProperties(Map<String, Map<String, Object>> predefinedMap, ToscaDefinition toscaDefinition) {
+
+ for (String key : predefinedMap.keySet()) {
+ Map<String, Object> nodeTemplateProperties = getNodeTemplatePropertiesByNodeTemplateType(key, toscaDefinition);
+
+ predefinedMap.get(key).forEach((i, j) -> {
+ Assert.assertEquals(nodeTemplateProperties.get(i), j, "Expected that the properties will be equal");
+ });
+ }
+
+ }
+
+ // Get properties by type
+ private static Map<String, Object> getNodeTemplatePropertiesByNodeTemplateType(String nodeTemplateType, ToscaDefinition toscaDefinition) {
+ Map<String, Object> propertiesMap = null;
+
+ Set<String> nodeTemplates = getNodeTemplates(toscaDefinition);
+
+ for (String nodeTemplate : nodeTemplates) {
+ String currentNodeTemplateType = getNodeTemplateType(toscaDefinition, nodeTemplate);
+ currentNodeTemplateType = currentNodeTemplateType.substring(currentNodeTemplateType.lastIndexOf(".") + 1);
+ if (currentNodeTemplateType.equals(nodeTemplateType)) {
+ propertiesMap = getNodeTemplateProperties(toscaDefinition, nodeTemplate);
+ break;
+ }
+ }
+
+ return propertiesMap;
+ }
+
+ // Get node templates
+ private static Set<String> getNodeTemplates(ToscaDefinition toscaDefinition) {
+ Set<String> resourceInstanceArray = toscaDefinition.getTopology_template().getNode_templates().keySet();
+ return resourceInstanceArray;
+ }
+
+ // Get type of node template
+ private static String getNodeTemplateType(ToscaDefinition toscaDefinition, String nodeTemplate) {
+ return toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getType();
+ }
+
+ // Get properties of node template
+ private static Map<String, Object> getNodeTemplateProperties(ToscaDefinition toscaDefinition, String nodeTemplate) {
+ Map<String, Object> propertiesMap = toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getProperties();
+ return propertiesMap;
+ }
+
+
+ public static void main(String[] args) throws Exception {
+ ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition;
+ File filesFolder = new File("C:/Users/al714h/Downloads/Design/");
+ File importToscaFilesFolder = new File("C:/Git_work/sdc/catalog-be/src/main/resources/import/tosca/");
+
+ File dataTypesLocation = new File(importToscaFilesFolder.getPath() + "/data-types/dataTypes.yml");
+
+ File genericVfFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_VF/Generic_VF.yml");
+ File genericVfcFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_VFC/Generic_VFC.yml");
+ File genericPnfFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_PNF/Generic_PNF.yml");
+ File genericServiceFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_Service/Generic_Service.yml");
+
+ File amdocsCsarFileName = new File("/77e6b842669f441db20a83489da3f4be.csar");
+ File VfCsarFileName = new File("/resource-Civfonboarded2016012VmxAv301072E2e1424cb9d-csar.csar");
+ File serviceCsarFileName = new File("/service-Ciservicefeba0521131d-csar.csar");
+
+ Map<String, DataTypeDefinition> parseDataTypesYaml = FileHandling.parseDataTypesYaml(dataTypesLocation.getAbsoluteFile().toString());
+ System.out.println("start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
+
+ toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + amdocsCsarFileName));
+ toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName));
+ toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + serviceCsarFileName));
+ ToscaTopologyTemplateDefinition topologyTemplate = toscaMainAmdocsDefinition.getTopology_template();
+ ToscaDefinition objectHelper = ToscaParserUtils.parseToscaYamlToJavaObject(genericVfFileLocation);
+
+ Map<String, Object> additionalInputs = new HashMap<>();
+ Set<String> keySet = objectHelper.getNode_types().keySet();
+ if (keySet != null) {
+ for (String key : keySet) {
+ additionalInputs = objectHelper.getNode_types().get(key).getProperties();
+ }
+ }
+// topologyTemplate.addInputs(additionalInputs);
+
+
+// toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path);
+ System.out.println("listTypeHeatMetaDefinition start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
+// List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition = CsarParserUtils.getListTypeHeatMetaDefinition(csarPath);
+ System.out.println("get service start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
+// System.out.println(listTypeHeatMetaDefinition);
+// for(TypeHeatMetaDefinition typeHeatMetaDefinition : listTypeHeatMetaDefinition){
+// for(GroupHeatMetaDefinition groupHeatMetaDefinition : typeHeatMetaDefinition.getGroupHeatMetaDefinition()){
+// List<HeatMetaFirstLevelDefinition> artifactList = groupHeatMetaDefinition.getArtifactList();
+// boolean isBase = groupHeatMetaDefinition.getPropertyHeatMetaDefinition().getValue();
+// }
+//
+// }
+ System.out.println("Finished");
+ System.out.println("get service start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
+
+
+ }
+
+
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/VfModule.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/VfModule.java
new file mode 100644
index 0000000000..c1d5e6a9ba
--- /dev/null
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/US/VfModule.java
@@ -0,0 +1,165 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.frontend.ci.tests.US;
+
+import com.aventstack.extentreports.Status;
+import org.onap.sdc.frontend.ci.tests.pages.CompositionPage;
+import org.onap.sdc.frontend.ci.tests.pages.DeploymentArtifactPage;
+import org.onap.sdc.frontend.ci.tests.pages.HomePage;
+import org.onap.sdc.frontend.ci.tests.pages.ServiceGeneralPage;
+import org.onap.sdc.backend.ci.tests.utils.general.FileHandling;
+import org.openecomp.sdc.be.model.Service;
+import org.onap.sdc.backend.ci.tests.data.providers.OnboardingDataProviders;
+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.ToscaArtifactsScreenEnum;
+import org.onap.sdc.backend.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+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.TypeHeatMetaDefinition;
+import org.onap.sdc.backend.ci.tests.datatypes.VendorLicenseModel;
+import org.onap.sdc.backend.ci.tests.datatypes.VendorSoftwareProductObject;
+import org.onap.sdc.backend.ci.tests.datatypes.enums.UserRoleEnum;
+import org.onap.sdc.backend.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
+import org.onap.sdc.frontend.ci.tests.pages.ResourceGeneralPage;
+import org.onap.sdc.backend.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.onap.sdc.frontend.ci.tests.utilities.ArtifactUIUtils;
+import org.onap.sdc.frontend.ci.tests.utilities.DownloadManager;
+import org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils;
+import org.onap.sdc.frontend.ci.tests.utilities.OnboardingUiUtils;
+import org.onap.sdc.frontend.ci.tests.utilities.ServiceUIUtils;
+import org.onap.sdc.backend.ci.tests.utils.CsarParserUtils;
+import org.onap.sdc.backend.ci.tests.utils.ToscaParserUtils;
+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.general.OnboardingUtils;
+import org.onap.sdc.backend.ci.tests.utils.general.VendorLicenseModelRestUtils;
+import org.onap.sdc.backend.ci.tests.utils.general.VendorSoftwareProductRestUtils;
+import org.onap.sdc.frontend.ci.tests.verificator.ServiceVerificator;
+import org.onap.sdc.frontend.ci.tests.verificator.VfModuleVerificator;
+import org.testng.annotations.Test;
+
+import java.awt.*;
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.AssertJUnit.assertNotNull;
+
+/**
+ * @author al714h
+ */
+
+public class VfModule extends SetupCDTest {
+
+
+ @Test
+ public void checkVfModulesCountAndStructure() throws Exception, AWTException {
+
+// String filePath = "src\\main\\resources\\Files\\VNFs";
+ String filepath = org.onap.sdc.frontend.ci.tests.utilities.FileHandling.getVnfRepositoryPath();
+// String vnfFile = "LDSA.zip";
+// String vnfFile = "FDNT.zip";
+ List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure();
+ List<String> newRandomFileNamesFromFolder = OnboardingDataProviders.getRandomElements(1, fileNamesFromFolder);
+ String filePath = FileHandling.getVnfRepositoryPath();
+ String vnfFile = newRandomFileNamesFromFolder.get(0);
+ getExtendTest().log(Status.INFO, String.format("Going to onboard the VNF %s......", vnfFile));
+ System.out.println(String.format("Going to onboard the VNF %s......", vnfFile));
+
+ VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, getUser(),
+ vendorLicenseModel);
+ String vspName = createVendorSoftwareProduct.getName();
+ //
+ DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.getVspId());
+ File latestFilefromDir = org.onap.sdc.frontend.ci.tests.utilities.FileHandling.getLastModifiedFileNameFromDir();
+ List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition = CsarParserUtils.getListTypeHeatMetaDefinition(latestFilefromDir);
+ //
+ getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
+ HomePage.showVspRepository();
+ getExtendTest().log(Status.INFO, String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
+
+ OnboardingUiUtils.importVSP(createVendorSoftwareProduct);
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ // Verify deployment artifacts
+ Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(latestFilefromDir.getAbsolutePath());
+ LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment"));
+ for (HeatMetaFirstLevelDefinition deploymentArtifact : deploymentArtifacts) {
+ if (deploymentArtifact.getType().equals("HEAT_ENV")) {
+ continue;
+ }
+ System.out.println("--------------");
+ System.out.println(deploymentArtifact.getFileName());
+ System.out.println(deploymentArtifact.getType());
+// System.out.println(deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")));
+ if (deploymentArtifact.getFileName().contains(".")) {
+ ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")), "1", deploymentArtifact.getType());
+ } else {
+ ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim(), "1", deploymentArtifact.getType());
+ }
+
+ }
+
+ DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile);
+//TODO Andrey should click on certify button
+ DeploymentArtifactPage.clickCertifyButton(vspName);
+
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata);
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CompositionPage.searchForElement(vspName);
+ CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
+ assertNotNull(vfElement);
+ ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+ GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue());
+ latestFilefromDir = org.onap.sdc.frontend.ci.tests.utilities.FileHandling.getLastModifiedFileNameFromDir();
+
+// verification
+ Service service = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), serviceMetadata.getVersion());
+ ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(latestFilefromDir);
+
+// compare number of vf modules defined in HEAT.meta file vs Service TOSCA yaml
+ VfModuleVerificator.compareNumberOfVfModules(listTypeHeatMetaDefinition, toscaDefinition);
+ VfModuleVerificator.verifyGroupMetadata(toscaDefinition, service);
+
+ getExtendTest().log(Status.INFO, String.format("Onboarding %s test is passed ! ", vnfFile));
+
+ }
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}