diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/test')
3 files changed, 61 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboardingTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboardingTest.java index 288995dfed..beae6af0b4 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboardingTest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboardingTest.java @@ -489,6 +489,29 @@ class SOL004ManifestOnboardingTest { } } + @Test + public void testSuccessfulParsingWithCompatibleSpecficationVersion() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/ValidToscaVersion3.mf")) { + manifest.parse(manifestAsStream); + assertValidManifest(8, 5, Collections.emptyMap(), ResourceTypeEnum.VF, false); + } + } + + @Test + public void testFailedParsingWithCompatibleSpecficationVersion() throws IOException { + try (final InputStream manifestAsStream = + getClass().getResourceAsStream("/vspmanager.csar/manifest/InvalidToscaVersion3.mf")) { + manifest.parse(manifestAsStream); + final List<String> errorList = Collections.singletonList( + Messages.MANIFEST_ERROR_WITH_LINE.formatMessage( + Messages.MANIFEST_METADATA_INVALID_ENTRY1.formatMessage("vnf_test: 1.0"), + 4, "vnf_test: 1.0") + ); + assertInvalidManifest(errorList); + } + } + private void assertValidManifest(final int expectedMetadataSize, final int expectedSourcesSize, final Map<String, Integer> expectedNonManoKeySize, final ResourceTypeEnum resourceType, final boolean isSigned) { diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidToscaVersion3.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidToscaVersion3.mf new file mode 100644 index 0000000000..c753e7622f --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidToscaVersion3.mf @@ -0,0 +1,19 @@ +metadata: + vnf_product_name: Mock + vnf_provider_id: ZTE + vnf_test: 1.0 + vnf_release_date_time: 2017.01.01T10:00+03:00 + vnf_software_version: 1.0.0 + vnfd_id: 2116fd24-83f2-416b-bf3c-ca1964793aca + compatible_specification_versions: 2.7.1, 3.1.1 + vnfm_info: etsivnfm:v2.3.1,0:myGreatVnfm-1 + +Source: MainServiceTemplate.yaml + +Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml + +Source: Artifacts/install.sh + +Source: Artifacts/create_stack.sh + +Source: Licenses/license.xml diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidToscaVersion3.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidToscaVersion3.mf new file mode 100644 index 0000000000..2cfa9a1eae --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidToscaVersion3.mf @@ -0,0 +1,19 @@ +metadata: + vnf_product_name: Mock + vnf_provider_id: ZTE + vnf_package_version: 1.0 + vnf_release_date_time: 2017.01.01T10:00+03:00 + vnf_software_version: 1.0.0 + vnfd_id: 2116fd24-83f2-416b-bf3c-ca1964793aca + compatible_specification_versions: 2.7.1, 3.1.1 + vnfm_info: etsivnfm:v2.3.1,0:myGreatVnfm-1 + +Source: MainServiceTemplate.yaml + +Source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml + +Source: Artifacts/install.sh + +Source: Artifacts/create_stack.sh + +Source: Licenses/license.xml |