summaryrefslogtreecommitdiffstats
path: root/integration-tests/src/test/java/org
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2021-08-23 11:59:28 +0100
committerMichael Morris <michael.morris@est.tech>2021-08-25 18:13:00 +0000
commit0499f0cd3522202708c926754e45a6d5e9c3c080 (patch)
tree422e32666bc382f96d0590ee5dab4b9ec89e8eba /integration-tests/src/test/java/org
parentf7776389f137cb881033d77d89cc3f1eb4974077 (diff)
Define a CSAR validator API for models
Change-Id: Ibdbedcc7cfe3660221f35667902f2e4eadc19725 Issue-ID: SDC-3682 Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'integration-tests/src/test/java/org')
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/validation/pmdictionary/CsarValidationTest.java36
1 files changed, 20 insertions, 16 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/validation/pmdictionary/CsarValidationTest.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/validation/pmdictionary/CsarValidationTest.java
index 2390de4780..9500c9b378 100644
--- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/validation/pmdictionary/CsarValidationTest.java
+++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/validation/pmdictionary/CsarValidationTest.java
@@ -20,21 +20,24 @@
*/
package org.onap.sdc.backend.ci.tests.validation.pmdictionary;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.stream.Collectors;
import org.junit.jupiter.api.Test;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.vendorsoftwareproduct.exception.OnboardPackageException;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.ValidationResult;
import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.ValidatorFactory;
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.*;
-
class CsarValidationTest {
@Test
@@ -43,10 +46,10 @@ class CsarValidationTest {
FileContentHandler pnfFileContent = CsarLoader.load("validPnfCompliantWithSOL004.csar", "/Files/PNFs/validation/pmdictionary/validPnfCompliantWithSOL004.csar");
//when
- Map<String, List<ErrorMessage>> errorsMap = ValidatorFactory.getValidator(pnfFileContent).validateContent(pnfFileContent);
+ final ValidationResult validationResult = ValidatorFactory.getValidator(pnfFileContent).validate(pnfFileContent);
//then
- assertThat(errorsMap, is(anEmptyMap()));
+ assertThat(validationResult.getErrors(), is(empty()));
}
@Test
@@ -56,8 +59,8 @@ class CsarValidationTest {
FileContentHandler pnfFileContent = CsarLoader.load("invalidPnfCompliantWithSOL004.csar", "/Files/PNFs/validation/pmdictionary/invalidPnfCompliantWithSOL004.csar");
//when
- Map<String, List<ErrorMessage>> errorMap = ValidatorFactory.getValidator(pnfFileContent).validateContent(pnfFileContent);
- List<ErrorMessage> errorList = errorMap.get("uploadFile");
+ final ValidationResult validationResult = ValidatorFactory.getValidator(pnfFileContent).validate(pnfFileContent);
+ List<ErrorMessage> errorList = validationResult.getErrors();
//then
assertThat(errorList, is(not(empty())));
@@ -74,10 +77,11 @@ class CsarValidationTest {
);
//when
- Map<String, List<ErrorMessage>> errorsMap = ValidatorFactory.getValidator(pnfFileContent).validateContent(pnfFileContent);
+ final ValidationResult validationResult = ValidatorFactory.getValidator(pnfFileContent).validate(pnfFileContent);
//then
- assertThat(errorsMap, is(anEmptyMap()));
+ assertThat(validationResult.isValid(), is(true));
+ assertThat(validationResult.getErrors(), is(empty()));
}
@Test
@@ -90,8 +94,8 @@ class CsarValidationTest {
);
//when
- Map<String, List<ErrorMessage>> errorsMap = ValidatorFactory.getValidator(pnfFileContent).validateContent(pnfFileContent);
- List<ErrorMessage> errorList = errorsMap.get("uploadFile");
+ final ValidationResult validationResult = ValidatorFactory.getValidator(pnfFileContent).validate(pnfFileContent);
+ List<ErrorMessage> errorList = validationResult.getErrors();
//then
assertThat(getActualErrorMessages(errorList), containsInAnyOrder(expectedErrorMessage.toArray()));