diff options
author | Yuli Shlosberg <ys9693@att.com> | 2017-11-28 15:55:44 +0200 |
---|---|---|
committer | Yuli Shlosberg <ys9693@att.com> | 2017-11-28 16:01:24 +0200 |
commit | d5e341bc22977beac2cc2c9d4b9368245cefda3a (patch) | |
tree | d6f3defa0fe88071f29956e08b8b14cb6cfaddd3 /src/test/java/org | |
parent | ea45979501b62b3c1e9e02edfb7ded6779e85018 (diff) |
add tests
Change-Id: Ifa5f6891a06d6bf5ae82d0dd73ee01aa60967afe
Issue-ID: SDC-695
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'src/test/java/org')
-rw-r--r-- | src/test/java/org/openecomp/sdc/toscaparser/api/JToscaMetadataParse.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/test/java/org/openecomp/sdc/toscaparser/api/JToscaMetadataParse.java b/src/test/java/org/openecomp/sdc/toscaparser/api/JToscaMetadataParse.java new file mode 100644 index 0000000..79d166f --- /dev/null +++ b/src/test/java/org/openecomp/sdc/toscaparser/api/JToscaMetadataParse.java @@ -0,0 +1,41 @@ +package org.openecomp.sdc.toscaparser.api; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.Collection; +import java.util.LinkedHashMap; + +import org.junit.Test; +import org.openecomp.sdc.toscaparser.api.common.JToscaException; +import org.openecomp.sdc.toscaparser.api.common.JToscaValidationIssue; +import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder; + +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); + } + + @Test + public void noWarningsAfterParse() throws JToscaException { + String fileStr = JToscaMetadataParse.class.getClassLoader().getResource("csars/tmpCSAR_Huawei_vSPGW_fixed.csar.csar").getFile(); + File file = new File(fileStr); + ToscaTemplate toscaTemplate = new ToscaTemplate(file.getAbsolutePath(), null, true, null); + + +// Collection<JToscaValidationIssue> issues = ThreadLocalsHolder.getCollector().getValidationIssues().values(); +// assertTrue(issues.size() == 0 ); + } + +} |