Pavel Aharoni | 8c51a2f | 2017-06-07 17:24:33 +0300 | [diff] [blame^] | 1 | package org.openecomp.sdc.toscaparser; |
| 2 | |
| 3 | import static org.junit.Assert.assertEquals; |
| 4 | import static org.junit.Assert.assertNotNull; |
| 5 | |
| 6 | import java.io.File; |
| 7 | import java.util.LinkedHashMap; |
| 8 | |
| 9 | import org.junit.Test; |
| 10 | import org.openecomp.sdc.toscaparser.api.ToscaTemplate; |
| 11 | import org.openecomp.sdc.toscaparser.api.common.JToscaException; |
| 12 | |
| 13 | public class JToscaMetadataParse { |
| 14 | |
| 15 | @Test |
| 16 | public void testMetadataParsedCorrectly() throws JToscaException { |
| 17 | String fileStr = JToscaMetadataParse.class.getClassLoader().getResource("csars/csar_hello_world.csar").getFile(); |
| 18 | File file = new File(fileStr); |
| 19 | ToscaTemplate toscaTemplate = new ToscaTemplate(file.getAbsolutePath(), null, true, null); |
| 20 | LinkedHashMap<String, Object> metadataProperties = toscaTemplate.getMetaProperties("TOSCA.meta"); |
| 21 | assertNotNull(metadataProperties); |
| 22 | Object entryDefinition = metadataProperties.get("Entry-Definitions"); |
| 23 | assertNotNull(entryDefinition); |
| 24 | assertEquals("tosca_helloworld.yaml", entryDefinition); |
| 25 | } |
| 26 | } |