summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/test/java
diff options
context:
space:
mode:
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-10-14 14:01:03 +0200
committerBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2020-10-15 10:26:41 +0200
commit35d4e259c80c9edeb362de0af9bd77bd3f4412b0 (patch)
tree1f07f1d56114656a2460594be8b87fce86ee8bd2 /csarvalidation/src/test/java
parent5e085985d5e333fbb000c37c8c508c0d46b7d7ee (diff)
Add handling of CSAR with no TOSCA meta and no certificate.
Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> Change-Id: Ic9914b13e0bd5d9844849f20051d99d18e369ae9 Issue-ID: VNFSDK-481
Diffstat (limited to 'csarvalidation/src/test/java')
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR130206IntegrationTest.java38
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!"
+ );
+ }
}