summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'csarvalidation/src/test')
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR130206IntegrationTest.java38
-rw-r--r--csarvalidation/src/test/resources/pnf/r130206/csar-cert-in-root.csarbin0 -> 7473 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r130206/csar-no-cert-no-tosca-dir.csarbin0 -> 6276 bytes
3 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!"
+ );
+ }
}
diff --git a/csarvalidation/src/test/resources/pnf/r130206/csar-cert-in-root.csar b/csarvalidation/src/test/resources/pnf/r130206/csar-cert-in-root.csar
new file mode 100644
index 0000000..66c1a71
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r130206/csar-cert-in-root.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r130206/csar-no-cert-no-tosca-dir.csar b/csarvalidation/src/test/resources/pnf/r130206/csar-no-cert-no-tosca-dir.csar
new file mode 100644
index 0000000..0b00af1
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r130206/csar-no-cert-no-tosca-dir.csar
Binary files differ