summaryrefslogtreecommitdiffstats
path: root/jtosca/src/test
diff options
context:
space:
mode:
authorPavel Aharoni <pa0916@att.com>2017-05-11 16:41:38 +0300
committerPavel Aharoni <pa0916@att.com>2017-05-11 16:41:51 +0300
commitaf2d8ef12f6b75ae837fffdeaf5d152756cec6d6 (patch)
tree5595ae8a7dbc663792d625dab168d5c94358fc79 /jtosca/src/test
parent8182ddf3140f4345ccbcb0bec37ff174756ba2e0 (diff)
[SDC-18] Tosca Parser conformance level - initial
Change-Id: I0d8d27f4b8085d918ecc94aace423d3216337f2d Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'jtosca/src/test')
-rw-r--r--jtosca/src/test/java/org.openecomp.sdc.toscaparser/JToscaMetadataParse.java26
-rw-r--r--jtosca/src/test/resources/csars/csar_hello_world.csarbin0 -> 936 bytes
2 files changed, 26 insertions, 0 deletions
diff --git a/jtosca/src/test/java/org.openecomp.sdc.toscaparser/JToscaMetadataParse.java b/jtosca/src/test/java/org.openecomp.sdc.toscaparser/JToscaMetadataParse.java
new file mode 100644
index 0000000..584a0fd
--- /dev/null
+++ b/jtosca/src/test/java/org.openecomp.sdc.toscaparser/JToscaMetadataParse.java
@@ -0,0 +1,26 @@
+package org.openecomp.sdc.toscaparser;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.util.LinkedHashMap;
+
+import org.junit.Test;
+import org.openecomp.sdc.toscaparser.api.ToscaTemplate;
+import org.openecomp.sdc.toscaparser.api.common.JToscaException;
+
+public class JToscaMetadataParse {
+
+ @Test
+ public void testMetadataParsedCorrectly() throws JToscaException {
+ String fileStr = JToscaMetadataParse.class.getClassLoader().getResource("csars/csar_hello_world.csar").getFile();
+ File file = new File(fileStr);
+ ToscaTemplate toscaTemplate = new ToscaTemplate(file.getAbsolutePath(), null, true, null);
+ LinkedHashMap<String, Object> metadataProperties = toscaTemplate.getMetaProperties("TOSCA.meta");
+ assertNotNull(metadataProperties);
+ Object entryDefinition = metadataProperties.get("Entry-Definitions");
+ assertNotNull(entryDefinition);
+ assertEquals("tosca_helloworld.yaml", entryDefinition);
+ }
+}
diff --git a/jtosca/src/test/resources/csars/csar_hello_world.csar b/jtosca/src/test/resources/csars/csar_hello_world.csar
new file mode 100644
index 0000000..43ffbbc
--- /dev/null
+++ b/jtosca/src/test/resources/csars/csar_hello_world.csar
Binary files differ