diff options
Diffstat (limited to 'csarvalidation/src/test/java')
-rw-r--r-- | csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR130206IntegrationTest.java | 38 |
1 files changed, 38 insertions, 0 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 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<CSARArchive.CSARError> 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<CSARArchive.CSARError> 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!" + ); + } } |