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/CsarValidatorTest.java42
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR01123IntegrationTest.java31
-rw-r--r--csarvalidation/src/test/resources/pnf/r01123/csar-option2-invalid-with-cms.zipbin0 -> 4673 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r01123/csar-option2-valid-with-cms.zipbin0 -> 4691 bytes
4 files changed, 51 insertions, 22 deletions
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java
index ecdd6fe..d742ca6 100644
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java
@@ -34,18 +34,17 @@ import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.absoluteFilePath;
public class CsarValidatorTest {
- public static final String NO_CERTIFICATE_RULE = "r130206";
- public static final String NO_ALL_FILES_LISTED_IN_MANIFEST = "r01123";
- public static final String OPERATION_STATUS_FAILED = "FAILED";
+ private static final String NO_CERTIFICATE_RULE = "r130206";
+ private static final String OPERATION_STATUS_FAILED = "FAILED";
@Test
public void shouldReportThanVnfValidationFailed() throws URISyntaxException {
// given
OnapCliWrapper cli = new OnapCliWrapper(new String[]{
- "--product", "onap-dublin",
- "csar-validate",
- "--format", "json",
- "--csar", absoluteFilePath("VoLTE.csar")});
+ "--product", "onap-dublin",
+ "csar-validate",
+ "--format", "json",
+ "--csar", absoluteFilePath("VoLTE.csar")});
// when
cli.handle();
@@ -62,11 +61,11 @@ public class CsarValidatorTest {
public void shouldReportThatPnfValidationFailedWhenCsarDoNotHaveCertificate_allOtherRulesShouldPass() throws URISyntaxException {
// given
OnapCliWrapper cli = new OnapCliWrapper(new String[]{
- "--product", "onap-dublin",
- "csar-validate",
- "--format", "json",
- "--pnf",
- "--csar", absoluteFilePath("pnf/r972082/validFile.csar")});
+ "--product", "onap-dublin",
+ "csar-validate",
+ "--format", "json",
+ "--pnf",
+ "--csar", absoluteFilePath("pnf/r972082/validFile.csar")});
// when
cli.handle();
@@ -82,11 +81,11 @@ public class CsarValidatorTest {
public void shouldReportThatPnfValidationFailedWhenZipDoNotHaveCertificate_allOtherRulesShouldPass() throws URISyntaxException {
// given
OnapCliWrapper cli = new OnapCliWrapper(new String[]{
- "--product", "onap-dublin",
- "csar-validate",
- "--format", "json",
- "--pnf",
- "--csar", absoluteFilePath("pnf/signed-package-valid-signature.zip")});
+ "--product", "onap-dublin",
+ "csar-validate",
+ "--format", "json",
+ "--pnf",
+ "--csar", absoluteFilePath("pnf/signed-package-valid-signature.zip")});
// when
cli.handle();
@@ -94,9 +93,8 @@ public class CsarValidatorTest {
// then
final OnapCommandResult onapCommandResult = cli.getCommandResult();
verifyThatOperation(onapCommandResult, OPERATION_STATUS_FAILED);
- verifyThatXRulesFails(onapCommandResult, 2);
+ verifyThatXRulesFails(onapCommandResult, 1);
verifyThatRuleFails(onapCommandResult, NO_CERTIFICATE_RULE);
- verifyThatRuleFails(onapCommandResult, NO_ALL_FILES_LISTED_IN_MANIFEST);
verifyThatOperationFinishedWithoutAnyError(cli);
}
@@ -136,11 +134,11 @@ public class CsarValidatorTest {
assertEquals(0, cli.getExitCode());
}
- class OnapCliWrapper extends OnapCli {
+ static class OnapCliWrapper extends OnapCli {
private OnapCommandResult commandResult;
- public OnapCliWrapper(String[] args) {
+ OnapCliWrapper(String[] args) {
super(args);
}
@@ -150,7 +148,7 @@ public class CsarValidatorTest {
this.commandResult = cmd.getResult();
}
- public OnapCommandResult getCommandResult() {
+ OnapCommandResult getCommandResult() {
return this.commandResult;
}
}
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 8f6ebbe..d08e00c 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
@@ -123,4 +123,35 @@ public class VTPValidateCSARR01123IntegrationTest {
assertThat(errors.size()).isEqualTo(0);
}
+ @Test
+ public void shouldNotReportAnyErrorWhenValidCsarIsZippedWithCmsFile() throws Exception {
+ // given
+ configureTestCase(testCase, TEST_CSAR_DIRECTORY + "csar-option2-valid-with-cms.zip", "vtp-validate-csar-r01123.yaml", IS_PNF);
+
+ // when
+ testCase.execute();
+
+ // then
+ List<CSARArchive.CSARError> errors = testCase.getErrors();
+ assertThat(errors.size()).isEqualTo(0);
+ }
+
+ @Test
+ public void shouldReportThatFileIsNotPresentInSourcesWhenInvalidCsarFileIsZippedWithCmsFile() throws Exception {
+ // given
+ configureTestCase(testCase, TEST_CSAR_DIRECTORY + "csar-option2-invalid-with-cms.zip", "vtp-validate-csar-r01123.yaml", IS_PNF);
+
+ // when
+ testCase.execute();
+
+ Condition<String> containingMissingFiles = new HamcrestCondition<>(
+ containsString("Artifacts/Informational/user_guide.txt")
+ );
+
+ // then
+ List<CSARArchive.CSARError> errors = testCase.getErrors();
+ assertThat(errors.size()).isEqualTo(1);
+ assertThat(convertToMessagesList(errors)).haveExactly(1, containingMissingFiles);
+ }
+
}
diff --git a/csarvalidation/src/test/resources/pnf/r01123/csar-option2-invalid-with-cms.zip b/csarvalidation/src/test/resources/pnf/r01123/csar-option2-invalid-with-cms.zip
new file mode 100644
index 0000000..8c30c68
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r01123/csar-option2-invalid-with-cms.zip
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r01123/csar-option2-valid-with-cms.zip b/csarvalidation/src/test/resources/pnf/r01123/csar-option2-valid-with-cms.zip
new file mode 100644
index 0000000..6965b95
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r01123/csar-option2-valid-with-cms.zip
Binary files differ