summaryrefslogtreecommitdiffstats
path: root/sdc-tosca-parser/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sdc-tosca-parser/src/test')
-rw-r--r--sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserStubsTest.java96
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-allotted-resources-4.csarbin0 -> 39949 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-groups-status-supported-case-3.csarbin0 -> 39943 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-nt-props-1.csarbin0 -> 39948 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-nt-tt-metadata-2.csarbin0 -> 39938 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar.csarbin0 -> 39979 bytes
-rw-r--r--sdc-tosca-parser/src/test/resources/csars/service-vmme-csar.csarbin0 -> 74074 bytes
7 files changed, 96 insertions, 0 deletions
diff --git a/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserStubsTest.java b/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserStubsTest.java
new file mode 100644
index 0000000..aac552c
--- /dev/null
+++ b/sdc-tosca-parser/src/test/java/org/openecomp/sdc/impl/ToscaParserStubsTest.java
@@ -0,0 +1,96 @@
+package org.openecomp.sdc.impl;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.AfterClass;
+import static org.junit.Assert.*;
+import org.junit.BeforeClass;
+import org.junit.Test;
+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;
+
+public class ToscaParserStubsTest {
+
+ private static ISdcCsarHelper csarHelper;
+ private static SdcToscaParserFactory factory;
+
+
+ @BeforeClass
+ public static void init() throws SdcToscaParserException{
+ factory = SdcToscaParserFactory.getInstance();
+ //csarHelper = factory.getSdcCsarHelper("C:\\Users\\pa0916\\Desktop\\Work\\ASDC\\CSARs\\service-ServiceFdnt-csar-allotted-resources-4.csar");
+ String fileStr = ToscaParserStubsTest.class.getClassLoader().getResource("csars/service-ServiceFdnt-csar-allotted-resources-4.csar").getFile();
+ File file = new File(fileStr);
+ csarHelper = factory.getSdcCsarHelper(file.getAbsolutePath());
+ }
+
+
+ @Test
+ //TODO add rainy flows
+ public void testNumberOfVfSunnyFlow() throws SdcToscaParserException {
+ List<NodeTemplate> serviceVfList = csarHelper.getServiceVfList();
+ assertNotNull(serviceVfList);
+ assertEquals(1, serviceVfList.size());
+ }
+
+ @Test
+ //TODO add rainy flows
+ public void testNodeTemplateFlatProperty() throws SdcToscaParserException {
+ List<NodeTemplate> serviceVfList = csarHelper.getServiceVfList();
+ String nodeTemplatePropertyLeafValue = csarHelper.getNodeTemplatePropertyLeafValue(serviceVfList.get(0), "availability_zone_max_count");
+ assertEquals("2", nodeTemplatePropertyLeafValue);
+ }
+
+ @Test
+ //TODO add rainy flows
+ public void testNodeTemplateNestedProperty() throws SdcToscaParserException {
+ List<NodeTemplate> serviceVfList = csarHelper.getServiceVfList();
+ String nodeTemplatePropertyLeafValue = csarHelper.getNodeTemplatePropertyLeafValue(serviceVfList.get(0), "nf_role#nf_naming#instance_name");
+ assertEquals("FDNT_instance_VF", nodeTemplatePropertyLeafValue);
+ }
+
+ @Test
+ //TODO add rainy flows
+ public void testServiceNodeTemplatesByType() throws SdcToscaParserException {
+ List<NodeTemplate> serviceVfList = csarHelper.getServiceNodeTemplatesByType("org.openecomp.resource.vf.Fdnt");
+ assertNotNull(serviceVfList);
+ assertEquals(1, serviceVfList.size());
+ }
+
+ @Test
+ //TODO add rainy flows
+ public void testGetTypeOfNodeTemplate() {
+ List<NodeTemplate> serviceVfList = csarHelper.getServiceVfList();
+ String typeOfNodeTemplate = csarHelper.getTypeOfNodeTemplate(serviceVfList.get(0));
+ assertEquals("org.openecomp.resource.vf.Fdnt", typeOfNodeTemplate);
+ }
+
+
+ //@Test
+ //TODO add rainy flows
+ public void testGetServiceMetadata() {
+ //FAILS!! Metadata is null
+ Map<String, String> serviceMetadata = csarHelper.getServiceMetadata();
+ assertNotNull(serviceMetadata);
+ assertEquals("78c72999-1003-4a35-8534-bbd7d96fcae3", serviceMetadata.get("invariantUUID"));
+ assertEquals("Service FDNT", serviceMetadata.get("name"));
+ assertEquals("true", serviceMetadata.get("serviceEcompNaming"));
+ }
+
+ @Test
+ //TODO add rainy flows
+ public void testGetAllottedResources() {
+ List<NodeTemplate> allottedResources = csarHelper.getAllottedResources();
+ assertEquals(1, allottedResources.size());
+ }
+
+
+ @AfterClass
+ public static void close(){
+ factory.close();
+ }
+ }
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-allotted-resources-4.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-allotted-resources-4.csar
new file mode 100644
index 0000000..7b4cff2
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-allotted-resources-4.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-groups-status-supported-case-3.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-groups-status-supported-case-3.csar
new file mode 100644
index 0000000..7286663
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-groups-status-supported-case-3.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-nt-props-1.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-nt-props-1.csar
new file mode 100644
index 0000000..ceac90a
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-nt-props-1.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-nt-tt-metadata-2.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-nt-tt-metadata-2.csar
new file mode 100644
index 0000000..3cda214
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar-nt-tt-metadata-2.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar.csar b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar.csar
new file mode 100644
index 0000000..6179316
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-ServiceFdnt-csar.csar
Binary files differ
diff --git a/sdc-tosca-parser/src/test/resources/csars/service-vmme-csar.csar b/sdc-tosca-parser/src/test/resources/csars/service-vmme-csar.csar
new file mode 100644
index 0000000..416707c
--- /dev/null
+++ b/sdc-tosca-parser/src/test/resources/csars/service-vmme-csar.csar
Binary files differ