From 8c51a2f78333e3217dac4345955f89fc3867a503 Mon Sep 17 00:00:00 2001 From: Pavel Aharoni Date: Wed, 7 Jun 2017 17:24:33 +0300 Subject: [SDC-28] JTOSCA initial commit Change-Id: Ic0ede56c1cc513e632c36954a4227317ae357020 Signed-off-by: Pavel Aharoni --- .../JToscaMetadataParse.java | 26 +++++++++++++++++++++ src/test/resources/csars/csar_hello_world.csar | Bin 0 -> 936 bytes .../resources/csars/service-ServiceFdnt-csar.csar | Bin 0 -> 40171 bytes 3 files changed, 26 insertions(+) create mode 100644 src/test/java/org.openecomp.sdc.toscaparser/JToscaMetadataParse.java create mode 100644 src/test/resources/csars/csar_hello_world.csar create mode 100644 src/test/resources/csars/service-ServiceFdnt-csar.csar (limited to 'src/test') diff --git a/src/test/java/org.openecomp.sdc.toscaparser/JToscaMetadataParse.java b/src/test/java/org.openecomp.sdc.toscaparser/JToscaMetadataParse.java new file mode 100644 index 0000000..584a0fd --- /dev/null +++ b/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 metadataProperties = toscaTemplate.getMetaProperties("TOSCA.meta"); + assertNotNull(metadataProperties); + Object entryDefinition = metadataProperties.get("Entry-Definitions"); + assertNotNull(entryDefinition); + assertEquals("tosca_helloworld.yaml", entryDefinition); + } +} diff --git a/src/test/resources/csars/csar_hello_world.csar b/src/test/resources/csars/csar_hello_world.csar new file mode 100644 index 0000000..43ffbbc Binary files /dev/null and b/src/test/resources/csars/csar_hello_world.csar differ diff --git a/src/test/resources/csars/service-ServiceFdnt-csar.csar b/src/test/resources/csars/service-ServiceFdnt-csar.csar new file mode 100644 index 0000000..983dc9b Binary files /dev/null and b/src/test/resources/csars/service-ServiceFdnt-csar.csar differ -- cgit 1.2.3-korg