diff options
author | 2020-07-21 11:35:49 +0200 | |
---|---|---|
committer | 2020-07-21 09:37:20 +0000 | |
commit | 3dcd5675ad634f5bd3dd859a0362c259de271a06 (patch) | |
tree | 6b27163d264c1f2d7037b0b664eb546d87cc4cc7 /csarvalidation/src/test/java/org/onap/cvc/csar | |
parent | cffcfb03ea1e357a51e80a1c699666cc3b0b3776 (diff) |
Add list of values validation using schema in PM Dictionary.
Issue-ID: VNFSDK-594
Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Change-Id: I1e59bdfb697adb6097636212fa5be8c749f084e6
Diffstat (limited to 'csarvalidation/src/test/java/org/onap/cvc/csar')
-rw-r--r-- | csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR816745IntegrationTest.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR816745IntegrationTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR816745IntegrationTest.java index 70a370e..5ef4e99 100644 --- a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR816745IntegrationTest.java +++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR816745IntegrationTest.java @@ -38,6 +38,7 @@ public class VTPValidateCSARR816745IntegrationTest { private static final boolean IS_PNF = true; private static final String TEST_CSAR_DIRECTORY = "pnf/r816745/"; + private static final int NUMBER_OF_EXPECTED_ERRORS = 4; private VTPValidateCSARR816745 testCase; @@ -132,12 +133,13 @@ public class VTPValidateCSARR816745IntegrationTest { } private void assertThatReturnedErrorsAreCorrect(List<CSARArchive.CSARError> errors) { - assertThat(errors.size()).isEqualTo(3); + assertThat(errors.size()).isEqualTo(NUMBER_OF_EXPECTED_ERRORS); Condition<String> containingSameFileForAllErrors = new HamcrestCondition<>( containsString("Artifacts/Deployment/Measurements/PM_Dictionary.yml") ); - assertThat(convertToFilesList(errors)).haveExactly(3, containingSameFileForAllErrors); + assertThat(convertToFilesList(errors)) + .haveExactly(NUMBER_OF_EXPECTED_ERRORS, containingSameFileForAllErrors); Condition<String> containingErrorForMissingValueInFirstDocument = new HamcrestCondition<>(allOf( containsString("Invalid YAML document in PM_Dictionary file."), @@ -151,9 +153,9 @@ public class VTPValidateCSARR816745IntegrationTest { containsString("Invalid YAML document in PM_Dictionary file."), containsString("In document number 1"), containsString("Path: /pmMetaData/pmFields/measResultType"), - containsString("Value is not in array of accepted values."), - containsString("value: integer"), - containsString("accepted values: [float, uint32, uint64]") + containsString("Value(s) is/are not in array of accepted values."), + containsString("value(s): integer"), + containsString("accepted value(s): [float, uint32, uint64]") )); assertThat(convertToMessagesList(errors)).haveExactly(1, containingErrorForWrongValueInFirstDocument); @@ -164,6 +166,16 @@ public class VTPValidateCSARR816745IntegrationTest { containsString("Key not found: measChangeType") )); assertThat(convertToMessagesList(errors)).haveExactly(1, containingErrorForMissingValueInSecondDocument); + + Condition<String> containingErrorForWrongValueInArrayInThirdDocument = new HamcrestCondition<>(allOf( + containsString("Invalid YAML document in PM_Dictionary file."), + containsString("In document number 3"), + containsString("Path: /pmMetaData/pmFields/measAdditionalFields/vendorField1"), + containsString("Value(s) is/are not in array of accepted values."), + containsString("value(s): [Z, A]"), + containsString("accepted value(s): [X, Y, Z]") + )); + assertThat(convertToMessagesList(errors)).haveExactly(1, containingErrorForWrongValueInArrayInThirdDocument); } } |