46a563a25e6beae2f1103bd8564caf562fb0dd77
[sdc.git] /
1 package org.openecomp.sdc.vendorsoftwareproduct.upload.csar;
2
3 import org.junit.Test;
4 import org.openecomp.sdc.common.errors.Messages;
5 import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.OnboardingToscaMetadata;
6
7 import java.io.IOException;
8 import java.io.InputStream;
9
10 import static org.junit.Assert.assertEquals;
11
12 public class MetadataParsingTest {
13
14   @Test
15   public void testNoEntryDefinitions() throws IOException {
16     try (InputStream is = getClass()
17         .getResourceAsStream("/vspmanager.csar/metadata/Invalidtosca.meta")) {
18       OnboardingToscaMetadata onboardingToscaMetadata = new OnboardingToscaMetadata(is);
19       assertEquals(onboardingToscaMetadata.getEntryDefinitionsPath(), null);
20     }
21   }
22
23   @Test
24   public void testValidMetadataFile() throws IOException {
25     try (InputStream is = getClass()
26         .getResourceAsStream("/vspmanager.csar/metadata/Validtosca.meta")) {
27       OnboardingToscaMetadata onboardingToscaMetadata = new OnboardingToscaMetadata(is);
28       assertEquals(onboardingToscaMetadata.getEntryDefinitionsPath(), "Definitions/MainServiceTemplate.yaml");
29     }
30
31   }
32 }