From 35d4e259c80c9edeb362de0af9bd77bd3f4412b0 Mon Sep 17 00:00:00 2001 From: Bartosz Gardziejewski Date: Wed, 14 Oct 2020 14:01:03 +0200 Subject: Add handling of CSAR with no TOSCA meta and no certificate. Signed-off-by: Bartosz Gardziejewski Change-Id: Ic9914b13e0bd5d9844849f20051d99d18e369ae9 Issue-ID: VNFSDK-481 --- .../VTPValidateCSARR130206IntegrationTest.java | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004') 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 443a61a..2d6d058 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 @@ -428,4 +428,42 @@ public class VTPValidateCSARR130206IntegrationTest { "Unable to find cms signature!" ); } + + @Test + public void shouldReturnNoCertificationErrorWhenCertIsOnlyInRoot() throws Exception { + + // given + configureTestCase(testCase, "pnf/r130206/csar-cert-in-root.csar", "vtp-validate-csar-r130206.yaml", IS_PNF); + + // when + testCase.execute(); + + // then + List errors = testCase.getErrors(); + + // This test returns other errors that are connected with missing tosca entry, + // in order to simplify testing, assertion only checks if certificate in root was found and used to validate CMS + assertThat(convertToMessagesList(errors)).contains( + "File has invalid signature!" + ); + } + + @Test + public void shouldReturnCertificateNotFoundErrorWhenCertIsNotPresentInCmsInRootAndTocsaDirectoryIsMissing() throws Exception { + + // given + configureTestCase(testCase, "pnf/r130206/csar-no-cert-no-tosca-dir.csar", "vtp-validate-csar-r130206.yaml", IS_PNF); + + // when + testCase.execute(); + + // then + List errors = testCase.getErrors(); + + // This test returns other errors that are connected with missing tosca entry, + // in order to simplify testing, assertion only checks if "certificate not found" error was reported + assertThat(convertToMessagesList(errors)).contains( + "Unable to find cert file!" + ); + } } -- cgit 1.2.3-korg