aboutsummaryrefslogtreecommitdiffstats
path: root/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
diff options
context:
space:
mode:
Diffstat (limited to 'ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java')
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java203
1 files changed, 88 insertions, 115 deletions
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 3238e66765..9949d63686 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
@@ -7,9 +7,9 @@
* 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.
@@ -35,10 +35,6 @@ import java.util.Map;
import java.util.Set;
-
-
-
-
public class Testing {
// public static void main(String[] args) throws Exception {
@@ -75,111 +71,91 @@ public class Testing {
//
//
// }
-
-
-
- private static void validateNodeTemplatesProperties(Map<String, Map<String, Object>> predefinedMap, ToscaDefinition toscaDefinition) {
-
- for(String key: predefinedMap.keySet()) {
- Map<String, Object> nodeTemplateProperties = getNodeTemplatePropertiesByNodeTemplateType(key, toscaDefinition);
-
- predefinedMap.get(key).forEach((i,j) -> {
- Assert.assertEquals(nodeTemplateProperties.get(i), j, "Expected that the properties will be equal");
- });
- }
-
- }
-
- // Get properties by type
- private static Map<String, Object> getNodeTemplatePropertiesByNodeTemplateType(String nodeTemplateType, ToscaDefinition toscaDefinition) {
- Map<String, Object> propertiesMap = null;
-
- Set<String> nodeTemplates = getNodeTemplates(toscaDefinition);
-
- for(String nodeTemplate: nodeTemplates) {
- String currentNodeTemplateType = getNodeTemplateType(toscaDefinition, nodeTemplate);
- currentNodeTemplateType = currentNodeTemplateType.substring(currentNodeTemplateType.lastIndexOf(".") + 1);
- if(currentNodeTemplateType.equals(nodeTemplateType)) {
- propertiesMap = getNodeTemplateProperties(toscaDefinition, nodeTemplate);
- break;
- }
- }
-
- return propertiesMap;
- }
-
- // Get node templates
- private static Set<String> getNodeTemplates(ToscaDefinition toscaDefinition) {
- Set<String> resourceInstanceArray = toscaDefinition.getTopology_template().getNode_templates().keySet();
- return resourceInstanceArray;
- }
-
- // Get type of node template
- private static String getNodeTemplateType(ToscaDefinition toscaDefinition, String nodeTemplate) {
- return toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getType();
- }
-
- // Get properties of node template
- private static Map<String, Object> getNodeTemplateProperties(ToscaDefinition toscaDefinition, String nodeTemplate) {
- Map<String, Object> propertiesMap = toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getProperties();
- return propertiesMap;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public static void main(String[] args) throws Exception {
- ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition;
- File filesFolder = new File("C:/Users/al714h/Downloads/Design/");
- File importToscaFilesFolder = new File("C:/Git_work/sdc/catalog-be/src/main/resources/import/tosca/");
-
- File dataTypesLocation = new File(importToscaFilesFolder.getPath() + "/data-types/dataTypes.yml");
-
- File genericVfFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_VF/Generic_VF.yml");
- File genericVfcFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_VFC/Generic_VFC.yml");
- File genericPnfFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_PNF/Generic_PNF.yml");
- File genericServiceFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_Service/Generic_Service.yml");
-
- File amdocsCsarFileName = new File("/77e6b842669f441db20a83489da3f4be.csar");
- File VfCsarFileName = new File("/resource-Civfonboarded2016012VmxAv301072E2e1424cb9d-csar.csar");
- File serviceCsarFileName = new File("/service-Ciservicefeba0521131d-csar.csar");
-
- Map<String, DataTypeDefinition> parseDataTypesYaml = FileHandling.parseDataTypesYaml(dataTypesLocation.getAbsoluteFile().toString());
- System.out.println("start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
-
- toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + amdocsCsarFileName));
- toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName));
- toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + serviceCsarFileName));
- ToscaTopologyTemplateDefinition topologyTemplate = toscaMainAmdocsDefinition.getTopology_template();
- ToscaDefinition objectHelper = ToscaParserUtils.parseToscaYamlToJavaObject(genericVfFileLocation);
-
- Map<String, Object> additionalInputs = new HashMap<>();
- Set<String> keySet = objectHelper.getNode_types().keySet();
- if(keySet != null){
- for(String key: keySet){
- additionalInputs = objectHelper.getNode_types().get(key).getProperties();
- }
- }
+
+
+ private static void validateNodeTemplatesProperties(Map<String, Map<String, Object>> predefinedMap, ToscaDefinition toscaDefinition) {
+
+ for (String key : predefinedMap.keySet()) {
+ Map<String, Object> nodeTemplateProperties = getNodeTemplatePropertiesByNodeTemplateType(key, toscaDefinition);
+
+ predefinedMap.get(key).forEach((i, j) -> {
+ Assert.assertEquals(nodeTemplateProperties.get(i), j, "Expected that the properties will be equal");
+ });
+ }
+
+ }
+
+ // Get properties by type
+ private static Map<String, Object> getNodeTemplatePropertiesByNodeTemplateType(String nodeTemplateType, ToscaDefinition toscaDefinition) {
+ Map<String, Object> propertiesMap = null;
+
+ Set<String> nodeTemplates = getNodeTemplates(toscaDefinition);
+
+ for (String nodeTemplate : nodeTemplates) {
+ String currentNodeTemplateType = getNodeTemplateType(toscaDefinition, nodeTemplate);
+ currentNodeTemplateType = currentNodeTemplateType.substring(currentNodeTemplateType.lastIndexOf(".") + 1);
+ if (currentNodeTemplateType.equals(nodeTemplateType)) {
+ propertiesMap = getNodeTemplateProperties(toscaDefinition, nodeTemplate);
+ break;
+ }
+ }
+
+ return propertiesMap;
+ }
+
+ // Get node templates
+ private static Set<String> getNodeTemplates(ToscaDefinition toscaDefinition) {
+ Set<String> resourceInstanceArray = toscaDefinition.getTopology_template().getNode_templates().keySet();
+ return resourceInstanceArray;
+ }
+
+ // Get type of node template
+ private static String getNodeTemplateType(ToscaDefinition toscaDefinition, String nodeTemplate) {
+ return toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getType();
+ }
+
+ // Get properties of node template
+ private static Map<String, Object> getNodeTemplateProperties(ToscaDefinition toscaDefinition, String nodeTemplate) {
+ Map<String, Object> propertiesMap = toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getProperties();
+ return propertiesMap;
+ }
+
+
+ public static void main(String[] args) throws Exception {
+ ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition;
+ File filesFolder = new File("C:/Users/al714h/Downloads/Design/");
+ File importToscaFilesFolder = new File("C:/Git_work/sdc/catalog-be/src/main/resources/import/tosca/");
+
+ File dataTypesLocation = new File(importToscaFilesFolder.getPath() + "/data-types/dataTypes.yml");
+
+ File genericVfFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_VF/Generic_VF.yml");
+ File genericVfcFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_VFC/Generic_VFC.yml");
+ File genericPnfFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_PNF/Generic_PNF.yml");
+ File genericServiceFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_Service/Generic_Service.yml");
+
+ File amdocsCsarFileName = new File("/77e6b842669f441db20a83489da3f4be.csar");
+ File VfCsarFileName = new File("/resource-Civfonboarded2016012VmxAv301072E2e1424cb9d-csar.csar");
+ File serviceCsarFileName = new File("/service-Ciservicefeba0521131d-csar.csar");
+
+ Map<String, DataTypeDefinition> parseDataTypesYaml = FileHandling.parseDataTypesYaml(dataTypesLocation.getAbsoluteFile().toString());
+ System.out.println("start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
+
+ toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + amdocsCsarFileName));
+ toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName));
+ toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + serviceCsarFileName));
+ ToscaTopologyTemplateDefinition topologyTemplate = toscaMainAmdocsDefinition.getTopology_template();
+ ToscaDefinition objectHelper = ToscaParserUtils.parseToscaYamlToJavaObject(genericVfFileLocation);
+
+ Map<String, Object> additionalInputs = new HashMap<>();
+ Set<String> keySet = objectHelper.getNode_types().keySet();
+ if (keySet != null) {
+ for (String key : keySet) {
+ additionalInputs = objectHelper.getNode_types().get(key).getProperties();
+ }
+ }
// topologyTemplate.addInputs(additionalInputs);
-
-
-
+
// toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path);
System.out.println("listTypeHeatMetaDefinition start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
// List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition = CsarParserUtils.getListTypeHeatMetaDefinition(csarPath);
@@ -194,12 +170,9 @@ public class Testing {
// }
System.out.println("Finished");
System.out.println("get service start " + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()));
-
-
-
- }
-
-
+
+ }
+
}