summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/test
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2019-12-12 14:41:10 +0000
committervasraz <vasyl.razinkov@est.tech>2019-12-13 10:28:21 +0000
commit02cd70328143803d94912634eab0afe378764ed1 (patch)
tree9128937d0301a971a0c939995521f2f0efcfa60c /csarvalidation/src/test
parent8db4db6563a98c4fac3e833707ab2b14098657d5 (diff)
Implement PNF package validation on PNF software version
1. New requirement (R-972082) 2. Edit requirement (R-146092) 3. Remove unused dependencies. Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: I0518da5cdbf22b0086cf2c4f50194b47994273f7 Issue-ID: VNFSDK-531
Diffstat (limited to 'csarvalidation/src/test')
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092IntegrationTest.java52
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082IntegrationTest.java113
-rw-r--r--csarvalidation/src/test/resources/pnf/r146092/missingYamlFileReferedInSourceSessionOfManifest.csarbin0 -> 24044 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r972082/missingFieldsInNonManoArtifactManifest.csarbin0 -> 18052 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r972082/missingPnfSoftwareVersionInYamlFile.csarbin0 -> 18000 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r972082/missingVersionInPnfSoftwareVersionInformation.csarbin0 -> 18029 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r972082/missingYamlFileReferedInSourceSessionOfManifest.csarbin0 -> 18073 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r972082/validFile.csarbin0 -> 18069 bytes
8 files changed, 147 insertions, 18 deletions
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092IntegrationTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092IntegrationTest.java
index 4e6daba..bf9b094 100644
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092IntegrationTest.java
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092IntegrationTest.java
@@ -22,6 +22,7 @@ import org.junit.Test;
import org.onap.cvc.csar.CSARArchive;
import java.util.List;
+import org.onap.cvc.csar.CSARArchive.CSARError;
import static org.assertj.core.api.Assertions.assertThat;
import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.configureTestCase;
@@ -46,53 +47,51 @@ public class VTPValidateCSARR146092IntegrationTest {
@Test
public void shouldDoNotReportErrorWhenNonManoArtifactIsNotAvailable() throws Exception {
// given
- configureTestCase(testCase, "pnf/r146092/missingNonManoArtifactInManifest.csar", "vtp-validate-csar-r146092.yaml", IS_PNF);
+ configureTestCase(testCase, "pnf/r146092/missingNonManoArtifactInManifest.csar",
+ "vtp-validate-csar-r146092.yaml", IS_PNF);
// when
testCase.execute();
// then
- List<CSARArchive.CSARError> errors = testCase.getErrors();
+ final List<CSARError> errors = testCase.getErrors();
assertThat(errors.size()).isEqualTo(0);
}
@Test
public void shouldReportThatMandatoryNonManoArtifactSetEntryHasNotAllFields() throws Exception {
// given
- configureTestCase(testCase, "pnf/r146092/missingFieldsInNonManoArtifactManifest.csar", "vtp-validate-csar-r146092.yaml", IS_PNF);
+ configureTestCase(testCase, "pnf/r146092/missingFieldsInNonManoArtifactManifest.csar",
+ "vtp-validate-csar-r146092.yaml", IS_PNF);
// when
testCase.execute();
// then
- List<CSARArchive.CSARError> errors = testCase.getErrors();
- assertThat(errors.size()).isEqualTo(4);
+ final List<CSARError> errors = testCase.getErrors();
+ assertThat(errors.size()).isEqualTo(1);
assertThat(convertToMessagesList(errors)).contains(
- "Missing. Entry [onap_ves_events]",
- "Missing. Entry [onap_pm_dictionary]",
- "Missing. Entry [onap_yang_modules]",
- "Missing. Entry [onap_others]"
+ "Missing. Entry [[onap_ansible_playbooks, onap_others, onap_pm_dictionary, onap_pnf_sw_information, onap_scripts, onap_ves_events, onap_yang_modules]]"
);
}
-
@Test
public void shouldReportThatNonManoArtifactEntryHasAnySource() throws Exception {
// given
- configureTestCase(testCase, "pnf/r146092/noSourceElementInNonManoArtifactEntryManifest.csar", "vtp-validate-csar-r146092.yaml", IS_PNF);
+ configureTestCase(testCase, "pnf/r146092/noSourceElementInNonManoArtifactEntryManifest.csar",
+ "vtp-validate-csar-r146092.yaml", IS_PNF);
// when
testCase.execute();
// then
- List<CSARArchive.CSARError> errors = testCase.getErrors();
+ final List<CSARError> errors = testCase.getErrors();
assertThat(errors.size()).isEqualTo(1);
assertThat(convertToMessagesList(errors)).contains(
- "Missing. Entry [Source under onap_ves_events]"
+ "Missing. Entry [Source under onap_ves_events]"
);
}
-
@Test
public void shouldReportThatNonManoArtifactEntryHasSourceWithUnknownFile() throws Exception {
// given
@@ -102,10 +101,10 @@ public class VTPValidateCSARR146092IntegrationTest {
testCase.execute();
// then
- List<CSARArchive.CSARError> errors = testCase.getErrors();
+ final List<CSARError> errors = testCase.getErrors();
assertThat(errors.size()).isEqualTo(1);
assertThat(convertToMessagesList(errors)).contains(
- "Invalid. Entry [Source under onap_ves_events has invalid 'Artifacts/Deployment/Events/RadioNode.yml' path]"
+ "Invalid. Entry [Source under onap_ves_events has invalid 'Artifacts/Deployment/Events/RadioNode.yml' path]"
);
}
@@ -118,10 +117,27 @@ public class VTPValidateCSARR146092IntegrationTest {
testCase.execute();
// then
- List<CSARArchive.CSARError> errors = testCase.getErrors();
+ final List<CSARError> errors = testCase.getErrors();
assertThat(errors.size()).isEqualTo(4);
assertThat(convertToMessagesList(errors)).contains(
- "Missing. Entry [Definition YAML]"
+ "Missing. Entry [Definition YAML]"
+ );
+ }
+
+ @Test
+ public void shouldReportThatEntryHasInvalidPathWhenYamlFileIsNotPresent() throws Exception {
+ // given
+ configureTestCase(testCase, "pnf/r146092/missingYamlFileReferedInSourceSessionOfManifest.csar", "vtp-validate-csar-r146092.yaml",
+ IS_PNF);
+
+ // when
+ testCase.execute();
+
+ // then
+ final List<CSARError> errors = testCase.getErrors();
+ assertThat(errors.size()).isEqualTo(1);
+ assertThat(convertToMessagesList(errors)).contains(
+ "Invalid. Entry [Source under onap_pnf_sw_information has invalid 'Files/pnf-sw-information/pnf-sw-information.yaml' path]"
);
}
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
new file mode 100644
index 0000000..fb9e431
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR972082IntegrationTest.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2019 Nordix
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.onap.cvc.csar.cc.sol004;
+
+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.util.List;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.cvc.csar.CSARArchive;
+import org.onap.cvc.csar.CSARArchive.CSARError;
+
+public class VTPValidateCSARR972082IntegrationTest {
+
+ private static final boolean IS_PNF = true;
+ private static final String VTP_VALIDATE_CSAR_R_972082_YAML = "vtp-validate-csar-r972082.yaml";
+ private static final String PNF_R_972082 = "pnf/r972082/";
+ private VTPValidateCSARR972082 testCase;
+
+ @Before
+ public void setUp() {
+ testCase = new VTPValidateCSARR972082();
+ }
+
+ @Test
+ public void shouldReturnProperRequestNumber() {
+ assertThat(testCase.getVnfReqsNo()).isEqualTo("R972082");
+ }
+
+ @Test
+ public void shouldReturnNoErrorOnCorrectCsarFile() throws Exception {
+ // given
+ configureTestCase(testCase, PNF_R_972082 + "validFile.csar", VTP_VALIDATE_CSAR_R_972082_YAML, IS_PNF);
+
+ // when
+ testCase.execute();
+
+ // then
+ final List<CSARError> errors = testCase.getErrors();
+ assertThat(errors.size()).isEqualTo(0);
+ }
+
+ @Test
+ public void shouldReportThatEntryHasInvalidPathWhenYamlFileIsNotPresent() throws Exception {
+ // given
+ configureTestCase(testCase, PNF_R_972082 + "missingYamlFileReferedInSourceSessionOfManifest.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. Entry [Source under onap_pnf_sw_information has invalid 'Files/pnf-sw-information/pnf-sw-information.yaml' path]"
+ );
+ }
+
+ @Test
+ public void shouldReportThatMandatoryNonManoArtifactSetEntryHasNotAllFields_() throws Exception {
+ // given
+ configureTestCase(testCase, PNF_R_972082 + "missingFieldsInNonManoArtifactManifest.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 [[onap_pnf_sw_information]]"
+ );
+ }
+
+ @Test
+ public void shouldReportMissingPnfSoftwareVersionInYamlFile() throws Exception {
+ // given
+ configureTestCase(testCase, PNF_R_972082 + "missingPnfSoftwareVersionInYamlFile.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 [pnf_software_version in Files/pnf-sw-information/pnf-sw-information.yaml]"
+ );
+ }
+
+} \ No newline at end of file
diff --git a/csarvalidation/src/test/resources/pnf/r146092/missingYamlFileReferedInSourceSessionOfManifest.csar b/csarvalidation/src/test/resources/pnf/r146092/missingYamlFileReferedInSourceSessionOfManifest.csar
new file mode 100644
index 0000000..88ea0ce
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r146092/missingYamlFileReferedInSourceSessionOfManifest.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r972082/missingFieldsInNonManoArtifactManifest.csar b/csarvalidation/src/test/resources/pnf/r972082/missingFieldsInNonManoArtifactManifest.csar
new file mode 100644
index 0000000..2d157d1
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r972082/missingFieldsInNonManoArtifactManifest.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r972082/missingPnfSoftwareVersionInYamlFile.csar b/csarvalidation/src/test/resources/pnf/r972082/missingPnfSoftwareVersionInYamlFile.csar
new file mode 100644
index 0000000..6142499
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r972082/missingPnfSoftwareVersionInYamlFile.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r972082/missingVersionInPnfSoftwareVersionInformation.csar b/csarvalidation/src/test/resources/pnf/r972082/missingVersionInPnfSoftwareVersionInformation.csar
new file mode 100644
index 0000000..b2c9d03
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r972082/missingVersionInPnfSoftwareVersionInformation.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r972082/missingYamlFileReferedInSourceSessionOfManifest.csar b/csarvalidation/src/test/resources/pnf/r972082/missingYamlFileReferedInSourceSessionOfManifest.csar
new file mode 100644
index 0000000..402ea13
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r972082/missingYamlFileReferedInSourceSessionOfManifest.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r972082/validFile.csar b/csarvalidation/src/test/resources/pnf/r972082/validFile.csar
new file mode 100644
index 0000000..11d1945
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r972082/validFile.csar
Binary files differ