From 657849e70f70f700cc8470af48351f3ae6b47b6f Mon Sep 17 00:00:00 2001 From: Aleksandra Maciaga Date: Wed, 13 May 2020 14:16:06 +0200 Subject: Fix VNF/PNF package integrity issue with CMS signature not containing certificate Signed-off-by: Aleksandra Maciaga Issue-ID: VNFSDK-582 Change-Id: Id3dc6c8e1ead183449fcf903d9b9b886e4796e84 --- .../VTPValidateCSARR130206IntegrationTest.java | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'csarvalidation/src/test/java/org') 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 @@ -62,6 +62,25 @@ public class VTPValidateCSARR130206IntegrationTest { assertThat(errors.size()).isEqualTo(0); } + @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 errors = testCase.getErrors(); + assertThat(errors.size()).isEqualTo(0); + } + + @Test public void shouldReportThatOnlySignatureIsInvalid() throws Exception { @@ -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 errors = testCase.getErrors(); + assertThat(convertToMessagesList(errors)).contains( + "Unable to find cert file defined by ETSI-Entry-Certificate!", + "Unable to find CMS section in manifest!" + + ); + } + } -- cgit 1.2.3-korg