From 02cd70328143803d94912634eab0afe378764ed1 Mon Sep 17 00:00:00 2001 From: vasraz Date: Thu, 12 Dec 2019 14:41:10 +0000 Subject: Implement PNF package validation on PNF software version 1. New requirement (R-972082) 2. Edit requirement (R-146092) 3. Remove unused dependencies. Signed-off-by: Vasyl Razinkov Change-Id: I0518da5cdbf22b0086cf2c4f50194b47994273f7 Issue-ID: VNFSDK-531 --- .../VTPValidateCSARR146092IntegrationTest.java | 52 ++++++++++++++-------- 1 file changed, 34 insertions(+), 18 deletions(-) (limited to 'csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092IntegrationTest.java') diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092IntegrationTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092IntegrationTest.java index 4e6daba..bf9b094 100644 --- a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092IntegrationTest.java +++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092IntegrationTest.java @@ -22,6 +22,7 @@ import org.junit.Test; import org.onap.cvc.csar.CSARArchive; import java.util.List; +import org.onap.cvc.csar.CSARArchive.CSARError; import static org.assertj.core.api.Assertions.assertThat; import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.configureTestCase; @@ -46,53 +47,51 @@ public class VTPValidateCSARR146092IntegrationTest { @Test public void shouldDoNotReportErrorWhenNonManoArtifactIsNotAvailable() throws Exception { // given - configureTestCase(testCase, "pnf/r146092/missingNonManoArtifactInManifest.csar", "vtp-validate-csar-r146092.yaml", IS_PNF); + configureTestCase(testCase, "pnf/r146092/missingNonManoArtifactInManifest.csar", + "vtp-validate-csar-r146092.yaml", IS_PNF); // when testCase.execute(); // then - List errors = testCase.getErrors(); + final List errors = testCase.getErrors(); assertThat(errors.size()).isEqualTo(0); } @Test public void shouldReportThatMandatoryNonManoArtifactSetEntryHasNotAllFields() throws Exception { // given - configureTestCase(testCase, "pnf/r146092/missingFieldsInNonManoArtifactManifest.csar", "vtp-validate-csar-r146092.yaml", IS_PNF); + configureTestCase(testCase, "pnf/r146092/missingFieldsInNonManoArtifactManifest.csar", + "vtp-validate-csar-r146092.yaml", IS_PNF); // when testCase.execute(); // then - List errors = testCase.getErrors(); - assertThat(errors.size()).isEqualTo(4); + final List errors = testCase.getErrors(); + assertThat(errors.size()).isEqualTo(1); assertThat(convertToMessagesList(errors)).contains( - "Missing. Entry [onap_ves_events]", - "Missing. Entry [onap_pm_dictionary]", - "Missing. Entry [onap_yang_modules]", - "Missing. Entry [onap_others]" + "Missing. Entry [[onap_ansible_playbooks, onap_others, onap_pm_dictionary, onap_pnf_sw_information, onap_scripts, onap_ves_events, onap_yang_modules]]" ); } - @Test public void shouldReportThatNonManoArtifactEntryHasAnySource() throws Exception { // given - configureTestCase(testCase, "pnf/r146092/noSourceElementInNonManoArtifactEntryManifest.csar", "vtp-validate-csar-r146092.yaml", IS_PNF); + configureTestCase(testCase, "pnf/r146092/noSourceElementInNonManoArtifactEntryManifest.csar", + "vtp-validate-csar-r146092.yaml", IS_PNF); // when testCase.execute(); // then - List errors = testCase.getErrors(); + final List errors = testCase.getErrors(); assertThat(errors.size()).isEqualTo(1); assertThat(convertToMessagesList(errors)).contains( - "Missing. Entry [Source under onap_ves_events]" + "Missing. Entry [Source under onap_ves_events]" ); } - @Test public void shouldReportThatNonManoArtifactEntryHasSourceWithUnknownFile() throws Exception { // given @@ -102,10 +101,10 @@ public class VTPValidateCSARR146092IntegrationTest { testCase.execute(); // then - List errors = testCase.getErrors(); + final List errors = testCase.getErrors(); assertThat(errors.size()).isEqualTo(1); assertThat(convertToMessagesList(errors)).contains( - "Invalid. Entry [Source under onap_ves_events has invalid 'Artifacts/Deployment/Events/RadioNode.yml' path]" + "Invalid. Entry [Source under onap_ves_events has invalid 'Artifacts/Deployment/Events/RadioNode.yml' path]" ); } @@ -118,10 +117,27 @@ public class VTPValidateCSARR146092IntegrationTest { testCase.execute(); // then - List errors = testCase.getErrors(); + final List errors = testCase.getErrors(); assertThat(errors.size()).isEqualTo(4); assertThat(convertToMessagesList(errors)).contains( - "Missing. Entry [Definition YAML]" + "Missing. Entry [Definition YAML]" + ); + } + + @Test + public void shouldReportThatEntryHasInvalidPathWhenYamlFileIsNotPresent() throws Exception { + // given + configureTestCase(testCase, "pnf/r146092/missingYamlFileReferedInSourceSessionOfManifest.csar", "vtp-validate-csar-r146092.yaml", + IS_PNF); + + // when + testCase.execute(); + + // then + final List errors = testCase.getErrors(); + assertThat(errors.size()).isEqualTo(1); + assertThat(convertToMessagesList(errors)).contains( + "Invalid. Entry [Source under onap_pnf_sw_information has invalid 'Files/pnf-sw-information/pnf-sw-information.yaml' path]" ); } -- cgit 1.2.3-korg