summaryrefslogtreecommitdiffstats
path: root/ui-ci
diff options
context:
space:
mode:
Diffstat (limited to 'ui-ci')
-rw-r--r--ui-ci/pom.xml4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java12
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java8
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java12
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java3
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java102
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java84
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java296
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidation.java77
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java334
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java44
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java14
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java3
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java11
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java16
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtillViaApis.java298
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java42
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java26
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ToscaValidation.java125
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java4
-rw-r--r--ui-ci/src/main/resources/ci/testSuites/toscaValidationSuite.xml24
34 files changed, 1329 insertions, 244 deletions
diff --git a/ui-ci/pom.xml b/ui-ci/pom.xml
index 9206348c3b..03b3f155bb 100644
--- a/ui-ci/pom.xml
+++ b/ui-ci/pom.xml
@@ -135,8 +135,8 @@
</dependency>
<dependency>
- <groupId>com.thinkaurelius.titan</groupId>
- <artifactId>titan-cassandra</artifactId>
+ <groupId>org.openecomp.sdc.sdc-titan-cassandra</groupId>
+ <artifactId>sdc-titan-cassandra</artifactId>
<version>${titan.version}</version>
<scope>compile</scope>
</dependency>
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java
index 41c1212cc0..06e55bc51f 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java
@@ -120,7 +120,7 @@ public class AddComponentInstancesArtifactsInCsar extends SetupCDTest {
ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
ToscaArtifactsPage.downloadCsar();
- File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
Map<String, Object> combineHeatArtifacstWithFolderArtifacsToMap = ArtifactFromCsar.getVFCArtifacts(latestFilefromDir.getAbsolutePath());
compareArtifactFromFileStructureToArtifactsFromJavaObject(artifacts, combineHeatArtifacstWithFolderArtifacsToMap);
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
index 9ea1b7239c..3fb1529461 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
@@ -133,7 +133,7 @@ public class MIBsArtifactsOnResourceInstance extends SetupCDTest {
@DataProvider(name="mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption")
public static Object[][] dataProviderMibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption() {
return new Object[][] {
- {"mibs1vFW_VFC.yml", ResourceTypeEnum.VFC},
+// {"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}
@@ -145,9 +145,9 @@ public class MIBsArtifactsOnResourceInstance extends SetupCDTest {
@Test(dataProvider="mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption")
public void mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
- if(resourceTypeEnum.equals(ResourceTypeEnum.CP)){
- throw new SkipException("Open bug 322930");
- }
+// if(resourceTypeEnum.equals(ResourceTypeEnum.CP)){
+// throw new SkipException("Open bug 322930");
+// }
setLog(fileName);
@@ -174,7 +174,7 @@ public class MIBsArtifactsOnResourceInstance extends SetupCDTest {
// 4. Create VF.
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
// 5. Click on composition.
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
@@ -212,7 +212,7 @@ public class MIBsArtifactsOnResourceInstance extends SetupCDTest {
// 1. Create VF.
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(resourceMetaData, getUser());
+ ResourceUIUtils.createVF(resourceMetaData, getUser());
// 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL.
ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java
index 9d460b0b0c..2195af9a90 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java
@@ -53,7 +53,7 @@ public class NewArtifactTypeGuide extends SetupCDTest {
String filePath = FileHandling.getFilePath(folder);
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(resourceMetaData, getUser());
+ ResourceUIUtils.createVF(resourceMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java
index 1f85ec21fb..df68a1893a 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java
@@ -81,7 +81,7 @@ public class RemoveRestrictionOfDeploymentArtifacts extends SetupCDTest {
@Test
public void createServiceWithInformationalArtifacts() throws Exception {
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(resourceMetaData, getUser());
+ ResourceUIUtils.createVF(resourceMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
index 4e9770cbea..8e669b1fac 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
@@ -22,6 +22,7 @@ package org.openecomp.sdc.ci.tests.US;
import java.io.File;
import java.text.SimpleDateFormat;
+import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -35,6 +36,8 @@ import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
import org.testng.Assert;
+import fj.data.Array;
+
@@ -195,8 +198,11 @@ public class Testing {
// }
System.out.println("Finished");
System.out.println("get service start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
+
+
+
}
-
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java
index e7d933491c..64caee87e9 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java
@@ -85,7 +85,7 @@ public class VfModule extends SetupCDTest {
String vspName = createVendorSoftwareProduct.left;
//
DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId"));
- File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition = CsarParserUtils.getListTypeHeatMetaDefinition(latestFilefromDir);
//
getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
@@ -133,7 +133,7 @@ public class VfModule extends SetupCDTest {
GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue());
- latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+ latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
// verification
Service service = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), serviceMetadata.getVersion());
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java
index 71c2612a82..677eb8cb10 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java
@@ -57,7 +57,7 @@ public class Vf_Tests_UI extends SetupCDTest{
public void uploadHeatEnvVFLevel() throws Exception {
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java
index 291a1dbb2e..6fcede0fce 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java
@@ -80,7 +80,7 @@ public class extendNode_TemplatePropertiesWithDefaultValues extends SetupCDTest
ServiceUIUtils.createService(serviceMetadata, getUser());
} else {
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(resourceMetaData, getUser());
+ ResourceUIUtils.createVF(resourceMetaData, getUser());
}
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
@@ -163,7 +163,7 @@ public class extendNode_TemplatePropertiesWithDefaultValues extends SetupCDTest
ServiceUIUtils.createService(serviceMetadata, getUser());
} else {
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(resourceMetaData, getUser());
+ ResourceUIUtils.createVF(resourceMetaData, getUser());
}
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java
index f63be6c8c3..69037500a2 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java
@@ -1,17 +1,22 @@
package org.openecomp.sdc.ci.tests.dataProvider;
+import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.openecomp.sdc.ci.tests.execute.sanity.ToscaValidationTest;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Factory;
public class OnbordingDataProviders {
protected static String filepath = FileHandling.getVnfRepositoryPath();
+// -----------------------dataProviders-----------------------------------------
@DataProvider(name = "randomVNF_List", parallel = false)
private static final Object[][] randomVnfList() throws Exception {
int randomElementNumber = 3; //how many VNFs to onboard randomly
@@ -30,6 +35,13 @@ public class OnbordingDataProviders {
return provideData(fileNamesFromFolder, filepath);
}
+// -----------------------factories-----------------------------------------
+ @Factory(dataProvider = "VNF_List")
+ public Object[] OnbordingDataProviders(String filepath, String vnfFile){
+ return new Object[] { new ToscaValidationTest(filepath, vnfFile)};
+ }
+
+
// -----------------------methods-----------------------------------------
public static Object[][] provideData(List<String> fileNamesFromFolder, String filepath) {
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
index fd6980fddd..f2e46b2973 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
@@ -36,7 +36,8 @@ public final class DataTestIdEnum {
IMPORT_VF("importVFbutton"),
IMPORT_VFC_FILE("file-importVFCbutton"),
IMPORT_VF_FILE("file-importVFbutton"),
- BUTTON_ADD_PRODUCT("createProductButton");
+ BUTTON_ADD_PRODUCT("createProductButton"),
+ BUTTON_ADD_PNF("createPNFButton"), ;
private String value;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java
new file mode 100644
index 0000000000..fbdb88e712
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java
@@ -0,0 +1,102 @@
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public class VendorSoftwareProductObject {
+
+ private String vendorName;
+ private String vspId;
+ private String category;
+ private String subCategory;
+ private String componentId;
+ private String description;
+ private String attContact;
+ private String vspName;
+
+ public VendorSoftwareProductObject() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public VendorSoftwareProductObject(String vendorName, String vspId, String category, String subCategory, String componentId, String description, String attContact) {
+ super();
+ this.vendorName = vendorName;
+ this.vspId = vspId;
+ this.category = category;
+ this.subCategory = subCategory;
+ this.componentId = componentId;
+ this.description = description;
+ this.attContact = attContact;
+ }
+
+
+ public String getVspName() {
+ return vspName;
+ }
+
+ public void setVspName(String vspName) {
+ this.vspName = vspName;
+ }
+
+ public String getVendorName() {
+ return vendorName;
+ }
+
+ public void setVendorName(String vendorName) {
+ this.vendorName = vendorName;
+ }
+
+ public String getVspId() {
+ return vspId;
+ }
+
+ public void setVspId(String vspId) {
+ this.vspId = vspId;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public String getSubCategory() {
+ return subCategory;
+ }
+
+ public void setSubCategory(String subCategory) {
+ this.subCategory = subCategory;
+ }
+
+ public String getComponentId() {
+ return componentId;
+ }
+
+ public void setComponentId(String componentId) {
+ this.componentId = componentId;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getAttContact() {
+ return attContact;
+ }
+
+ public void setAttContact(String attContact) {
+ this.attContact = attContact;
+ }
+
+ @Override
+ public String toString() {
+ return "VendorSoftwareProductObject [vendorName=" + vendorName + ", vspId=" + vspId + ", category=" + category + ", subCategory=" + subCategory + ", componentId=" + componentId + ", description=" + description + ", attContact="
+ + attContact + "]";
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
index f842136425..0e09059b28 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
@@ -229,7 +229,7 @@ public class AdminUserManagment extends SetupCDTest {
reloginWithNewRole(UserRoleEnum.DESIGNER);
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
ExtentTestActions.log(Status.INFO, "Creating a new VF named " + resourceMetaData.getName());
- ResourceUIUtils.createResource(resourceMetaData, getUser());
+ ResourceUIUtils.createVF(resourceMetaData, getUser());
ResourceGeneralPage.clickSubmitForTestingButton(resourceMetaData.getName());
Resource resourceObjectByNameAndVersion = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
ExtentTestActions.log(Status.INFO, "Getting the VF to 'In Testing' state.");
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java
index f0bc6f7505..5533eb38f5 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java
@@ -197,7 +197,7 @@ public class CatalogLeftPanelTest extends SetupCDTest{
public void lastUpdatedResource() throws Exception{
// create resource
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
@@ -210,7 +210,7 @@ public class CatalogLeftPanelTest extends SetupCDTest{
public void fromCatalogCheckout() throws Exception{
// create resource
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java
index d2c787e4e5..5d1dfea5c1 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java
@@ -192,7 +192,7 @@ public class Categories extends SetupCDTest {
SubCategoryDefinition subCategoryDefinition = categoryDefinition.getSubcategories().get(0);
subCategoryDefinition.setName(newSubCategory);
- ResourceUIUtils.createResource(resourceMetaData, getUser());
+ ResourceUIUtils.createVF(resourceMetaData, getUser());
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java
index b8b7bd752e..7dd3279644 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java
@@ -307,7 +307,7 @@ public class CustomizationUUID extends SetupCDTest {
public ResourceReqDetails createNewResourceWithArtifactSubmitForTesting() throws Exception {
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
index c9dcf2a08e..f32709e219 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
@@ -24,17 +24,13 @@ import static org.testng.AssertJUnit.assertEquals;
import java.awt.AWTException;
import java.io.File;
-import java.io.FileOutputStream;
-import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.bouncycastle.util.encoders.Base64;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
@@ -42,21 +38,21 @@ import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtillViaApis;
import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.clearspring.analytics.util.Pair;
-import com.google.gson.Gson;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
@@ -66,11 +62,11 @@ public class OnboardViaApis{
private static final String FULL_PATH = "C://tmp//CSARs//";
-
+ protected static String filepath = FileHandling.getVnfRepositoryPath();
//-------------------------------------------------------------------------------------------------------
User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- ResourceReqDetails resourceDetails;
+// ResourceReqDetails resourceDetails;
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
@@ -80,7 +76,7 @@ public class OnboardViaApis{
lc.getLogger("org.apache").setLevel(Level.OFF);
lc.getLogger("org.*").setLevel(Level.OFF);
lc.getLogger("org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest").setLevel(Level.OFF);
- resourceDetails = ElementFactory.getDefaultResource();
+// resourceDetails = ElementFactory.getDefaultResource();
}
@Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
@@ -95,7 +91,7 @@ public class OnboardViaApis{
timestamp = new Timestamp(System.currentTimeMillis());
System.err.println(timestamp + " Starting download service csar file: " + vnfFile);
File file = new File(fullFileName);
- downloadToscaCsarToDirectory(service, file);
+ OnboardingUtillViaApis.downloadToscaCsarToDirectory(service, file);
timestamp = new Timestamp(System.currentTimeMillis());
System.err.println(timestamp + " Finished download service csar file: " + vnfFile);
System.out.println("end");
@@ -106,8 +102,6 @@ public class OnboardViaApis{
@Test
public void onboardingAndParser() throws Exception {
Service service = null;
- String filepath = getFilePath();
-// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
String vnfFile = fileNamesFromFolder.get(7);
System.err.println(timestamp + " Starting test with VNF: " + vnfFile);
@@ -119,49 +113,19 @@ public class OnboardViaApis{
// convertServiceDistributionStatusToObject.
}
- public static String getFilePath() {
- String filepath = System.getProperty("filepath");
- if (filepath == null && System.getProperty("os.name").contains("Windows")) {
- filepath = FileHandling.getResourcesFilesPath() +"VNFs";
- }
-
- else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
- filepath = FileHandling.getBasePath() + File.separator + "Files" + File.separator +"VNFs";
- }
- return filepath;
- }
- public static void downloadToscaCsarToDirectory(Service service, File file) {
- try {
- Either<String,RestResponse> serviceToscaArtifactPayload = AtomicOperationUtils.getServiceToscaArtifactPayload(service, "assettoscacsar");
- if(serviceToscaArtifactPayload.left().value() != null){
- Gson gson = new Gson();
- @SuppressWarnings("unchecked")
- Map<String, String> fromJson = gson.fromJson(serviceToscaArtifactPayload.left().value(), Map.class);
- String string = fromJson.get("base64Contents").toString();
- byte[] byteArray = Base64.decode(string.getBytes(StandardCharsets.UTF_8));
- File downloadedFile = new File(file.getAbsolutePath());
- FileOutputStream fos = new FileOutputStream(downloadedFile);
- fos.write(byteArray);
- fos.flush();
- fos.close();
- }
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
+
public Service runOnboardViaApisOnly(String filepath, String vnfFile) throws Exception, AWTException {
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
System.err.println(timestamp + " Starting onboard VNF: " + vnfFile);
- Pair<String,Map<String,String>> onboardAndValidate = onboardAndValidateViaApi(filepath, vnfFile, sdncDesignerDetails1);
- String vspName = onboardAndValidate.left;
+ Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(filepath, vnfFile, sdncDesignerDetails1);
+ String vspName = createVendorSoftwareProduct.left;
+ VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right;
timestamp = new Timestamp(System.currentTimeMillis());
System.err.println(timestamp + " Finished onboard VNF: " + vnfFile);
- Resource resource = AtomicOperationUtils.getResourceObject(resourceDetails.getUniqueId());
+ ResourceReqDetails resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(vendorSoftwareProductObject, vspName);
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, vspName);
AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
resource = AtomicOperationUtils.getResourceObject(resource.getUniqueId());
@@ -175,27 +139,9 @@ public class OnboardViaApis{
- public Pair<String, Map<String, String>> onboardAndValidateViaApi(String filepath, String vnfFile, User user) throws Exception {
-
- AmdocsLicenseMembers amdocsLicenseMembers = createVendorLicense(user);
- Pair<String, Map<String, String>> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user, amdocsLicenseMembers);
- String vspName = createVendorSoftwareProduct.left;
- List<String> tags = new ArrayList<>();
- tags.add(vspName);
- Map<String, String> map = createVendorSoftwareProduct.right;
-
- resourceDetails.setCsarUUID(map.get("vspId"));
- resourceDetails.setCsarVersion("1.0");
- resourceDetails.setName(vspName);
- resourceDetails.setTags(tags);
- resourceDetails.setResourceType(map.get("componentType"));
- resourceDetails.setVendorName(map.get("vendorName"));
- resourceDetails.setVendorRelease("1.0");
- resourceDetails.setResourceType("VF");
- RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncDesignerDetails1);
-
- return createVendorSoftwareProduct;
- }
+
+
+
public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers)
throws Exception {
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java
new file mode 100644
index 0000000000..0bb315aefe
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java
@@ -0,0 +1,296 @@
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.util.List;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class PNF extends SetupCDTest {
+
+ private String filePath;
+ @BeforeClass
+ public void beforeClass(){
+ filePath = FileHandling.getFilePath("");
+ }
+
+ @BeforeMethod
+ public void beforeTest(){
+ System.out.println("File repository is : " + filePath);
+ getExtendTest().log(Status.INFO, "File repository is : " + filePath);
+ }
+
+ @Test
+ public void updatePNF() throws Exception {
+
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+
+ // update Resource
+ ResourceReqDetails updatedResource = new ResourceReqDetails();
+ updatedResource.setName("ciUpdatedName");
+ updatedResource.setDescription("kuku");
+ updatedResource.setVendorName("updatedVendor");
+ updatedResource.setVendorRelease("updatedRelease");
+ updatedResource.setContactId("ab0001");
+ updatedResource.setCategories(pnfMetaData.getCategories());
+ updatedResource.setVersion("0.1");
+ updatedResource.setResourceType(ResourceTypeEnum.VF.getValue());
+ List<String> newTags = pnfMetaData.getTags();
+ newTags.remove(pnfMetaData.getName());
+ newTags.add(updatedResource.getName());
+ updatedResource.setTags(newTags);
+ ResourceUIUtils.updateResource(updatedResource, getUser());
+
+ VfVerificator.verifyVFMetadataInUI(updatedResource);
+ VfVerificator.verifyVFUpdated(updatedResource, getUser());
+ }
+
+ @Test
+ public void addUpdateDeleteInformationalArtifactPNFTest() throws Exception {
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
+
+ AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(1));
+
+ String newDescription = "new description";
+ InformationalArtifactPage.clickEditArtifact(informationalArtifact.getArtifactLabel());
+ InformationalArtifactPage.artifactPopup().insertDescription(newDescription);
+ InformationalArtifactPage.artifactPopup().clickDoneButton();
+ String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifact.getArtifactLabel());
+ AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+
+ InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel());
+ InformationalArtifactPage.clickOK();
+ AssertJUnit.assertTrue("artifact "+ informationalArtifact.getArtifactLabel() + "is not deleted", InformationalArtifactPage.checkElementsCountInTable(0));
+ }
+
+ @Test
+ public void addPropertiesToVfcInstanceInPNFTest() throws Exception {
+
+ String fileName = "CP.yml";
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+
+ try{
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
+
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ CanvasElement cpElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+ vfCanvasManager.clickOnCanvaElement(cpElement);
+ CompositionPage.showPropertiesAndAttributesTab();
+ List<WebElement> properties = CompositionPage.getProperties();
+ String propertyValue = "abc123";
+ for (int i = 0; i < 2; i++) {
+ WebElement findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label"));
+ findElement.click();
+ PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue);
+ PropertiesPage.getPropertyPopup().clickSave();
+
+ findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value"));
+ AssertJUnit.assertTrue(findElement.getText().equals(propertyValue));
+ }
+ }
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+ }
+ }
+
+ @Test
+ public void changeInstanceVersionPNFTest() throws Exception{
+
+ ResourceReqDetails atomicResourceMetaData = null;
+ ResourceReqDetails pnfMetaData = null;
+ CanvasManager vfCanvasManager;
+ CanvasElement cpElement = null;
+ String fileName = "CP.yml";
+ try{
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ pnfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.PNF, getUser());
+ ResourceUIUtils.createPNF(pnfMetaData, getUser());
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ cpElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+
+ CompositionPage.clickSubmitForTestingButton(pnfMetaData.getName());
+ assert(false);
+ }
+ catch(Exception e){
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+ AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError));
+
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(pnfMetaData.getName());
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.changeComponentVersion(vfCanvasManager, cpElement, "1.0");
+
+ //verfication
+ VfVerificator.verifyInstanceVersion(pnfMetaData, getUser(), atomicResourceMetaData.getName(), "1.0");
+ }
+
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
+ }
+
+ }
+
+ @Test
+ public void verifyToscaArtifactsExistPNFTest() throws Exception{
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+
+ final int numOfToscaArtifacts = 2;
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+ AssertJUnit.assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
+
+ for(int i = 0; i < numOfToscaArtifacts; i++){
+ String typeFromScreen = ToscaArtifactsPage.getArtifactType(i);
+ AssertJUnit.assertTrue(typeFromScreen.equals(ArtifactTypeEnum.TOSCA_CSAR.getType()) || typeFromScreen.equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType()));
+ }
+
+ ToscaArtifactsPage.clickSubmitForTestingButton(pnfMetaData.getName());
+ VfVerificator.verifyToscaArtifactsInfo(pnfMetaData, getUser());
+ }
+
+ @Test
+ public void pnfCertificationTest() throws Exception{
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+
+ String vfName = pnfMetaData.getName();
+
+ ResourceGeneralPage.clickCheckinButton(vfName);
+ GeneralUIUtils.findComponentAndClick(vfName);
+ ResourceGeneralPage.clickSubmitForTestingButton(vfName);
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfName);
+ TesterOperationPage.certifyComponent(vfName);
+
+ pnfMetaData.setVersion("1.0");
+ VfVerificator.verifyVFLifecycle(pnfMetaData, getUser(), LifecycleStateEnum.CERTIFIED);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(vfName);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED);
+ }
+
+ @Test
+ public void deletePNFCheckedoutTest() throws Exception{
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+
+ GeneralPageElements.clickTrashButtonAndConfirm();
+
+ pnfMetaData.setVersion("0.1");
+ VfVerificator.verifyVfDeleted(pnfMetaData, getUser());
+ }
+
+ @Test
+ public void revertPNFMetadataTest() throws Exception{
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+
+ ResourceReqDetails pvfRevertDetails = new ResourceReqDetails();
+ pvfRevertDetails.setName("ciUpdatedName");
+ pvfRevertDetails.setDescription("kuku");
+ pvfRevertDetails.setCategories(pnfMetaData.getCategories());
+ pvfRevertDetails.setVendorName("updatedVendor");
+ pvfRevertDetails.setVendorRelease("updatedRelease");
+ ResourceUIUtils.fillResourceGeneralInformationPage(pvfRevertDetails, getUser(), false);
+
+ GeneralPageElements.clickRevertButton();
+
+ VfVerificator.verifyVFMetadataInUI(pnfMetaData);
+ }
+
+ @Test
+ public void checkoutVfTest() throws Exception{
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+
+ ResourceGeneralPage.clickCheckinButton(pnfMetaData.getName());
+ GeneralUIUtils.findComponentAndClick(pnfMetaData.getName());
+ GeneralPageElements.clickCheckoutButton();
+
+ pnfMetaData.setVersion("0.2");
+ VfVerificator.verifyVFLifecycle(pnfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+
+ ResourceGeneralPage.clickSubmitForTestingButton(pnfMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(pnfMetaData.getName());
+ TesterOperationPage.certifyComponent(pnfMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(pnfMetaData.getName());
+ ResourceGeneralPage.clickCheckoutButton();
+
+ pnfMetaData.setVersion("1.1");
+ pnfMetaData.setUniqueId(null);
+ VfVerificator.verifyVFLifecycle(pnfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+ }
+
+ public ResourceReqDetails createPNFWithGenerateName() throws Exception {
+ ResourceReqDetails pnfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.PNF, getUser());
+ ResourceUIUtils.createPNF(pnfMetaData, getUser());
+ return pnfMetaData;
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
index 339f9290e8..54656d8b9b 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
@@ -188,7 +188,7 @@ public class Service extends SetupCDTest {
public void submitServiceForTestingWithNonCertifiedAsset() throws Exception{
ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
- ResourceUIUtils.createResource(atomicResourceMetaData, getUser());
+ ResourceUIUtils.createVF(atomicResourceMetaData, getUser());
ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
@@ -496,7 +496,7 @@ public class Service extends SetupCDTest {
public CanvasElement createServiceWithRiArtifact(ResourceReqDetails atomicResourceMetaData, ServiceReqDetails serviceMetadata, ArtifactInfo artifact) throws Exception, AWTException {
- ResourceUIUtils.createResource(atomicResourceMetaData, getUser());
+ ResourceUIUtils.createVF(atomicResourceMetaData, getUser());
ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
ServiceUIUtils.createService(serviceMetadata, getUser());
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidation.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidation.java
deleted file mode 100644
index 293547f392..0000000000
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidation.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*-
- * ============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.openecomp.sdc.ci.tests.execute.sanity;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class ToscaValidation{
-
-
- @BeforeClass
- public void precondition(){
-
- Map<String, Map<String, Object>> expected = new HashMap<String, Map<String, Object>>();
-
- //import amdocs VNF and download csar
-
- //parse downloaded csar and add it to expected object
-
- //create VF base on VNF imported from previous step - declare all inputs
-
- //certify VF and download csar
-
- //parse downloaded csar and add it to expected object
-
- //create service add VF - declare all inputs
-
- //certify service and download csar
-
- //parse downloaded csar and add it to expected object
-
-
- }
-
- @Test
- public void validateMetaData(){
-
-
-
-
- }
-
- @Test
- public void validatePropertiesInputs(){
-
-
-
- }
-
-
-
-
-
-
-
-}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java
new file mode 100644
index 0000000000..d70f5e8d5d
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java
@@ -0,0 +1,334 @@
+/*-
+ * ============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.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+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.Service;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.tosca.model.ToscaMetadataFieldsPresentationEnum;
+import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtillViaApis;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.ToscaValidation;
+import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
+import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
+import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.toscaparser.api.elements.Metadata;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+import fj.data.Either;
+
+
+public class ToscaValidationTest extends SetupCDTest{
+
+ ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition;
+ protected String vnfFile;
+ protected String filepath;
+ protected File filesFolder;
+ protected SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
+ protected ISdcCsarHelper fdntCsarHelper;
+ protected ResourceReqDetails resourceReqDetails;
+ protected Resource resource;
+ protected ServiceReqDetails serviceReqDetails;
+ protected Service service;
+ protected ComponentInstance componentInstanceDefinition;
+ User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ 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");
+
+// Map<String, DataTypeDefinition> parseDataTypesYaml = FileHandling.parseDataTypesYaml(dataTypesLocation.getAbsoluteFile().toString());
+
+// 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);
+
+
+ public ToscaValidationTest(String filepath, String vnfFile) {
+ this.filepath = filepath;
+ this.vnfFile = vnfFile;
+ }
+
+
+ @BeforeClass
+
+ public void precondition() throws Exception{
+//--------------------------GENERAL--------------------------------
+ setLog(vnfFile);
+ filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
+//--------------------------AMDOCS--------------------------------
+ Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(filepath, vnfFile, user);
+ VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right;
+ vendorSoftwareProductObject.setVspName(createVendorSoftwareProduct.left);
+ DownloadManager.downloadCsarByNameFromVSPRepository(vendorSoftwareProductObject.getVspName(), vendorSoftwareProductObject.getVspId(), false);
+ File amdocsCsarFileName = FileHandling.getLastModifiedFileNameFromDir(filesFolder.getAbsolutePath());
+ toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(amdocsCsarFileName);
+
+//TODO--------------------------AMDOCS DOWNLOAD VIA APIS--------------------------------
+
+//--------------------------VF--------------------------------
+// create VF base on VNF imported from previous step - have, resourceReqDetails object include part of resource metadata
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(vendorSoftwareProductObject, vendorSoftwareProductObject.getVspName());
+ resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, vendorSoftwareProductObject.getVspName());
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ File VfCsarFileName = new File(File.separator + "VfCsar_" + ElementFactory.generateUUIDforSufix() + ".csar");
+ OnboardingUtillViaApis.downloadToscaCsarToDirectory(resource, new File(filesFolder.getPath() + VfCsarFileName));
+ toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName));
+
+//--------------------------SERVICE--------------------------------
+ serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(user);
+ service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value();
+// TODO declare all VFi inputs + add all generic
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ File ServiceCsarFileName = new File(File.separator + "ServiceCsar_" + ElementFactory.generateUUIDforSufix() + ".csar");
+ OnboardingUtillViaApis.downloadToscaCsarToDirectory(service, new File(filesFolder.getPath() + ServiceCsarFileName));
+ toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + ServiceCsarFileName));
+
+//--------------------------verification against Pavel Parser--------------------------------
+
+ SetupCDTest.getExtendTest().log(Status.INFO, "Tosca parser is going to convert service csar file to ISdcCsarHelper object...");
+ fdntCsarHelper = factory.getSdcCsarHelper(filesFolder.getPath() + ServiceCsarFileName);
+
+ }
+
+
+ //--------------------------Metadata verification--------------------------------
+//--------------------------Resource--------------------------------
+
+ @Test()
+ public void validateVfMetadata() throws Exception{
+ setLog(vnfFile);
+ SetupCDTest.getExtendTest().log(Status.INFO, "validateVfMetadata " + vnfFile);
+ //add resource metadata to expected object
+ toscaMainAmdocsDefinition = addAndGenerateResourceMetadataToExpectedObject(toscaMainAmdocsDefinition, resourceReqDetails, resource);
+ Either<Boolean,Map<String,Object>> resourceToscaMetadataValidator = ToscaValidation.resourceToscaMetadataValidator(toscaMainAmdocsDefinition, toscaMainVfDefinition);
+ Assert.assertFalse(!resourceToscaMetadataValidator.left().value().equals(true), "Found error/s on Vf metadata verification");
+
+ }
+
+ @Test()
+ public void validateResourceNodeTemplateMetadata() throws Exception{
+ setLog(vnfFile);
+ SetupCDTest.getExtendTest().log(Status.INFO, "validateResourceNodeTemplateMetadata " + vnfFile);
+ Map<String, Map<String, String>> generateReosurceNodeTemplateMetadataToExpectedObject = generateResourceNodeTemplateMetadataToExpectedObject(resource);
+ Boolean resourceToscaMetadataValidator = ToscaValidation.resourceToscaNodeTemplateMetadataValidator(generateReosurceNodeTemplateMetadataToExpectedObject, toscaMainVfDefinition);
+ Assert.assertFalse(!resourceToscaMetadataValidator.equals(true), "Found error/s on Resource Node Template metadata verification");
+ }
+
+//--------------------------Service--------------------------------
+ @Test()
+ public void validateServiceMetadata() throws Exception{
+ setLog(vnfFile);
+ SetupCDTest.getExtendTest().log(Status.INFO, "validateServiceMetadata " + vnfFile);
+ Map<String, String> generateServiceMetadataToExpectedObject = generateServiceMetadataToExpectedObject(serviceReqDetails, service);
+ Either<Boolean,Map<String, Object>> serviceToscaMetadataValidator = ToscaValidation.serviceToscaMetadataValidator(generateServiceMetadataToExpectedObject, toscaMainServiceDefinition);
+ Assert.assertFalse(!serviceToscaMetadataValidator.left().value().equals(true), "Found error/s on Service metadata verification");
+ }
+
+
+ @Test()
+ public void validateServiceNodeTemplateMetadata() throws Exception{
+ setLog(vnfFile);
+ SetupCDTest.getExtendTest().log(Status.INFO, "validateServiceNodeTemplateMetadata " + vnfFile);
+ Map<String, String> generateServiceNodeTemplateMetadataToExpectedObject = generateServiceNodeTemplateMetadataToExpectedObject(resourceReqDetails, resource, componentInstanceDefinition);
+ Either<Boolean,Map<String, Object>> serviceToscaMetadataValidator = ToscaValidation.componentToscaNodeTemplateMetadataValidator(generateServiceNodeTemplateMetadataToExpectedObject, toscaMainServiceDefinition, componentInstanceDefinition.getName(), ComponentTypeEnum.SERVICE);
+ Assert.assertFalse(!serviceToscaMetadataValidator.left().value().equals(true), "Found error/s on Service Node Template metadata verification");
+ }
+
+//--------------------------Service verification against Pavel Parser--------------------------------
+ @Test()
+ public void validateServiceMetadataUsingParser() throws Exception{
+ setLog(vnfFile);
+ SetupCDTest.getExtendTest().log(Status.INFO, "validateServiceMetadataUsingParser " + vnfFile);
+ Map<String, String> generateServiceMetadataToExpectedObject = generateServiceMetadataToExpectedObject(serviceReqDetails, service);
+ Metadata serviceMetadata = fdntCsarHelper.getServiceMetadata();
+ Either<Boolean,Map<String, Object>> serviceToscaMetadataValidatorAgainstParser = ToscaValidation.serviceToscaMetadataValidatorAgainstParser(generateServiceMetadataToExpectedObject, serviceMetadata);
+ Assert.assertFalse(!serviceToscaMetadataValidatorAgainstParser.left().value().equals(true), "Found error/s on Service metadata verification");
+ }
+
+ @Test()
+ public void validateServiceNodeTemplateMetadataUsingParser() throws Exception{
+ setLog(vnfFile);
+ SetupCDTest.getExtendTest().log(Status.INFO, "validateServiceMetadataUsingParser " + vnfFile);
+ Map<String, String> generateServiceNodeTemplateMetadataToExpectedObject = generateServiceNodeTemplateMetadataToExpectedObject(resourceReqDetails, resource, componentInstanceDefinition);
+ List<NodeTemplate> serviceNodeTemplates = fdntCsarHelper.getServiceNodeTemplates();
+ Metadata serviceNodeTemplateMetadata = serviceNodeTemplates.get(0).getMetaData();
+ Either<Boolean,Map<String, Object>> serviceNodeTemplateToscaMetadataValidatorAgainstParser = ToscaValidation.serviceToscaMetadataValidatorAgainstParser(generateServiceNodeTemplateMetadataToExpectedObject, serviceNodeTemplateMetadata);
+ Assert.assertFalse(!serviceNodeTemplateToscaMetadataValidatorAgainstParser.left().value().equals(true), "Found error/s on Service metadata verification");
+ }
+
+
+
+ //--------------------------Input verification--------------------------------
+
+ //--------------------------Resource--------------------------------
+
+
+ //--------------------------Service--------------------------------
+
+
+ //--------------------------Service verification against Pavel Parser--------------------------------
+
+
+
+
+
+
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+
+
+
+ public static ToscaDefinition addAndGenerateResourceMetadataToExpectedObject(ToscaDefinition toscaDefinition, ResourceReqDetails resourceReqDetails, Component component) {
+
+ Map<String, String> metadata = convertResourceMetadataToMap(resourceReqDetails, component);
+ toscaDefinition.setMetadata(metadata);
+ return toscaDefinition;
+ }
+
+
+ public static Map<String, String> convertResourceMetadataToMap(ResourceReqDetails resourceReqDetails, Component component) {
+ Map<String, String> metadata = new HashMap<>();
+
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.CATEGORY.value, resourceReqDetails.getCategories().get(0).getName());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.DESCRIPTION.value, resourceReqDetails.getDescription());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.INVARIANT_UUID.value, component.getInvariantUUID());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.TYPE.value, "VF");
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.UUID.value, component.getUUID());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.NAME.value, component.getName());
+
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.RESOURCE_VENDOR_NAME.value, resourceReqDetails.getVendorName());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.RESOURCE_VENDOR_MODEL_NUMBER.value, resourceReqDetails.getResourceVendorModelNumber());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.RESOURCE_VENDOR_RELEASE.value, resourceReqDetails.getVendorRelease());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.SUBCATEGORY.value, resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName());
+ return metadata;
+ }
+
+ public static Map<String, String> convertResourceNodeTemplateMetadataToMap(ComponentInstance componentInstance) throws Exception{
+
+ Resource resource = AtomicOperationUtils.getResourceObject(componentInstance.getComponentUid());
+ Map<String, String> metadata = new HashMap<>();
+
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.CATEGORY.value, resource.getCategories().get(0).getName());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.DESCRIPTION.value, resource.getDescription());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.INVARIANT_UUID.value, resource.getInvariantUUID());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.TYPE.value, resource.getResourceType().toString());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.UUID.value, resource.getUUID());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.NAME.value, resource.getName());
+
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.RESOURCE_VENDOR_NAME.value, resource.getVendorName());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.RESOURCE_VENDOR_MODEL_NUMBER.value, resource.getResourceVendorModelNumber());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.RESOURCE_VENDOR_RELEASE.value, resource.getVendorRelease());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.SUBCATEGORY.value, resource.getCategories().get(0).getSubcategories().get(0).getName());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.CUSTOMIZATION_UUID.value, componentInstance.getCustomizationUUID());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.VERSION.value, componentInstance.getComponentVersion());
+
+ return metadata;
+
+ }
+ public static Map<String, String> generateServiceNodeTemplateMetadataToExpectedObject(ResourceReqDetails resourceReqDetails, Component component, ComponentInstance componentInstanceDefinition) {
+
+ Map<String, String> metadata = convertResourceMetadataToMap(resourceReqDetails, component);
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.CUSTOMIZATION_UUID.value, componentInstanceDefinition.getCustomizationUUID());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.VERSION.value, componentInstanceDefinition.getComponentVersion());
+
+ return metadata;
+ }
+
+ public static Map<String, Map<String, String>> generateResourceNodeTemplateMetadataToExpectedObject(Component component) throws Exception {
+
+ Map<String, Map<String, String>> resourcesNodeTemplateMetadataMap = new HashMap<>();
+ if(component.getComponentInstances() != null && component.getComponentInstances().size() != 0){
+ for (ComponentInstance componentInstance:component.getComponentInstances()){
+ Map<String, String> metadata = convertResourceNodeTemplateMetadataToMap(componentInstance);
+ resourcesNodeTemplateMetadataMap.put(componentInstance.getName(), metadata);
+ }
+ }
+ return resourcesNodeTemplateMetadataMap;
+ }
+
+ public static Map<String, String> generateServiceMetadataToExpectedObject(ServiceReqDetails serviceReqDetails, Component component) {
+
+ Map<String, String> metadata = new HashMap<>();
+
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.CATEGORY.value, serviceReqDetails.getCategories().get(0).getName());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.DESCRIPTION.value, serviceReqDetails.getDescription());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.INVARIANT_UUID.value, component.getInvariantUUID());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.TYPE.value, "Service");
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.UUID.value, component.getUUID());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.NAME.value, component.getName());
+
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.SERVICE_TYPE.value, serviceReqDetails.getServiceType());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.SERVICE_ROLE.value, serviceReqDetails.getServiceRole());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.NAMING_POLICY.value, serviceReqDetails.getNamingPolicy());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.ECOMP_GENERATED_NAMING.value, serviceReqDetails.getEcompGeneratedNaming().toString());
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.SERVICE_ECOMP_NAMING.value, serviceReqDetails.getEcompGeneratedNaming().toString());//equals to ECOMP_GENERATED_NAMING
+
+ return metadata;
+ }
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
index 8763d677dd..730cc1ce56 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
@@ -107,7 +107,7 @@ public class Vf extends SetupCDTest {
// create Resource
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(resourceMetaData, getUser());
+ ResourceUIUtils.createVF(resourceMetaData, getUser());
// update Resource
ResourceReqDetails updatedResource = new ResourceReqDetails();
@@ -144,7 +144,7 @@ public class Vf extends SetupCDTest {
reloginWithNewRole(UserRoleEnum.DESIGNER);
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
CanvasManager canvasManager = CanvasManager.getCanvasManager();
@@ -168,7 +168,7 @@ public class Vf extends SetupCDTest {
@Test
public void addUpdateDeleteDeploymentArtifactToVfTest() throws Exception {
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
@@ -199,7 +199,7 @@ public class Vf extends SetupCDTest {
@Test
public void addUpdateDeleteInformationalArtifact() throws Exception {
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
@@ -233,7 +233,7 @@ public class Vf extends SetupCDTest {
ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
@@ -274,7 +274,7 @@ public class Vf extends SetupCDTest {
ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
vfCanvasManager = CanvasManager.getCanvasManager();
CompositionPage.searchForElement(atomicResourceMetaData.getName());
@@ -314,7 +314,7 @@ public class Vf extends SetupCDTest {
@Test(enabled = false)
public void addUpdateDeleteSimplePropertiesToVfTest() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
@@ -340,7 +340,7 @@ public class Vf extends SetupCDTest {
@Test(enabled = false)
public void vfcInstancesInputScreenTest() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
@@ -380,7 +380,7 @@ public class Vf extends SetupCDTest {
public void addAllInformationalArtifactPlaceholdersInVfTest() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
@@ -394,7 +394,7 @@ public class Vf extends SetupCDTest {
@Test
public void verifyToscaArtifactsExist() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
final int numOfToscaArtifacts = 2;
ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
@@ -429,7 +429,7 @@ public class Vf extends SetupCDTest {
@Test
public void vfCertificationTest() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
String vfName = vfMetaData.getName();
@@ -452,7 +452,7 @@ public class Vf extends SetupCDTest {
@Test
public void deleteVfCheckedoutTest() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
GeneralPageElements.clickTrashButtonAndConfirm();
@@ -463,7 +463,7 @@ public class Vf extends SetupCDTest {
@Test
public void revertVfMetadataTest() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceReqDetails vfRevertDetails = new ResourceReqDetails();
vfRevertDetails.setName("ciUpdatedName");
@@ -482,7 +482,7 @@ public class Vf extends SetupCDTest {
@Test
public void addDeploymentArtifactInCompositionScreenTest() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
@@ -499,7 +499,7 @@ public class Vf extends SetupCDTest {
@Test(enabled = false)
public void addPropertyInCompositionScreenTest() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
@@ -515,7 +515,7 @@ public class Vf extends SetupCDTest {
@Test
public void addDeploymentArtifactAndVerifyInCompositionScreen() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
@@ -537,7 +537,7 @@ public class Vf extends SetupCDTest {
@Test
public void checkoutVfTest() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
@@ -566,7 +566,7 @@ public class Vf extends SetupCDTest {
@Test
public void deleteInstanceFromVfCanvas() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
@@ -582,7 +582,7 @@ public class Vf extends SetupCDTest {
@Test
public void changeInstanceNameInVfTest() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
@@ -605,7 +605,7 @@ public class Vf extends SetupCDTest {
ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
CanvasManager canvasManager = CanvasManager.getCanvasManager();
CompositionPage.searchForElement(atomicResourceMetaData.getName());
@@ -628,7 +628,7 @@ public class Vf extends SetupCDTest {
@Test
public void isDisabledAndReadOnlyInCheckin() throws Exception{
ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
@@ -660,7 +660,7 @@ public class Vf extends SetupCDTest {
OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue());
- File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
ToscaDefinition toscaDefinition = VfModuleVerificator.getToscaTemplate(latestFilefromDir.getAbsolutePath());
VfModuleVerificator.validateSpecificModulePropertiesFromFile(toscaDefinition);
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
index 86e81df0bb..2faeedc15b 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
@@ -194,7 +194,7 @@ public class VfArtifacts extends SetupCDTest{
if (DeploymentArtifactPage.getArtifactType(deploymentArtifcatsList.get(i)).equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) {
DeploymentArtifactPage.clickDownloadEnvArtifact(deploymentArtifcatsList.get(i));
GeneralUIUtils.ultimateWait();
- File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(downloadDirPath);
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir(downloadDirPath);
ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir, currentZipEnvfiles.get(deploymentArtifcatsList.get(i)), PARAMETERS);
}
}
@@ -218,7 +218,7 @@ public class VfArtifacts extends SetupCDTest{
if (DeploymentArtifactPage.getArtifactType(deploymentArtifcatsList.get(i)).equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) {
DeploymentArtifactPage.clickDownloadEnvArtifact(deploymentArtifcatsList.get(i));
GeneralUIUtils.ultimateWait();
- File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(downloadDirPath);
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir(downloadDirPath);
ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir,currentZipEnvfiles.get(deploymentArtifcatsList.get(i)), PARAMETERS);
}
}
@@ -243,7 +243,7 @@ public class VfArtifacts extends SetupCDTest{
if (GeneralUIUtils.isElementVisibleByTestId(GeneralUIUtils.getDataTestIdAttributeValue(deploymentArtifcatsList.get(i)))) {
CompositionPage.clickDownloadEnvArtifactComposition(fileName).click();
GeneralUIUtils.ultimateWait();
- File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(downloadDirPath);
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir(downloadDirPath);
ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir,currentZipEnvfiles.get(fileName), PARAMETERS);
}
}
@@ -290,7 +290,7 @@ public class VfArtifacts extends SetupCDTest{
for (HeatParameterDataDefinition param : heatEnvUpdatedParameters.get(i).getHeatParameterDefinition()) {
mapExpectedProperties.put(param.getName(), ArtifactUIUtils.getValue(param));
}
- ArtifactUIUtils.compareYamlParametersByPattern(mapExpectedProperties, FileHandling.getLastModifiedFileFromDir(downloadDirPath), PARAMETERS);
+ ArtifactUIUtils.compareYamlParametersByPattern(mapExpectedProperties, FileHandling.getLastModifiedFileNameFromDir(downloadDirPath), PARAMETERS);
}
}
}
@@ -306,7 +306,7 @@ public class VfArtifacts extends SetupCDTest{
GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
for(Entry<String, File> envFileEntry : generatedEnvFileList.entrySet()){
GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
- ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileFromDir(), PARAMETERS);
+ ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileNameFromDir(), PARAMETERS);
if(true){
throw new SkipException("Test skipped, new artifact version design should be developed");
}
@@ -331,7 +331,7 @@ public class VfArtifacts extends SetupCDTest{
for(Entry<String, File> envFileEntry : generatedUpdatedEnvFileList.entrySet()){
// TODO test will pass on case all objects on deployment view are visible
GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
- ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileFromDir(), PARAMETERS);
+ ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileNameFromDir(), PARAMETERS);
if(true){
throw new SkipException("Test skipped, new artifact version design should be developed");
}
@@ -357,7 +357,7 @@ public class VfArtifacts extends SetupCDTest{
GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
for(Entry<String, File> envFileEntry : generatedUpdatedSecondTimeEnvFileList.entrySet()){
GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
- ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileFromDir(), PARAMETERS);
+ ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileNameFromDir(), PARAMETERS);
if(true){
throw new SkipException("Test skipped, new artifact version design should be developed");
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
index 10ae6cba7a..21aa5720a0 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
@@ -159,7 +159,8 @@ public abstract class SetupCDTest extends DriverFactory {
public void setBrowserBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception {
boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty();
- if (emptyDataProvider) {
+ String className = method.getDeclaringClass().getName();
+ if (emptyDataProvider && !className.contains("ToscaValidationTest") ) {
System.out.println("ExtentReport instance started from BeforeMethod...");
String suiteName = ExtentManager.getSuiteName(context);
if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) {
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java
index 9caeee8f9f..ae86923396 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java
@@ -104,7 +104,7 @@ public class HomePage extends GeneralPageElements {
public static File downloadVspCsarToDefaultDirectory(String vspName) throws Exception {
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
DownloadManager.downloadCsarByNameFromVSPRepository(vspName, "");
- File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
return latestFilefromDir;
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java
index c06a51ce91..1abae858e3 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java
@@ -478,7 +478,7 @@ public final class ArtifactUIUtils {
String heatDisplayName = pairToUpdate.getHeatArtifactDisplayName();
GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+heatDisplayName);
- File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
String pattern = PARAMETERS;
Map<String, Object> mapUpdetedEnvFile = FileHandling.parseYamlFileToMapByPattern(updateEnvFile, pattern);
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java
index ceada39b04..f4264ffdea 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java
@@ -68,8 +68,11 @@ public class DownloadManager {
* @param vspName
* @throws Exception
*/
- public static void downloadCsarByNameFromVSPRepository(String vspName, String vspId) throws Exception{
- FileHandling.cleanCurrentDownloadDir();
+ public static void downloadCsarByNameFromVSPRepository(String vspName, String vspId, Boolean isDelete) throws Exception{
+
+ if(isDelete){
+ FileHandling.cleanCurrentDownloadDir();
+ }
HomePage.showVspRepository();
boolean vspFound = HomePage.searchForVSP(vspName);
if (vspFound){
@@ -88,6 +91,10 @@ public class DownloadManager {
}
}
+ public static void downloadCsarByNameFromVSPRepository(String vspName, String vspId) throws Exception{
+ downloadCsarByNameFromVSPRepository(vspName, vspId, true);
+ }
+
// AttFtpClient instance = AttFtpClient.getInstance();
//
// String server = "localhost";
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
index 4fe1938af8..8c2556d00a 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
@@ -264,11 +264,19 @@ public class FileHandling {
}
- public static synchronized File getLastModifiedFileFromDir() throws Exception{
- return getLastModifiedFileFromDir(SetupCDTest.getWindowTest().getDownloadDirectory());
+ /**
+ * @return last modified file name from default directory
+ * @throws Exception
+ */
+ public static synchronized File getLastModifiedFileNameFromDir() throws Exception{
+ return getLastModifiedFileNameFromDir(SetupCDTest.getWindowTest().getDownloadDirectory());
}
- public static synchronized File getLastModifiedFileFromDir(String dirPath){
+ /**
+ * @param dirPath
+ * @return last modified file name from dirPath directory
+ */
+ public static synchronized File getLastModifiedFileNameFromDir(String dirPath){
File dir = new File(dirPath);
File[] files = dir.listFiles();
if (files == null) {
@@ -397,7 +405,7 @@ public class FileHandling {
public static String getMD5OfFile(File file) throws IOException {
String content = FileUtils.readFileToString(file);
- String md5 = GeneralUtility.calculateMD5ByString(content);
+ String md5 = GeneralUtility.calculateMD5Base64EncodedByString(content);
return md5;
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtillViaApis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtillViaApis.java
new file mode 100644
index 0000000000..6abce99acb
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtillViaApis.java
@@ -0,0 +1,298 @@
+/*-
+ * ============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.openecomp.sdc.ci.tests.utilities;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.bouncycastle.util.encoders.Base64;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.api.Urls;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
+
+import com.clearspring.analytics.util.Pair;
+import com.google.gson.Gson;
+
+import fj.data.Either;
+
+public class OnboardingUtillViaApis {
+
+ protected static Map<String, String> prepareHeadersMap(String userId) {
+ Map<String, String> headersMap = new HashMap<String, String>();
+ headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");
+ headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json");
+ headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId);
+ return headersMap;
+ }
+
+ public static Pair<String, VendorSoftwareProductObject> createVspViaApis(String filepath, String vnfFile, User user) throws Exception {
+
+ VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject();
+
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(user);
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, user, amdocsLicenseMembers);
+ Map<String, String> map = createVendorSoftwareProduct.right;
+ vendorSoftwareProductObject.setAttContact(map.get("attContact"));
+ vendorSoftwareProductObject.setCategory(map.get("category"));
+ vendorSoftwareProductObject.setComponentId(map.get("componentId"));
+ vendorSoftwareProductObject.setDescription(map.get("description"));
+ vendorSoftwareProductObject.setSubCategory(map.get("subCategory"));
+ vendorSoftwareProductObject.setVendorName(map.get("vendorName"));
+ vendorSoftwareProductObject.setVspId(map.get("vspId"));
+ Pair<String, VendorSoftwareProductObject> pair = new Pair<String, VendorSoftwareProductObject>(createVendorSoftwareProduct.left, vendorSoftwareProductObject);
+ return pair;
+ }
+
+/* public static Resource createResourceFromVSP(Pair<String, Map<String, String>> createVendorSoftwareProduct, String vspName) throws Exception {
+ List<String> tags = new ArrayList<>();
+ tags.add(vspName);
+ Map<String, String> map = createVendorSoftwareProduct.right;
+ ResourceReqDetails resourceDetails = new ResourceReqDetails();
+ resourceDetails.setCsarUUID(map.get("vspId"));
+ resourceDetails.setCsarVersion("1.0");
+ resourceDetails.setName(vspName);
+ resourceDetails.setTags(tags);
+ resourceDetails.setDescription(map.get("description"));
+ resourceDetails.setResourceType(map.get("componentType"));
+ resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory());
+ resourceDetails.setVendorName(map.get("vendorName"));
+ resourceDetails.setVendorRelease("1.0");
+ resourceDetails.setResourceType("VF");
+ resourceDetails.setResourceVendorModelNumber("666");
+ resourceDetails.setContactId(map.get("attContact"));
+ resourceDetails.setIcon("defaulticon");
+ Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value();
+
+ return resource;
+ }*/
+ public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails, String vspName) throws Exception {
+// List<String> tags = new ArrayList<>();
+// tags.add(vspName);
+// Map<String, String> map = createVendorSoftwareProduct.right;
+// ResourceReqDetails resourceDetails = new ResourceReqDetails();
+// resourceDetails.setCsarUUID(map.get("vspId"));
+// resourceDetails.setCsarVersion("1.0");
+// resourceDetails.setName(vspName);
+// resourceDetails.setTags(tags);
+// resourceDetails.setDescription(map.get("description"));
+// resourceDetails.setResourceType(map.get("componentType"));
+// resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory());
+// resourceDetails.setVendorName(map.get("vendorName"));
+// resourceDetails.setVendorRelease("1.0");
+// resourceDetails.setResourceType("VF");
+// resourceDetails.setResourceVendorModelNumber("666");
+// resourceDetails.setContactId(map.get("attContact"));
+// resourceDetails.setIcon("defaulticon");
+ Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value();
+
+ return resource;
+ }
+ public static void downloadToscaCsarToDirectory(Component component, File file) {
+ try {
+ Either<String, RestResponse> componentToscaArtifactPayload = AtomicOperationUtils.getComponenetArtifactPayload(component, "assettoscacsar");
+ if(componentToscaArtifactPayload.left().value() != null){
+ convertPayloadToFile(componentToscaArtifactPayload.left().value(), file);
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+// public static void convertPayloadToFile(String payload, File file, boolean isBased64, boolean isSdcFormat) throws IOException{
+//
+// Gson gson = new Gson();
+// byte[] byteArray = null;
+// Map<String, String> fromJson;
+// @SuppressWarnings("unchecked")
+// String string = null;// = fromJson.get("base64Contents").toString();
+// if(isSdcFormat){
+// fromJson = gson.fromJson(payload, Map.class);
+// string = fromJson.get("base64Contents").toString();
+// }else if (isBased64) {
+// byteArray = Base64.decode(string.getBytes(StandardCharsets.UTF_8));
+// }else{
+// byteArray = payload.getBytes(StandardCharsets.UTF_8);
+// }
+// File downloadedFile = new File(file.getAbsolutePath());
+// FileOutputStream fos = new FileOutputStream(downloadedFile);
+// fos.write(byteArray);
+// fos.flush();
+// fos.close();
+//
+// }
+
+ public static void convertPayloadToFile(String payload, File file) throws IOException{
+
+ Gson gson = new Gson();
+ @SuppressWarnings("unchecked")
+ Map<String, String> fromJson = gson.fromJson(payload, Map.class);
+ String string = fromJson.get("base64Contents").toString();
+ byte[] byteArray = Base64.decode(string.getBytes(StandardCharsets.UTF_8));
+ File downloadedFile = new File(file.getAbsolutePath());
+ FileOutputStream fos = new FileOutputStream(downloadedFile);
+ fos.write(byteArray);
+ fos.flush();
+ fos.close();
+ }
+
+
+ public static void convertPayloadToZipFile(String payload, File file) throws IOException{
+
+ byte[] byteArray = payload.getBytes(StandardCharsets.ISO_8859_1);
+ File downloadedFile = new File(file.getAbsolutePath());
+ FileOutputStream fos = new FileOutputStream(downloadedFile);
+ fos.write(byteArray);
+ fos.flush();
+ fos.close();
+
+
+// ZipOutputStream fos = null;
+//
+//
+// for (Charset charset : Charset.availableCharsets().values()) {
+// try{
+// // System.out.println("How to do it???");
+// File downloadedFile = new File(file.getAbsolutePath() + "_" + charset +".csar");
+// fos = new ZipOutputStream(new FileOutputStream(downloadedFile));
+// byte[] byteArray = payload.getBytes(charset);
+// fos.write(byteArray);
+// fos.flush();
+//
+// }
+// catch(Exception e){
+// fos.close();
+// }
+// }
+ System.out.println("");
+
+// ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(byteArray));
+// ZipEntry entry = null;
+// while ((entry = zipStream.getNextEntry()) != null) {
+//
+// String entryName = entry.getName();
+//
+// FileOutputStream out = new FileOutputStream(file+"/"+entryName);
+//
+// byte[] byteBuff = new byte[4096];
+// int bytesRead = 0;
+// while ((bytesRead = zipStream.read(byteBuff)) != -1)
+// {
+// out.write(byteBuff, 0, bytesRead);
+// }
+//
+// out.close();
+// zipStream.closeEntry();
+// }
+// zipStream.close();
+//
+
+
+
+ BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(payload.getBytes(StandardCharsets.ISO_8859_1)));
+ String filePath = file.toString();
+ BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(filePath)));
+ int inByte;
+ while((inByte = bis.read()) != -1) bos.write(inByte);
+ bis.close();
+ bos.close();
+ }
+
+ public static Either<String, RestResponse> getVendorSoftwareProduct(String vspId, User user, Boolean validateState) throws Exception {
+
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.GET_VENDOR_SOFTWARE_PRODUCT, config.getCatalogBeHost(), config.getCatalogBePort(), vspId);
+ String userId = user.getUserId();
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+ headersMap.put(HttpHeaderEnum.X_ECOMP_REQUEST_ID_HEADER.getValue(), "123456");
+ headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "*/*");
+ headersMap.put("Accept-Encoding", "gzip, deflate, br");
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendGet(url, headersMap);
+ if (validateState) {
+ assertTrue("add property to resource failed: " + response.getResponseMessage(), response.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+ if (response.getErrorCode() != BaseRestUtils.STATUS_CODE_SUCCESS && response.getResponse().getBytes() == null && response.getResponse().getBytes().length == 0) {
+ return Either.right(response);
+ }
+ return Either.left(response.getResponse());
+
+ }
+
+ public static ResourceReqDetails prepareOnboardedResourceDetailsBeforeCreate(VendorSoftwareProductObject vendorSoftwareProductObject, String vspName) {
+
+ List<String> tags = new ArrayList<>();
+ tags.add(vspName);
+ ResourceReqDetails resourceDetails = new ResourceReqDetails();
+ resourceDetails.setCsarUUID(vendorSoftwareProductObject.getVspId());
+ resourceDetails.setCsarVersion("1.0");
+ resourceDetails.setName(vspName);
+ resourceDetails.setTags(tags);
+ resourceDetails.setDescription(vendorSoftwareProductObject.getDescription());
+ resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory());
+ resourceDetails.setVendorName(vendorSoftwareProductObject.getVendorName());
+ resourceDetails.setVendorRelease("1.0");
+ resourceDetails.setResourceType("VF");
+ resourceDetails.setResourceVendorModelNumber("666");
+ resourceDetails.setContactId(vendorSoftwareProductObject.getAttContact());
+ resourceDetails.setIcon("defaulticon");
+
+ return resourceDetails;
+ }
+
+ public static ServiceReqDetails prepareServiceDetailsBeforeCreate(User user) {
+
+ ServiceReqDetails serviceDetails = ElementFactory.getDefaultService(ServiceCategoriesEnum.NETWORK_L4, user);
+ serviceDetails.setServiceType("MyServiceType");
+ serviceDetails.setServiceRole("MyServiceRole");
+ serviceDetails.setNamingPolicy("MyServiceNamingPolicy");
+ serviceDetails.setEcompGeneratedNaming(false);
+
+ return serviceDetails;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java
index 398e1f18db..b4f834a421 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java
@@ -56,6 +56,7 @@ import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
@@ -520,21 +521,6 @@ public class OnboardingUtils {
return new Pair<RestResponse, Map<String, String>>(response, vspMetadta);
}
-/* public static RestResponse getVendorSoftwareProduct(Map vspObject, User user) throws Exception {
- Config config = Utils.getConfig();
- String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/" + vspObject.get("vspId"),
- config.getCatalogBeHost(), config.getCatalogBePort());
-
- String userId = user.getUserId();
-
- Map<String, String> headersMap = prepareHeadersMap(userId);
- HttpRequest http = new HttpRequest();
-
- RestResponse response = http.httpsSendGet(url, headersMap);
-
- return response;
- }*/
-
public static RestResponse validateUpload(String vspid, User user) throws Exception {
Config config = Utils.getConfig();
String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate/process",
@@ -748,7 +734,7 @@ public class OnboardingUtils {
String vspName = createVendorSoftwareProduct.left;
DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId"));
- File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
ExtentTestActions.log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
HomePage.showVspRepository();
@@ -810,19 +796,19 @@ public class OnboardingUtils {
}
-enum SnmpTypeEnum{
- SNMP_POLL ("snmp"),
- SNMP_TRAP ("snmp-trap");
+ enum SnmpTypeEnum{
+ SNMP_POLL ("snmp"),
+ SNMP_TRAP ("snmp-trap");
+
+ private String value;
- private String value;
-
- public String getValue() {
- return value;
- }
-
- private SnmpTypeEnum(String value) {
- this.value = value;
- }
+ public String getValue() {
+ return value;
+ }
+ private SnmpTypeEnum(String value) {
+ this.value = value;
+ }
}
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java
index c76bf4b74a..1eaa626e94 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java
@@ -539,30 +539,41 @@ public final class ResourceUIUtils {
return getCreatedResource;
}
+ /**
+ * @deprecated Use {@link #createVF(ResourceReqDetails,User)} instead
+ */
public static void createResource(ResourceReqDetails resource, User user) throws Exception {
+ createVF(resource, user);
+ }
+
+ public static void createVF(ResourceReqDetails resource, User user) throws Exception {
ExtentTestActions.log(Status.INFO, "Going to create a new VF.");
+ createResource(resource, user, DataTestIdEnum.Dashboard.BUTTON_ADD_VF);
+ }
+
+ public static void createResource(ResourceReqDetails resource, User user, DataTestIdEnum.Dashboard button) {
WebElement addVFButton = null;
try {
GeneralUIUtils.ultimateWait();
try{
GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new");
- addVFButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+ addVFButton = GeneralUIUtils.getWebElementByTestID(button.getValue());
}
catch (Exception e){
File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resource.getName());
final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
- SetupCDTest.getExtendTest().log(Status.WARNING, "Add VF button is not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
+ SetupCDTest.getExtendTest().log(Status.WARNING, "Add button is not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
showButtonsADD();
- addVFButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+ addVFButton = GeneralUIUtils.getWebElementByTestID(button.getValue());
}
addVFButton.click();
GeneralUIUtils.ultimateWait();
}
catch (Exception e ) {
- SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on ADD VF button, retrying ... "));
+ SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on ADD button, retrying ... "));
GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new");
GeneralUIUtils.ultimateWait();
- GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue()).click();
+ GeneralUIUtils.getWebElementByTestID(button.getValue()).click();
GeneralUIUtils.ultimateWait();
}
fillResourceGeneralInformationPage(resource, user, true);
@@ -1140,4 +1151,9 @@ public final class ResourceUIUtils {
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s %s", textToClick, customizationFoLogLocal));
GeneralUIUtils.clickOnElementByText(textToClick);
}
+
+ public static void createPNF(ResourceReqDetails resource, User user) throws Exception {
+ ExtentTestActions.log(Status.INFO, "Going to create a new PNF.");
+ createResource(resource, user, DataTestIdEnum.Dashboard.BUTTON_ADD_PNF);
+ }
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ToscaValidation.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ToscaValidation.java
new file mode 100644
index 0000000000..5afb94fda1
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ToscaValidation.java
@@ -0,0 +1,125 @@
+package org.openecomp.sdc.ci.tests.verificator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.toscaparser.api.elements.Metadata;
+
+import com.aventstack.extentreports.Status;
+
+import fj.data.Either;
+
+public class ToscaValidation {
+
+
+ /**
+ * @param expectedToscaDefinition
+ * @param actualToscaDefinition
+ * @return true if all validation success else return error map
+ */
+ public static Either<Boolean, Map<String, Object>> resourceToscaMetadataValidator(ToscaDefinition expectedToscaDefinition, ToscaDefinition actualToscaDefinition){
+
+ SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate resource TOSCA metadata...");
+ Map<String, String> expectedMetadata = expectedToscaDefinition.getMetadata();
+ Map<String, String> actualMetadata = actualToscaDefinition.getMetadata();
+ Either<Boolean, Map<String, Object>> resourceToscaMetadataValidator = compareMapData(expectedMetadata, actualMetadata);
+ if(resourceToscaMetadataValidator.isLeft()){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Resource TOSCA metadata verification success");
+ }else{
+ SetupCDTest.getExtendTest().log(Status.ERROR, "Resource TOSCA metadata verification failed" + resourceToscaMetadataValidator.right().value());
+ }
+ return resourceToscaMetadataValidator;
+ }
+
+ public static Boolean resourceToscaNodeTemplateMetadataValidator(Map<String, Map<String, String>> expectedMetadata, ToscaDefinition actualToscaDefinition){
+ boolean isTestFailed = true;
+ for(String nodeTemplateName : expectedMetadata.keySet()){
+ Either<Boolean,Map<String,Object>> serviceToscaMetadataValidator = componentToscaNodeTemplateMetadataValidator(expectedMetadata.get(nodeTemplateName), actualToscaDefinition, nodeTemplateName, ComponentTypeEnum.RESOURCE);
+ if(serviceToscaMetadataValidator.left().value() == false){
+ isTestFailed = false;
+ }
+ }
+ return isTestFailed;
+ }
+
+ public static Either<Boolean, Map<String, Object>> serviceToscaMetadataValidator(Map<String, String> expectedMetadata, ToscaDefinition actualToscaDefinition){
+
+ SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate service TOSCA metadata...");
+ Map<String, String> actualMetadata = actualToscaDefinition.getMetadata();
+ Either<Boolean,Map<String,Object>> serviceToscaMetadataValidator = compareMapData(expectedMetadata, actualMetadata);
+ if(serviceToscaMetadataValidator.isLeft()){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Service TOSCA metadata verification success");
+ }else{
+ SetupCDTest.getExtendTest().log(Status.ERROR, "Service TOSCA metadata verification failed" + serviceToscaMetadataValidator.right().value().toString());
+ }
+ return serviceToscaMetadataValidator;
+ }
+
+ public static Either<Boolean, Map<String, Object>> componentToscaNodeTemplateMetadataValidator(Map<String, String> expectedMetadata, ToscaDefinition actualToscaDefinition, String nodeTemplateName, ComponentTypeEnum componentType){
+
+ SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate "+ componentType.getValue() + " node template TOSCA metadata...");
+ Map<String, String> actualMetadata = actualToscaDefinition.getTopology_template().getNode_templates().get(nodeTemplateName).getMetadata();
+ Either<Boolean,Map<String,Object>> componentToscaMetadataValidator = compareMapData(expectedMetadata, actualMetadata);
+ if(componentToscaMetadataValidator.isLeft()){
+ SetupCDTest.getExtendTest().log(Status.INFO, componentType.getValue() + " TOSCA node template metadata verification success");
+ }else{
+ SetupCDTest.getExtendTest().log(Status.ERROR, componentType.getValue() + " TOSCA node template metadata verification failed" + componentToscaMetadataValidator.right().value().toString());
+ }
+ return componentToscaMetadataValidator;
+ }
+
+ public static Either<Boolean, Map<String, Object>> serviceToscaMetadataValidatorAgainstParser(Map<String, String> expectedMetadata, Metadata actualMetadata){
+
+ SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate service TOSCA metadata...");
+
+ Either<Boolean,Map<String,Object>> serviceToscaMetadataValidator = compareMetadataUsingToscaParser(expectedMetadata, actualMetadata);
+ if(serviceToscaMetadataValidator.isLeft()){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Service TOSCA metadata verification vs. tosca parser success");
+ }else{
+ SetupCDTest.getExtendTest().log(Status.ERROR, "Service TOSCA metadata verification vs. tosca parser failed" + serviceToscaMetadataValidator.right().value().toString());
+ }
+ return serviceToscaMetadataValidator;
+ }
+
+
+ public static Either<Boolean, Map<String, Object>> compareMapData(Map<String, String> expectedMetadata, Map<String, String> actualMetadata) {
+ Either.left(false);
+ Map<String, Object> errorMap = new HashMap<>();
+ for(String key : expectedMetadata.keySet()){
+ boolean isError = compaireValue(expectedMetadata.get(key), actualMetadata.get(key));
+ if(!isError){
+ errorMap.put("Data key["+key+"]", "expected: " + expectedMetadata.get(key) + ", actual: " + actualMetadata.get(key));
+ }
+ }
+ if(errorMap != null && !errorMap.isEmpty()){
+ return Either.right(errorMap);
+ }
+ return Either.left(true);
+ }
+
+ public static Either<Boolean, Map<String, Object>> compareMetadataUsingToscaParser(Map<String, String> expectedMetadata, Metadata actualMetadata) {
+ Map<String, Object> errorMap = new HashMap<>();
+ for(String key : expectedMetadata.keySet()){
+ boolean isError = compaireValue(expectedMetadata.get(key), actualMetadata.getValue(key));
+ if(!isError){
+ errorMap.put("Data key["+key+"]", "expected: " + expectedMetadata.get(key) + ", actual: " + actualMetadata.getValue(key));
+ }
+ }
+ if(errorMap != null && !errorMap.isEmpty()){
+ return Either.right(errorMap);
+ }
+ return Either.left(true);
+ }
+
+ private static boolean compaireValue(String expected, String actual) {
+
+ return expected.equals(actual) ? true : false;
+
+ }
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java
index 7f01b86eaf..9426fc1cde 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java
@@ -38,7 +38,7 @@ import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsMetadataDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaServiceGroupsMetadataDefinition;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDefinition;
import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
@@ -75,7 +75,7 @@ public class VfModuleVerificator {
for (Map.Entry<String, ToscaGroupsTopologyTemplateDefinition> groupTopologyTemplateDefinition : groups.entrySet()) {
String key = groupTopologyTemplateDefinition.getKey();
GroupInstance groupInstanceObject = getGroupInstanceByKey(key, service);
- ToscaGroupsMetadataDefinition metadata = groupTopologyTemplateDefinition.getValue().getMetadata();
+ ToscaServiceGroupsMetadataDefinition metadata = groupTopologyTemplateDefinition.getValue().getMetadata();
assertNotNull("groupInstanceObject is null", groupInstanceObject);
assertTrue("expected vfModuleModelName " + groupInstanceObject.getGroupName() + ", actual " + metadata.getVfModuleModelName(), groupInstanceObject.getGroupName().equals(metadata.getVfModuleModelName()));
assertTrue("expected vfModuleModelInvariantUUID " + groupInstanceObject.getInvariantUUID() + ", actual " + metadata.getVfModuleModelInvariantUUID(), groupInstanceObject.getInvariantUUID().equals(metadata.getVfModuleModelInvariantUUID()));
diff --git a/ui-ci/src/main/resources/ci/testSuites/toscaValidationSuite.xml b/ui-ci/src/main/resources/ci/testSuites/toscaValidationSuite.xml
new file mode 100644
index 0000000000..6114517c8f
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/testSuites/toscaValidationSuite.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="uitests" configfailurepolicy="continue" parallel="instances" thread-count="2" data-provider-thread-count="2">
+ <parameter name="makeDistribution" value="false"/>
+
+ <test name="OnbordingDataProviders">
+ <classes>
+
+ <class name="org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders">
+ <methods>
+ <include name="OnbordingDataProviders"/>
+ <!-- <exclude name="onboardVNFShotFlow"/>
+ <exclude name="onboardRandomVNFsTest"/> -->
+ </methods>
+ </class>
+ <!-- <class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard">
+ <methods>
+ <include name="onboardRandomVNFsTest"/>
+ </methods>
+ </class> -->
+
+ </classes>
+ </test> <!-- uitests -->
+</suite> <!-- uisuite --> \ No newline at end of file