summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib/src/test
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2019-08-30 18:20:32 +0100
committerOren Kleks <orenkle@amdocs.com>2019-10-24 06:15:28 +0000
commit78f88751aa64fb72fd6321346929bd1d94f716a9 (patch)
tree58cabd13dcfbad357729ef338c8e2dca3255f1fb /openecomp-be/lib/openecomp-tosca-lib/src/test
parent105ce0729d5333cc095ef5bd8104a6c5b90cc9f0 (diff)
Fix and refactor manifest parsing
Fix a CMS signature reading expected token. Fix the necessity of a empty line in the end of the manifest. Implement CMS signature, Source checksum algorithm and digest reading. Indicate the line number and content when a manifest error occurs. Remove unnecessary recursive reading. Centralize manifest tokens. Improve tests by checking the expected error. Document the code. Change-Id: I7d12020d8922fc5d4c8d9f238557dfbcc0b65757 Issue-ID: SDC-2563 Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/test')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java127
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboardingTest.java436
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf2
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf4
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf2
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidToscaNonManoGarbageAtEnd.mf (renamed from openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf)4
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf2
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf2
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/double-signed.mf35
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-manifest.mf5
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata-with-source.mf (renamed from openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf)0
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata.mf1
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-duplicated-entries.mf4
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-incorrect-entry.mf5
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-mixed-entries.mf5
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-entry.mf3
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-value.mf3
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/no-metadata.mf (renamed from openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf)0
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-empty-source.mf11
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-no-sources.mf10
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-hash.mf8
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-value.mf9
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-algorithm.mf8
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-value.mf9
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/metadata-pnfd.mf27
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed-with-non-mano.mf30
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed.mf27
27 files changed, 645 insertions, 134 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java
deleted file mode 100644
index b083cfad3a..0000000000
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/ManifestParsingTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.tosca.csar;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.common.errors.Messages;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Optional;
-
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
-
-public class ManifestParsingTest {
-
- private Manifest manifest;
-
- @Before
- public void setUp(){
- manifest = new SOL004ManifestOnboarding();
- }
-
- @Test
- public void testSuccessfulParsing() throws IOException {
- try (InputStream is = getClass()
- .getResourceAsStream("/vspmanager.csar/manifest/ValidTosca.mf")) {
- manifest.parse(is);
- assertTrue(manifest.isValid());
- assertEquals(manifest.getMetadata().size(), 4);
- assertEquals(manifest.getSources().size(), 5);
- Optional<ResourceTypeEnum> resourceTypeEnum = manifest.getType();
- if(resourceTypeEnum.isPresent()){
- assertTrue(resourceTypeEnum.get() == ResourceTypeEnum.VF);
- }
- }
- }
-
- @Test
- public void testNoMetadataParsing() throws IOException {
- try (InputStream is = getClass()
- .getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca1.mf")) {
- manifest.parse(is);
- assertFalse(manifest.isValid());
- assertTrue(manifest.getErrors().stream().anyMatch(error -> error
- .contains(Messages.MANIFEST_INVALID_LINE.getErrorMessage().substring(0, 10))));
- }
- }
-
- @Test
- public void testBrokenMDParsing() throws IOException {
- try (InputStream is = getClass()
- .getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca2.mf")) {
- manifest.parse(is);
- assertFalse(manifest.isValid());
- assertTrue(manifest.getErrors().stream().anyMatch(error -> error
- .contains(Messages.MANIFEST_INVALID_LINE.getErrorMessage().substring(0, 10))));
- }
- }
-
- @Test
- public void testNoMetaParsing() throws IOException {
- try (InputStream is = getClass()
- .getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca4.mf")) {
- manifest.parse(is);
- assertFalse(manifest.isValid());
- assertTrue(manifest.getErrors().stream().anyMatch(error -> error
- .contains(Messages.MANIFEST_NO_METADATA.getErrorMessage().substring(0, 10))));
- }
- }
-
- @Test
- public void testSuccessfulNonManoParsing() throws IOException {
- try (InputStream is = getClass()
- .getResourceAsStream("/vspmanager.csar/manifest/ValidNonManoTosca.mf")) {
- manifest.parse(is);
- assertTrue(manifest.isValid());
- assertEquals(manifest.getMetadata().size(), 4);
- assertEquals(manifest.getSources().size(), 5);
- assertEquals(manifest.getNonManoSources().size(), 2);
- }
- }
-
- @Test
- public void testFailfulNonManoParsing() throws IOException {
- try (InputStream is = getClass()
- .getResourceAsStream("/vspmanager.csar/manifest/InValidNonManoTosca.mf")) {
- manifest.parse(is);
- assertFalse(manifest.isValid());
- }
- }
-
- @Test
- public void testFailfulNonManoParsingWithGarbadge() throws IOException {
- try (InputStream is = getClass()
- .getResourceAsStream("/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf")) {
- manifest.parse(is);
- assertFalse(manifest.isValid());
- }
- }
-
- @Test
- public void testParseManifestWithNoFile() throws IOException {
- try (InputStream is = getClass()
- .getResourceAsStream("/vspmanager.csar/manifest/SOME_WRONG_FILE")) {
- manifest.parse(is);
- assertFalse(manifest.isValid());
- }
- }
-}
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
new file mode 100644
index 0000000000..7cb1511a32
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/csar/SOL004ManifestOnboardingTest.java
@@ -0,0 +1,436 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.tosca.csar;
+
+import static junit.framework.TestCase.assertSame;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import com.google.common.collect.ImmutableMap;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.common.errors.Messages;
+
+public class SOL004ManifestOnboardingTest {
+
+ private Manifest manifest;
+
+ @Before
+ public void setUp() {
+ manifest = new SOL004ManifestOnboarding();
+ }
+
+ @Test
+ public void testSuccessfulParsing() throws IOException {
+ try (final InputStream manifestAsStream =
+ getClass().getResourceAsStream("/vspmanager.csar/manifest/ValidTosca.mf")) {
+ manifest.parse(manifestAsStream);
+ assertValidManifest(4, 5, Collections.emptyMap(), ResourceTypeEnum.VF);
+ }
+ }
+
+ @Test
+ public void testNoMetadataParsing() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/invalid/no-metadata.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(
+ buildErrorMessage(3, "Source: MainServiceTemplate.yaml", Messages.MANIFEST_START_METADATA)
+ );
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testBrokenMDParsing() throws IOException {
+ try (final InputStream manifestAsStream =
+ getClass().getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca2.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(Messages.MANIFEST_INVALID_LINE.formatMessage(9, "vnf_package_version: 1.0"));
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testNoMetaParsing() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/invalid/empty-metadata-with-source.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(
+ buildErrorMessage(4, "Source: MainServiceTemplate.yaml",
+ Messages.MANIFEST_METADATA_INVALID_ENTRY1, "Source: MainServiceTemplate.yaml")
+ );
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testSuccessfulNonManoParsing() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/ValidNonManoTosca.mf")) {
+ manifest.parse(manifestAsStream);
+ assertValidManifest(4, 5,
+ ImmutableMap.of("foo_bar", 3, "prv.happy-nfv.cool", 3), ResourceTypeEnum.VF);
+ }
+ }
+
+ @Test
+ public void testInvalidNonManoParsing() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/InValidNonManoTosca.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> errorList = Collections.singletonList(
+ buildErrorMessage(34, "vnf_product_name: Mock", Messages.MANIFEST_INVALID_NON_MANO_KEY,
+ "vnf_product_name")
+ );
+ assertInvalidManifest(errorList);
+ }
+ }
+
+ private String buildErrorMessage(final int lineNumber, final String line, final Messages message,
+ final Object... params) {
+ return Messages.MANIFEST_ERROR_WITH_LINE.formatMessage(message.formatMessage(params), lineNumber, line);
+ }
+
+ @Test
+ public void testNonManoParsingWithGarbage() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/InvalidToscaNonManoGarbageAtEnd.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> errorList = Collections.singletonList(
+ Messages.MANIFEST_ERROR_WITH_LINE.formatMessage(
+ Messages.MANIFEST_INVALID_NON_MANO_KEY.formatMessage("some garbage"),
+ 34, "some garbage")
+ );
+ assertInvalidManifest(errorList);
+ }
+ }
+
+ @Test
+ public void testInvalidManifestFile() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/SOME_WRONG_FILE")) {
+ manifest.parse(manifestAsStream);
+ assertInvalidManifest(Collections.singletonList(Messages.MANIFEST_PARSER_INTERNAL.getErrorMessage()));
+ }
+ }
+
+ @Test
+ public void testManifestSigned() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/valid/signed.mf")) {
+ manifest.parse(manifestAsStream);
+ assertValidManifest(4, 3, Collections.emptyMap(), ResourceTypeEnum.VF);
+ }
+ }
+
+ @Test
+ public void testManifestSignedWithNonManoArtifacts() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/valid/signed-with-non-mano.mf")) {
+ manifest.parse(manifestAsStream);
+ assertValidManifest(4, 3, ImmutableMap.of("foo_bar", 3), ResourceTypeEnum.VF);
+ manifest.getType().ifPresent(typeEnum -> assertSame(typeEnum, ResourceTypeEnum.VF));
+ }
+ }
+
+ @Test
+ public void testManifestWithPnf() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/valid/metadata-pnfd.mf")) {
+ manifest.parse(manifestAsStream);
+ assertValidManifest(4, 3, new HashMap<>(), ResourceTypeEnum.PNF);
+ }
+ }
+
+ @Test
+ public void testMetadataWithNoValue() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/invalid/metadata-no-value.mf")) {
+ manifest.parse(manifestAsStream);
+
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(
+ buildErrorMessage(3, "vnf_provider_id", Messages.MANIFEST_METADATA_INVALID_ENTRY1, "vnf_provider_id")
+ );
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testMetadataWithValueButNoEntry() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/invalid/metadata-no-entry.mf")) {
+ manifest.parse(manifestAsStream);
+
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(
+ buildErrorMessage(3, ": no-entry-value", Messages.MANIFEST_METADATA_INVALID_ENTRY1, ": no-entry-value")
+ );
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testMetadataWithIncorrectEntry() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/invalid/metadata-incorrect-entry.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(
+ buildErrorMessage(4, "vnf_release_data_time: 2019-08-29T22:17:39.275281",
+ Messages.MANIFEST_METADATA_INVALID_ENTRY1, "vnf_release_data_time: 2019-08-29T22:17:39.275281")
+ );
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testMetadataWithMixedEntries() throws IOException {
+ try (final InputStream manifestAsStream = getClass()
+ .getResourceAsStream("/vspmanager.csar/manifest/invalid/metadata-mixed-entries.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(buildErrorMessage(6, "", Messages.MANIFEST_METADATA_UNEXPECTED_ENTRY_TYPE));
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testMetadataWithDuplicatedEntries() throws IOException {
+ try (final InputStream manifestAsStream =
+ getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/metadata-duplicated-entries.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(
+ buildErrorMessage(4, "vnf_product_name: vPP", Messages.MANIFEST_METADATA_DUPLICATED_ENTRY,
+ "vnf_product_name")
+ );
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testManifestNonManoKeyWithoutSources() throws IOException {
+ try (final InputStream manifestAsStream =
+ getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/non-mano-key-with-no-sources.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(
+ buildErrorMessage(11, "", Messages.MANIFEST_EMPTY_NON_MANO_KEY,
+ "foo_bar")
+ );
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testManifestNonManoKeyWithEmptySourceEntry() throws IOException {
+ try (final InputStream manifestAsStream =
+ getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/non-mano-key-with-empty-source.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(
+ buildErrorMessage(11, "Source:", Messages.MANIFEST_EMPTY_NON_MANO_SOURCE)
+ );
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testManifestWithEmptyMetadata() throws IOException {
+ try (final InputStream manifestAsStream =
+ getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/empty-metadata.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(buildErrorMessage(2, "", Messages.MANIFEST_NO_METADATA));
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testManifestSourceAlgorithmWithoutHash() throws IOException {
+ try (final InputStream manifestAsStream =
+ getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/source-algorithm-without-hash.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(buildErrorMessage(9, "", Messages.MANIFEST_EXPECTED_HASH_ENTRY));
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testManifestSourceHashWithoutAlgorithm() throws IOException {
+ try (final InputStream manifestAsStream =
+ getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/source-hash-without-algorithm.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(buildErrorMessage(8, "Hash: 3b119b37da5b76ec7c933168b21cedd8", Messages.MANIFEST_EXPECTED_ALGORITHM_BEFORE_HASH));
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testManifestSourceAlgorithmWithoutValue() throws IOException {
+ try (final InputStream manifestAsStream =
+ getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/source-algorithm-without-value.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(buildErrorMessage(8, "Algorithm:", Messages.MANIFEST_EXPECTED_ALGORITHM_VALUE));
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testManifestSourceHashWithoutValue() throws IOException {
+ try (final InputStream manifestAsStream =
+ getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/source-hash-without-value.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(buildErrorMessage(9, "Hash:", Messages.MANIFEST_EXPECTED_HASH_VALUE));
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testEmptyManifest() throws IOException {
+ try (final InputStream manifestAsStream =
+ getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/empty-manifest.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList.add(Messages.MANIFEST_EMPTY.getErrorMessage());
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+ @Test
+ public void testManifestWithDuplicatedCmsSignature() throws IOException {
+ try (final InputStream manifestAsStream =
+ getClass().getResourceAsStream("/vspmanager.csar/manifest/invalid/double-signed.mf")) {
+ manifest.parse(manifestAsStream);
+ final List<String> expectedErrorList = new ArrayList<>();
+ expectedErrorList
+ .add(buildErrorMessage(26, "-----BEGIN CMS-----", Messages.MANIFEST_DUPLICATED_CMS_SIGNATURE));
+ assertInvalidManifest(expectedErrorList);
+ }
+ }
+
+
+ @Test
+ public void testGetEntry() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ final Method getEntryMethod = AbstractOnboardingManifest.class.getDeclaredMethod("readEntryName", String.class);
+ getEntryMethod.setAccessible(true);
+ final Optional<String> noEntry = (Optional<String>) getEntryMethod.invoke(manifest, ":");
+ assertThat("Entry should not be present", noEntry.isPresent(), is(false));
+
+ final Optional<String> blankEntry = (Optional<String>) getEntryMethod.invoke(manifest, " :");
+ assertThat("Entry should not be present", blankEntry.isPresent(), is(false));
+
+ final Optional<String> noColon = (Optional<String>) getEntryMethod.invoke(manifest, "anyKeyWithoutColon ");
+ assertThat("Entry should not be present", noColon.isPresent(), is(false));
+
+ final Optional<String> blank = (Optional<String>) getEntryMethod.invoke(manifest, " ");
+ assertThat("Entry should not be present", blank.isPresent(), is(false));
+
+ final Optional<String> empty = (Optional<String>) getEntryMethod.invoke(manifest, "");
+ assertThat("Entry should not be present", empty.isPresent(), is(false));
+
+ final Optional<String> nul1 = (Optional<String>) getEntryMethod.invoke(manifest, new Object[]{null});
+ assertThat("Entry should not be present", nul1.isPresent(), is(false));
+
+ final Optional<String> entry = (Optional<String>) getEntryMethod
+ .invoke(manifest, " entry to test : : a value ::: test test: ");
+ assertThat("Entry should be present", entry.isPresent(), is(true));
+ assertThat("Entry should be as expected", entry.get(), equalTo("entry to test"));
+ }
+
+ @Test
+ public void testGetValue() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+ final Method getValueMethod = AbstractOnboardingManifest.class.getDeclaredMethod("readEntryValue", String.class);
+ getValueMethod.setAccessible(true);
+ final Optional<String> noValue = (Optional<String>) getValueMethod.invoke(manifest, ":");
+ assertThat("Value should not be present", noValue.isPresent(), is(false));
+
+ final Optional<String> blankValue = (Optional<String>) getValueMethod.invoke(manifest, ": ");
+ assertThat("Value should not be present", blankValue.isPresent(), is(false));
+
+ final Optional<String> noColon = (Optional<String>) getValueMethod.invoke(manifest, "anyKeyWithoutColon ");
+ assertThat("Value should not be present", noColon.isPresent(), is(false));
+
+ final Optional<String> blank = (Optional<String>) getValueMethod.invoke(manifest, " ");
+ assertThat("Value should not be present", blank.isPresent(), is(false));
+
+ final Optional<String> empty = (Optional<String>) getValueMethod.invoke(manifest, "");
+ assertThat("Value should not be present", empty.isPresent(), is(false));
+
+ final Optional<String> nul1 = (Optional<String>) getValueMethod.invoke(manifest, new Object[]{null});
+ assertThat("Value should not be present", nul1.isPresent(), is(false));
+
+ final Optional<String> value = (Optional<String>) getValueMethod
+ .invoke(manifest, "attribute : : a value ::: test test: ");
+ assertThat("Value should be present", value.isPresent(), is(true));
+ assertThat("Value should be as expected", value.get(), equalTo(": a value ::: test test:"));
+ }
+
+ private void assertValidManifest(final int expectedMetadataSize, final int expectedSourcesSize,
+ final Map<String, Integer> expectedNonManoKeySize,
+ final ResourceTypeEnum resourceType) {
+ assertThat("Should have no errors", manifest.getErrors(), is(empty()));
+ assertThat("Should be valid", manifest.isValid(), is(true));
+ assertThat("Metadata should have the expected size",
+ manifest.getMetadata().keySet(), hasSize(expectedMetadataSize));
+ assertThat("Sources should have the expected size", manifest.getSources(), hasSize(expectedSourcesSize));
+ assertThat("Non Mano Sources keys should have the expected size",
+ manifest.getNonManoSources().keySet(), hasSize(expectedNonManoKeySize.keySet().size()));
+ for (final Entry<String, Integer> nonManoKeyAndSize : expectedNonManoKeySize.entrySet()) {
+ final String nonManoKey = nonManoKeyAndSize.getKey();
+ assertThat("Should contain expected Non Mano Sources key",
+ manifest.getNonManoSources().keySet(), hasItem(nonManoKey));
+ assertThat(String.format("Non Mano Sources keys %s should have the expected sources size", nonManoKey),
+ manifest.getNonManoSources().get(nonManoKey).size(), equalTo(nonManoKeyAndSize.getValue()));
+ }
+ assertThat("Should have a type", manifest.getType().isPresent(), is(true));
+ assertThat("Type should be as expected", manifest.getType().get(), equalTo(resourceType));
+ }
+
+ private void assertInvalidManifest(final List<String> expectedErrorList) {
+ assertThat("Should be invalid", manifest.isValid(), is(false));
+ assertThat("Should have the expected error quantity", manifest.getErrors(), hasSize(expectedErrorList.size()));
+ assertThat("Should have expected errors", manifest.getErrors(),
+ containsInAnyOrder(expectedErrorList.toArray(new String[0])));
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf
index 9cced6b371..02215a6cfb 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InValidNonManoTosca.mf
@@ -2,7 +2,7 @@ metadata:
vnf_product_name: Mock
vnf_provider_id: ZTE
vnf_package_version: 1.0
- vnf_release_data_time: 2017.01.01T10:00+03:00
+ vnf_release_date_time: 2017.01.01T10:00+03:00
Source: MainServiceTemplate.yaml
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf
index 057f54867b..54bb5cd65f 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf
@@ -1,11 +1,13 @@
metadata:
vnf_product_name: Mock
vnf_provider_id: ZTE
+ vnf_package_version: 1.0
+ vnf_release_date_time: 2017.01.01T10:00+03:00
Source: MainServiceTemplate.yaml
vnf_package_version: 1.0
- vnf_release_data_time: 2017.01.01T10:00+03:00
+ vnf_release_date_time: 2017.01.01T10:00+03:00
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf
index 64e9445f7f..060207f120 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf
@@ -2,6 +2,6 @@ metadata:
vnf_product_name: Mock
vnf_provider_id: ZTE
vnf_package_version: 1.0
- vnf_release_data_time: 2017.01.01T10:00+03:00
+ vnf_release_date_time: 2017.01.01T10:00+03:00
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidToscaNonManoGarbageAtEnd.mf
index cfe6bc48da..15c2833c22 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTocsaNonManoGarbadgeAtEnd.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidToscaNonManoGarbageAtEnd.mf
@@ -2,7 +2,7 @@ metadata:
vnf_product_name: Mock
vnf_provider_id: ZTE
vnf_package_version: 1.0
- vnf_release_data_time: 2017.01.01T10:00+03:00
+ vnf_release_date_time: 2017.01.01T10:00+03:00
Source: MainServiceTemplate.yaml
@@ -31,4 +31,4 @@ non_mano_artifact_sets:
Source: happy/cool/hot/hot_or_cool.json
-some garbadge \ No newline at end of file
+some garbage \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf
index 25ec14c7cc..03f2b3cf3b 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidNonManoTosca.mf
@@ -2,7 +2,7 @@ metadata:
vnf_product_name: Mock
vnf_provider_id: ZTE
vnf_package_version: 1.0
- vnf_release_data_time: 2017.01.01T10:00+03:00
+ vnf_release_date_time: 2017.01.01T10:00+03:00
Source: MainServiceTemplate.yaml
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf
index b2accb7a1c..b9d3844d53 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf
@@ -2,7 +2,7 @@ metadata:
vnf_product_name: Mock
vnf_provider_id: ZTE
vnf_package_version: 1.0
- vnf_release_data_time: 2017.01.01T10:00+03:00
+ vnf_release_date_time: 2017.01.01T10:00+03:00
Source: MainServiceTemplate.yaml
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/double-signed.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/double-signed.mf
new file mode 100644
index 0000000000..88098a1006
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/double-signed.mf
@@ -0,0 +1,35 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id: Ericsson
+ vnf_package_version: R24A583
+ vnf_release_date_time: 2019-08-29T22:17:39.275281
+
+Source: scripts/userdata.file
+Algorithm: md5
+Hash: 3b119b37da5b76ec7c933168b21cedd8
+
+-----BEGIN CMS-----
+MIIBcwYJKoZIhvcNAQcCoIIBZDCCAWACAQMxDTALBglghkgBZQMEAgEwCwYJKoZI
+hvcNAQcBMYIBPTCCATkCAQOAFGOGMKMvLSRzUBjkgZipSoZm1U/UMAsGCWCGSAFl
+AwQCATANBgkqhkiG9w0BAQEFAASCAQBNHXz1p5NBM9Nlvp8RPoVjszzh9UfQ/OCp
+mB926MTLexWOiawjPRKuoiXn4y4dQFZBXauunCOyXYfPASUMFnhL/7gvhajPH25/
+MwEyEsUqsCyJ63tAeYxZAqTZWA2pZi9ejCPoRnt6xl7EhEyogXiSBgc2P89hxhe6
+0/MP6Mtw9D8Ks7M1LxH6ntxGApPTNRlmMtQkrx/ZUtAcKKZJoNpofzdmd+O60PMT
+igNsuwzMNy5LfSjvp8xgWoxhWr4/zLRIZ5F5Z5qhz7lia9xDSGYMfPitDCVqI9XE
+O58S/FoHu+z3Tig7vauTFFbiJjIu9SkG0c33ayEUCKejuVQPjuY9
+-----END CMS-----
+
+Source: scripts/userdata.file.sm
+Algorithm: md5
+Hash: 3b119b37da5b76ec7c933168b21cedd7
+
+-----BEGIN CMS-----
+MIIBcwYJKoZIhvcNAQcCoIIBZDCCAWACAQMxDTALBglghkgBZQMEAgEwCwYJKoZI
+hvcNAQcBMYIBPTCCATkCAQOAFGOGMKMvLSRzUBjkgZipSoZm1U/UMAsGCWCGSAFl
+AwQCATANBgkqhkiG9w0BAQEFAASCAQBNHXz1p5NBM9Nlvp8RPoVjszzh9UfQ/OCp
+mB926MTLexWOiawjPRKuoiXn4y4dQFZBXauunCOyXYfPASUMFnhL/7gvhajPH25/
+MwEyEsUqsCyJ63tAeYxZAqTZWA2pZi9ejCPoRnt6xl7EhEyogXiSBgc2P89hxhe6
+0/MP6Mtw9D8Ks7M1LxH6ntxGApPTNRlmMtQkrx/ZUtAcKKZJoNpofzdmd+O60PMT
+igNsuwzMNy5LfSjvp8xgWoxhWr4/zLRIZ5F5Z5qhz7lia9xDSGYMfPitDCVqI9XE
+O58S/FoHu+z3Tig7vauTFFbiJjIu9SkG0c33ayEUCKejuVQPjuY9
+-----END CMS-----
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-manifest.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-manifest.mf
new file mode 100644
index 0000000000..3f2ff2d6cc
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-manifest.mf
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata-with-source.mf
index d8e291c4a3..d8e291c4a3 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata-with-source.mf
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata.mf
new file mode 100644
index 0000000000..7b518cbe81
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/empty-metadata.mf
@@ -0,0 +1 @@
+metadata: \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-duplicated-entries.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-duplicated-entries.mf
new file mode 100644
index 0000000000..696265eab1
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-duplicated-entries.mf
@@ -0,0 +1,4 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id: Ericsson
+ vnf_product_name: vPP
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-incorrect-entry.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-incorrect-entry.mf
new file mode 100644
index 0000000000..139e18e267
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-incorrect-entry.mf
@@ -0,0 +1,5 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id: Ericsson
+ vnf_release_data_time: 2019-08-29T22:17:39.275281
+ vnf_package_version: R24A583
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-mixed-entries.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-mixed-entries.mf
new file mode 100644
index 0000000000..0d26e2de98
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-mixed-entries.mf
@@ -0,0 +1,5 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id: Ericsson
+ vnf_release_date_time: 2019-08-29T22:17:39.275281
+ pnfd_archive_version: 1.0
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-entry.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-entry.mf
new file mode 100644
index 0000000000..bc6db7ebf4
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-entry.mf
@@ -0,0 +1,3 @@
+metadata:
+ vnf_product_name: vPP
+ : no-entry-value \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-value.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-value.mf
new file mode 100644
index 0000000000..9d286d6dd9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/metadata-no-value.mf
@@ -0,0 +1,3 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/no-metadata.mf
index ebdec213d3..ebdec213d3 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/no-metadata.mf
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-empty-source.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-empty-source.mf
new file mode 100644
index 0000000000..e4544d487a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-empty-source.mf
@@ -0,0 +1,11 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id: Ericsson
+ vnf_package_version: R24A583
+ vnf_release_date_time: 2019-08-29T22:17:39.275281
+
+Source: scripts/userdata.file.sm
+
+non_mano_artifact_sets:
+ foo_bar:
+ Source: \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-no-sources.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-no-sources.mf
new file mode 100644
index 0000000000..a7533bbf45
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/non-mano-key-with-no-sources.mf
@@ -0,0 +1,10 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id: Ericsson
+ vnf_package_version: R24A583
+ vnf_release_date_time: 2019-08-29T22:17:39.275281
+
+Source: scripts/userdata.file.sm
+
+non_mano_artifact_sets:
+ foo_bar:
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-hash.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-hash.mf
new file mode 100644
index 0000000000..a9a988735b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-hash.mf
@@ -0,0 +1,8 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id: Ericsson
+ vnf_package_version: R24A583
+ vnf_release_date_time: 2019-08-29T22:17:39.275281
+
+Source: scripts/userdata.file.sm
+Algorithm: md5
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-value.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-value.mf
new file mode 100644
index 0000000000..79797d7b8c
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-algorithm-without-value.mf
@@ -0,0 +1,9 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id: Ericsson
+ vnf_package_version: R24A583
+ vnf_release_date_time: 2019-08-29T22:17:39.275281
+
+Source: scripts/userdata.file.sm
+Algorithm:
+Hash: 3b119b37da5b76ec7c933168b21cedd8
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-algorithm.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-algorithm.mf
new file mode 100644
index 0000000000..ec10bc800f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-algorithm.mf
@@ -0,0 +1,8 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id: Ericsson
+ vnf_package_version: R24A583
+ vnf_release_date_time: 2019-08-29T22:17:39.275281
+
+Source: scripts/userdata.file.sm
+Hash: 3b119b37da5b76ec7c933168b21cedd8
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-value.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-value.mf
new file mode 100644
index 0000000000..2d786f1e54
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/invalid/source-hash-without-value.mf
@@ -0,0 +1,9 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id: Ericsson
+ vnf_package_version: R24A583
+ vnf_release_date_time: 2019-08-29T22:17:39.275281
+
+Source: scripts/userdata.file.sm
+Algorithm: md5
+Hash:
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/metadata-pnfd.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/metadata-pnfd.mf
new file mode 100644
index 0000000000..8bf73ede63
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/metadata-pnfd.mf
@@ -0,0 +1,27 @@
+metadata:
+ pnfd_name: Name
+ pnfd_provider: Provider
+ pnfd_archive_version: 1.0
+ pnfd_release_date_time: 2017-01-01T10:00:00+03:00
+
+Source: TOSCA-Metadata/TOSCA.meta
+
+Source: scripts/userdata.file
+Algorithm: md5
+Hash: 3b119b37da5b76ec7c933168b21cedd8
+
+Source: scripts/userdata.file.sm
+
+
+
+
+-----BEGIN CMS-----
+MIIBcwYJKoZIhvcNAQcCoIIBZDCCAWACAQMxDTALBglghkgBZQMEAgEwCwYJKoZI
+hvcNAQcBMYIBPTCCATkCAQOAFGOGMKMvLSRzUBjkgZipSoZm1U/UMAsGCWCGSAFl
+AwQCATANBgkqhkiG9w0BAQEFAASCAQBNHXz1p5NBM9Nlvp8RPoVjszzh9UfQ/OCp
+mB926MTLexWOiawjPRKuoiXn4y4dQFZBXauunCOyXYfPASUMFnhL/7gvhajPH25/
+MwEyEsUqsCyJ63tAeYxZAqTZWA2pZi9ejCPoRnt6xl7EhEyogXiSBgc2P89hxhe6
+0/MP6Mtw9D8Ks7M1LxH6ntxGApPTNRlmMtQkrx/ZUtAcKKZJoNpofzdmd+O60PMT
+igNsuwzMNy5LfSjvp8xgWoxhWr4/zLRIZ5F5Z5qhz7lia9xDSGYMfPitDCVqI9XE
+O58S/FoHu+z3Tig7vauTFFbiJjIu9SkG0c33ayEUCKejuVQPjuY9
+-----END CMS-----
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed-with-non-mano.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed-with-non-mano.mf
new file mode 100644
index 0000000000..dee6384892
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed-with-non-mano.mf
@@ -0,0 +1,30 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id: Ericsson
+ vnf_package_version: R24A583
+ vnf_release_date_time: 2019-08-29T22:17:39.275281
+
+Source: TOSCA-Metadata/TOSCA.meta
+
+Source: scripts/userdata.file
+Algorithm: md5
+Hash: 3b119b37da5b76ec7c933168b21cedd8
+
+Source: scripts/userdata.file.sm
+
+-----BEGIN CMS-----
+MIIBcwYJKoZIhvcNAQcCoIIBZDCCAWACAQMxDTALBglghkgBZQMEAgEwCwYJKoZI
+hvcNAQcBMYIBPTCCATkCAQOAFGOGMKMvLSRzUBjkgZipSoZm1U/UMAsGCWCGSAFl
+AwQCATANBgkqhkiG9w0BAQEFAASCAQBNHXz1p5NBM9Nlvp8RPoVjszzh9UfQ/OCp
+mB926MTLexWOiawjPRKuoiXn4y4dQFZBXauunCOyXYfPASUMFnhL/7gvhajPH25/
+MwEyEsUqsCyJ63tAeYxZAqTZWA2pZi9ejCPoRnt6xl7EhEyogXiSBgc2P89hxhe6
+0/MP6Mtw9D8Ks7M1LxH6ntxGApPTNRlmMtQkrx/ZUtAcKKZJoNpofzdmd+O60PMT
+igNsuwzMNy5LfSjvp8xgWoxhWr4/zLRIZ5F5Z5qhz7lia9xDSGYMfPitDCVqI9XE
+O58S/FoHu+z3Tig7vauTFFbiJjIu9SkG0c33ayEUCKejuVQPjuY9
+-----END CMS-----
+
+non_mano_artifact_sets:
+ foo_bar:
+ Source: foobar/foo/foo.yaml
+ Source: foobar/foo/foo.script
+ Source: foobar/bar/descriptor.xml
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed.mf b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed.mf
new file mode 100644
index 0000000000..fe43239d29
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/vspmanager.csar/manifest/valid/signed.mf
@@ -0,0 +1,27 @@
+metadata:
+ vnf_product_name: vPP
+ vnf_provider_id: Ericsson
+ vnf_package_version: R24A583
+ vnf_release_date_time: 2019-08-29T22:17:39.275281
+
+Source: TOSCA-Metadata/TOSCA.meta
+
+Source: scripts/userdata.file
+Algorithm: md5
+Hash: 3b119b37da5b76ec7c933168b21cedd8
+
+Source: scripts/userdata.file.sm
+
+
+
+
+-----BEGIN CMS-----
+MIIBcwYJKoZIhvcNAQcCoIIBZDCCAWACAQMxDTALBglghkgBZQMEAgEwCwYJKoZI
+hvcNAQcBMYIBPTCCATkCAQOAFGOGMKMvLSRzUBjkgZipSoZm1U/UMAsGCWCGSAFl
+AwQCATANBgkqhkiG9w0BAQEFAASCAQBNHXz1p5NBM9Nlvp8RPoVjszzh9UfQ/OCp
+mB926MTLexWOiawjPRKuoiXn4y4dQFZBXauunCOyXYfPASUMFnhL/7gvhajPH25/
+MwEyEsUqsCyJ63tAeYxZAqTZWA2pZi9ejCPoRnt6xl7EhEyogXiSBgc2P89hxhe6
+0/MP6Mtw9D8Ks7M1LxH6ntxGApPTNRlmMtQkrx/ZUtAcKKZJoNpofzdmd+O60PMT
+igNsuwzMNy5LfSjvp8xgWoxhWr4/zLRIZ5F5Z5qhz7lia9xDSGYMfPitDCVqI9XE
+O58S/FoHu+z3Tig7vauTFFbiJjIu9SkG0c33ayEUCKejuVQPjuY9
+-----END CMS-----