diff options
author | Maciej Malewski <maciej.malewski@nokia.com> | 2020-07-13 12:22:05 +0200 |
---|---|---|
committer | Bogumil Zebek <bogumil.zebek@nokia.com> | 2020-07-13 11:16:08 +0000 |
commit | 89e3a96553b1607fa7ab3ee9dd69150be3a75a81 (patch) | |
tree | 262ab9c3d0fc6e1c3fda74be3cc03221f1f98bbb /csarvalidation/src/test | |
parent | acc4f065bea5608a4e812f6126c102abe8206748 (diff) |
Fix validation process
Rule must check if files defined in a manifest file are available in a csar artifact.
Code created by Bogumil Zebek.
Issue-ID: VNFSDK-583
Signed-off-by: Maciej Malewski <maciej.malewski@nokia.com>
Change-Id: I890a67bb8f62af306825f2c7d150baffac385671
Diffstat (limited to 'csarvalidation/src/test')
2 files changed, 22 insertions, 3 deletions
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR01123IntegrationTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR01123IntegrationTest.java index d08e00c..a3112ce 100644 --- a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR01123IntegrationTest.java +++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR01123IntegrationTest.java @@ -67,7 +67,7 @@ public class VTPValidateCSARR01123IntegrationTest { } @Test - public void shouldReportThatFileIsNotPresentInSources() throws Exception { + public void shouldReportThatFileAvailableInCsarIsNotPresentInManifestSources() throws Exception { // given configureTestCase(testCase, TEST_CSAR_DIRECTORY + "csar-option1-invalid-noFileInManifest.csar", "vtp-validate-csar-r01123.yaml", IS_PNF); @@ -89,6 +89,25 @@ public class VTPValidateCSARR01123IntegrationTest { } @Test + public void shouldReportThatFilePresentInManifestIsNotPresentInCsarFile() throws Exception { + // given + configureTestCase(testCase, TEST_CSAR_DIRECTORY + "csar-option1-invalid-missing-files.csar", "vtp-validate-csar-r01123.yaml", IS_PNF); + + // when + testCase.execute(); + + Condition<String> containingMissingFiles = new HamcrestCondition<>(allOf( + containsString("Definitions/a.yaml"), + containsString("Definitions/b.yaml") + )); + + // then + List<CSARArchive.CSARError> errors = testCase.getErrors(); + assertThat(errors.size()).isEqualTo(1); + assertThat(convertToMessagesList(errors)).haveExactly(1, containingMissingFiles); + } + + @Test public void shouldReportThatVendorNameIsMissingAndThatFileIsNotPresentInSource() throws Exception { // given configureTestCase(testCase, TEST_CSAR_DIRECTORY + "csar-option1-invalid-noVendor-noFileInManifest.csar", "vtp-validate-csar-r01123.yaml", IS_PNF); @@ -120,7 +139,7 @@ public class VTPValidateCSARR01123IntegrationTest { // then List<CSARArchive.CSARError> errors = testCase.getErrors(); - assertThat(errors.size()).isEqualTo(0); + assertThat(errors.size()).isZero(); } @Test @@ -133,7 +152,7 @@ public class VTPValidateCSARR01123IntegrationTest { // then List<CSARArchive.CSARError> errors = testCase.getErrors(); - assertThat(errors.size()).isEqualTo(0); + assertThat(errors.size()).isZero(); } @Test diff --git a/csarvalidation/src/test/resources/pnf/r01123/csar-option1-invalid-missing-files.csar b/csarvalidation/src/test/resources/pnf/r01123/csar-option1-invalid-missing-files.csar Binary files differnew file mode 100644 index 0000000..bab095d --- /dev/null +++ b/csarvalidation/src/test/resources/pnf/r01123/csar-option1-invalid-missing-files.csar |