diff options
Diffstat (limited to 'csarvalidation/src/test/java/org')
3 files changed, 101 insertions, 19 deletions
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR130206IntegrationTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR130206IntegrationTest.java index 036e169..feabe7f 100644 --- a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR130206IntegrationTest.java +++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR130206IntegrationTest.java @@ -63,6 +63,25 @@ public class VTPValidateCSARR130206IntegrationTest { } @Test + @Ignore("It is impossible to write test which will always pass, because certificate used to sign the file has time validity." + + "To verify signed package please please follow instructions from test/resources/README.txt file and comment @Ignore tag. " + + "Use instructions for option 1. Test was created for manual verification." + ) + public void manual_shouldValidateCsarWithCertificateInEtsiAndMissingInCMS() throws Exception { + + // given + configureTestCase(testCase, "pnf/r130206/csar-with-etsi-cert-without-cert-in-cms.csar", "vtp-validate-csar-r130206.yaml", IS_PNF); + + // when + testCase.execute(); + + // then + List<CSARArchive.CSARError> errors = testCase.getErrors(); + assertThat(errors.size()).isEqualTo(0); + } + + + @Test public void shouldReportThatOnlySignatureIsInvalid() throws Exception { // given @@ -122,5 +141,23 @@ public class VTPValidateCSARR130206IntegrationTest { } + @Test + public void shouldReportThanInVnfPackageETSIFileIsMissingAndNoCertificateInCMS() throws Exception { + + // given + configureTestCase(testCase, "pnf/r130206/csar-with-no-certificate.csar", "vtp-validate-csar-r130206.yaml", IS_PNF); + + // when + testCase.execute(); + + // then + List<CSARArchive.CSARError> errors = testCase.getErrors(); + assertThat(convertToMessagesList(errors)).contains( + "Unable to find cert file defined by ETSI-Entry-Certificate!", + "Unable to find CMS section in manifest!" + + ); + } + } 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 bf9b094..d2a7b8a 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 @@ -19,10 +19,9 @@ package org.onap.cvc.csar.cc.sol004; import org.junit.Before; import org.junit.Test; -import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARError; 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; @@ -45,10 +44,24 @@ public class VTPValidateCSARR146092IntegrationTest { } @Test - public void shouldDoNotReportErrorWhenNonManoArtifactIsNotAvailable() throws Exception { + public void shouldNotReportErrorWhenCSARValid() throws Exception { + //given + configureTestCase(testCase, "pnf/r146092/validFile.csar", + "vtp-validate-csar-r146092.yaml", IS_PNF); + + // when + testCase.execute(); + + // then + final List<CSARError> errors = testCase.getErrors(); + assertThat(errors.size()).isEqualTo(0); + } + + @Test + public void shouldNotReportErrorWhenNonManoArtifactIsNotAvailable() throws Exception { // given configureTestCase(testCase, "pnf/r146092/missingNonManoArtifactInManifest.csar", - "vtp-validate-csar-r146092.yaml", IS_PNF); + "vtp-validate-csar-r146092.yaml", IS_PNF); // when testCase.execute(); @@ -62,7 +75,7 @@ public class VTPValidateCSARR146092IntegrationTest { public void shouldReportThatMandatoryNonManoArtifactSetEntryHasNotAllFields() throws Exception { // given configureTestCase(testCase, "pnf/r146092/missingFieldsInNonManoArtifactManifest.csar", - "vtp-validate-csar-r146092.yaml", IS_PNF); + "vtp-validate-csar-r146092.yaml", IS_PNF); // when testCase.execute(); @@ -71,7 +84,7 @@ public class VTPValidateCSARR146092IntegrationTest { final List<CSARError> errors = testCase.getErrors(); assertThat(errors.size()).isEqualTo(1); assertThat(convertToMessagesList(errors)).contains( - "Missing. Entry [[onap_ansible_playbooks, onap_others, onap_pm_dictionary, onap_pnf_sw_information, onap_scripts, onap_ves_events, onap_yang_modules]]" + "Missing. Entry [[onap_ansible_playbooks, onap_others, onap_pm_dictionary, onap_pnf_sw_information, onap_scripts, onap_ves_events, onap_yang_modules]]" ); } @@ -79,7 +92,7 @@ public class VTPValidateCSARR146092IntegrationTest { public void shouldReportThatNonManoArtifactEntryHasAnySource() throws Exception { // given configureTestCase(testCase, "pnf/r146092/noSourceElementInNonManoArtifactEntryManifest.csar", - "vtp-validate-csar-r146092.yaml", IS_PNF); + "vtp-validate-csar-r146092.yaml", IS_PNF); // when testCase.execute(); @@ -88,7 +101,7 @@ public class VTPValidateCSARR146092IntegrationTest { final List<CSARError> 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]" ); } @@ -104,7 +117,7 @@ public class VTPValidateCSARR146092IntegrationTest { final List<CSARError> 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]" ); } @@ -120,7 +133,7 @@ public class VTPValidateCSARR146092IntegrationTest { final List<CSARError> errors = testCase.getErrors(); assertThat(errors.size()).isEqualTo(4); assertThat(convertToMessagesList(errors)).contains( - "Missing. Entry [Definition YAML]" + "Missing. Entry [Definition YAML]" ); } @@ -128,7 +141,7 @@ public class VTPValidateCSARR146092IntegrationTest { public void shouldReportThatEntryHasInvalidPathWhenYamlFileIsNotPresent() throws Exception { // given configureTestCase(testCase, "pnf/r146092/missingYamlFileReferedInSourceSessionOfManifest.csar", "vtp-validate-csar-r146092.yaml", - IS_PNF); + IS_PNF); // when testCase.execute(); @@ -137,7 +150,7 @@ public class VTPValidateCSARR146092IntegrationTest { final List<CSARError> 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]" + "Invalid. Entry [Source under onap_pnf_sw_information has invalid 'Files/pnf-sw-information/pnf-sw-information.yaml' path]" ); } diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082IntegrationTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082IntegrationTest.java index fb9e431..66937d4 100644 --- a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082IntegrationTest.java +++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082IntegrationTest.java @@ -21,10 +21,12 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.configureTestCase; import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.convertToMessagesList; +import java.net.URISyntaxException; import java.util.List; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; +import org.onap.cli.fw.error.OnapCommandException; import org.onap.cvc.csar.CSARArchive; import org.onap.cvc.csar.CSARArchive.CSARError; @@ -59,6 +61,20 @@ public class VTPValidateCSARR972082IntegrationTest { } @Test + public void shouldReturnNoErrorWhenOptionalNonManoArtifactSetEntryIsNotPresent() throws Exception { + // given + configureTestCase(testCase, PNF_R_972082 + "missingOnapPnfSwInformationArtifactSetEntry.csar", + VTP_VALIDATE_CSAR_R_972082_YAML, IS_PNF); + + // when + testCase.execute(); + + // then + final List<CSARError> errors = testCase.getErrors(); + assertThat(errors.size()).isEqualTo(0); + } + + @Test public void shouldReportThatEntryHasInvalidPathWhenYamlFileIsNotPresent() throws Exception { // given configureTestCase(testCase, PNF_R_972082 + "missingYamlFileReferedInSourceSessionOfManifest.csar", @@ -77,9 +93,9 @@ public class VTPValidateCSARR972082IntegrationTest { } @Test - public void shouldReportThatMandatoryNonManoArtifactSetEntryHasNotAllFields_() throws Exception { + public void shouldReportMissingPnfSoftwareVersionInYamlFile() throws Exception { // given - configureTestCase(testCase, PNF_R_972082 + "missingFieldsInNonManoArtifactManifest.csar", + configureTestCase(testCase, PNF_R_972082 + "missingPnfSoftwareVersionInYamlFile.csar", VTP_VALIDATE_CSAR_R_972082_YAML, IS_PNF); // when @@ -89,15 +105,15 @@ public class VTPValidateCSARR972082IntegrationTest { final List<CSARError> errors = testCase.getErrors(); assertThat(errors.size()).isEqualTo(1); assertThat(convertToMessagesList(errors)).contains( - "Missing. Entry [[onap_pnf_sw_information]]" + "Missing. Entry [pnf_software_version in Files/pnf-sw-information/pnf-sw-information.yaml]" ); } @Test - public void shouldReportMissingPnfSoftwareVersionInYamlFile() throws Exception { + public void shouldReportMissingSourceElementUnderAttribute() throws OnapCommandException, URISyntaxException { // given - configureTestCase(testCase, PNF_R_972082 + "missingPnfSoftwareVersionInYamlFile.csar", - VTP_VALIDATE_CSAR_R_972082_YAML, IS_PNF); + configureTestCase(testCase, PNF_R_972082 + "missingSourceElementUnderAttributeError.csar", + VTP_VALIDATE_CSAR_R_972082_YAML, IS_PNF); // when testCase.execute(); @@ -106,8 +122,24 @@ public class VTPValidateCSARR972082IntegrationTest { final List<CSARError> errors = testCase.getErrors(); assertThat(errors.size()).isEqualTo(1); assertThat(convertToMessagesList(errors)).contains( - "Missing. Entry [pnf_software_version in Files/pnf-sw-information/pnf-sw-information.yaml]" + "Missing. Entry [Source under onap_pnf_sw_information]" ); } + @Test + public void shouldReportInvalidYamlStructure() throws OnapCommandException, URISyntaxException { + // given + configureTestCase(testCase, PNF_R_972082 + "invalidYamlStructure.csar", + VTP_VALIDATE_CSAR_R_972082_YAML, IS_PNF); + + // when + testCase.execute(); + + // then + final List<CSARError> errors = testCase.getErrors(); + assertThat(errors.size()).isEqualTo(1); + assertThat(convertToMessagesList(errors)).contains( + "Invalid. Yaml file Files/pnf-sw-information/pnf-sw-information.yaml is invalid" + ); + } }
\ No newline at end of file |