diff options
author | Michal Banka <michal.banka@nokia.com> | 2020-05-13 09:52:21 +0200 |
---|---|---|
committer | Michal Banka <michal.banka@nokia.com> | 2020-05-13 09:52:34 +0200 |
commit | 8ac0d45cbe411112f5267336981240b329678c1c (patch) | |
tree | c7c55ed23e332c914803c0da0d159b5581caab85 /csarvalidation/src/test | |
parent | 8913e624e48ea3ca7a938e03dc0dc8a5d9dbd6cc (diff) |
Increase code coverage of R972082 rule
Change-Id: I6d8174842128ba7fa8aa1b2167c048d00edaf9fa
Signed-off-by: Michal Banka <michal.banka@nokia.com>
Issue-ID: VNFSDK-585
Diffstat (limited to 'csarvalidation/src/test')
-rw-r--r-- | csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082IntegrationTest.java | 35 | ||||
-rw-r--r-- | csarvalidation/src/test/resources/pnf/r972082/invalidYamlStructure.csar | bin | 0 -> 18075 bytes | |||
-rw-r--r-- | csarvalidation/src/test/resources/pnf/r972082/missingSourceElementUnderAttributeError.csar | bin | 0 -> 18064 bytes |
3 files changed, 35 insertions, 0 deletions
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082IntegrationTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082IntegrationTest.java index fb9e431..48b2d6e 100644 --- a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082IntegrationTest.java +++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082IntegrationTest.java @@ -21,10 +21,12 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.configureTestCase; import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.convertToMessagesList; +import java.net.URISyntaxException; import java.util.List; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; +import org.onap.cli.fw.error.OnapCommandException; import org.onap.cvc.csar.CSARArchive; import org.onap.cvc.csar.CSARArchive.CSARError; @@ -110,4 +112,37 @@ public class VTPValidateCSARR972082IntegrationTest { ); } + @Test + public void shouldReportMissingSourceElementUnderAttribute() throws OnapCommandException, URISyntaxException { + // given + configureTestCase(testCase, PNF_R_972082 + "missingSourceElementUnderAttributeError.csar", + VTP_VALIDATE_CSAR_R_972082_YAML, IS_PNF); + + // when + testCase.execute(); + + // then + final List<CSARError> errors = testCase.getErrors(); + assertThat(errors.size()).isEqualTo(1); + assertThat(convertToMessagesList(errors)).contains( + "Missing. Entry [Source under onap_pnf_sw_information]" + ); + } + + @Test + public void shouldReportInvalidYamlStructure() throws OnapCommandException, URISyntaxException { + // given + configureTestCase(testCase, PNF_R_972082 + "invalidYamlStructure.csar", + VTP_VALIDATE_CSAR_R_972082_YAML, IS_PNF); + + // when + testCase.execute(); + + // then + final List<CSARError> errors = testCase.getErrors(); + assertThat(errors.size()).isEqualTo(1); + assertThat(convertToMessagesList(errors)).contains( + "Invalid. Yaml file Files/pnf-sw-information/pnf-sw-information.yaml is invalid" + ); + } }
\ No newline at end of file diff --git a/csarvalidation/src/test/resources/pnf/r972082/invalidYamlStructure.csar b/csarvalidation/src/test/resources/pnf/r972082/invalidYamlStructure.csar Binary files differnew file mode 100644 index 0000000..3360ce4 --- /dev/null +++ b/csarvalidation/src/test/resources/pnf/r972082/invalidYamlStructure.csar diff --git a/csarvalidation/src/test/resources/pnf/r972082/missingSourceElementUnderAttributeError.csar b/csarvalidation/src/test/resources/pnf/r972082/missingSourceElementUnderAttributeError.csar Binary files differnew file mode 100644 index 0000000..e11093c --- /dev/null +++ b/csarvalidation/src/test/resources/pnf/r972082/missingSourceElementUnderAttributeError.csar |