summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--asdc-tests/pom.xml4
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java2
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java2
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/CRUDExternalAPI.java2
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java6
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java2
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java4
-rw-r--r--asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java2
-rw-r--r--asdctool/pom.xml4
-rw-r--r--catalog-be/pom.xml5
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java12
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java155
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java16
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertor.java11
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java6
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java8
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java2
-rw-r--r--catalog-dao/pom.xml5
-rw-r--r--catalog-model/pom.xml4
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java50
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java8
-rw-r--r--catalog-ui/src/app/models/component-metadata.ts4
-rw-r--r--catalog-ui/src/app/models/components/service.ts3
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts16
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html1
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general.less2
-rw-r--r--catalog-ui/src/app/view-models/workspace/workspace-view.html8
-rw-r--r--catalog-ui/src/app/view-models/workspace/workspace.less6
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java4
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java9
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java9
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java2
-rw-r--r--pom.xml8
-rw-r--r--sdc-os-chef/pom.xml11
-rw-r--r--test-apis-ci/pom.xml14
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java176
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java152
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestActions.java111
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestManager.java14
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java2
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java72
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java56
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceReqDetails.java25
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java37
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java102
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java2
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java2
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java4
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java2
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java126
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java59
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupsTopologyTemplateDefinition.java6
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaImportsDefinition.java22
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java8
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaMetadataDefinition.java196
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaServiceGroupsMetadataDefinition.java (renamed from test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupsMetadataDefinition.java)4
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/model/ToscaMetadataFieldsPresentationEnum.java74
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java11
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java51
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java4
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java542
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java293
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java799
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java88
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java4
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java2
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/CRUDExternalAPI.java2
-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
106 files changed, 4454 insertions, 583 deletions
diff --git a/.gitignore b/.gitignore
index 5cf5bb213b..631577ffa1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -160,3 +160,4 @@ common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-cor
/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/logback.xml
/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/logback.xml
+sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/testSuites/*
diff --git a/asdc-tests/pom.xml b/asdc-tests/pom.xml
index de800cfcf7..266ad36903 100644
--- a/asdc-tests/pom.xml
+++ b/asdc-tests/pom.xml
@@ -226,8 +226,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>
<exclusions>
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
index 7e363202bb..1f578d108c 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
@@ -311,7 +311,7 @@ public class ArtifactServletTest extends ComponentBaseTest {
httppost.addHeader(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
httppost.addHeader(HttpHeaderEnum.USER_ID.getValue(), sdncUserDetails.getUserId());
if (addMd5Header) {
- httppost.addHeader(HttpHeaderEnum.Content_MD5.getValue(), GeneralUtility.calculateMD5ByString(jsonBody));
+ httppost.addHeader(HttpHeaderEnum.Content_MD5.getValue(), GeneralUtility.calculateMD5Base64EncodedByString(jsonBody));
}
StringEntity input = new StringEntity(jsonBody);
input.setContentType("application/json");
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java
index e4c89bee94..65c0bba6a0 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java
@@ -620,7 +620,7 @@ artifact.setArtifactLabel("configure");*/
httppost.addHeader(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
httppost.addHeader(HttpHeaderEnum.USER_ID.getValue(), sdncUserDetails.getUserId());
if (addMd5Header) {
- httppost.addHeader(HttpHeaderEnum.Content_MD5.getValue(), GeneralUtility.calculateMD5ByString(jsonBody));
+ httppost.addHeader(HttpHeaderEnum.Content_MD5.getValue(), GeneralUtility.calculateMD5Base64EncodedByString(jsonBody));
}
StringEntity input = new StringEntity(jsonBody);
input.setContentType("application/json");
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/CRUDExternalAPI.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/CRUDExternalAPI.java
index 4a4e5a4529..45dbf315fb 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/CRUDExternalAPI.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/CRUDExternalAPI.java
@@ -3474,7 +3474,7 @@ public class CRUDExternalAPI extends ComponentBaseTest {
httppost.addHeader(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
httppost.addHeader(HttpHeaderEnum.USER_ID.getValue(), sdncUserDetails.getUserId());
if (addMd5Header) {
- httppost.addHeader(HttpHeaderEnum.Content_MD5.getValue(), GeneralUtility.calculateMD5ByString(jsonBody));
+ httppost.addHeader(HttpHeaderEnum.Content_MD5.getValue(), GeneralUtility.calculateMD5Base64EncodedByString(jsonBody));
}
StringEntity input = new StringEntity(jsonBody);
input.setContentType("application/json");
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
index 255dfd9de2..4dbc374e35 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
@@ -213,7 +213,7 @@ public class DistributionDownloadArtifactTest extends ComponentBaseTest {
AssertJUnit.assertEquals(artifactDetails.getPayload(), Base64.encodeBase64String(actualContents.getBytes()));
// validating checksum
- String actualPayloadChecksum = GeneralUtility.calculateMD5ByByteArray(actualContents.getBytes());
+ String actualPayloadChecksum = GeneralUtility.calculateMD5Base64EncodedByByteArray(actualContents.getBytes());
AssertJUnit.assertEquals(expectedPayloadChecksum, actualPayloadChecksum);
// validate audit
@@ -381,7 +381,7 @@ public class DistributionDownloadArtifactTest extends ComponentBaseTest {
// validating checksum
byte[] bytes = actualContents.getBytes();
- String actualPayloadChecksum = GeneralUtility.calculateMD5ByByteArray(bytes);
+ String actualPayloadChecksum = GeneralUtility.calculateMD5Base64EncodedByByteArray(bytes);
assertEquals(expectedPayloadChecksum, actualPayloadChecksum);
// validating valid zip
@@ -576,7 +576,7 @@ public class DistributionDownloadArtifactTest extends ComponentBaseTest {
// validating checksum
byte[] bytes = actualContents.getBytes();
- String actualPayloadChecksum = GeneralUtility.calculateMD5ByByteArray(bytes);
+ String actualPayloadChecksum = GeneralUtility.calculateMD5Base64EncodedByByteArray(bytes);
AssertJUnit.assertEquals(expectedPayloadChecksum, actualPayloadChecksum);
// validating valid zip
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
index 56841e1c5d..61c846242c 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
@@ -184,7 +184,7 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
+ " \"icon\": \"router\",\r\n" + " \"tags\": [\r\n" + " \"importResource4test\"\r\n" + " ],\r\n"
+ " \"payloadData\": \"" + encodedPayload + "\"\r\n" + "}";
- String md5 = GeneralUtility.calculateMD5ByString(json);
+ String md5 = GeneralUtility.calculateMD5Base64EncodedByString(json);
Map<String, String> headers = new HashMap<String, String>();
headers.put(Constants.MD5_HEADER, md5);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java
index b17deb3756..a47477f363 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java
@@ -86,7 +86,7 @@ public class ResourceRestUtils extends BaseRestUtils {
Gson gson = new Gson();
String userBodyJson = gson.toJson(resourceDetails);
- String calculateMD5 = GeneralUtility.calculateMD5ByString(userBodyJson);
+ String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson);
headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5);
HttpRequest http = new HttpRequest();
// System.out.println(url);
@@ -508,7 +508,7 @@ public class ResourceRestUtils extends BaseRestUtils {
Gson gson = new Gson();
String userBodyJson = gson.toJson(resourceDetails);
- String calculateMD5 = GeneralUtility.calculateMD5ByString(userBodyJson);
+ String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson);
headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5);
HttpRequest http = new HttpRequest();
RestResponse updateResourceResponse = http.httpSendPut(url, userBodyJson, headersMap);
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java
index 10f573cf0e..19d7d728fe 100644
--- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java
+++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java
@@ -48,7 +48,7 @@ public class ResourceRestUtilsExternalAPI extends BaseRestUtils {
Gson gson = new Gson();
String userBodyJson = gson.toJson(resourceDetails);
- String calculateMD5 = GeneralUtility.calculateMD5ByString(userBodyJson);
+ String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson);
headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5);
headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), authorizationHeader);
headersMap.put(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
diff --git a/asdctool/pom.xml b/asdctool/pom.xml
index 633360d8f8..410e852f8f 100644
--- a/asdctool/pom.xml
+++ b/asdctool/pom.xml
@@ -269,8 +269,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>
<exclusions>
diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml
index 6d34402ac5..8b638e84d7 100644
--- a/catalog-be/pom.xml
+++ b/catalog-be/pom.xml
@@ -320,9 +320,8 @@
</dependency>
<dependency>
- <groupId>com.thinkaurelius.titan</groupId>
- <artifactId>titan-cassandra</artifactId>
- <!--<artifactId>asdc-titan-cassandra</artifactId>-->
+ <groupId>org.openecomp.sdc.sdc-titan-cassandra</groupId>
+ <artifactId>sdc-titan-cassandra</artifactId>
<version>${titan.version}</version>
<scope>compile</scope>
<exclusions>
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
index 61f0c02d10..74bb55b63d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
@@ -355,7 +355,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
}
byte[] decodedPayload = artifactDefinition.getPayloadData();
artifactDefinition.setEsId(artifactDefinition.getUniqueId());
- artifactDefinition.setArtifactChecksum(GeneralUtility.calculateMD5ByByteArray(decodedPayload));
+ artifactDefinition.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(decodedPayload));
return lockComponentAndUpdateArtifact(component.getUniqueId(), artifactDefinition, AuditingActionEnum.ARTIFACT_PAYLOAD_UPDATE, artifactDefinition.getUniqueId(), user, component.getComponentType(), component, decodedPayload, null, null,
shouldLock, inTransaction);
@@ -1007,7 +1007,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
private Either<Boolean, ResponseFormat> validateMd5(String origMd5, String originData, byte[] payload, ArtifactOperationInfo operation) {
if (origMd5 != null) {
- String encodeBase64Str = GeneralUtility.calculateMD5ByString(originData);
+ String encodeBase64Str = GeneralUtility.calculateMD5Base64EncodedByString(originData);
if (false == encodeBase64Str.equals(origMd5)) {
log.debug("The calculated md5 is different then the received one");
@@ -2754,7 +2754,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
return Either.right(responseFormat);
}
- String checkSum = GeneralUtility.calculateMD5ByByteArray(decodedPayload);
+ String checkSum = GeneralUtility.calculateMD5Base64EncodedByByteArray(decodedPayload);
artifactInfo.setArtifactChecksum(checkSum);
log.trace("Calculated checksum, base64 payload: {}, checksum: {}", payload, checkSum);
@@ -3642,7 +3642,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
return Either.right(artifactDataRes.right().value());
}
- String newCheckSum = GeneralUtility.calculateMD5ByByteArray(artifactData.getDataAsArray());
+ String newCheckSum = GeneralUtility.calculateMD5Base64EncodedByByteArray(artifactData.getDataAsArray());
String oldCheckSum;
String esArtifactId = artifactDefinition.getEsId();
Either<ESArtifactData, CassandraOperationStatus> artifactfromES;
@@ -3657,7 +3657,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
return Either.right(componentsUtils.getResponseFormatByArtifactId(actionStatus, artifactDefinition.getArtifactDisplayName()));
}
esArtifactData = artifactfromES.left().value();
- oldCheckSum = GeneralUtility.calculateMD5ByByteArray(esArtifactData.getDataAsArray());
+ oldCheckSum = GeneralUtility.calculateMD5Base64EncodedByByteArray(esArtifactData.getDataAsArray());
} else {
oldCheckSum = artifactDefinition.getArtifactChecksum();
@@ -4696,7 +4696,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
try {
for (ArtifactDefinition artifact : artifactsToHandle) {
originData = buildJsonStringForCsarVfcArtifact(artifact);
- origMd5 = GeneralUtility.calculateMD5ByString(originData);
+ origMd5 = GeneralUtility.calculateMD5Base64EncodedByString(originData);
actionResult = handleArtifactRequest(component.getUniqueId(), user.getUserId(), componentType, operation, artifact.getUniqueId(), artifact, origMd5, originData, null, null, null, null, shouldLock, inTransaction);
if (actionResult.isRight()) {
log.debug("Failed to upload artifact to component with type {} and name {}. Status is {}. ", componentType, component.getName(), actionResult.right().value());
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java
index 3d280ab7ca..8198ef3d85 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java
@@ -307,7 +307,7 @@ public class CsarValidationUtils {
return Either.right(toscaYamlRes.right().value());
}
- String newCheckSum = GeneralUtility.calculateMD5ByByteArray(toscaYamlRes.left().value().getRight().getBytes());
+ String newCheckSum = GeneralUtility.calculateMD5Base64EncodedByByteArray(toscaYamlRes.left().value().getRight().getBytes());
return Either.left(newCheckSum);
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
index 8fd28e1224..ba26576648 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
@@ -82,12 +82,12 @@ import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceInput;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.ComponentParametersView;
+import org.openecomp.sdc.be.model.CsarInfo;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.GroupProperty;
import org.openecomp.sdc.be.model.GroupTypeDefinition;
import org.openecomp.sdc.be.model.HeatParameterDefinition;
-import org.openecomp.sdc.be.model.CsarInfo;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.InterfaceDefinition;
import org.openecomp.sdc.be.model.LifeCycleTransitionEnum;
@@ -148,13 +148,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.WebApplicationContext;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.parser.ParserException;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import fj.data.Either;
-import org.yaml.snakeyaml.parser.ParserException;
@org.springframework.stereotype.Component("resourceBusinessLogic")
public class ResourceBusinessLogic extends ComponentBusinessLogic {
@@ -624,7 +624,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
preparedResource = createResourcesInstancesEither.left().value();
- createResourcesInstancesEither = createResourceInstancesRelations(csarInfo.getModifier(), yamlFileName, preparedResource, instances, inTransaction, shouldLock);
+ createResourcesInstancesEither = createResourceInstancesRelations(csarInfo.getModifier(), yamlFileName, preparedResource, instances);
if (createResourcesInstancesEither.isRight()) {
log.debug("failed to create relation between resource instances status is {}", createResourcesInstancesEither.right().value());
result = Either.right(createResourcesInstancesEither.right().value());
@@ -779,7 +779,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
if (!foundArtifact.getArtifactChecksum().equals(currNewArtifact.getArtifactChecksum())) {
foundArtifact.setPayload(currNewArtifact.getPayloadData());
foundArtifact.setPayloadData(Base64.encodeBase64String(currNewArtifact.getPayloadData()));
- foundArtifact.setArtifactChecksum(GeneralUtility.calculateMD5ByByteArray(currNewArtifact.getPayloadData()));
+ foundArtifact.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(currNewArtifact.getPayloadData()));
artifactsToUpdate.add(foundArtifact);
}
existingArtifacts.remove(foundArtifact.getArtifactLabel());
@@ -1461,7 +1461,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
String nameWithouNamespacePrefix = nodeName.substring(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX.length());
String[] findTypes = nameWithouNamespacePrefix.split("\\.");
String resourceType = findTypes[0];
- return resourceVfName + "-" + nameWithouNamespacePrefix.substring(resourceType.length() + 1);
+ return resourceVfName + "-" + nameWithouNamespacePrefix.substring(resourceType.length() + 1) + "Cvfc";
}
private Either<Resource, ResponseFormat> createResourceAndRIsFromYaml(String yamlName, Resource resource, ParsedToscaYamlInfo parsedToscaYamlInfo, AuditingActionEnum actionEnum, boolean isNormative,
@@ -1633,7 +1633,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
List<GroupDefinition> groupsToCreate = new ArrayList<GroupDefinition>();
if (groupsFromResource != null && !groupsFromResource.isEmpty()) {
for (GroupDefinition group : groupsAsList) {
- Optional<GroupDefinition> op = groupsFromResource.stream().filter(p -> p.getName().equals(group.getName())).findAny();
+ Optional<GroupDefinition> op = groupsFromResource.stream().filter(p -> p.getName().equalsIgnoreCase(group.getName())).findAny();
if (op.isPresent()) {
GroupDefinition groupToUpdate = op.get();
groupToUpdate.setMembers(group.getMembers());
@@ -1643,7 +1643,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
}
for (GroupDefinition group : groupsFromResource) {
- Optional<GroupDefinition> op = groupsAsList.stream().filter(p -> p.getName().equals(group.getName())).findAny();
+ Optional<GroupDefinition> op = groupsAsList.stream().filter(p -> p.getName().equalsIgnoreCase(group.getName())).findAny();
if (!op.isPresent() && (group.getArtifacts() == null || group.getArtifacts().isEmpty())) {
groupsToDelete.add(group);
@@ -1651,7 +1651,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
} else
- groupsToCreate.addAll(groupsAsList);
+ groupsToCreate.addAll(groupsAsList);
Either<List<GroupDefinition>, ResponseFormat> prepareGroups = null;
if (!groupsToCreate.isEmpty()) {
@@ -1886,7 +1886,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
resource = createResourcesInstancesEither.left().value();
log.debug("************* Going to create all relations {}", yamlName);
- createResourcesInstancesEither = createResourceInstancesRelations(csarInfo.getModifier(), yamlName, resource, uploadComponentInstanceInfoMap, true, false);
+ createResourcesInstancesEither = createResourceInstancesRelations(csarInfo.getModifier(), yamlName, resource, uploadComponentInstanceInfoMap);
log.debug("************* Finished to create all relations {}", yamlName);
@@ -2087,7 +2087,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
String jsonStr = gson.toJson(json);
- String origMd5 = GeneralUtility.calculateMD5ByString(jsonStr);
+ String origMd5 = GeneralUtility.calculateMD5Base64EncodedByString(jsonStr);
ArtifactDefinition artifactDefinitionFromJson = RepresentationUtils.convertJsonToArtifactDefinition(jsonStr, ArtifactDefinition.class);
String artifactUniqueId = artifactDefinitionFromJson == null ? null : artifactDefinitionFromJson.getUniqueId();
Either<Either<ArtifactDefinition, Operation>, ResponseFormat> uploadArtifactToService = artifactsBusinessLogic.validateAndHandleArtifact(resource.getUniqueId(), ComponentTypeEnum.RESOURCE, operation, artifactUniqueId,
@@ -2416,7 +2416,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
for (ArtifactDefinition createdArtifact : createdDeplymentArtifactsAfterDelete) {
if (artifactTemplate.getFileName().equalsIgnoreCase(createdArtifact.getArtifactName())) {
arifactsUids.add(createdArtifact.getUniqueId());
- arifactsUuids.add(createdArtifact.getUniqueId());
+ arifactsUuids.add(createdArtifact.getArtifactUUID());
isCreate = false;
String heatEnvId = checkAndGetHeatEnvId(createdArtifact);
if (!heatEnvId.isEmpty()) {
@@ -2436,7 +2436,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
for (ArtifactDefinition createdNewArtifact : createdNewArtifacts) {
if (artifactTemplate.getFileName().equalsIgnoreCase(createdNewArtifact.getArtifactName())) {
arifactsUids.add(createdNewArtifact.getUniqueId());
- arifactsUuids.add(createdNewArtifact.getUniqueId());
+ arifactsUuids.add(createdNewArtifact.getArtifactUUID());
isCreate = false;
String heatEnvId = checkAndGetHeatEnvId(createdNewArtifact);
if (!heatEnvId.isEmpty()) {
@@ -2455,7 +2455,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
ArtifactDefinition createdArtifact = createArtifactEither.left().value();
arifactsUids.add(createdArtifact.getUniqueId());
- arifactsUuids.add(createdArtifact.getUniqueId());
+ arifactsUuids.add(createdArtifact.getArtifactUUID());
ArtifactTypeEnum artifactType = ArtifactTypeEnum.findType(createdArtifact.getArtifactType());
if (artifactType == ArtifactTypeEnum.HEAT || artifactType == ArtifactTypeEnum.HEAT_NET || artifactType == ArtifactTypeEnum.HEAT_VOL) {
Either<ArtifactDefinition, ResponseFormat> createHeatEnvPlaceHolder = artifactsBusinessLogic.createHeatEnvPlaceHolder(createdArtifact, ArtifactsBusinessLogic.HEAT_VF_ENV_NAME, resource.getUniqueId(), NodeTypeEnum.Resource,
@@ -3532,7 +3532,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
return Either.left(artifactTemplateInfoList);
}
- private Either<Resource, ResponseFormat> createResourceInstancesRelations(User user, String yamlName, Resource resource, Map<String, UploadComponentInstanceInfo> uploadResInstancesMap, boolean inTransaction, boolean needLock) {
+ private Either<Resource, ResponseFormat> createResourceInstancesRelations(User user, String yamlName, Resource resource, Map<String, UploadComponentInstanceInfo> uploadResInstancesMap) {
log.debug("createResourceInstancesRelations try to create relations ");
List<ComponentInstance> componentInstancesList = resource.getComponentInstances();
if (uploadResInstancesMap == null) {
@@ -3590,7 +3590,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
return Either.right(responseFormat);
}
String resourceInstanceId = currentCompInstance.getUniqueId();
- Resource originResource = null;
+ Resource originResource;
if (!originCompMap.containsKey(currentCompInstance.getComponentUid())) {
Either<Resource, StorageOperationStatus> getOriginResourceRes = toscaOperationFacade.getToscaFullElement(currentCompInstance.getComponentUid());
if (getOriginResourceRes.isRight()) {
@@ -3603,38 +3603,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
} else {
originResource = originCompMap.get(currentCompInstance.getComponentUid());
}
- if (originResource.getCapabilities() != null && !originResource.getCapabilities().isEmpty()) {
- Map<String, List<CapabilityDefinition>> originCapabilities ;
- if (MapUtils.isNotEmpty(uploadComponentInstanceInfo.getCapabilitiesNamesToUpdate()) && resource.getResourceType() == ResourceTypeEnum.CVFC) {
- originCapabilities = new HashMap<>();
- originResource.getCapabilities().entrySet().stream().forEach(e ->{
- List<CapabilityDefinition> list = e.getValue().stream().map(l -> new CapabilityDefinition(l)).collect(Collectors.toList());
- originCapabilities.put(e.getKey(), list);
- });
- for (List<CapabilityDefinition> capabilities : originCapabilities.values()) {
- capabilities.stream().filter(c -> uploadComponentInstanceInfo.getCapabilitiesNamesToUpdate().containsKey(c.getName())).forEach(c -> c.setName(uploadComponentInstanceInfo.getCapabilitiesNamesToUpdate().get(c.getName())));
- }
- }else{
- originCapabilities = originResource.getCapabilities();
- }
- instCapabilties.put(currentCompInstance, originCapabilities);
- }
- if (originResource.getRequirements() != null && !originResource.getRequirements().isEmpty()) {
- Map<String, List<RequirementDefinition>> originRequirements;
- if (MapUtils.isNotEmpty(uploadComponentInstanceInfo.getRequirementsNamesToUpdate()) && resource.getResourceType() == ResourceTypeEnum.CVFC) {
- originRequirements = new HashMap<>();
- originResource.getRequirements().entrySet().stream().forEach(e ->{
- List<RequirementDefinition> list = e.getValue().stream().map(l -> new RequirementDefinition(l)).collect(Collectors.toList());
- originRequirements.put(e.getKey(), list);
- });
- for (List<RequirementDefinition> requirements : originRequirements.values()) {
- requirements.stream().filter(r -> uploadComponentInstanceInfo.getRequirementsNamesToUpdate().containsKey(r.getName())).forEach(r -> r.setName(uploadComponentInstanceInfo.getRequirementsNamesToUpdate().get(r.getName())));
- }
- }else{
- originRequirements = originResource.getRequirements();
- }
- instRequirements.put(currentCompInstance, originRequirements);
- }
+ if (originResource.getCapabilities() != null && !originResource.getCapabilities().isEmpty())
+ instCapabilties.put(currentCompInstance, originResource.getCapabilities());
+ if (originResource.getRequirements() != null && !originResource.getRequirements().isEmpty())
+ instRequirements.put(currentCompInstance, originResource.getRequirements());
if (originResource.getDeploymentArtifacts() != null && !originResource.getDeploymentArtifacts().isEmpty())
instDeploymentArtifacts.put(resourceInstanceId, originResource.getDeploymentArtifacts());
if (originResource.getArtifacts() != null && !originResource.getArtifacts().isEmpty())
@@ -3711,16 +3683,16 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
parametersView.setIgnoreCapabilities(false);
parametersView.setIgnoreRequirements(false);
- Either<Resource, StorageOperationStatus> eitherGerResource = toscaOperationFacade.getToscaElement(resource.getUniqueId(), parametersView);
+ Either<Resource, StorageOperationStatus> eitherGetResource = toscaOperationFacade.getToscaElement(resource.getUniqueId(), parametersView);
- if (eitherGerResource.isRight()) {
- ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGerResource.right().value()), resource);
+ if (eitherGetResource.isRight()) {
+ ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGetResource.right().value()), resource);
return Either.right(responseFormat);
}
- resource = eitherGerResource.left().value();
+ resource = eitherGetResource.left().value();
for (Entry<String, UploadComponentInstanceInfo> entry : uploadResInstancesMap.entrySet()) {
UploadComponentInstanceInfo uploadComponentInstanceInfo = entry.getValue();
@@ -3755,15 +3727,88 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
log.debug("************* in create relations, getResource start");
- eitherGerResource = toscaOperationFacade.getToscaElement(resource.getUniqueId());
+ eitherGetResource = toscaOperationFacade.getToscaElement(resource.getUniqueId());
log.debug("************* in create relations, getResource end");
- if (eitherGerResource.isRight()) {
- ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGerResource.right().value()), resource);
+ if (eitherGetResource.isRight()) {
+ ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGetResource.right().value()), resource);
return Either.right(responseFormat);
}
- return Either.left(eitherGerResource.left().value());
+ resource = eitherGetResource.left().value();
+ if(resource.getResourceType() == ResourceTypeEnum.CVFC){
+ eitherGetResource = updateCalculatedCapReqWithSubstitutionMappings(resource, uploadResInstancesMap);
+ if (eitherGetResource.isRight()) {
+ ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGetResource.right().value()), resource);
+ return Either.right(responseFormat);
+ }
+ }
+ return Either.left(eitherGetResource.left().value());
+ }
+
+ private Either<Resource, StorageOperationStatus> updateCalculatedCapReqWithSubstitutionMappings(Resource resource, Map<String, UploadComponentInstanceInfo> uploadResInstancesMap) {
+ Either<Resource, StorageOperationStatus> updateRes = null;
+ Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> updatedInstCapabilities = new HashMap<>();
+ Map<ComponentInstance, Map<String, List<RequirementDefinition>>> updatedInstRequirements = new HashMap<>();
+ StorageOperationStatus status = toscaOperationFacade.deleteAllCalculatedCapabilitiesRequirements( resource.getUniqueId());
+ if(status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND){
+ log.debug("Failed to delete all calculated capabilities and requirements of resource {} upon update. Status is {}", resource.getUniqueId(), status);
+ updateRes = Either.right(status);
+ }
+ if(updateRes == null){
+ fillUpdatedInstCapabilitiesRequirements(resource.getComponentInstances(), uploadResInstancesMap, updatedInstCapabilities, updatedInstRequirements);
+ status = toscaOperationFacade.associateCalculatedCapReq(updatedInstCapabilities, updatedInstRequirements, resource.getUniqueId());
+ if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
+ log.debug("Failed to associate capabilities and requirementss of resource {}, updated according to a substitution mapping. Status is {}", resource.getUniqueId(), status);
+ updateRes = Either.right(status);
+ }
+ }
+ if(updateRes == null){
+ updateRes = toscaOperationFacade.getToscaElement( resource.getUniqueId());
+ }
+ return updateRes;
+ }
+
+
+ private void fillUpdatedInstCapabilitiesRequirements(List<ComponentInstance> componentInstances, Map<String, UploadComponentInstanceInfo> uploadResInstancesMap,
+ Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> updatedInstCapabilities, Map<ComponentInstance, Map<String, List<RequirementDefinition>>> updatedInstRequirements) {
+
+ componentInstances.stream().forEach( i -> {
+ fillUpdatedInstCapabilities(updatedInstCapabilities, i, uploadResInstancesMap.get(i.getName()).getCapabilitiesNamesToUpdate());
+ fillUpdatedInstRequirements(updatedInstRequirements, i, uploadResInstancesMap.get(i.getName()).getRequirementsNamesToUpdate());
+ });
+ }
+
+ private void fillUpdatedInstRequirements(Map<ComponentInstance, Map<String, List<RequirementDefinition>>> updatedInstRequirements, ComponentInstance instance, Map<String, String> requirementsNamesToUpdate) {
+ Map<String, List<RequirementDefinition>> updatedRequirements = new HashMap<>();
+ Set<String> updatedReqNames = new HashSet<>();
+ if(MapUtils.isNotEmpty(requirementsNamesToUpdate)){
+ for (Map.Entry<String, List<RequirementDefinition>> requirements : instance.getRequirements().entrySet()) {
+ updatedRequirements.put(requirements.getKey(), requirements.getValue().stream()
+ .filter(r -> requirementsNamesToUpdate.containsKey(r.getName()) && !updatedReqNames.contains(requirementsNamesToUpdate.get(r.getName())))
+ .map(r ->{r.setParentName(r.getName()); r.setName(requirementsNamesToUpdate.get(r.getName())); updatedReqNames.add(r.getName()); return r;})
+ .collect(Collectors.toList()));
+ }
+ }
+ if(MapUtils.isNotEmpty(updatedRequirements)){
+ updatedInstRequirements.put(instance, updatedRequirements);
+ }
+ }
+
+ private void fillUpdatedInstCapabilities(Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> updatedInstCapabilties, ComponentInstance instance, Map<String, String> capabilitiesNamesToUpdate) {
+ Map<String, List<CapabilityDefinition>> updatedCapabilities = new HashMap<>();
+ Set<String> updatedCapNames = new HashSet<>();
+ if(MapUtils.isNotEmpty(capabilitiesNamesToUpdate)){
+ for (Map.Entry<String, List<CapabilityDefinition>> requirements : instance.getCapabilities().entrySet()) {
+ updatedCapabilities.put(requirements.getKey(), requirements.getValue().stream()
+ .filter(c -> capabilitiesNamesToUpdate.containsKey(c.getName()) && !updatedCapNames.contains(capabilitiesNamesToUpdate.get(c.getName())))
+ .map(c -> {c.setParentName(c.getName()); c.setName(capabilitiesNamesToUpdate.get(c.getName())); updatedCapNames.add(c.getName()); return c;})
+ .collect(Collectors.toList()));
+ }
+ }
+ if(MapUtils.isNotEmpty(updatedCapabilities)){
+ updatedInstCapabilties.put(instance, updatedCapabilities);
+ }
}
private ResponseFormat addRelationToRI(String yamlName, Resource resource, UploadComponentInstanceInfo nodesInfoValue, List<RequirementCapabilityRelDef> relations) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
index 85db9a2c0f..89c444b6d9 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java
@@ -1616,7 +1616,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
vfModuleArtifactDefinition.setArtifactName(currVF.getNormalizedName() + "_modules.json");
vfModuleArtifactDefinition.setPayloadData(vfModulePayloadString);
if (vfModulePayloadString != null) {
- newCheckSum = GeneralUtility.calculateMD5ByByteArray(vfModulePayloadString.getBytes());
+ newCheckSum = GeneralUtility.calculateMD5Base64EncodedByByteArray(vfModulePayloadString.getBytes());
}
vfModuleArtifactDefinition.setArtifactChecksum(newCheckSum);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java
index 32293ca9b7..1c2f175cfb 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java
@@ -166,7 +166,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
} else {
Object representation = RepresentationUtils.toRepresentation(uploadArtifactEither.left().value());
Map<String, String> headers = new HashMap<>();
- headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5ByString((String) representation));
+ headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByString((String) representation));
responseWrapper.setInnerElement(getComponentsUtils().getResponseFormat(ActionStatus.OK));
response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), representation, headers);
}
@@ -263,7 +263,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
} else {
Object representation = RepresentationUtils.toRepresentation(uploadArtifactEither.left().value());
Map<String, String> headers = new HashMap<>();
- headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5ByString((String) representation));
+ headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByString((String) representation));
responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
responseWrapper.setInnerElement(buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), representation, headers));
}
@@ -363,7 +363,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
} else {
Object representation = RepresentationUtils.toRepresentation(uploadArtifactEither.left().value());
Map<String, String> headers = new HashMap<>();
- headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5ByString((String) representation));
+ headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByString((String) representation));
responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
responseWrapper.setInnerElement(buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), representation, headers));
}
@@ -459,7 +459,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
} else {
Object representation = RepresentationUtils.toRepresentation(uploadArtifactEither.left().value());
Map<String, String> headers = new HashMap<>();
- headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5ByString((String) representation));
+ headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByString((String) representation));
responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
responseWrapper.setInnerElement(buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), representation, headers));
}
@@ -550,7 +550,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
} else {
Object representation = RepresentationUtils.toRepresentation(uploadArtifactEither.left().value());
Map<String, String> headers = new HashMap<>();
- headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5ByString((String) representation));
+ headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByString((String) representation));
responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
responseWrapper.setInnerElement(buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), representation, headers));
}
@@ -641,7 +641,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
} else {
Object representation = RepresentationUtils.toRepresentation(uploadArtifactEither.left().value());
Map<String, String> headers = new HashMap<>();
- headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5ByString((String) representation));
+ headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByString((String) representation));
responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
responseWrapper.setInnerElement(buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), representation, headers));
}
@@ -719,7 +719,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
byte[] value = downloadComponentArtifactEither.left().value();
InputStream is = new ByteArrayInputStream(value);
Map<String, String> headers = new HashMap<>();
- headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5ByByteArray(value));
+ headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByByteArray(value));
responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
responseWrapper.setInnerElement(buildOkResponse(responseFormat, is, headers));
}
@@ -800,7 +800,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
byte[] value = downloadResourceArtifactEither.left().value();
InputStream is = new ByteArrayInputStream(value);
Map<String, String> headers = new HashMap<>();
- headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5ByByteArray(value));
+ headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByByteArray(value));
responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
responseWrapper.setInnerElement(buildOkResponse(responseFormat, is, headers));
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java
index f96e226d26..6e971f215d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java
@@ -352,7 +352,7 @@ public class AssetsDataServlet extends AbstractValidationsServlet {
} else {
byte[] value = csarArtifact.left().value().getRight();
InputStream is = new ByteArrayInputStream(value);
- String contenetMD5 = GeneralUtility.calculateMD5ByByteArray(value);
+ String contenetMD5 = GeneralUtility.calculateMD5Base64EncodedByByteArray(value);
Map<String, String> headers = new HashMap<>();
headers.put(Constants.CONTENT_DISPOSITION_HEADER, getContentDispositionValue(csarArtifact.left().value().getLeft()));
headers.put(Constants.MD5_HEADER, contenetMD5);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java
index 55ad44db0c..f1dd1539b4 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java
@@ -458,7 +458,7 @@ public abstract class AbstractValidationsServlet extends BeGenericServlet {
if (recievedMD5 == null) {
isValid = false;
} else {
- String calculateMD5 = GeneralUtility.calculateMD5ByString(resourceInfoJsonString);
+ String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(resourceInfoJsonString);
isValid = calculateMD5.equals(recievedMD5);
}
if (!isValid) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertor.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertor.java
index 6c4c5fafe1..006c5c22d3 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertor.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertor.java
@@ -187,7 +187,7 @@ public class CapabiltyRequirementConvertor {
String sourceCapName;
if(ToscaUtils.isComplexVfc(component)){
fullReqName = r.getName();
- sourceCapName = getSourceCvfcDataTypeName(r.getName(), r.getOwnerName());
+ sourceCapName = r.getParentName();
} else {
fullReqName = getRequirementPath(r);
sourceCapName = getSubPathByFirstDelimiterAppearance(fullReqName);
@@ -205,13 +205,6 @@ public class CapabiltyRequirementConvertor {
return toscaRequirements;
}
- private String getSourceCvfcDataTypeName(String name, String ownerName) {
- if(name.contains(ownerName)){
- return name.substring(0, name.length() - ownerName.length() - 1);
- }
- return null;
- }
-
private String getRequirementPath(RequirementDefinition r) {
List<String> pathArray = Lists.reverse(r.getPath().stream()
.map(path -> ValidationUtils.normalizeComponentInstanceName(getSubPathByLastDelimiterAppearance(path)))
@@ -275,7 +268,7 @@ public class CapabiltyRequirementConvertor {
String sourceReqName;
if(ToscaUtils.isComplexVfc(component)){
fullCapName = c.getName();
- sourceReqName = getSourceCvfcDataTypeName(c.getName(), c.getOwnerName());
+ sourceReqName = c.getParentName();
} else {
fullCapName = getCapabilityPath(c);
sourceReqName = getSubPathByFirstDelimiterAppearance(fullCapName);
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
index 85b1927548..66627086f6 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
@@ -633,7 +633,7 @@ public class CsarUtils {
for (ArtifactDefinition artDef : generatedArtifactsDefinitions) {
String data = gson.toJson(artDef);
- String dataMD5 = GeneralUtility.calculateMD5ByString(data);
+ String dataMD5 = GeneralUtility.calculateMD5Base64EncodedByString(data);
String artifactUniqueId = null;
if ((operationType.getArtifactOperationEnum() == ArtifactOperationEnum.Update) || (operationType.getArtifactOperationEnum() == ArtifactOperationEnum.Delete)) {
@@ -941,7 +941,7 @@ public class CsarUtils {
artifact.setArtifactDisplayName(artifact.getArtifactName().lastIndexOf('.') > 0 ? artifact.getArtifactName().substring(0, artifact.getArtifactName().lastIndexOf('.')) : artifact.getArtifactName());
artifact.setArtifactLabel(ValidationUtils.normalizeArtifactLabel(artifact.getArtifactName()));
artifact.setDescription(ARTIFACT_CREATED_FROM_CSAR);
- artifact.setArtifactChecksum(GeneralUtility.calculateMD5ByByteArray(entry.getValue()));
+ artifact.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(entry.getValue()));
return artifact;
}
@@ -971,7 +971,7 @@ public class CsarUtils {
this.artifactLabel = ValidationUtils.normalizeArtifactLabel(artifactName);
if (payloadData != null) {
this.payloadData = Base64.encodeBase64String(payloadData);
- this.artifactChecksum = GeneralUtility.calculateMD5ByByteArray(payloadData);
+ this.artifactChecksum = GeneralUtility.calculateMD5Base64EncodedByByteArray(payloadData);
}
this.artifactUniqueId = artifactUniqueId;
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
index f3c7a7d24c..c47400bcdb 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
@@ -1498,14 +1498,14 @@ public class ResourceBusinessLogicTest {
deploymentArtifactToUpdate.setArtifactName(deploymentArtifactToUpdateFileName);
deploymentArtifactToUpdate.setArtifactType("SNMP_POLL");
deploymentArtifactToUpdate.setPayload(oldPayloadData);
- deploymentArtifactToUpdate.setArtifactChecksum(GeneralUtility.calculateMD5ByByteArray(oldPayloadData));
+ deploymentArtifactToUpdate.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData));
ArtifactDefinition deploymentArtifactToDelete = new ArtifactDefinition();
deploymentArtifactToDelete.setMandatory(false);
deploymentArtifactToDelete.setArtifactName(deploymentArtifactToDeleteFileName);
deploymentArtifactToDelete.setArtifactType("SNMP_TRAP");
deploymentArtifactToDelete.setPayload(oldPayloadData);
- deploymentArtifactToDelete.setArtifactChecksum(GeneralUtility.calculateMD5ByByteArray(oldPayloadData));
+ deploymentArtifactToDelete.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData));
ArtifactDefinition deploymentArtifactToIgnore = new ArtifactDefinition();
@@ -1520,14 +1520,14 @@ public class ResourceBusinessLogicTest {
artifactToUpdate.setArtifactName(artifactInfoToUpdateFileName);
artifactToUpdate.setArtifactType("SNMP_POLL");
artifactToUpdate.setPayload(oldPayloadData);
- artifactToUpdate.setArtifactChecksum(GeneralUtility.calculateMD5ByByteArray(oldPayloadData));
+ artifactToUpdate.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData));
ArtifactDefinition artifactToDelete = new ArtifactDefinition();
artifactToDelete.setMandatory(false);
artifactToDelete.setArtifactName(artifactInfoToDeleteFileName);
artifactToDelete.setArtifactType("SNMP_TRAP");
artifactToDelete.setPayload(oldPayloadData);
- artifactToDelete.setArtifactChecksum(GeneralUtility.calculateMD5ByByteArray(oldPayloadData));
+ artifactToDelete.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData));
ArtifactDefinition artifactToIgnore = new ArtifactDefinition();
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java
index 3afb5d6bdc..107163c520 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java
@@ -229,7 +229,7 @@ public class ResourceServletTest extends JerseyTest {
}
private void setMD5OnRequest(boolean isValid, UploadResourceInfo json) {
- String md5 = (isValid) ? GeneralUtility.calculateMD5ByString(gson.toJson(json)) : "stam=";
+ String md5 = (isValid) ? GeneralUtility.calculateMD5Base64EncodedByString(gson.toJson(json)) : "stam=";
when(request.getHeader(Constants.MD5_HEADER)).thenReturn(md5);
}
diff --git a/catalog-dao/pom.xml b/catalog-dao/pom.xml
index 2627899e1f..d3c255ae79 100644
--- a/catalog-dao/pom.xml
+++ b/catalog-dao/pom.xml
@@ -221,9 +221,8 @@
</dependency>
<dependency>
- <groupId>com.thinkaurelius.titan</groupId>
- <artifactId>titan-cassandra</artifactId>
- <!--<artifactId>asdc-titan-cassandra</artifactId>-->
+ <groupId>org.openecomp.sdc.sdc-titan-cassandra</groupId>
+ <artifactId>sdc-titan-cassandra</artifactId>
<version>${titan.version}</version>
<scope>provided</scope>
<exclusions>
diff --git a/catalog-model/pom.xml b/catalog-model/pom.xml
index 444686d3a2..3752d79a20 100644
--- a/catalog-model/pom.xml
+++ b/catalog-model/pom.xml
@@ -119,8 +119,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>provided</scope>
<exclusions>
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java
index 71e2010ccd..d986d77450 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java
@@ -55,6 +55,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
@@ -598,11 +599,11 @@ public class NodeTypeOperation extends ToscaElementOperation {
return Either.right(StorageOperationStatus.PARENT_RESOURCE_NOT_FOUND);
} else {
if (resources.size() > 1) {
- log.error("Multiple parent resources called {} found in the graph.", parentResource);
- return Either.right(StorageOperationStatus.MULTIPLE_PARENT_RESOURCE_FOUND);
+ return handleMultipleParent(parentResource, derivedResources, resources);
+ } else {
+ GraphVertex parentResourceData = resources.get(0);
+ derivedResources.add(parentResourceData);
}
- GraphVertex parentResourceData = resources.get(0);
- derivedResources.add(parentResourceData);
}
}
@@ -611,6 +612,47 @@ public class NodeTypeOperation extends ToscaElementOperation {
}
return Either.left(derivedResources);
}
+
+ Either<List<GraphVertex>, StorageOperationStatus> handleMultipleParent(String parentResource, List<GraphVertex> derivedResource, List<GraphVertex> fetchedDerivedResources){
+
+ Either<List<GraphVertex>, StorageOperationStatus> result = Either.left(derivedResource);
+ try{
+ fetchedDerivedResources.sort((d1,d2)->{
+ return new Double(Double.parseDouble((String)d1.getMetadataProperty(GraphPropertyEnum.VERSION)))
+ .compareTo(Double.parseDouble((String)d2.getMetadataProperty(GraphPropertyEnum.VERSION)));
+ });
+
+ int actualHighestIndex = fetchedDerivedResources.size() - 1;
+ derivedResource.add(fetchedDerivedResources.get(actualHighestIndex));
+ fetchedDerivedResources.remove(actualHighestIndex);
+
+ StorageOperationStatus status = fixMultipleParent(fetchedDerivedResources);
+ if(status != StorageOperationStatus.OK){
+ result = Either.right(status);
+ }
+ } catch (Exception e){
+ CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Exception occured during handle multiple parent {}. Exception is {}",
+ parentResource, e.getMessage());
+ result = Either.right(StorageOperationStatus.GENERAL_ERROR);
+ }
+ return result;
+ }
+
+ private StorageOperationStatus fixMultipleParent(List<GraphVertex> fetchedDerivedResources) {
+ StorageOperationStatus result = StorageOperationStatus.OK;
+ for(GraphVertex fetchedDerivedResource : fetchedDerivedResources){
+ fetchedDerivedResource.addMetadataProperty(GraphPropertyEnum.IS_HIGHEST_VERSION, false);
+ Either<GraphVertex, TitanOperationStatus> updateVertexRes = titanDao.updateVertex(fetchedDerivedResource);
+ if (updateVertexRes.isRight()) {
+ TitanOperationStatus titatStatus = updateVertexRes.right().value();
+ CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to set highest version of node type {} to false. Status is {}",
+ fetchedDerivedResource.getMetadataProperty(GraphPropertyEnum.TOSCA_RESOURCE_NAME), titatStatus);
+ result = DaoStatusConverter.convertTitanStatusToStorageStatus(titatStatus);
+ break;
+ }
+ }
+ return result;
+ }
private GraphVertex fillMetadata(GraphVertex nodeTypeVertex, NodeType nodeType) {
nodeTypeVertex.setLabel(VertexTypeEnum.NODE_TYPE);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java
index 3cc80eaf36..b11036df49 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java
@@ -2207,5 +2207,13 @@ public class ToscaOperationFacade {
public StorageOperationStatus deleteComponentInstanceInputsFromTopologyTemplate(Component containerComponent, ComponentTypeEnum componentType, List<InputDefinition> inputsToDelete) {
return topologyTemplateOperation.deleteToscaDataElements(containerComponent.getUniqueId(), EdgeLabelEnum.INPUTS, inputsToDelete.stream().map(i -> i.getName()).collect(Collectors.toList()));
}
+
+ public StorageOperationStatus deleteAllCalculatedCapabilitiesRequirements(String topologyTemplateId) {
+ StorageOperationStatus status = topologyTemplateOperation.removeToscaData(topologyTemplateId, EdgeLabelEnum.CALCULATED_CAPABILITIES, VertexTypeEnum.CALCULATED_CAPABILITIES);
+ if(status == StorageOperationStatus.OK){
+ status = topologyTemplateOperation.removeToscaData(topologyTemplateId, EdgeLabelEnum.CALCULATED_REQUIREMENTS, VertexTypeEnum.CALCULATED_REQUIREMENTS);
+ }
+ return status;
+ }
}
diff --git a/catalog-ui/src/app/models/component-metadata.ts b/catalog-ui/src/app/models/component-metadata.ts
index 8c6ed5593d..1545739ce3 100644
--- a/catalog-ui/src/app/models/component-metadata.ts
+++ b/catalog-ui/src/app/models/component-metadata.ts
@@ -65,6 +65,7 @@ export class ComponentMetadata {
public namingPolicy: string;
public serviceType:string;
public serviceRole:string;
+ public environmentContext:string;
//backend lifecycleState
@@ -101,7 +102,7 @@ export class ComponentMetadata {
this.projectCode = response.projectCode;
this.resourceType = response.resourceType;
this.csarUUID = response.csarUUID;
- this.csarVersion = response.version;
+ this.csarVersion = response.csarVersion;
this.state = response.state;
this.ecompGeneratedNaming = response.ecompGeneratedNaming;
this.namingPolicy = response.namingPolicy;
@@ -109,6 +110,7 @@ export class ComponentMetadata {
this.resourceVendorModelNumber = response.resourceVendorModelNumber;
this.serviceType = response.serviceType;
this.serviceRole = response.serviceRole;
+ this.environmentContext = response.environmentContext;
return this;
}
diff --git a/catalog-ui/src/app/models/components/service.ts b/catalog-ui/src/app/models/components/service.ts
index 90a38e895b..ce6921b1bb 100644
--- a/catalog-ui/src/app/models/components/service.ts
+++ b/catalog-ui/src/app/models/components/service.ts
@@ -36,6 +36,7 @@ export class Service extends Component {
public namingPolicy:string;
public serviceType:string;
public serviceRole:string;
+ public environmentContext:string;
constructor(componentService:IServiceService, $q:ng.IQService, component?:Service) {
super(componentService, $q, component);
@@ -47,6 +48,7 @@ export class Service extends Component {
this.namingPolicy = component.namingPolicy;
this.serviceType = component.serviceType;
this.serviceRole = component.serviceRole;
+ this.environmentContext = component.environmentContext;
if (component.categories && component.categories[0]) {
this.mainCategory = component.categories[0].name;
this.selectedCategory = this.mainCategory;
@@ -161,6 +163,7 @@ export class Service extends Component {
this.namingPolicy = componentMetadata.namingPolicy;
this.serviceType = componentMetadata.serviceType;
this.serviceRole = componentMetadata.serviceRole;
+ this.environmentContext = componentMetadata.environmentContext;
this.setComponentDisplayData();
}
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
index 48fc9dbb42..c60a490b4b 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
+++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
@@ -20,7 +20,7 @@
'use strict';
import {ModalsHandler, ValidationUtils, EVENTS, CHANGE_COMPONENT_CSAR_VERSION_FLAG, ComponentType, DEFAULT_ICON,
- ResourceType} from "app/utils";
+ ResourceType, ComponentState} from "app/utils";
import {CacheService, EventListenerService, ProgressService, OnboardingService} from "app/services";
import {IAppConfigurtaion, IValidate, IMainCategory, Resource, ISubCategory,Service, ICsarComponent} from "app/models";
import {IWorkspaceViewModelScope} from "app/view-models/workspace/workspace-view-model";
@@ -41,6 +41,7 @@ export class componentCategories {//categories field bind to this obj in order t
selectedCategory:string;
}
+
export interface IGeneralScope extends IWorkspaceViewModelScope {
validation:Validation;
editForm:ng.IFormController;
@@ -56,7 +57,7 @@ export interface IGeneralScope extends IWorkspaceViewModelScope {
browseFileLabel:string;
componentCategories:componentCategories;
- onToscaFileChange():void
+ onToscaFileChange():void;
validateField(field:any):boolean;
validateName(isInit:boolean):void;
calculateUnique(mainCategory:string, subCategory:string):string; // Build unique string from main and sub category
@@ -146,21 +147,24 @@ export class GeneralViewModel {
(<Resource>this.$scope.component).resourceType == ResourceType.VF &&
(<Resource>this.$scope.component).csarUUID) {
this.$scope.isShowOnboardingSelectionBrowse = true;
- let onboardCsarFilesMap:Dictionary<string> = this.cacheService.get('onboardCsarFilesMap');
+ let onboardCsarFilesMap:Dictionary<Dictionary<string>> = this.cacheService.get('onboardCsarFilesMap');
// The onboardCsarFilesMap in cache contains map of [packageId]:[vsp display name for brows]
// if the map is empty - Do request to BE
if(onboardCsarFilesMap) {
- this.$scope.importedToscaBrowseFileText = onboardCsarFilesMap[(<Resource>this.$scope.component).csarUUID];
+ if (onboardCsarFilesMap[(<Resource>this.$scope.component).csarUUID]){
+ this.$scope.importedToscaBrowseFileText = onboardCsarFilesMap[(<Resource>this.$scope.component).csarUUID][(<Resource>this.$scope.component).csarVersion];
+ }
}
if(!onboardCsarFilesMap || !this.$scope.importedToscaBrowseFileText){
let onSuccess = (vsps:Array<ICsarComponent>): void =>{
onboardCsarFilesMap = {};
_.each(vsps, (vsp:ICsarComponent)=>{
- onboardCsarFilesMap[vsp.packageId] = vsp.vspName + " (" + vsp.version + ")";
+ onboardCsarFilesMap[vsp.packageId] = onboardCsarFilesMap[vsp.packageId] || {};
+ onboardCsarFilesMap[vsp.packageId][vsp.version] = vsp.vspName + " (" + vsp.version + ")";
});
this.cacheService.set('onboardCsarFilesMap', onboardCsarFilesMap);
- this.$scope.importedToscaBrowseFileText = onboardCsarFilesMap[(<Resource>this.$scope.component).csarUUID];
+ this.$scope.importedToscaBrowseFileText = onboardCsarFilesMap[(<Resource>this.$scope.component).csarUUID][(<Resource>this.$scope.component).csarVersion];
};
let onError = (): void =>{
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html
index d3626803e9..3a3b2d316d 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html
+++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html
@@ -375,6 +375,7 @@
</div>
</div>
<!--------------------- Service Role -------------------->
+
<div class="meta-data" data-ng-if="component.creationDate">
<div>
<b>Created:</b>
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general.less b/catalog-ui/src/app/view-models/workspace/tabs/general/general.less
index 9633ec5bb6..b9b59deb1b 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/general/general.less
+++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general.less
@@ -34,7 +34,7 @@
}
.description{
- height: 300px;
+ height: 360px;
}
.i-sdc-form-item.description-field{
diff --git a/catalog-ui/src/app/view-models/workspace/workspace-view.html b/catalog-ui/src/app/view-models/workspace/workspace-view.html
index 19ebefe7a5..a7c9da05c4 100644
--- a/catalog-ui/src/app/view-models/workspace/workspace-view.html
+++ b/catalog-ui/src/app/view-models/workspace/workspace-view.html
@@ -70,10 +70,12 @@
</div>
</div>
- <div class="tab-title" data-ng-if="!isComposition && !isDeployment">
- {{getTabTitle()}}
+ <div class="w-sdc-main-container-body-content-wrapper">
+ <div class="tab-title" data-ng-if="!isComposition && !isDeployment">
+ {{getTabTitle()}}
+ </div>
+ <div class="w-sdc-main-container-body-content" data-ng-class="{'third-party':thirdParty}" data-ui-view></div>
</div>
- <div class="w-sdc-main-container-body-content" data-ng-class="{'third-party':thirdParty}" data-ui-view></div>
</div>
</div>
<top-nav search-bind="search.filterTerm" hide-search="true" menu-model="breadcrumbsModel" version="{{version}}"></top-nav>
diff --git a/catalog-ui/src/app/view-models/workspace/workspace.less b/catalog-ui/src/app/view-models/workspace/workspace.less
index d0799f4bac..8b8b6d624a 100644
--- a/catalog-ui/src/app/view-models/workspace/workspace.less
+++ b/catalog-ui/src/app/view-models/workspace/workspace.less
@@ -174,7 +174,7 @@
height: calc(~'100% - @{action_nav_height}'); //composition is the only tab without a tab title. need to exclude from calculation.
}
.w-sdc-main-container-body-content {
- height:calc(~'100% - @{action_nav_height} - @{tab_title}');
+ // height:calc(~'100% - @{action_nav_height} - @{tab_title}');
align-items: center;
padding: 0 100px 20px 100px;
&.third-party {
@@ -187,6 +187,10 @@
bottom: 0;
}
}
+ .w-sdc-main-container-body-content-wrapper {
+ overflow: auto;
+ height: calc(~'100% - @{action_nav_height}')
+ }
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java
index 0b55fd1845..8890b14dd1 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java
@@ -134,7 +134,7 @@ public class GeneralUtility {
return res;
}
- public static String calculateMD5ByByteArray(byte[] payload) {
+ public static String calculateMD5Base64EncodedByByteArray(byte[] payload) {
String decodedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(payload);
byte[] encodeMd5 = Base64.encodeBase64(decodedMd5.getBytes());
return new String(encodeMd5);
@@ -146,7 +146,7 @@ public class GeneralUtility {
* @param data
* @return
*/
- public static String calculateMD5ByString(String data) {
+ public static String calculateMD5Base64EncodedByString(String data) {
String calculatedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(data);
// encode base-64 result
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java
index 8ec5a89c44..fd04f47b29 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java
@@ -52,6 +52,7 @@ public class CapabilityDataDefinition extends ToscaDataDefinition implements Ser
this.setType(a.getType());
this.setDescription ( a.getDescription());
this.setName( a.getName());
+ this.setParentName( a.getParentName());
this.setValidSourceTypes( a.getValidSourceTypes());
this.setCapabilitySources( a.getCapabilitySources());
this.setOwnerId( a.getOwnerId());
@@ -128,6 +129,14 @@ public class CapabilityDataDefinition extends ToscaDataDefinition implements Ser
public void setName(String name) {
setToscaPresentationValue(JsonPresentationFields.NAME, name);
}
+
+ public String getParentName() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.PARENT_NAME);
+ }
+
+ public void setParentName(String parentName) {
+ setToscaPresentationValue(JsonPresentationFields.PARENT_NAME, parentName);
+ }
public String getType() {
return (String) getToscaPresentationValue(JsonPresentationFields.TYPE);
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java
index b32f65f9d3..4a6f770ebc 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/RequirementDataDefinition.java
@@ -47,6 +47,7 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se
public RequirementDataDefinition(RequirementDataDefinition other) {
this.setUniqueId(other.getUniqueId());
this.setName(other.getName());
+ this.setParentName(other.getParentName());
this.setCapability(other.getCapability());
this.setNode(other.getNode());
this.setRelationship(other.getRelationship());
@@ -78,6 +79,14 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se
public void setName(String name) {
setToscaPresentationValue(JsonPresentationFields.NAME, name);
}
+
+ public String getParentName() {
+ return (String) getToscaPresentationValue(JsonPresentationFields.PARENT_NAME);
+ }
+
+ public void setParentName(String parentName) {
+ setToscaPresentationValue(JsonPresentationFields.PARENT_NAME, parentName);
+ }
/**
* specify the capability type
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
index fd028c0349..8634ac871a 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
@@ -134,7 +134,7 @@ public enum JsonPresentationFields {
RELATIONSHIP ("relationship", null),
VALID_SOURCE_TYPES ("validSourceTypes", null),
REQUIREMENT_ID ("requirementId", null),
-
+ PARENT_NAME ("parentName", null),
//Relation
CAPABILTY_OWNER_ID ("capabilityOwnerId", null),
REQUIREMENT_OWNER_ID ("requirementOwnerId", null),
diff --git a/pom.xml b/pom.xml
index 17bf79aba3..fe89499b3f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<artifactId>sdc-main</artifactId>
<version>1.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
-
+ <name>sdc</name>
<properties>
@@ -381,9 +381,9 @@
<properties>
<ecomp.version>1.2.7</ecomp.version>
- <artifact-generator-api.version>1710.0.0-SNAPSHOT</artifact-generator-api.version>
- <artifact-generator-core.version>1710.0.0-SNAPSHOT</artifact-generator-core.version>
- <dox-common-lib.version>1710.0.0-SNAPSHOT</dox-common-lib.version>
+ <artifact-generator-api.version>1710.0.0</artifact-generator-api.version>
+ <artifact-generator-core.version>1710.0.0</artifact-generator-core.version>
+ <dox-common-lib.version>1710.0.0</dox-common-lib.version>
<sdc-tosca-parser.version>1.1.14</sdc-tosca-parser.version>
</properties>
diff --git a/sdc-os-chef/pom.xml b/sdc-os-chef/pom.xml
index 79eab3502a..654284741c 100644
--- a/sdc-os-chef/pom.xml
+++ b/sdc-os-chef/pom.xml
@@ -186,10 +186,10 @@
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
- <version>0.19.1</version>
+ <version>0.22.1</version>
<configuration>
- <verbose>true</verbose>
+ <verbose>false</verbose>
<apiVersion>1.23</apiVersion>
<images>
@@ -291,11 +291,10 @@
<id>clean-images</id>
<phase>pre-clean</phase>
<goals>
- <goal>remove</goal>
+ <goal>remove</goal>
</goals>
<configuration>
- <removeAll>true</removeAll>
- <image>openecomp/sdc-backend,openecomp/sdc-frontend,openecomp/sdc-elasticsearch,openecomp/sdc-kibana<!-- ,openecomp/sdc-sanity --></image>
+ <removeAll>true</removeAll>
</configuration>
</execution>
@@ -315,7 +314,7 @@
<goal>push</goal>
</goals>
<configuration>
- <image>openecomp/sdc-backend,openecomp/sdc-frontend,openecomp/sdc-elasticsearch,openecomp/sdc-kibana<!-- ,openecomp/sdc-sanity --></image>
+ <image>openecomp/sdc-backend,openecomp/sdc-frontend,openecomp/sdc-elasticsearch,openecomp/sdc-kibana,openecomp/sdc-cassandra<!--,openecomp/sdc-sanity--></image>
</configuration>
</execution>
</executions>
diff --git a/test-apis-ci/pom.xml b/test-apis-ci/pom.xml
index 7184c8b06f..14e1fc3fcd 100644
--- a/test-apis-ci/pom.xml
+++ b/test-apis-ci/pom.xml
@@ -226,8 +226,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>
<exclusions>
@@ -277,10 +277,16 @@
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
- <dependency>
+ <!-- <dependency>
<groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-tosca-parser</artifactId>
- <version>${sdc-tosca-parser.version}</version>
+ <version>${sdc-tosca-parser.version}</version>
+ <scope>compile</scope>
+ </dependency> -->
+ <dependency>
+ <groupId>org.openecomp.sdc.sdc-tosca</groupId>
+ <artifactId>sdc-tosca</artifactId>
+ <version>1.1.32-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
index a9cc119b20..cfd132d5d0 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
@@ -35,7 +35,6 @@ import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.ImmutableTriple;
import org.apache.log4j.Logger;
@@ -60,7 +59,6 @@ import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils;
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.AutomationUtils;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils;
@@ -71,13 +69,8 @@ import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.slf4j.LoggerFactory;
import org.testng.ITestContext;
import org.testng.ITestResult;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.AfterSuite;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.*;
-import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.thinkaurelius.titan.core.TitanFactory;
@@ -94,17 +87,16 @@ public abstract class ComponentBaseTest {
protected static Logger logger= Logger.getLogger(ComponentBaseTest.class);
- // public ComponentBaseTest(TestName testName, String className) {
- // super(testName, className);
- // }
+// public ComponentBaseTest(TestName testName, String className) {
+// super(testName, className);
+// }
- protected static ExtentReports extentReport;
- public static final String REPORT_FOLDER = "./ExtentReport/";
+ protected static final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator;
private static final String VERSIONS_INFO_FILE_NAME = "versions.info";
private static final String REPORT_FILE_NAME = "SDC_CI_Extent_Report.html";
protected static TitanGraph titanGraph;
- private static Config myconfig;
public static Config config;
+ protected static ITestContext myContext;
@@ -125,104 +117,45 @@ public abstract class ComponentBaseTest {
lc.getLogger("io.netty").setLevel(Level.INFO);
lc.getLogger("c.d").setLevel(Level.INFO);
}
+
+ public static String getReportFolder() {
+ return REPORT_FOLDER;
+ }
@BeforeSuite(alwaysRun = true)
- public static void openTitan(ITestContext context) throws Exception {
-
- logger.info("<<<BeforeSuite>>>");
- myconfig = Utils.getConfig();
+ public void setupBeforeSuite(ITestContext context) throws Exception {
config = Utils.getConfig();
-
- File dir = new File(REPORT_FOLDER);
- try {
- FileUtils.deleteDirectory(dir);
- } catch (IOException e) {
- }
- dir.mkdir();
-
- System.out.println("BeforeSuite - get reporter");
- extentReport = ExtentManager.getReporter(REPORT_FOLDER + REPORT_FILE_NAME);
-
- String onboardVersion = AutomationUtils.getOnboardVersion();
- String osVersion = AutomationUtils.getOSVersion();
- String envData = myconfig.getUrl();
- // TODO: uncomment config file
-// extentReport.loadConfig(AutomationUtils.getConfigFile(CONFIG_FILE));
-
- extentReport.setSystemInfo("Onboard Version", onboardVersion);
- extentReport.setSystemInfo("OS Version", osVersion);
- extentReport.setSystemInfo("ExecutedOn", envData);
- extentReport.setSystemInfo("SuiteName", context.getName());
- AutomationUtils.createVersionsInfoFile(REPORT_FOLDER + VERSIONS_INFO_FILE_NAME, onboardVersion, osVersion, envData);
-
- System.out.println("BeforeSuite - open titan");
- openTitanLogic();
-
- System.out.println("BeforeSuite - createConsumer");
+ myContext=context;
+ ExtentManager.initReporter(getReportFolder(), REPORT_FILE_NAME, context);
AtomicOperationUtils.createDefaultConsumer(true);
-
- System.out.println("BeforeSuite - performClean");
+ openTitanLogic();
performClean();
- }
-
- protected static void openTitanLogic() throws Exception {
-
- logger.trace(config.toString());
- String titanConfigFilePath = myconfig.getTitanPropertiesFile();
- titanGraph = TitanFactory.open(titanConfigFilePath);
- assertNotNull(titanGraph);
-
- }
-
- @AfterClass(alwaysRun = true)
- public synchronized static void cleanAfterClass() throws Exception{
-
-// System.out.println("<<<<<<<<class name>>>>>"+method.getDeclaringClass());
-// System.out.println("<<<<<<<<class name>>>>>"+method.getName());
- System.out.println("delete components AfterClass");
- deleteCreatedComponents(getCatalogAsMap());
-// extentReport.flush();
}
- @AfterSuite(alwaysRun = true)
- public static void shutdownTitan() throws Exception {
-
- System.out.println("AfterSuite - flush report");
- extentReport.flush();
- System.out.println("AfterSuite - perform clean");
- performClean();
- System.out.println("AfterSuite - close report");
-// extentReport.close();
- System.out.println("AfterSuite - close titan");
- shutdownTitanLogic();
- System.out.println("AfterSuite - suite ended");
- }
-
- protected static void shutdownTitanLogic() {
- if (titanGraph.isOpen()) {
- titanGraph.close();
- }
- CassandraUtils.close();
- }
-
@BeforeMethod(alwaysRun = true)
- public void beforeState(java.lang.reflect.Method method) throws Exception {
-
-
- ExtentTestManager.startTest(method.getName());
- String[] parts = this.getClass().getName().toString().split("\\.");
- String lastOne1 = parts[parts.length-1];
- String lastOne2 = parts[parts.length-2];
- getExtendTest().assignCategory(lastOne2 + "-" + lastOne1);
- getExtendTest().log(Status.INFO, "Test started");
+ public void setBrowserBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception {
+
+
+ boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty();
+ String className = method.getDeclaringClass().getName();
+ if (emptyDataProvider && !className.contains("ToscaValidationTest") ) {
+ System.out.println("ExtentReport instance started from BeforeMethod...");
+ String suiteName = ExtentManager.getSuiteName(context);
+ ExtentTestManager.startTest(method.getName());
+ ExtentTestManager.assignCategory(this.getClass());
+
+ } else {
+ System.out.println("ExtentReport instance started from Test...");
+ }
+
}
@AfterMethod(alwaysRun = true)
- public void afterState(ITestResult result) throws Exception {
+ public void quitAfterTest(ITestResult result, ITestContext context) throws Exception {
String testName = result.getName();
Throwable throwable = result.getThrowable();
@@ -248,8 +181,55 @@ public abstract class ComponentBaseTest {
ExtentTestManager.endTest();
- extentReport.flush();
+
+
+ }
+
+ @AfterClass(alwaysRun = true)
+ public synchronized static void cleanAfterClass() throws Exception{
+
+// System.out.println("<<<<<<<<class name>>>>>"+method.getDeclaringClass());
+// System.out.println("<<<<<<<<class name>>>>>"+method.getName());
+
+
+ System.out.println("delete components AfterClass");
+ deleteCreatedComponents(getCatalogAsMap());
+// extentReport.flush();
+
+ }
+
+ @AfterSuite(alwaysRun = true)
+ public static void shutdownTitan() throws Exception {
+
+ performClean();
+ shutdownTitanLogic();
+
+ }
+
+ protected static void openTitanLogic() throws Exception {
+
+ logger.trace(config.toString());
+ String titanConfigFilePath = config.getTitanPropertiesFile();
+ titanGraph = TitanFactory.open(titanConfigFilePath);
+ assertNotNull(titanGraph);
+ }
+
+
+ protected static void shutdownTitanLogic() {
+ if (titanGraph.isOpen()) {
+ titanGraph.close();
+ }
+ CassandraUtils.close();
+ }
+
+
+
+ public void setLog(String fromDataProvider) {
+
+ String suiteName = ExtentManager.getSuiteName(myContext);
+ ExtentTestManager.startTest(Thread.currentThread().getStackTrace()[2].getMethodName() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + fromDataProvider);
+ ExtentTestManager.assignCategory(this.getClass());
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java
index 2b970fd8a1..ae16f7406e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java
@@ -20,53 +20,149 @@
package org.openecomp.sdc.ci.tests.api;
-import org.openecomp.sdc.ci.tests.utils.rest.AutomationUtils;
-
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import com.aventstack.extentreports.reporter.ExtentXReporter;
import com.aventstack.extentreports.reporter.configuration.Protocol;
import com.aventstack.extentreports.reporter.configuration.Theme;
+import org.openecomp.sdc.ci.tests.config.Config;
+
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
+import org.openecomp.sdc.ci.tests.utils.rest.AutomationUtils;
+import org.testng.ITestContext;
+
+import java.io.File;
public class ExtentManager {
+
+ private static final String VERSIONS_INFO_FILE_NAME = "versions.info";
+ private static ExtentReports extent;
+ private static ExtentHtmlReporter htmlReporter;
+ private static ExtentXReporter extentxReporter;
+ private static final String icon = "$(document).ready(function() {" +"\n"+
+ "$('.brand-logo').html('').prepend(\"<span><img src='data:image/png;base64,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' style='display: block; margin-left: auto; margin-right: auto; margin-top: 7px; width: 89px;'/></span>\").width(\"120px\").css(\"float\",\"left\").css(\"padding-left\",\"0\");$('.report-name').css(\"font-weight\",\"bold\");"+"\n"+
+// "$('.logo-content' ).remove();"+"\n"+
+// "$('#slide-out li:first-child').on('click', function(){ $('#charts-row').hide() }) ; $('#slide-out li:last-child').on('click', function(){ $('#charts-row').show() });"+"\n"+
+// "$('.charts div:nth-child(2)').remove();"+"\n"+
+ "})";
- private static ExtentReports extent;
+ public enum suiteNameXml {
+
+ TESTNG_FAILED_XML_NAME("testng-failed.xml");
+
+ suiteNameXml(String value) {
+ this.value = value;
+ }
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ }
- public synchronized static ExtentReports getReporter(String filePath) {
- if (extent == null) {
- // initialize the HtmlReporter
- ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(filePath);
-
- // initialize ExtentReports and attach the HtmlReporter
- extent = new ExtentReports();
+ public synchronized static ExtentReports setReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception {
+ String dbIp = Utils.getConfig().getReportDBhost();
+ int dbPort = Utils.getConfig().getReportDBport();
- // attach all reporters
- extent.attachReporter(htmlReporter);
-
-
+ if (extent == null) {
+ extentxReporter = new ExtentXReporter(dbIp, dbPort);
+ extent = new ExtentReports();
+ initAndSetExtentHtmlReporter(filePath, htmlFile, isAppend);
+
+ if(extentxReporter.config().getReportObjectId() != null){
+ setExtentXReporter(isAppend);
+ }else{
+ extentxReporter.stop();
+ }
}
-
return extent;
}
- public synchronized static ExtentHtmlReporter setConfiguration(ExtentHtmlReporter htmlReporter) {
+ public synchronized static void setExtentXReporter(Boolean isAppend){
+ extentxReporter.setAppendExisting(isAppend);
+ extent.attachReporter(extentxReporter);
+ }
+
+ public synchronized static void initAndSetExtentHtmlReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception{
+ htmlReporter = new ExtentHtmlReporter(filePath + htmlFile);
+ setConfiguration(htmlReporter);
+ htmlReporter.setAppendExisting(isAppend);
+ extent.attachReporter(htmlReporter);
+ }
+
+ public synchronized static ExtentReports getReporter() {
+ return extent;
+ }
+
+ public static void initReporter(String filepath, String htmlFile, ITestContext context) throws Exception {
+
+ String onboardVersion = AutomationUtils.getOnboardVersion();
+ String osVersion = AutomationUtils.getOSVersion();
+ Config config = Utils.getConfig();
+ String envData = config.getUrl();
+ String suiteName = getSuiteName(context);
+
+ if(suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())){
+ if (config.getUseBrowserMobProxy())
+ setTrafficCaptue(config);
+
+ setReporter(filepath, htmlFile, true);
+ String suiteNameFromVersionInfoFile = FileHandling.getKeyByValueFromPropertyFormatFile(filepath + VERSIONS_INFO_FILE_NAME, "suiteName");
+ reporterDataDefinition(onboardVersion, osVersion, envData, suiteNameFromVersionInfoFile);
+ }else{
+ FileHandling.deleteDirectory(ComponentBaseTest.getReportFolder());
+ FileHandling.createDirectory(filepath);
+ setReporter(filepath, htmlFile, false);
+ reporterDataDefinition(onboardVersion, osVersion, envData, suiteName);
+ AutomationUtils.createVersionsInfoFile(filepath + VERSIONS_INFO_FILE_NAME, onboardVersion, osVersion, envData, suiteName);
+ }
+
+ }
+
+ public static void reporterDataDefinition(String onboardVersion, String osVersion, String envData, String suiteNameFromVersionInfoFile) throws Exception {
+ extent.setSystemInfo("Onboard Version", onboardVersion);
+ extent.setSystemInfo("OS Version", osVersion);
+// extent.setSystemInfo("Host Name Address", RestCDUtils.getExecutionHostAddress());
+ extent.setSystemInfo("ExecutedOn", envData);
+ extent.setSystemInfo("SuiteName", suiteNameFromVersionInfoFile);
+ }
+
+ public static String getSuiteName(ITestContext context) {
+ String suitePath = context.getSuite().getXmlSuite().getFileName();
+ if(suitePath != null){
+ File file = new File(suitePath);
+ String suiteName = file.getName();
+ return suiteName;
+ }
+ return null;
+ }
+
+ public synchronized static ExtentHtmlReporter setConfiguration(ExtentHtmlReporter htmlReporter) throws Exception {
+
htmlReporter.config().setTheme(Theme.STANDARD);
-
htmlReporter.config().setEncoding("UTF-8");
-
htmlReporter.config().setProtocol(Protocol.HTTPS);
-
- htmlReporter.config().setDocumentTitle("ASDC Automation Report");
-
+ htmlReporter.config().setDocumentTitle("SDC Automation Report");
htmlReporter.config().setChartVisibilityOnOpen(true);
-
- htmlReporter.config().setReportName(AutomationUtils.getOSVersion());
-
+// htmlReporter.config().setReportName(AutomationUtils.getATTVersion());
+ htmlReporter.config().setReportName("SDC Automation Report");
+ htmlReporter.config().setChartVisibilityOnOpen(false);
+ htmlReporter.config().setJS(icon);
return htmlReporter;
}
-
- public synchronized static ExtentReports getReporter() {
- return extent;
- }
+
+ public static void closeReporter(){
+ extent.flush();
+ }
+
+ public static void setTrafficCaptue(Config config) {
+ boolean mobProxyStatus = config.getUseBrowserMobProxy();
+ if (mobProxyStatus){
+ config.setCaptureTraffic(true);;
+ }
+ }
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestActions.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestActions.java
new file mode 100644
index 0000000000..f865ef1699
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestActions.java
@@ -0,0 +1,111 @@
+/*-
+ * ============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.api;
+
+import com.aventstack.extentreports.ExtentTest;
+import com.aventstack.extentreports.MediaEntityBuilder;
+import com.aventstack.extentreports.Status;
+import com.aventstack.extentreports.markuputils.ExtentColor;
+import com.aventstack.extentreports.markuputils.Markup;
+import com.aventstack.extentreports.markuputils.MarkupHelper;
+
+import java.io.File;
+
+
+public class ExtentTestActions {
+
+ public static void log(Status logStatus, Markup mark){
+ ExtentTest test = ExtentTestManager.getTest();
+ test.log(logStatus, mark);
+ }
+
+ public static void log(Status logStatus, String message){
+ ExtentTest test = ExtentTestManager.getTest();
+ test.log(logStatus, message);
+ }
+
+ public static void log(Status logStatus, String message, String duration){
+ log(logStatus, message + addDurationTag(duration));
+ }
+
+ public static void log(Status logStatus, Throwable throwabel){
+ ExtentTest test = ExtentTestManager.getTest();
+ test.log(logStatus, throwabel);
+ }
+
+ public static void addTag(Status logStatus, String message){
+ Markup m = null;
+ switch(logStatus){
+ case PASS:
+ m = MarkupHelper.createLabel(message, ExtentColor.GREEN);
+ break;
+ case FAIL:
+ m = MarkupHelper.createLabel(message, ExtentColor.RED);
+ break;
+ case SKIP:
+ m = MarkupHelper.createLabel(message, ExtentColor.BLUE);
+ break;
+ case FATAL:
+ m = MarkupHelper.createLabel(message, ExtentColor.BROWN);
+ break;
+ default:
+ break;
+ }
+
+ if (m != null){
+ log(logStatus, m);
+ }
+ }
+
+// public static String addScreenshot(Status logStatus, String screenshotName, String message) throws IOException{
+// String imageFilePath = null;
+// String uuid = UUID.randomUUID().toString();
+// String[] stringArray = uuid.split("-");
+// screenshotName = screenshotName + "-" + stringArray[stringArray.length - 1];
+// try {
+// File imageFile = GeneralUIUtils.takeScreenshot(screenshotName, SetupCDTest.getScreenshotFolder());
+// imageFilePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFile.toURI()).getPath();
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
+//
+// ExtentTest test = ExtentTestManager.getTest();
+// test.log(logStatus, message, MediaEntityBuilder.createScreenCaptureFromPath(imageFilePath).build());
+// return imageFilePath;
+// }
+
+ private static String addDurationTag(String duration){
+ return "<td width=\"80px\">" + duration + "</td>";
+ }
+
+ public static String addLinkTag(String fileName, String pathToFile){
+ return String.format("<a download=\"%s\" href=\"%s\">HAR file</a>", fileName, pathToFile);
+ }
+
+ public static void addFileToReportAsLink(File harFile, String pathToFileFromReportDirectory, String message) {
+ log(Status.INFO, message, addLinkTag(harFile.getName(), pathToFileFromReportDirectory));
+ }
+
+
+
+
+
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestManager.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestManager.java
index 9c4acd4367..3d8c6a999e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestManager.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestManager.java
@@ -20,11 +20,10 @@
package org.openecomp.sdc.ci.tests.api;
-import java.util.HashMap;
-
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
+import java.util.HashMap;
public class ExtentTestManager {
@@ -37,8 +36,6 @@ public class ExtentTestManager {
public static synchronized void endTest() {
// extent.endTest(extentTestMap.get(Thread.currentThread().getId()));
-// extentTestMap.get(Thread.currentThread().getId()); // This is test
- // TODO: maybe uncomment becuase we will need it only at the end
extent.flush();
}
@@ -52,5 +49,14 @@ public class ExtentTestManager {
return test;
}
+
+ public static synchronized <T> void assignCategory(Class<T> clazz){
+ String[] parts = clazz.getName().split("\\.");
+ String lastOne1 = parts[parts.length-1];
+ String lastOne2 = parts[parts.length-2];
+ getTest().assignCategory(lastOne2 + "-" + lastOne1);
+ }
+
+
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
index ea1c9eff8d..15a1eb783a 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
@@ -364,5 +364,7 @@ public interface Urls {
final String ONBOARD_VERSION = "http://%s:%s/onboarding-api/docs/build-info.json";
final String OS_VERSION = "http://%s:%s/sdc2/rest/version";
+// amdocs APIs
+ final String GET_VENDOR_SOFTWARE_PRODUCT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/packages/%s";
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java
new file mode 100644
index 0000000000..8b58ca9993
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java
@@ -0,0 +1,72 @@
+package org.openecomp.sdc.ci.tests.dataProviders;
+
+import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
+import org.testng.annotations.DataProvider;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+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
+ List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure();
+ List<String> newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder);
+ System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size()));
+ return provideData(newRandomFileNamesFromFolder, filepath);
+ }
+
+ @DataProvider(name = "VNF_List" , parallel = true)
+ private static final Object[][] VnfList() throws Exception {
+
+ List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
+
+ System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
+ return provideData(fileNamesFromFolder, filepath);
+ }
+
+// -----------------------factories-----------------------------------------
+
+
+
+
+// -----------------------methods-----------------------------------------
+ public static Object[][] provideData(List<String> fileNamesFromFolder, String filepath) {
+
+ Object[][] arObject = new Object[fileNamesFromFolder.size()][];
+ int index = 0;
+ for (Object obj : fileNamesFromFolder) {
+ arObject[index++] = new Object[] { filepath, obj };
+ }
+ return arObject;
+ }
+
+ private static List<String> getRandomElements(int randomElementNumber, List<String> fileNamesFromFolder) {
+ if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){
+ return null;
+ }else{
+ List<Integer> indexList = new ArrayList<>();
+ List<String> newRandomFileNamesFromFolder = new ArrayList<>();
+ for(int i = 0; i < fileNamesFromFolder.size(); i++){
+ indexList.add(i);
+ }
+ Collections.shuffle(indexList);
+ Integer[] randomArray = indexList.subList(0, randomElementNumber).toArray(new Integer[randomElementNumber]);
+ for(int i = 0; i < randomArray.length; i++){
+ newRandomFileNamesFromFolder.add(fileNamesFromFolder.get(randomArray[i]));
+ }
+ return newRandomFileNamesFromFolder;
+ }
+ }
+
+
+
+
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java
new file mode 100644
index 0000000000..9c2cfa809c
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java
@@ -0,0 +1,56 @@
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public class AmdocsLicenseMembers {
+
+ private String vendorId;
+ private String vendorLicenseName;
+ private String vendorLicenseAgreementId;
+ private String featureGroupId;
+
+ public AmdocsLicenseMembers(String vendorId, String vendorLicenseName, String vendorLicenseAgreementId, String featureGroupId) {
+ super();
+ this.vendorId = vendorId;
+ this.vendorLicenseName = vendorLicenseName;
+ this.vendorLicenseAgreementId = vendorLicenseAgreementId;
+ this.featureGroupId = featureGroupId;
+ }
+
+ public String getVendorId() {
+ return vendorId;
+ }
+
+ public void setVendorId(String vendorId) {
+ this.vendorId = vendorId;
+ }
+
+ public String getVendorLicenseName() {
+ return vendorLicenseName;
+ }
+
+ public void setVendorLicenseName(String vendorLicenseName) {
+ this.vendorLicenseName = vendorLicenseName;
+ }
+
+ public String getVendorLicenseAgreementId() {
+ return vendorLicenseAgreementId;
+ }
+
+ public void setVendorLicenseAgreementId(String vendorLicenseAgreementId) {
+ this.vendorLicenseAgreementId = vendorLicenseAgreementId;
+ }
+
+ public String getFeatureGroupId() {
+ return featureGroupId;
+ }
+
+ public void setFeatureGroupId(String featureGroupId) {
+ this.featureGroupId = featureGroupId;
+ }
+
+ @Override
+ public String toString() {
+ return "AmdocsLicenseMembers [vendorId=" + vendorId + ", vendorLicenseName=" + vendorLicenseName + ", vendorLicenseAgreementId=" + vendorLicenseAgreementId + ", featureGroupId=" + featureGroupId + "]";
+ }
+
+
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceReqDetails.java
index 8456e5b35b..5a80fd14ca 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceReqDetails.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceReqDetails.java
@@ -35,8 +35,10 @@ public class ResourceReqDetails extends ComponentReqDetails {
Boolean isAbstract;
Boolean isHighestVersion;
String cost;
+
String licenseType;
String toscaResourceName;
+ String resourceVendorModelNumber;
private String resourceType = ResourceTypeEnum.VFC.toString(); // Default
// value
@@ -45,6 +47,21 @@ public class ResourceReqDetails extends ComponentReqDetails {
super();
}
+ public ResourceReqDetails(List<String> derivedFrom, String vendorName, String vendorRelease, Boolean isAbstract, Boolean isHighestVersion, String cost, String licenseType, String toscaResourceName, String resourceVendorModelNumber,
+ String resourceType) {
+ super();
+ this.derivedFrom = derivedFrom;
+ this.vendorName = vendorName;
+ this.vendorRelease = vendorRelease;
+ this.isAbstract = isAbstract;
+ this.isHighestVersion = isHighestVersion;
+ this.cost = cost;
+ this.licenseType = licenseType;
+ this.toscaResourceName = toscaResourceName;
+ this.resourceVendorModelNumber = resourceVendorModelNumber;
+ this.resourceType = resourceType;
+ }
+
public ResourceReqDetails(Resource resource) {
super();
this.resourceType = resource.getResourceType().toString();
@@ -68,6 +85,7 @@ public class ResourceReqDetails extends ComponentReqDetails {
this.UUID = resource.getUUID();
this.categories = resource.getCategories();
this.importedToscaChecksum = resource.getImportedToscaChecksum();
+ this.resourceVendorModelNumber = resource.getResourceVendorModelNumber();
}
@@ -136,6 +154,13 @@ public class ResourceReqDetails extends ComponentReqDetails {
this.toscaResourceName = resourceName;
}
+ public String getResourceVendorModelNumber() {
+ return resourceVendorModelNumber;
+ }
+
+ public void setResourceVendorModelNumber(String resourceVendorModelNumber) {
+ this.resourceVendorModelNumber = resourceVendorModelNumber;
+ }
public String getToscaResourceName() {
return toscaResourceName;
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java
index e33183ca94..2f3d648ef6 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java
@@ -26,6 +26,43 @@ import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
public class ServiceReqDetails extends ComponentReqDetails {
+
+ protected String serviceType;
+ protected String serviceRole;
+ protected String namingPolicy;
+ protected Boolean ecompGeneratedNaming;
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
+ public String getNamingPolicy() {
+ return namingPolicy;
+ }
+
+ public void setNamingPolicy(String namingPolicy) {
+ this.namingPolicy = namingPolicy;
+ }
+
+ public Boolean getEcompGeneratedNaming() {
+ return ecompGeneratedNaming;
+ }
+
+ public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) {
+ this.ecompGeneratedNaming = ecompGeneratedNaming;
+ }
public ServiceReqDetails(String serviceName, String category, ArrayList<String> tags, String description,
String contactId, String icon) {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java
new file mode 100644
index 0000000000..fbdb88e712
--- /dev/null
+++ b/test-apis-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/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
index 7e363202bb..1f578d108c 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java
@@ -311,7 +311,7 @@ public class ArtifactServletTest extends ComponentBaseTest {
httppost.addHeader(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
httppost.addHeader(HttpHeaderEnum.USER_ID.getValue(), sdncUserDetails.getUserId());
if (addMd5Header) {
- httppost.addHeader(HttpHeaderEnum.Content_MD5.getValue(), GeneralUtility.calculateMD5ByString(jsonBody));
+ httppost.addHeader(HttpHeaderEnum.Content_MD5.getValue(), GeneralUtility.calculateMD5Base64EncodedByString(jsonBody));
}
StringEntity input = new StringEntity(jsonBody);
input.setContentType("application/json");
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java
index bb2b662009..5f1230f4ce 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java
@@ -624,7 +624,7 @@ artifact.setArtifactLabel("configure");*/
httppost.addHeader(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
httppost.addHeader(HttpHeaderEnum.USER_ID.getValue(), sdncUserDetails.getUserId());
if (addMd5Header) {
- httppost.addHeader(HttpHeaderEnum.Content_MD5.getValue(), GeneralUtility.calculateMD5ByString(jsonBody));
+ httppost.addHeader(HttpHeaderEnum.Content_MD5.getValue(), GeneralUtility.calculateMD5Base64EncodedByString(jsonBody));
}
StringEntity input = new StringEntity(jsonBody);
input.setContentType("application/json");
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
index 7ba705fc7d..258619292f 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
@@ -212,7 +212,7 @@ public class DistributionDownloadArtifactTest extends ComponentBaseTest {
AssertJUnit.assertEquals(artifactDetails.getPayload(), Base64.encodeBase64String(actualContents.getBytes()));
// validating checksum
- String actualPayloadChecksum = GeneralUtility.calculateMD5ByByteArray(actualContents.getBytes());
+ String actualPayloadChecksum = GeneralUtility.calculateMD5Base64EncodedByByteArray(actualContents.getBytes());
AssertJUnit.assertEquals(expectedPayloadChecksum, actualPayloadChecksum);
// validate audit
@@ -380,7 +380,7 @@ public class DistributionDownloadArtifactTest extends ComponentBaseTest {
// validating checksum
byte[] bytes = actualContents.getBytes();
- String actualPayloadChecksum = GeneralUtility.calculateMD5ByByteArray(bytes);
+ String actualPayloadChecksum = GeneralUtility.calculateMD5Base64EncodedByByteArray(bytes);
assertEquals(expectedPayloadChecksum, actualPayloadChecksum);
// validating valid zip
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
index c069f984d2..56deb3e08b 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
@@ -189,7 +189,7 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
+ " \"icon\": \"router\",\r\n" + " \"tags\": [\r\n" + " \"importResource4test\"\r\n" + " ],\r\n"
+ " \"payloadData\": \"" + encodedPayload + "\"\r\n" + "}";
- String md5 = GeneralUtility.calculateMD5ByString(json);
+ String md5 = GeneralUtility.calculateMD5Base64EncodedByString(json);
Map<String, String> headers = new HashMap<String, String>();
headers.put(Constants.MD5_HEADER, md5);
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java
new file mode 100644
index 0000000000..2b341f5cbf
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java
@@ -0,0 +1,126 @@
+/*-
+ * ============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.sanity;
+
+
+
+
+
+import org.junit.Rule;
+import org.junit.rules.TestName;
+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.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.api.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.dataProviders.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.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+import fj.data.Either;
+
+
+
+
+
+
+public class Onboard extends ComponentBaseTest {
+
+
+ @Rule
+ public static TestName name = new TestName();
+
+ public Onboard() {
+ super(name, Onboard.class.getName());
+ }
+
+ protected String makeDistributionValue;
+
+
+
+ @Parameters({ "makeDistribution" })
+ @BeforeMethod
+ public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) {
+ makeDistributionValue = makeDistributionReadValue;
+ }
+
+
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
+ public void onboardVNFShotFlow(String filepath, String vnfFile) throws Exception, Throwable {
+ setLog(vnfFile);
+ System.out.println("print - >" + makeDistributionValue);
+ runOnboardToDistributionFlow(filepath, vnfFile);
+ }
+
+
+
+
+
+ public void runOnboardToDistributionFlow(String filepath, String vnfFile) throws Exception {
+
+ ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile));
+ User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+ Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(filepath, vnfFile, user);
+ VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right;
+ vendorSoftwareProductObject.setVspName(createVendorSoftwareProduct.left);
+
+ // create VF base on VNF imported from previous step - have, resourceReqDetails object include part of resource metadata
+ ResourceReqDetails resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(vendorSoftwareProductObject, vendorSoftwareProductObject.getVspName());
+ ExtentTestActions.log(Status.INFO, String.format("Create VF %s From VSP", resourceReqDetails.getName()));
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, vendorSoftwareProductObject.getVspName());
+ ExtentTestActions.log(Status.INFO, String.format("Certify VF"));
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ //--------------------------SERVICE--------------------------------
+ ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(user);
+ ExtentTestActions.log(Status.INFO, String.format("Create Service %s", serviceReqDetails.getName()));
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+ ExtentTestActions.log(Status.INFO, String.format("add VF to Service"));
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ addComponentInstanceToComponentContainer.left().value();
+ ExtentTestActions.log(Status.INFO, String.format("Certify Service"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ ExtentTestActions.log(Status.INFO, String.format("Distribute Service"));
+ AtomicOperationUtils.distributeService(service, true);
+
+ ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile));
+ }
+
+
+
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java
index 18b2329663..d7ac4a5676 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java
@@ -29,9 +29,7 @@ public class ToscaDefinition {
String tosca_definitions_version;
Map<String, String> metadata;
-// Map<String, ToscaImportsDefinition> imports;
-// TODO waiting for answer about imports representation
- Object imports;
+ List<Map<String, ToscaImportsDefinition>> imports;
Map<String, ToscaNodeTypesDefinition> node_types;
ToscaTopologyTemplateDefinition topology_template;
@@ -39,54 +37,49 @@ public class ToscaDefinition {
super();
}
- @Override
- public String toString() {
- return "ToscaDefinition [tosca_definitions_version=" + tosca_definitions_version + ", metadata=" + metadata + ", imports=" + imports + ", node_types=" + node_types + ", topology_template=" + topology_template + "]";
- }
- public String getTosca_definitions_version() {
- return tosca_definitions_version;
- }
- public void setTosca_definitions_version(String tosca_definitions_version) {
+ public ToscaDefinition(String tosca_definitions_version, Map<String, String> metadata, List<Map<String, ToscaImportsDefinition>> imports, Map<String, ToscaNodeTypesDefinition> node_types,
+ ToscaTopologyTemplateDefinition topology_template) {
+ super();
this.tosca_definitions_version = tosca_definitions_version;
+ this.metadata = metadata;
+ this.imports = imports;
+ this.node_types = node_types;
+ this.topology_template = topology_template;
}
+
+
public Map<String, String> getMetadata() {
return metadata;
}
+
+
public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
}
-
-
-// public Map<String,ToscaImportsDefinition> getImports() {
-// return (Map<String, ToscaImportsDefinition>) imports;
-// }
-//
-// public void setImports(Map<String,ToscaImportsDefinition> imports) {
-// this.imports = imports;
-// }
-//
-// public List<ToscaImportsDefinition> getImports() {
-// return (List<ToscaImportsDefinition>) imports;
-// }
-//
-// public void setImports(List<ToscaImportsDefinition> imports) {
-// this.imports = imports;
-// }
-
- public Object getImports() {
+
+ public List<Map<String, ToscaImportsDefinition>> getImports() {
return imports;
}
- public void setImports(Object imports) {
+ public void setImports(List<Map<String, ToscaImportsDefinition>> imports) {
this.imports = imports;
}
+ public String getTosca_definitions_version() {
+ return tosca_definitions_version;
+ }
+
+ public void setTosca_definitions_version(String tosca_definitions_version) {
+ this.tosca_definitions_version = tosca_definitions_version;
+ }
+
+
public Map<String, ToscaNodeTypesDefinition> getNode_types() {
return node_types;
}
@@ -109,9 +102,7 @@ public class ToscaDefinition {
public static TypeDescription getTypeDescription(){
TypeDescription typeDescription = new TypeDescription(ToscaDefinition.class);
typeDescription.putMapPropertyType("metadata", String.class, String.class);
-// TODO Andrey imports format
- typeDescription.putMapPropertyType("imports", String.class, ToscaImportsDefinition.class);
-// typeDescription.putListPropertyType("imports", List.class);
+ typeDescription.putListPropertyType("imports", Map.class);
typeDescription.putMapPropertyType("node_types", String.class, ToscaNodeTypesDefinition.class);
return typeDescription;
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupsTopologyTemplateDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupsTopologyTemplateDefinition.java
index dc3c40751c..e3051515cd 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupsTopologyTemplateDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupsTopologyTemplateDefinition.java
@@ -35,17 +35,17 @@ public class ToscaGroupsTopologyTemplateDefinition {
private Map<String, Object> interfaces;
private List<String> members;
// private Map<String, String> metadata;
- private ToscaGroupsMetadataDefinition metadata;
+ private ToscaServiceGroupsMetadataDefinition metadata;
public ToscaGroupsTopologyTemplateDefinition() {
super();
}
- public ToscaGroupsMetadataDefinition getMetadata() {
+ public ToscaServiceGroupsMetadataDefinition getMetadata() {
return metadata;
}
- public void setMetadata(ToscaGroupsMetadataDefinition metadata) {
+ public void setMetadata(ToscaServiceGroupsMetadataDefinition metadata) {
this.metadata = metadata;
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaImportsDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaImportsDefinition.java
index d62e33e1dd..a5070b8662 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaImportsDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaImportsDefinition.java
@@ -20,8 +20,11 @@
package org.openecomp.sdc.ci.tests.tosca.datatypes;
+import org.yaml.snakeyaml.TypeDescription;
+
public class ToscaImportsDefinition {
+ private String name;
private String file;
private String repository;
private String namespace_uri;
@@ -32,17 +35,21 @@ public class ToscaImportsDefinition {
// TODO Auto-generated constructor stub
}
- public ToscaImportsDefinition(String file, String repository, String namespace_uri, String namespace_prefix) {
+ public ToscaImportsDefinition(String name, String file, String repository, String namespace_uri, String namespace_prefix) {
super();
+ this.name = name;
this.file = file;
this.repository = repository;
this.namespace_uri = namespace_uri;
this.namespace_prefix = namespace_prefix;
}
- @Override
- public String toString() {
- return "ToscaImportsDefinition [file=" + file + ", repository=" + repository + ", namespace_uri=" + namespace_uri + ", namespace_prefix=" + namespace_prefix + "]";
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
}
public String getFile() {
@@ -76,6 +83,13 @@ public class ToscaImportsDefinition {
public void setNamespace_prefix(String namespace_prefix) {
this.namespace_prefix = namespace_prefix;
}
+
+ //gets Type description for Yaml snake
+ public static TypeDescription getTypeDescription(){
+ TypeDescription typeDescription = new TypeDescription(ToscaImportsDefinition.class);
+ return typeDescription;
+ }
+
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java
index 6f9590f0ae..45feadecca 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java
@@ -22,6 +22,8 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes;
import java.util.Map;
+import org.yaml.snakeyaml.TypeDescription;
+
public class ToscaInputsTopologyTemplateDefinition {
private Map<String,Map<String,Object>> inputs;
@@ -40,6 +42,10 @@ public class ToscaInputsTopologyTemplateDefinition {
}
-
+ //gets Type description for Yaml snake
+ public static TypeDescription getTypeDescription(){
+ TypeDescription typeDescription = new TypeDescription(ToscaInputsTopologyTemplateDefinition.class);
+ return typeDescription;
+ }
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaMetadataDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaMetadataDefinition.java
new file mode 100644
index 0000000000..ceba7adbe4
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaMetadataDefinition.java
@@ -0,0 +1,196 @@
+/*-
+ * ============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.tosca.datatypes;
+
+import org.yaml.snakeyaml.TypeDescription;
+
+public class ToscaMetadataDefinition {
+
+ private String invariantUUID;
+ private String UUID;
+ private String name;
+ private String description;
+ private String type;
+ private String category;
+ private String subcategory;
+ private String resourceVendor;
+ private String resourceVendorRelease;
+ private String resourceVendorModelNumber;
+ private String serviceType;
+ private String serviceRole;
+ private String serviceEcompNaming;
+ private String ecompGeneratedNaming;
+ private String namingPolicy;
+
+ public ToscaMetadataDefinition(String invariantUUID, String uUID, String name, String description, String type, String category, String subcategory, String resourceVendor, String resourceVendorRelease, String resourceVendorModelNumber,
+ String serviceType, String serviceRole, String serviceEcompNaming, String ecompGeneratedNaming, String namingPolicy) {
+ super();
+ this.invariantUUID = invariantUUID;
+ UUID = uUID;
+ this.name = name;
+ this.description = description;
+ this.type = type;
+ this.category = category;
+ this.subcategory = subcategory;
+ this.resourceVendor = resourceVendor;
+ this.resourceVendorRelease = resourceVendorRelease;
+ this.resourceVendorModelNumber = resourceVendorModelNumber;
+ this.serviceType = serviceType;
+ this.serviceRole = serviceRole;
+ this.serviceEcompNaming = serviceEcompNaming;
+ this.ecompGeneratedNaming = ecompGeneratedNaming;
+ this.namingPolicy = namingPolicy;
+ }
+
+ public String getInvariantUUID() {
+ return invariantUUID;
+ }
+
+ public void setInvariantUUID(String invariantUUID) {
+ this.invariantUUID = invariantUUID;
+ }
+
+ public String getUUID() {
+ return UUID;
+ }
+
+ public void setUUID(String uUID) {
+ UUID = uUID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ 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 getResourceVendor() {
+ return resourceVendor;
+ }
+
+ public void setResourceVendor(String resourceVendor) {
+ this.resourceVendor = resourceVendor;
+ }
+
+ public String getResourceVendorRelease() {
+ return resourceVendorRelease;
+ }
+
+ public void setResourceVendorRelease(String resourceVendorRelease) {
+ this.resourceVendorRelease = resourceVendorRelease;
+ }
+
+ public String getResourceVendorModelNumber() {
+ return resourceVendorModelNumber;
+ }
+
+ public void setResourceVendorModelNumber(String resourceVendorModelNumber) {
+ this.resourceVendorModelNumber = resourceVendorModelNumber;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
+ public String getServiceEcompNaming() {
+ return serviceEcompNaming;
+ }
+
+ public void setServiceEcompNaming(String serviceEcompNaming) {
+ this.serviceEcompNaming = serviceEcompNaming;
+ }
+
+ public String getEcompGeneratedNaming() {
+ return ecompGeneratedNaming;
+ }
+
+ public void setEcompGeneratedNaming(String ecompGeneratedNaming) {
+ this.ecompGeneratedNaming = ecompGeneratedNaming;
+ }
+
+ public String getNamingPolicy() {
+ return namingPolicy;
+ }
+
+ public void setNamingPolicy(String namingPolicy) {
+ this.namingPolicy = namingPolicy;
+ }
+
+ @Override
+ public String toString() {
+ return "ToscaMetadataDefinition [invariantUUID=" + invariantUUID + ", UUID=" + UUID + ", name=" + name + ", description=" + description + ", type=" + type + ", category=" + category + ", subcategory=" + subcategory
+ + ", resourceVendor=" + resourceVendor + ", resourceVendorRelease=" + resourceVendorRelease + ", resourceVendorModelNumber=" + resourceVendorModelNumber + ", serviceType=" + serviceType + ", serviceRole=" + serviceRole
+ + ", serviceEcompNaming=" + serviceEcompNaming + ", ecompGeneratedNaming=" + ecompGeneratedNaming + ", namingPolicy=" + namingPolicy + "]";
+ }
+
+ //gets Type description for Yaml snake
+ public static TypeDescription getTypeDescription(){
+ TypeDescription typeDescription = new TypeDescription(ToscaMetadataDefinition.class);
+ return typeDescription;
+ }
+
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupsMetadataDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaServiceGroupsMetadataDefinition.java
index eec057ed52..86ca8f56cf 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaGroupsMetadataDefinition.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaServiceGroupsMetadataDefinition.java
@@ -20,7 +20,7 @@
package org.openecomp.sdc.ci.tests.tosca.datatypes;
-public class ToscaGroupsMetadataDefinition {
+public class ToscaServiceGroupsMetadataDefinition {
private String vfModuleModelName;
private String vfModuleModelInvariantUUID;
@@ -28,7 +28,7 @@ public class ToscaGroupsMetadataDefinition {
private String vfModuleModelUUID;
private String vfModuleModelVersion;
- public ToscaGroupsMetadataDefinition() {
+ public ToscaServiceGroupsMetadataDefinition() {
super();
// TODO Auto-generated constructor stub
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/model/ToscaMetadataFieldsPresentationEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/model/ToscaMetadataFieldsPresentationEnum.java
new file mode 100644
index 0000000000..cdea2ff69c
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/model/ToscaMetadataFieldsPresentationEnum.java
@@ -0,0 +1,74 @@
+package org.openecomp.sdc.ci.tests.tosca.model;
+
+public class ToscaMetadataFieldsPresentationEnum {
+
+ public enum ToscaMetadataFieldsEnum {
+// general
+ INVARIANT_UUID ("invariantUUID", ComponentTypeEnum.RESOURCE_SERVICE_NODE_TEMPLATE.value),
+ UUID ("UUID", ComponentTypeEnum.RESOURCE_SERVICE_NODE_TEMPLATE.value),
+ NAME ("name", ComponentTypeEnum.RESOURCE_SERVICE_NODE_TEMPLATE.value),
+ DESCRIPTION ("description", ComponentTypeEnum.RESOURCE_SERVICE_NODE_TEMPLATE.value),
+ CATEGORY ("category", ComponentTypeEnum.RESOURCE_SERVICE_NODE_TEMPLATE.value),
+ TYPE ("type", ComponentTypeEnum.RESOURCE_SERVICE_NODE_TEMPLATE.value),
+
+// resource
+ SUBCATEGORY ("subcategory", ComponentTypeEnum.RESOURCE_NODE_TEMPLATE.value),
+ RESOURCE_VENDOR_NAME ("resourceVendor", ComponentTypeEnum.RESOURCE_NODE_TEMPLATE.value),
+ RESOURCE_VENDOR_RELEASE ("resourceVendorRelease", ComponentTypeEnum.RESOURCE_NODE_TEMPLATE.value),
+ RESOURCE_VENDOR_MODEL_NUMBER ("resourceVendorModelNumber", ComponentTypeEnum.RESOURCE_NODE_TEMPLATE.value),
+
+// service
+ SERVICE_TYPE ("serviceType", ComponentTypeEnum.SERVICE.value),
+ SERVICE_ROLE ("serviceRole", ComponentTypeEnum.SERVICE.value),
+ SERVICE_ECOMP_NAMING ("serviceEcompNaming", ComponentTypeEnum.SERVICE.value),
+ ECOMP_GENERATED_NAMING ("ecompGeneratedNaming", ComponentTypeEnum.SERVICE.value),
+ NAMING_POLICY ("namingPolicy", ComponentTypeEnum.SERVICE.value),
+
+// node_template
+ CUSTOMIZATION_UUID ("customizationUUID", ComponentTypeEnum.NODE_TEMPLATE.value),
+ VERSION ("version", ComponentTypeEnum.RESOURCE_GROUP_NODE_TEMPLATE.value),
+
+// service group:
+ VF_MODULE_MODEL_NAME ("vfModuleModelName", ComponentTypeEnum.RESOURCE_GROUP_SERVICE_GROUP.value),
+ VF_MODULE_MODEL_INVARIANT_UUID ("vfModuleModelInvariantUUID", ComponentTypeEnum.RESOURCE_GROUP_SERVICE_GROUP.value),
+ VF_MODULE_MODEL_UUID ("vfModuleModelUUID", ComponentTypeEnum.RESOURCE_GROUP_SERVICE_GROUP.value),
+ VF_MODULE_MODEL_VERSION ("vfModuleModelVersion", ComponentTypeEnum.RESOURCE_GROUP_SERVICE_GROUP.value),
+
+ VF_MODULE_MODEL_CUSTOMIZATION_UUID ("vfModuleModelCustomizationUUID", ComponentTypeEnum.SERVICE_GROUP.value)
+ ;
+
+
+
+ public String value;
+ public String componentTypes;
+
+ private ToscaMetadataFieldsEnum(String value, String componentTypes) {
+ this.value = value;
+ this.componentTypes = componentTypes;
+ }
+
+ }
+
+
+ public enum ComponentTypeEnum {
+// RESOURCE_SERVICE_NODE_TEMPLATE_RESOURCE_GROUP("resource, service, nodeTemplate, resourceGroup"),
+ RESOURCE_SERVICE_NODE_TEMPLATE("resource, service, nodeTemplate"),
+ RESOURCE_NODE_TEMPLATE("resource, nodeTemplate"),
+ SERVICE("service"),
+ NODE_TEMPLATE("nodeTemplate"),
+ RESOURCE_GROUP_NODE_TEMPLATE("resourceGroup, nodeTemplate"),
+ SERVICE_GROUP("serviceGroup"),
+ RESOURCE_GROUP_SERVICE_GROUP("resourceGroup, serviceGroup"),
+
+ ;
+
+ private String value;
+
+ private ComponentTypeEnum(String value) {
+ this.value = value;
+ }
+
+ }
+
+
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java
index 3bae41fc57..5926798ceb 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java
@@ -29,12 +29,13 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
-import java.util.Set;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ToscaKeysEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaImportsDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaInputsTopologyTemplateDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaMetadataDefinition;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaNodeTemplatesTopologyTemplateDefinition;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaParameterConstants;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaSubstitutionMappingsDefinition;
@@ -42,12 +43,10 @@ import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinitio
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ImportRestUtils;
-import org.openecomp.sdc.ci.tests.utils.validation.CsarValidationUtils;
import org.openecomp.sdc.common.rest.api.RestResponseAsByteArray;
import org.openecomp.sdc.common.util.ZipUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.yaml.snakeyaml.TypeDescription;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.introspector.PropertyUtils;
@@ -158,7 +157,9 @@ public class ToscaParserUtils {
toscaStructure.addTypeDescription(ToscaNodeTemplatesTopologyTemplateDefinition.getTypeDescription());
toscaStructure.addTypeDescription(ToscaGroupsTopologyTemplateDefinition.getTypeDescription());
toscaStructure.addTypeDescription(ToscaSubstitutionMappingsDefinition.getTypeDescription());
-
+ toscaStructure.addTypeDescription(ToscaImportsDefinition.getTypeDescription());
+ toscaStructure.addTypeDescription(ToscaMetadataDefinition.getTypeDescription());
+ toscaStructure.addTypeDescription(ToscaInputsTopologyTemplateDefinition.getTypeDescription());
// Skip properties which are found in YAML, but not found in POJO
PropertyUtils propertyUtils = new PropertyUtils();
propertyUtils.setSkipMissingProperties(true);
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
index 17148ce8a9..58ab9f353e 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
@@ -39,6 +39,7 @@ import org.apache.commons.lang3.tuple.Pair;
import org.aspectj.apache.bcel.classfile.Code;
import org.json.JSONException;
import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
@@ -50,6 +51,7 @@ 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.api.Urls;
+import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails;
@@ -67,6 +69,7 @@ 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.rest.ArtifactRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
@@ -134,6 +137,25 @@ public final class AtomicOperationUtils {
}
}
+ public static Either<Resource, RestResponse> createResourceByResourceDetails(ResourceReqDetails resourceDetails, UserRoleEnum userRole, Boolean validateState) {
+ try {
+ User defaultUser = ElementFactory.getDefaultUser(userRole);
+ RestResponse resourceResp = ResourceRestUtils.createResource(resourceDetails, defaultUser);
+
+ if (validateState) {
+ assertTrue(resourceResp.getErrorCode() == ResourceRestUtils.STATUS_CODE_CREATED);
+ }
+
+ if (resourceResp.getErrorCode() == ResourceRestUtils.STATUS_CODE_CREATED) {
+ Resource resourceResponseObject = ResponseParser.convertResourceResponseToJavaObject(resourceResp.getResponse());
+ return Either.left(resourceResponseObject);
+ }
+ return Either.right(resourceResp);
+ } catch (Exception e) {
+ throw new AtomicOperationException(e);
+ }
+ }
+
public static Either<Resource, RestResponse> createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum resourceType, NormativeTypesEnum normativeTypes, ResourceCategoryEnum resourceCategory, UserRoleEnum userRole, Boolean validateState)
throws Exception {
User defaultUser = ElementFactory.getDefaultUser(userRole);
@@ -206,6 +228,20 @@ public final class AtomicOperationUtils {
return Either.right(createServiceResp);
}
+ public static Either<Service, RestResponse> createCustomService(ServiceReqDetails serviceDetails, UserRoleEnum userRole, Boolean validateState) throws Exception {
+ User defaultUser = ElementFactory.getDefaultUser(userRole);
+ RestResponse createServiceResp = ServiceRestUtils.createService(serviceDetails, defaultUser);
+
+ if (validateState) {
+ assertTrue(createServiceResp.getErrorCode() == ServiceRestUtils.STATUS_CODE_CREATED);
+ }
+
+ if (createServiceResp.getErrorCode() == ResourceRestUtils.STATUS_CODE_CREATED) {
+ Service serviceResponseObject = ResponseParser.convertServiceResponseToJavaObject(createServiceResp.getResponse());
+ return Either.left(serviceResponseObject);
+ }
+ return Either.right(createServiceResp);
+ }
// *********** PRODUCT ****************
public static Either<Product, RestResponse> createDefaultProduct(UserRoleEnum userRole, Boolean validateState) throws Exception {
@@ -713,16 +749,21 @@ public final class AtomicOperationUtils {
}
}
- public static Either<String, RestResponse> getServiceToscaArtifactPayload(Service service, String artifactType) throws Exception {
+ public static Either<String, RestResponse> getComponenetArtifactPayload(Component component, String artifactType) throws Exception {
- String url = String.format(Urls.UI_DOWNLOAD_SERVICE_ARTIFACT, "localhost", "8080", service.getUniqueId(), service.getToscaArtifacts().get(artifactType).getUniqueId());
- String userId = service.getLastUpdaterUserId();
+ String url;
+ Config config = Utils.getConfig();
+ if(component.getComponentType().toString().toUpperCase().equals(ComponentTypeEnum.SERVICE.getValue().toUpperCase())){
+ url = String.format(Urls.UI_DOWNLOAD_SERVICE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), component.getUniqueId(), component.getToscaArtifacts().get(artifactType).getUniqueId());
+ }else{
+ url = String.format(Urls.UI_DOWNLOAD_RESOURCE_ARTIFACT, config.getCatalogBeHost(), config.getCatalogBePort(), component.getUniqueId(), component.getToscaArtifacts().get(artifactType).getUniqueId());
+ }
+ String userId = component.getLastUpdaterUserId();
Map<String, String> headersMap = new HashMap<String, String>();
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");
headersMap.put(HttpHeaderEnum.CACHE_CONTROL.getValue(), "no-cache");
headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), basicAuthentication);
headersMap.put(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
-// headersMap.put("X-ECOMP-InstanceID", "test");
if (userId != null) {
headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId);
}
@@ -735,4 +776,6 @@ public final class AtomicOperationUtils {
}
+
+
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java
index 5c23b5f3fe..ddca429f2c 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java
@@ -293,7 +293,7 @@ public class ElementFactory {
tags.add("serviceTag1");
tags.add(serviceName);
String description = "service Description";
- String icon = "myIcon";
+ String icon = "defaulticon";
ServiceReqDetails serviceDetails = new ServiceReqDetails(serviceName, category.getValue(), tags, description, contactId, icon);
@@ -979,7 +979,7 @@ public class ElementFactory {
return requirementDef;
}
- private static String generateUUIDforSufix() {
+ public static String generateUUIDforSufix() {
String uniqueSufix = UUID.randomUUID().toString();
String[] split = uniqueSufix.split("-");
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java
new file mode 100644
index 0000000000..77be6df729
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java
@@ -0,0 +1,542 @@
+/*-
+ * ============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.utils.general;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.be.model.DataTypeDefinition;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.config.Config;
+
+import org.openecomp.sdc.common.util.GeneralUtility;
+import org.yaml.snakeyaml.Yaml;
+
+import java.io.*;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+public class FileHandling {
+
+// ------------------yaml parser methods----------------------------
+ public static Map<?, ?> parseYamlFile(String filePath) throws Exception {
+ Yaml yaml = new Yaml();
+ File file = new File(filePath);
+ InputStream inputStream = new FileInputStream(file);
+ Map<?, ?> map = (Map<?, ?>) yaml.load(inputStream);
+ return map;
+ }
+
+ /**
+ * The method return map fetched objects by pattern from yaml file
+ * @param yamlFile
+ * @param pattern
+ * @return
+ * @throws Exception
+ */
+ public static Map<String, Object> parseYamlFileToMapByPattern(File yamlFile, String pattern) throws Exception {
+ Map<?, ?> yamlFileToMap = FileHandling.parseYamlFile(yamlFile.toString());
+ Map<String, Object> objectMap = getObjectMapByPattern(yamlFileToMap, pattern);
+ return objectMap;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Map<String, Object> getObjectMapByPattern(Map<?, ?> parseUpdetedEnvFile, String pattern) {
+ Map<String, Object> objectMap = null;
+
+ Object objectUpdetedEnvFile = parseUpdetedEnvFile.get(pattern);
+ if(objectUpdetedEnvFile instanceof HashMap){
+ objectMap = (Map<String, Object>) objectUpdetedEnvFile;
+ }
+ return objectMap;
+ }
+
+
+ public static Map<String, DataTypeDefinition> parseDataTypesYaml(String filePath) throws Exception {
+ @SuppressWarnings("unchecked")
+ Map<String, DataTypeDefinition> dataTypesMap = (Map<String, DataTypeDefinition>) parseYamlFile(filePath);
+ return dataTypesMap;
+ }
+// -------------------------------------------------------------------------------------------------
+
+ public static String getFilePath(String folder) {
+ String filepath = System.getProperty("filepath");
+ if (filepath == null && System.getProperty("os.name").contains("Windows")) {
+ filepath = FileHandling.getResourcesFilesPath() + folder + File.separator;
+ }
+
+ else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filepath = FileHandling.getBasePath() + "Files" + File.separator + folder + File.separator;
+ }
+
+ System.out.println(filepath);
+
+ return filepath;
+ }
+
+ public static String getBasePath() {
+ return System.getProperty("user.dir") + File.separator;
+ }
+
+ public static String getSdcVnfsPath() {
+ return getBasePath() + Paths.get("..", "..", "sdc-vnfs").toString();
+ }
+
+ public static String getDriversPath() {
+ return getBasePath() + "src" + File.separator + "main" + File.separator + "resources"
+ + File.separator + "ci" + File.separator + "drivers" + File.separator;
+ }
+
+ public static String getResourcesFilesPath() {
+// return getBasePath() + "src" + File.separator + "main" + File.separator + "resources"
+// + File.separator + "Files" + File.separator;
+
+ return getSdcVnfsPath()+ File.separator + "ui-tests" + File.separator + "Files" + File.separator;
+ }
+
+ public static String getResourcesEnvFilesPath() {
+ return getBasePath() + File.separator + "src" + File.separator + "main" + File.separator + "resources"
+ + File.separator + "Files" + File.separator + "ResourcesEnvFiles" +File.separator;
+ }
+
+ public static String getCiFilesPath() {
+ return getBasePath() + "src" + File.separator + "main" + File.separator + "resources"
+ + File.separator + "ci";
+ }
+
+ public static String getConfFilesPath() {
+ return getCiFilesPath() + File.separator + "conf" + File.separator;
+ }
+
+ public static String getTestSuitesFilesPath() {
+ return getCiFilesPath() + File.separator + "testSuites" + File.separator;
+ }
+
+ public static String getVnfRepositoryPath() {
+ return getFilePath("VNFs");
+ }
+
+ public static File getConfigFile(String configFileName) throws Exception {
+ File configFile = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + configFileName);
+ if (!configFile.exists()) {
+ configFile = new File(FileHandling.getConfFilesPath() + configFileName);
+ }
+ return configFile;
+ }
+
+ public static Object[] filterFileNamesFromFolder(String filepath, String extension) {
+ try {
+ File dir = new File(filepath);
+ List<String> filenames = new ArrayList<String>();
+
+ FilenameFilter extensionFilter = new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(extension);
+ }
+ };
+
+ if (dir.isDirectory()) {
+ for (File file : dir.listFiles(extensionFilter)) {
+ filenames.add(file.getName());
+ }
+ return filenames.toArray();
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static List<String> filterFileNamesListFromFolder(String filepath, String extension) {
+ try {
+ File dir = new File(filepath);
+ List<String> filenames = new ArrayList<String>();
+
+ FilenameFilter extensionFilter = new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(extension);
+ }
+ };
+
+ if (dir.isDirectory()) {
+ for (File file : dir.listFiles(extensionFilter)) {
+ filenames.add(file.getName());
+ }
+ return filenames;
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static String[] getArtifactsFromZip(String filepath, String zipFilename){
+ try{
+ ZipFile zipFile = new ZipFile(filepath + File.separator + zipFilename);
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
+
+ String[] artifactNames = new String[zipFile.size() - 1];
+
+ int i = 0;
+ while(entries.hasMoreElements()){
+ ZipEntry nextElement = entries.nextElement();
+ if (!nextElement.isDirectory()){
+ if (!nextElement.getName().equals("MANIFEST.json")){
+ String name = nextElement.getName();
+ artifactNames[i++] = name;
+ }
+ }
+ }
+ zipFile.close();
+ return artifactNames;
+ }
+ catch(ZipException zipEx){
+ System.err.println("Error in zip file named : " + zipFilename);
+ zipEx.printStackTrace();
+ } catch (IOException e) {
+ System.err.println("Unhandled exception : ");
+ e.printStackTrace();
+ }
+
+ return null;
+
+ }
+
+// public static Object[] getZipFileNamesFromFolder(String filepath) {
+// return filterFileNamesFromFolder(filepath, ".zip");
+// }
+
+ public static List<String> getZipFileNamesFromFolder(String filepath) {
+ return filterFileNamesListFromFolder(filepath, ".zip");
+ }
+
+ public static int countFilesInZipFile(String[] artifactsArr, String reqExtension){
+ int fileCounter = 0;
+ for (String artifact : artifactsArr){
+ String extensionFile = artifact.substring(artifact.lastIndexOf(".") + 1 , artifact.length());
+ if (extensionFile.equals(reqExtension)){
+ fileCounter++;
+ }
+ }
+ return fileCounter;
+ }
+
+
+ /**
+ * @return last modified file name from default directory
+ * @throws Exception
+ */
+// TODO add download directory capability
+// public static synchronized File getLastModifiedFileNameFromDir() throws Exception{
+// return getLastModifiedFileNameFromDir(ComponentBaseTest.getWindowTest().getDownloadDirectory());
+// }
+
+ /**
+ * @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) {
+ assertTrue("File not found under directory " + dirPath, false);
+ return null;
+ }
+
+ File lastModifiedFile = files[0];
+ for (int i = 1; i < files.length; i++) {
+ if(files[i].isDirectory()) {
+ continue;
+ }
+ if (lastModifiedFile.lastModified() < files[i].lastModified()) {
+ lastModifiedFile = files[i];
+ }
+ }
+ return lastModifiedFile;
+ }
+
+ public static void deleteDirectory(String directoryPath) {
+ File dir = new File(directoryPath);
+ try {
+ FileUtils.deleteDirectory(dir);
+ } catch (IOException e) {
+ System.out.println("Failed to delete " + dir);
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Failed to delete " + dir);
+ }
+ }
+
+ public static void createDirectory(String directoryPath) {
+ File directory = new File(String.valueOf(directoryPath));
+ if (! directory.exists()){
+ directory.mkdir();
+ }
+ }
+
+
+ /**
+ * The method append data to existing file, if file not exists - create it
+ * @param pathToFile
+ * @param text
+ * @param leftSpaceCount
+ * @throws IOException
+ */
+ public static synchronized void writeToFile(File pathToFile, Object text, Integer leftSpaceCount) throws IOException{
+
+ BufferedWriter bw = null;
+ FileWriter fw = null;
+ if(!pathToFile.exists()){
+ createEmptyFile(pathToFile);
+ }
+ try {
+ fw = new FileWriter(pathToFile, true);
+ bw = new BufferedWriter(fw);
+ StringBuilder sb = new StringBuilder();
+ if(leftSpaceCount > 0 ){
+ for(int i = 0; i < leftSpaceCount; i++){
+ sb.append(" ");
+ }
+ }
+ bw.write(sb.toString() + text);
+ bw.newLine();
+ bw.close();
+ fw.close();
+ } catch (Exception e) {
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Unable to write to flie " + pathToFile);
+ }
+ }
+
+// public static synchronized void writeToFile(File pathToFile, Map<String, Pair<String, Object>> dataMap, Integer leftSpaceCount) throws IOException{
+//
+// BufferedWriter bw = null;
+// FileWriter fw = null;
+// try {
+// if(!pathToFile.exists()){
+// createEmptyFile(pathToFile);
+// }
+// fw = new FileWriter(pathToFile, true);
+// bw = new BufferedWriter(fw);
+// StringBuilder sb = new StringBuilder();
+// if(leftSpaceCount > 0 ){
+// for(int i = 0; i < leftSpaceCount; i++){
+// sb.append(" ");
+// }
+// }
+// for(Map.Entry<String, Pair<String, Object>> entry : dataMap.entrySet()){
+// Object record = ArtifactUIUtils.getFormatedData(entry.getKey(), entry.getValue().right);
+// bw.write(sb.toString() + record);
+// bw.newLine();
+// }
+// bw.close();
+// fw.close();
+// } catch (Exception e) {
+// ComponentBaseTest.getExtendTest().log(Status.INFO, "Unable to write to flie " + pathToFile);
+// }
+// }
+
+ public static void deleteLastDowloadedFiles(List<File> files) throws IOException {
+ for (File file : files) {
+ File fileToDelete =new File(Config.instance().getWindowsDownloadDirectory()+file.getName());
+ fileToDelete.delete();
+ }
+ }
+// TODO add work with directory capaability
+// public static void cleanCurrentDownloadDir() throws IOException {
+// try{
+// ExtentTestActions.log(Status.INFO, "Cleaning directory " + ComponentBaseTest.getWindowTest().getDownloadDirectory());
+// System.gc();
+// FileUtils.cleanDirectory(new File(ComponentBaseTest.getWindowTest().getDownloadDirectory()));
+// }
+// catch(Exception e){
+//
+// }
+// }
+
+ public static boolean isFileDownloaded(String downloadPath, String fileName) {
+ boolean flag = false;
+ File dir = new File(downloadPath);
+ File[] dir_contents = dir.listFiles();
+ for (int i = 0; i < dir_contents.length; i++) {
+ if (dir_contents[i].getName().equals(fileName))
+ return flag = true;
+ }
+ return flag;
+ }
+
+ public static String getMD5OfFile(File file) throws IOException {
+ String content = FileUtils.readFileToString(file);
+ String md5 = GeneralUtility.calculateMD5Base64EncodedByString(content);
+ return md5;
+ }
+
+ public static File createEmptyFile(String fileToCreate) {
+ File file= new File(fileToCreate);
+ try {
+ if(file.exists()){
+ deleteFile(file);
+ }
+ file.createNewFile();
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Create file " + fileToCreate);
+ } catch (IOException e) {
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Failed to create file " + fileToCreate);
+ e.printStackTrace();
+ }
+ return file;
+ }
+
+ public static File createEmptyFile(File fileToCreate) {
+ try {
+ if(fileToCreate.exists()){
+ deleteFile(fileToCreate);
+ }
+ fileToCreate.createNewFile();
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Create file " + fileToCreate);
+ } catch (IOException e) {
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Failed to create file " + fileToCreate);
+ e.printStackTrace();
+ }
+ return fileToCreate;
+ }
+
+ public static void deleteFile(File file){
+
+ try{
+ if(file.exists()){
+ file.deleteOnExit();
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "File " + file.getName() + "has been deleted");
+ }else{
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Failed to delete file " + file.getName());
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+ }
+
+
+ /**
+ * get file list from directory by extension array
+ * @param directory
+ * @param okFileExtensions
+ * @return
+ */
+ public static List<File> getHeatAndHeatEnvArtifactsFromZip(File directory, String[] okFileExtensions){
+
+ List<File> fileList = new ArrayList<>();
+ File[] files = directory.listFiles();
+
+ for (String extension : okFileExtensions){
+ for(File file : files){
+ if (file.getName().toLowerCase().endsWith(extension)){
+ fileList.add(file);
+ }
+ }
+ }
+ return fileList;
+ }
+
+ private static final int BUFFER_SIZE = 4096;
+// public static void unzip(String zipFilePath, String destDirectory) throws IOException {
+// File destDir = new File(destDirectory);
+// if (!destDir.exists()) {
+// destDir.mkdir();
+// }
+// ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath));
+// ZipEntry entry = zipIn.getNextEntry();
+//// iterates over entries in the zip file
+// while (entry != null) {
+// String entryName;
+// if(System.getProperty("os.name").contains("Windows")){
+// entryName = entry.getName().replaceAll("/", "\\"+File.separator);
+// }else{
+// entryName = entry.getName();
+// }
+// String filePath = destDirectory + entryName;
+// String currPath = destDirectory;
+// String[] dirs = entryName.split("\\"+File.separator);
+// String currToken;
+// for(int i = 0; i<dirs.length;++i){
+// currToken = dirs[i];
+// if(!entry.isDirectory() && i==dirs.length-1){
+// extractFile(zipIn, filePath);
+// } else {
+// if(currPath.endsWith(File.separator)){
+// currPath = currPath + currToken;
+// }else{
+// currPath = currPath + File.separator + currToken;
+// }
+//// if the entry is a directory, make the directory
+// File dir = new File(currPath);
+// dir.mkdir();
+// }
+// }
+// zipIn.closeEntry();
+// entry = zipIn.getNextEntry();
+// }
+// zipIn.close();
+// }
+
+ private static void extractFile(ZipInputStream zipIn, String filePath) throws IOException {
+ BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath));
+ byte[] bytesIn = new byte[BUFFER_SIZE];
+ int read = 0;
+ while ((read = zipIn.read(bytesIn)) != -1) {
+ bos.write(bytesIn, 0, read);
+ }
+ bos.close();
+ }
+
+// public static int getFileCountFromDefaulDownloadDirectory(){
+// return new File(ComponentBaseTest.getWindowTest().getDownloadDirectory()).listFiles().length;
+// }
+
+
+ public static String getKeyByValueFromPropertyFormatFile(String fullPath, String key) {
+ Properties prop = new Properties();
+ InputStream input = null;
+ String value = null;
+ try {
+ input = new FileInputStream(fullPath);
+ prop.load(input);
+ value = (prop.getProperty(key));
+
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ } finally {
+ if (input != null) {
+ try {
+ input.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return value.replaceAll("\"","");
+ }
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java
new file mode 100644
index 0000000000..12f04e282c
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java
@@ -0,0 +1,293 @@
+/*-
+ * ============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.utils.general;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+import com.google.gson.Gson;
+import fj.data.Either;
+
+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.ExtentTestActions;
+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.rest.BaseRestUtils;
+
+import java.io.*;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+import org.apache.commons.codec.binary.Base64;
+
+
+
+import static org.testng.AssertJUnit.assertTrue;
+
+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();
+ ExtentTestActions.log(Status.INFO, String.format("Create Vendor License"));
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(user);
+ ExtentTestActions.log(Status.INFO, String.format("Create Vendor Software Product"));
+ 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.decodeBase64(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/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
new file mode 100644
index 0000000000..a1838b66d1
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
@@ -0,0 +1,799 @@
+/*-
+ * ============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.utils.general;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+import org.apache.commons.io.IOUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.apache.http.entity.mime.content.FileBody;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
+import org.openecomp.sdc.ci.tests.api.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.config.Config;
+
+import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+
+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.execute.devCI.ArtifactFromCsar;
+
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+
+import org.testng.Assert;
+
+import java.io.*;
+import java.nio.file.FileSystems;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static org.testng.AssertJUnit.assertEquals;
+
+public class OnboardingUtils {
+
+ protected static List<String> exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip",
+ "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip",
+
+
+ "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip",
+ "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip");
+
+ protected static List<String> exludeVnfListForToscaParser = Arrays.asList("2016-043_vsaegw_fdnt_30_1607_e2e.zip", "vIRC_CC.zip",
+ "2016-045_vlb_lmsp_30_1607_e2e.zip", "2016-050_vdns_vmdns_30_1607_e2e.zip",
+ "2016-247_mns_mns_30_1610_e2e.zip", "2016-044_vfw_fcgi_30_1607_e2e.zip");
+
+ public OnboardingUtils() {
+ }
+
+ public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers)
+ throws Exception {
+ Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user, amdocsLicenseMembers);
+
+ String vspid = pair.right.get("vspId");
+
+ prepareVspForUse(user, vspid);
+
+ return pair;
+ }
+
+ public static void prepareVspForUse(User user, String vspid) throws Exception {
+ RestResponse checkin = checkinVendorSoftwareProduct(vspid, user);
+ assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue());
+
+ RestResponse submit = submitVendorSoftwareProduct(vspid, user);
+ assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue());
+
+ RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspid, user);
+ assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue());
+
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor software product");
+ }
+
+ public static Pair<String, Map<String, String>> createVSP(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception {
+ String vspName = handleFilename(HeatFileName);
+
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to create the vendor software product");
+
+ Pair<RestResponse, Map<String, String>> createNewVspPair = createNewVendorSoftwareProduct(vspName, amdocsLicenseMembers, user);
+ RestResponse createNewVendorSoftwareProduct = createNewVspPair.left;
+ assertEquals("did not succeed to create new VSP", 200,createNewVendorSoftwareProduct.getErrorCode().intValue());
+ String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId");
+ String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId");
+
+ Map<String, String> vspMeta = createNewVspPair.right;
+ Map<String, String> vspObject = new HashMap<String, String>();
+ Iterator<String> iterator = vspMeta.keySet().iterator();
+ while(iterator.hasNext()){
+ Object key = iterator.next();
+ Object value = vspMeta.get(key);
+ vspObject.put(key.toString(), value.toString());
+ }
+ vspObject.put("vspId", vspid);
+ vspObject.put("componentId", componentId);
+ vspObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName());
+ vspObject.put("attContact", user.getUserId());
+
+ RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspid, user);
+ assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue());
+
+ RestResponse validateUpload = validateUpload(vspid, user);
+ assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue());
+
+ Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject);
+
+ return pair;
+ }
+
+ public static void updateVspWithVfcArtifacts(String filepath, String vspId, String updatedSnmpPoll, String updatedSnmpTrap, String componentId, User user) throws Exception{
+ RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user);
+ assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue());
+ ExtentTestActions.log(Status.INFO, "Deleting SNMP POLL");
+ deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_POLL);
+ ExtentTestActions.log(Status.INFO, "Deleting SNMP TRAP");
+ deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_TRAP);
+ addVFCArtifacts(filepath, updatedSnmpPoll, updatedSnmpTrap, vspId, user, componentId);
+ prepareVspForUse(user, vspId);
+ }
+
+ public static String updateVendorSoftwareProduct(String vspId, String HeatFileName, String filepath, User user)
+ throws Exception, Throwable {
+ String vspName = handleFilename(HeatFileName);
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to update the vendor software product");
+
+ RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user);
+ assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue());
+
+ RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspId, user);
+ assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue());
+
+ RestResponse validateUpload = validateUpload(vspId, user);
+ assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue());
+
+ RestResponse checkin = checkinVendorSoftwareProduct(vspId, user);
+ assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue());
+
+
+ RestResponse submit = submitVendorSoftwareProduct(vspId, user);
+ assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue());
+
+ RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspId, user);
+ assertEquals("did not succeed to update package of VSP ", 200, createPackage.getErrorCode().intValue());
+
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor software product");
+
+ return vspName;
+ }
+
+ public static String handleFilename(String heatFileName) {
+ final String namePrefix = "ciVFOnboarded-";
+ final String nameSuffix = "-" + getShortUUID();
+
+ String subHeatFileName = heatFileName.substring(0, heatFileName.lastIndexOf("."));
+
+ if ((namePrefix + subHeatFileName + nameSuffix).length() >= 50) {
+ subHeatFileName = subHeatFileName.substring(0, 50 - namePrefix.length() - nameSuffix.length());
+ }
+
+ if (subHeatFileName.contains("(") || subHeatFileName.contains(")")) {
+ subHeatFileName = subHeatFileName.replace("(", "-");
+ subHeatFileName = subHeatFileName.replace(")", "-");
+ }
+
+ String vnfName = namePrefix + subHeatFileName + nameSuffix;
+ return vnfName;
+ }
+
+ public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user, String vspComponentId) throws Exception{
+ vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId;
+ if (vspComponentId != null){
+ if (snmpPoll != null){
+ ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP POLL with the file " + snmpPoll);
+ RestResponse uploadSnmpPollArtifact = uploadSnmpPollArtifact(filepath, snmpPoll, vspid, user, vspComponentId);
+ assertEquals("Did not succeed to add SNMP POLL", 200, uploadSnmpPollArtifact.getErrorCode().intValue());
+ }
+ if (snmpTrap != null){
+ ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP TRAP with the file " + snmpTrap);
+ RestResponse uploadSnmpTrapArtifact = uploadSnmpTrapArtifact(filepath, snmpTrap, vspid, user, vspComponentId);
+ assertEquals("Did not succeed to add SNMP TRAP", 200, uploadSnmpTrapArtifact.getErrorCode().intValue());
+ }
+ }
+
+ return vspComponentId;
+ }
+
+ public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user) throws Exception{
+ return addVFCArtifacts(filepath, snmpPoll, snmpTrap, vspid, user, null);
+ }
+
+ private static RestResponse uploadSnmpPollArtifact(String filepath, String zipArtifact, String vspid, User user,
+ String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException {
+ Config config = Utils.getConfig();
+ String snmpPollUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp/upload",
+ config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId);
+ return uploadFile(filepath, zipArtifact, snmpPollUrl, user);
+ }
+
+ private static RestResponse uploadSnmpTrapArtifact(String filepath, String zipArtifact, String vspid, User user,
+ String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException {
+ Config config = Utils.getConfig();
+ String snmpTrapUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp-trap/upload",
+ config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId);
+ return uploadFile(filepath, zipArtifact, snmpTrapUrl, user);
+ }
+
+ private static RestResponse deleteSnmpArtifact(String componentId, String vspId, User user, SnmpTypeEnum snmpType) throws Exception
+ {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/%s",
+ config.getCatalogBeHost(),config.getCatalogBePort(), vspId, componentId, snmpType.getValue());
+ String userId = user.getUserId();
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendDelete(url, headersMap);
+ return response;
+ }
+
+
+
+ private static String getVSPComponentId(String vspid, User user) throws Exception, JSONException {
+ RestResponse components = getVSPComponents(vspid, user);
+ String response = components.getResponse();
+ Map<String, Object> responseMap = (Map<String, Object>) JSONValue.parse(response);
+ JSONArray results = (JSONArray)responseMap.get("results");
+ for (Object res : results){
+ Map<String, Object> compMap= (Map<String, Object>) JSONValue.parse(res.toString());
+ String componentId = compMap.get("id").toString();
+ return componentId;
+ }
+ return null;
+ }
+
+ private static RestResponse getVSPComponents(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/components", config.getCatalogBeHost(),config.getCatalogBePort(), vspid);
+ String userId = user.getUserId();
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendGet(url, headersMap);
+ return response;
+ }
+
+ public static AmdocsLicenseMembers createVendorLicense(User user) throws Exception {
+
+ AmdocsLicenseMembers amdocsLicenseMembers;
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license");
+ String vendorLicenseName = "ciLicense" + getShortUUID();
+ RestResponse vendorLicenseResponse = createVendorLicenseModels_1(vendorLicenseName, user);
+ assertEquals("did not succeed to create vendor license model", 200, vendorLicenseResponse.getErrorCode().intValue());
+ String vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value");
+
+ RestResponse vendorKeyGroupsResponse = createVendorKeyGroups_2(vendorId, user);
+ assertEquals("did not succeed to create vendor key groups", 200, vendorKeyGroupsResponse.getErrorCode().intValue());
+ String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), "value");
+
+ RestResponse vendorEntitlementPool = createVendorEntitlementPool_3(vendorId, user);
+ assertEquals("did not succeed to create vendor entitlement pool", 200, vendorEntitlementPool.getErrorCode().intValue());
+ String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(), "value");
+
+ RestResponse vendorLicenseFeatureGroups = createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, entitlementPoolId, user);
+ assertEquals("did not succeed to create vendor license feature groups", 200, vendorLicenseFeatureGroups.getErrorCode().intValue());
+ String featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value");
+
+ RestResponse vendorLicenseAgreement = createVendorLicenseAgreement_5(vendorId, featureGroupId, user);
+ assertEquals("did not succeed to create vendor license agreement", 200, vendorLicenseAgreement.getErrorCode().intValue());
+ String vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), "value");
+
+ RestResponse checkinVendorLicense = checkinVendorLicense(vendorId, user);
+ assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue());
+
+ RestResponse submitVendorLicense = submitVendorLicense(vendorId, user);
+ assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue());
+
+ ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor license");
+
+ amdocsLicenseMembers = new AmdocsLicenseMembers(vendorId, vendorLicenseName, vendorLicenseAgreementId, featureGroupId);
+
+ return amdocsLicenseMembers;
+ }
+
+ private static String getShortUUID() {
+ return UUID.randomUUID().toString().split("-")[0];
+ }
+
+ private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user)
+ throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/" + onboardComponent + "/%s/versions/0.1/actions",
+ config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+ String userId = user.getUserId();
+
+ JSONObject jObject = new JSONObject();
+ jObject.put("action", action);
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPut(url, jObject.toString(), headersMap);
+ return response;
+ }
+
+ public static RestResponse checkinVendorLicense(String vspid, User user) throws Exception {
+ return actionOnComponent(vspid, "Checkin", "vendor-license-models", user);
+ }
+
+ public static RestResponse submitVendorLicense(String vspid, User user) throws Exception {
+ return actionOnComponent(vspid, "Submit", "vendor-license-models", user);
+ }
+
+ public static RestResponse createVendorLicenseModels_1(String name, User user) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models", config.getCatalogBeHost(),
+ config.getCatalogBePort());
+ String userId = user.getUserId();
+
+ JSONObject jObject = new JSONObject();
+ jObject.put("vendorName", name);
+ jObject.put("description", "new vendor license model");
+ jObject.put("iconRef", "icon");
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
+ return response;
+
+ }
+
+ public static RestResponse createVendorLicenseAgreement_5(String vspid, String featureGroupId, User user)
+ throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-agreements",
+ config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+ String userId = user.getUserId();
+
+ JSONObject licenseTermpObject = new JSONObject();
+ licenseTermpObject.put("choice", "Fixed_Term");
+ licenseTermpObject.put("other", "");
+
+ JSONObject jObjectBody = new JSONObject();
+ jObjectBody.put("name", "abc");
+ jObjectBody.put("description", "new vendor license agreement");
+ jObjectBody.put("requirementsAndConstrains", "abc");
+ jObjectBody.put("licenseTerm", licenseTermpObject);
+ jObjectBody.put("addedFeatureGroupsIds", Arrays.asList(featureGroupId).toArray());
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
+ return response;
+ }
+
+ public static RestResponse createVendorLicenseFeatureGroups_4(String vspid, String licenseKeyGroupId,
+ String entitlementPoolId, User user) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/feature-groups",
+ config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+ String userId = user.getUserId();
+
+ JSONObject jObject = new JSONObject();
+ jObject.put("name", "xyz");
+ jObject.put("description", "new vendor license feature groups");
+ jObject.put("partNumber", "123abc456");
+ jObject.put("manufacturerReferenceNumber", "5");
+ jObject.put("addedLicenseKeyGroupsIds", Arrays.asList(licenseKeyGroupId).toArray());
+ jObject.put("addedEntitlementPoolsIds", Arrays.asList(entitlementPoolId).toArray());
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
+ return response;
+
+ }
+
+ public static RestResponse createVendorEntitlementPool_3(String vspid, User user) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/entitlement-pools",
+ config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+ String userId = user.getUserId();
+
+ JSONObject jEntitlementMetricObject = new JSONObject();
+ jEntitlementMetricObject.put("choice", "CPU");
+ jEntitlementMetricObject.put("other", "");
+
+ JSONObject jAggregationFunctionObject = new JSONObject();
+ jAggregationFunctionObject.put("choice", "Peak");
+ jAggregationFunctionObject.put("other", "");
+
+ JSONObject jOperationalScope = new JSONObject();
+ jOperationalScope.put("choices", Arrays.asList("Availability_Zone").toArray());
+ jOperationalScope.put("other", "");
+
+ JSONObject jTimeObject = new JSONObject();
+ jTimeObject.put("choice", "Hour");
+ jTimeObject.put("other", "");
+
+ JSONObject jObjectBody = new JSONObject();
+ jObjectBody.put("name", "def"+ getShortUUID());
+ jObjectBody.put("description", "new vendor license entitlement pool");
+ jObjectBody.put("thresholdValue", "23");
+ jObjectBody.put("thresholdUnits", "Absolute");
+ jObjectBody.put("entitlementMetric", jEntitlementMetricObject);
+ jObjectBody.put("increments", "abcd");
+ jObjectBody.put("aggregationFunction", jAggregationFunctionObject);
+ jObjectBody.put("operationalScope", jOperationalScope);
+ jObjectBody.put("time", jTimeObject);
+ jObjectBody.put("manufacturerReferenceNumber", "123aaa");
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
+ return response;
+ }
+
+ public static RestResponse createVendorKeyGroups_2(String vspid, User user) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-key-groups",
+ config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+ String userId = user.getUserId();
+
+ JSONObject jOperationalScope = new JSONObject();
+ jOperationalScope.put("choices", Arrays.asList("Tenant").toArray());
+ jOperationalScope.put("other", "");
+
+ JSONObject jObjectBody = new JSONObject();
+ jObjectBody.put("name", "keyGroup" + getShortUUID());
+ jObjectBody.put("description", "new vendor license key group");
+ jObjectBody.put("operationalScope", jOperationalScope);
+ jObjectBody.put("type", "Universal");
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
+ return response;
+ }
+
+ public static Pair<RestResponse, Map<String, String>> createNewVendorSoftwareProduct(String name, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception {
+ Map<String, String> vspMetadta = new HashMap<String, String>();
+
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products",
+ config.getCatalogBeHost(), config.getCatalogBePort());
+
+ String userId = user.getUserId();
+
+ JSONObject jlicensingDataObj = new JSONObject();
+ jlicensingDataObj.put("licenseAgreement", amdocsLicenseMembers.getVendorLicenseAgreementId());
+ jlicensingDataObj.put("featureGroups", Arrays.asList(amdocsLicenseMembers.getFeatureGroupId()).toArray());
+
+ JSONObject jlicensingVersionObj = new JSONObject();
+ jlicensingVersionObj.put("id", "1.0");
+ jlicensingVersionObj.put("label", "1.0");
+
+ JSONObject jObject = new JSONObject();
+ jObject.put("name", name);
+ jObject.put("description", "new VSP description");
+ jObject.put("category", "resourceNewCategory.generic");
+ jObject.put("subCategory", "resourceNewCategory.generic.database");
+ jObject.put("onboardingMethod", "HEAT");
+ jObject.put("licensingVersion", jlicensingVersionObj);
+ jObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName());
+ jObject.put("vendorId", amdocsLicenseMembers.getVendorId());
+ jObject.put("icon", "icon");
+ jObject.put("licensingData", jlicensingDataObj);
+
+ vspMetadta.put("description", jObject.getString("description"));
+ vspMetadta.put("category", jObject.getString("category"));
+ vspMetadta.put("subCategory", jObject.getString("subCategory").split("\\.")[2]);
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+ HttpRequest http = new HttpRequest();
+
+ RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
+ return new Pair<RestResponse, Map<String, String>>(response, vspMetadta);
+ }
+
+ 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",
+ config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+
+ String userId = user.getUserId();
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+ HttpRequest http = new HttpRequest();
+
+ String body =null;
+
+ RestResponse response = http.httpSendPut(url, body, headersMap);
+
+ return response;
+ }
+
+ public static RestResponse uploadHeatPackage(String filepath, String filename, 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", config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+ return uploadFile(filepath, filename, url, user);
+ }
+
+ private static RestResponse uploadFile(String filepath, String filename, String url, User user)
+ throws FileNotFoundException, IOException, ClientProtocolException {
+ CloseableHttpResponse response = null;
+
+ MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create();
+ mpBuilder.addPart("upload", new FileBody(getTestZipFile(filepath, filename)));
+
+ Map<String, String> headersMap = prepareHeadersMap(user.getUserId());
+ headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "multipart/form-data");
+
+ CloseableHttpClient client = HttpClients.createDefault();
+ try {
+ HttpPost httpPost = new HttpPost(url);
+ RestResponse restResponse = new RestResponse();
+
+ Iterator<String> iterator = headersMap.keySet().iterator();
+ while (iterator.hasNext()) {
+ String key = iterator.next();
+ String value = headersMap.get(key);
+ httpPost.addHeader(key, value);
+ }
+ httpPost.setEntity(mpBuilder.build());
+ response = client.execute(httpPost);
+ HttpEntity entity = response.getEntity();
+ String responseBody = null;
+ if (entity != null) {
+ InputStream instream = entity.getContent();
+ StringWriter writer = new StringWriter();
+ IOUtils.copy(instream, writer);
+ responseBody = writer.toString();
+ try {
+
+ } finally {
+ instream.close();
+ }
+ }
+
+ restResponse.setErrorCode(response.getStatusLine().getStatusCode());
+ restResponse.setResponse(responseBody);
+
+ return restResponse;
+
+ } finally {
+ closeResponse(response);
+ closeHttpClient(client);
+
+ }
+ }
+
+ private static void closeResponse(CloseableHttpResponse response) {
+ try {
+ if (response != null) {
+ response.close();
+ }
+ } catch (IOException e) {
+ System.out.println(String.format("failed to close client or response: %s", e.getMessage()));
+ }
+ }
+
+ private static void closeHttpClient(CloseableHttpClient client) {
+ try {
+ if (client != null) {
+ client.close();
+ }
+ } catch (IOException e) {
+ System.out.println(String.format("failed to close client or response: %s", e.getMessage()));
+ }
+ }
+
+ private static File getTestZipFile(String filepath, String filename) throws IOException {
+ Config config = Utils.getConfig();
+ String sourceDir = config.getImportResourceTestsConfigDir();
+ java.nio.file.Path filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename);
+ return filePath.toFile();
+ }
+
+ public static RestResponse checkinVendorSoftwareProduct(String vspid, User user) throws Exception {
+ return actionOnComponent(vspid, "Checkin", "vendor-software-products", user);
+ }
+
+ private static RestResponse checkoutVendorSoftwareProduct(String vspid, User user) throws Exception {
+ return actionOnComponent(vspid, "Checkout", "vendor-software-products", user);
+ }
+
+ public static RestResponse submitVendorSoftwareProduct(String vspid, User user) throws Exception {
+ return actionOnComponent(vspid, "Submit", "vendor-software-products", user);
+ }
+
+ public static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user) throws Exception {
+ return actionOnComponent(vspid, "Create_Package", "vendor-software-products", user);
+ }
+
+ 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;
+ }
+
+
+// private static void importUpdateVSP(Pair<String, Map<String, String>> vsp, boolean isUpdate) throws Exception{
+// String vspName = vsp.left;
+// Map<String, String> vspMetadata = vsp.right;
+// boolean vspFound = HomePage.searchForVSP(vspName);
+//
+// if (vspFound){
+//
+// List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable();
+//// WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30);
+//// WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1)));
+//// findElement.click();
+// elemenetsFromTable.get(1).click();
+// GeneralUIUtils.waitForLoader();
+//
+// if (isUpdate){
+// GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.UPDATE_VSP.getValue());
+//
+// }
+// else{
+// GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.IMPORT_VSP.getValue());
+// }
+//
+// String lifeCycleState = ResourceGeneralPage.getLifeCycleState();
+// boolean needCheckout = lifeCycleState.equals(LifeCycleStateEnum.CHECKIN.getValue()) || lifeCycleState.equals(LifeCycleStateEnum.CERTIFIED.getValue());
+// if (needCheckout)
+// {
+// try {
+// ResourceGeneralPage.clickCheckoutButton();
+// Assert.assertTrue(ResourceGeneralPage.getLifeCycleState().equals(LifeCycleStateEnum.CHECKOUT.getValue()), "Did not succeed to checkout");
+//
+// } catch (Exception e) {
+// ExtentTestActions.log(Status.ERROR, "Did not succeed to checkout");
+// e.printStackTrace();
+// }
+// GeneralUIUtils.waitForLoader();
+// }
+//
+// //Metadata verification
+// VfVerificator.verifyOnboardedVnfMetadata(vspName, vspMetadata);
+//
+// ExtentTestActions.log(Status.INFO, "Clicking create/update VNF");
+// String duration = GeneralUIUtils.getActionDuration(() -> waitUntilVnfCreated());
+// ExtentTestActions.log(Status.INFO, "Succeeded in importing/updating " + vspName, duration);
+// }
+// else{
+// Assert.fail("Did not find VSP named " + vspName);
+// }
+// }
+
+// private static void waitUntilVnfCreated() {
+// GeneralUIUtils.clickOnElementByTestIdWithoutWait(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
+// GeneralUIUtils.waitForLoader(60*10);
+// GeneralUIUtils.waitForAngular();
+// GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
+// }
+//
+// public static void updateVSP(Pair<String, Map<String, String>> vsp) throws Exception{
+// ExtentTestActions.log(Status.INFO, "Updating VSP " + vsp.left);
+// importUpdateVSP(vsp, true);
+// }
+//
+// public static void importVSP(Pair<String, Map<String, String>> vsp) throws Exception{
+// ExtentTestActions.log(Status.INFO, "Importing VSP " + vsp.left);
+// importUpdateVSP(vsp, false);
+// }
+//
+// public static void updateVnfAndValidate(String filepath, Pair<String, Map<String, String>> vsp, String updatedVnfFile, User user) throws Exception, Throwable {
+// ExtentTestActions.log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile));
+// System.out.println(String.format("Going to update the VNF with %s......", updatedVnfFile));
+//
+// Map<String, String> vspMap = vsp.right;
+// String vspId = vspMap.get("vspId");
+//
+// updateVendorSoftwareProduct(vspId, updatedVnfFile, filepath, user);
+// HomePage.showVspRepository();
+// updateVSP(vsp);
+// ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+// DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, updatedVnfFile);
+// }
+//
+// public static Pair<String, Map<String, String>> onboardAndValidate(String filepath, String vnfFile, User user) throws Exception {
+// ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile));
+// System.out.println(String.format("Going to onboard the VNF %s", vnfFile));
+//
+// AmdocsLicenseMembers amdocsLicenseMembers = createVendorLicense(user);
+// Pair<String, Map<String, String>> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user, amdocsLicenseMembers);
+// String vspName = createVendorSoftwareProduct.left;
+//
+// DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId"));
+// File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
+//
+// ExtentTestActions.log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
+// HomePage.showVspRepository();
+// ExtentTestActions.log(Status.INFO,String.format("Going to import %s", vnfFile.substring(0, vnfFile.indexOf("."))));
+// importVSP(createVendorSoftwareProduct);
+//
+// ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+//
+// // Verify deployment artifacts
+// Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(latestFilefromDir.getAbsolutePath());
+//
+// LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment"));
+// ArtifactsCorrelationManager.addVNFartifactDetails(vspName, deploymentArtifacts);
+//
+// List<String> heatEnvFilesFromCSAR = deploymentArtifacts.stream().filter(e -> e.getType().equals("HEAT_ENV")).
+// map(e -> e.getFileName()).
+// collect(Collectors.toList());
+//
+// validateDeploymentArtifactsVersion(deploymentArtifacts, heatEnvFilesFromCSAR);
+//
+// DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile);
+// return createVendorSoftwareProduct;
+// }
+//
+// public static void validateDeploymentArtifactsVersion(LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts,
+// List<String> heatEnvFilesFromCSAR) {
+// String artifactVersion;
+// String artifactName;
+//
+// for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) {
+// artifactVersion = "1";
+//
+// if(deploymentArtifact.getType().equals("HEAT_ENV")) {
+// continue;
+// } else if(deploymentArtifact.getFileName().contains(".")) {
+// artifactName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf("."));
+// } else {
+// artifactName = deploymentArtifact.getFileName().trim();
+// }
+//
+// if (heatEnvFilesFromCSAR.contains(artifactName + ".env")){
+// artifactVersion = "2";
+// }
+// ArtifactUIUtils.validateArtifactNameVersionType(artifactName, artifactVersion, deploymentArtifact.getType());
+// }
+// }
+
+
+ /**
+ * @return
+ * The method returns VNF names list from Files directory under sdc-vnfs repository
+ */
+ public static List<String> getVnfNamesFileList() {
+ String filepath = FileHandling.getVnfRepositoryPath();
+ List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+ fileNamesFromFolder.removeAll(exludeVnfList);
+ return fileNamesFromFolder;
+ }
+
+ /**
+ * @return
+ * The method returns VNF names list from Files directory under sdc-vnfs repository excluding zip files that known as failed in tosca parser
+ */
+ public static List<String> getVnfNamesFileListExcludeToscaParserFailure() {
+ List<String> fileNamesFromFolder = getVnfNamesFileList();
+ fileNamesFromFolder.removeAll(exludeVnfListForToscaParser);
+ return fileNamesFromFolder;
+ }
+
+}
+
+ \ No newline at end of file
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java
new file mode 100644
index 0000000000..71038920ae
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java
@@ -0,0 +1,88 @@
+/*-
+ * ============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.utils.general;
+
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.nio.file.FileSystems;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.stream.Collectors;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.apache.http.entity.mime.content.FileBody;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
+
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+
+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.execute.devCI.ArtifactFromCsar;
+
+
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+enum SnmpTypeEnum{
+ SNMP_POLL ("snmp"),
+ SNMP_TRAP ("snmp-trap");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private SnmpTypeEnum(String value) {
+ this.value = value;
+}
+
+}
+
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java
index e08ef6523f..ec8fd4089a 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java
@@ -78,7 +78,7 @@ public class ResourceRestUtils extends BaseRestUtils {
Gson gson = new Gson();
String userBodyJson = gson.toJson(resourceDetails);
- String calculateMD5 = GeneralUtility.calculateMD5ByString(userBodyJson);
+ String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson);
headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5);
HttpRequest http = new HttpRequest();
// System.out.println(url);
@@ -490,7 +490,7 @@ public class ResourceRestUtils extends BaseRestUtils {
Gson gson = new Gson();
String userBodyJson = gson.toJson(resourceDetails);
- String calculateMD5 = GeneralUtility.calculateMD5ByString(userBodyJson);
+ String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson);
headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5);
HttpRequest http = new HttpRequest();
RestResponse updateResourceResponse = http.httpSendPut(url, userBodyJson, headersMap);
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java
index 10f573cf0e..19d7d728fe 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java
@@ -48,7 +48,7 @@ public class ResourceRestUtilsExternalAPI extends BaseRestUtils {
Gson gson = new Gson();
String userBodyJson = gson.toJson(resourceDetails);
- String calculateMD5 = GeneralUtility.calculateMD5ByString(userBodyJson);
+ String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson);
headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5);
headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), authorizationHeader);
headersMap.put(HttpHeaderEnum.X_ECOMP_INSTANCE_ID.getValue(), "ci");
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/CRUDExternalAPI.java b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/CRUDExternalAPI.java
index 61b7ea18d2..9ba6953bb3 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/CRUDExternalAPI.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/CRUDExternalAPI.java
@@ -3377,7 +3377,7 @@ public class CRUDExternalAPI extends ComponentBaseTest {
httppost.addHeader(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
httppost.addHeader(HttpHeaderEnum.USER_ID.getValue(), sdncUserDetails.getUserId());
if (addMd5Header) {
- httppost.addHeader(HttpHeaderEnum.Content_MD5.getValue(), GeneralUtility.calculateMD5ByString(jsonBody));
+ httppost.addHeader(HttpHeaderEnum.Content_MD5.getValue(), GeneralUtility.calculateMD5Base64EncodedByString(jsonBody));
}
StringEntity input = new StringEntity(jsonBody);
input.setContentType("application/json");
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