summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/MetadataParsingTest.java
blob: b17c8a17cd8456e75471bad7685073760ad4438d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.openecomp.sdc.vendorsoftwareproduct.upload.csar;


import static org.testng.Assert.assertEquals;

import java.io.IOException;
import java.io.InputStream;
import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.OnboardingToscaMetadata;
import org.testng.annotations.Test;

public class MetadataParsingTest {

  @Test
  public void testNoEntryDefinitions() throws IOException {
    try (InputStream is = getClass()
        .getResourceAsStream("/vspmanager.csar/metadata/Invalidtosca.meta")) {
      OnboardingToscaMetadata onboardingToscaMetadata = new OnboardingToscaMetadata(is);
      assertEquals(onboardingToscaMetadata.getEntryDefinitionsPath(), null);
    }
  }

  @Test
  public void testValidMetadataFile() throws IOException {
    try (InputStream is = getClass()
        .getResourceAsStream("/vspmanager.csar/metadata/Validtosca.meta")) {
      OnboardingToscaMetadata onboardingToscaMetadata = new OnboardingToscaMetadata(is);
      assertEquals(onboardingToscaMetadata.getEntryDefinitionsPath(), "Definitions/MainServiceTemplate.yaml");
    }

  }
}