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/PnfCSARArchiveTest.java44
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java16
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/IntegrationTestUtils.java78
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092IntegrationTest.java118
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR293901IntegrationTest.java60
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR57019IntegrationTest.java78
-rw-r--r--csarvalidation/src/test/resources/pnf/MainServiceTemplate.mf4
-rw-r--r--csarvalidation/src/test/resources/pnf/dummyPnfv2.csarbin4039 -> 4037 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r146092/missingFieldsInNonManoArtifactManifest.csarbin0 -> 3965 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r146092/missingNonManoArtifactInManifest.csarbin0 -> 3950 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r146092/noSourceElementInNonManoArtifactEntryManifest.csarbin0 -> 4078 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r146092/sourceElementWithUnknownFileInNonManoArtifactEntryManifest.csarbin0 -> 4086 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r293901/allMandatoryEntriesDefinedInTOSCAMeta.csar (renamed from csarvalidation/src/test/resources/pnf/allMandatoryEntriesDefinedInTOSCAMeta.csar)bin4117 -> 4117 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r293901/noMandatoryEntriesInTOSCAMeta.csar (renamed from csarvalidation/src/test/resources/pnf/noMandatoryEntriesInTOSCAMeta.csar)bin3943 -> 3943 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r293901/noTOSCAMetaInTOSCADirectory.csar (renamed from csarvalidation/src/test/resources/pnf/noTOSCAMetaInTOSCADirectory.csar)bin164 -> 164 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r57019/allMandatoryEntriesDefinedInMetadataManifest.csarbin0 -> 4099 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r57019/noMandatoryEntriesInMetadataManifest.csarbin0 -> 4039 bytes
17 files changed, 322 insertions, 76 deletions
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfCSARArchiveTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfCSARArchiveTest.java
index b29470c..ca85c7a 100644
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfCSARArchiveTest.java
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfCSARArchiveTest.java
@@ -1,12 +1,12 @@
/**
* Copyright 2019 Nokia
- *
+ * <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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <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.
@@ -19,8 +19,6 @@ package org.onap.cvc.csar;
import com.google.common.collect.Lists;
import org.junit.Test;
-import java.io.IOException;
-import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
@@ -35,18 +33,34 @@ public class PnfCSARArchiveTest {
.toURI().getPath();
// when
- try( PnfCSARArchive pnfCSARArchive = new PnfCSARArchive()) {
+ try (PnfCSARArchive pnfCSARArchive = new PnfCSARArchive()) {
pnfCSARArchive.init(fileName);
pnfCSARArchive.parse();
// then
- verifyThatMetadataWasSet(pnfCSARArchive);
- verifyThatNonManoArtifactsWereSet(pnfCSARArchive);
+ PnfCSARArchive.PnfManifest manifest = (PnfCSARArchive.PnfManifest) pnfCSARArchive.getManifest();
+ verifyThatMetadataWasSet(manifest);
+ verifyThatSourcesSectionWasSet(manifest);
+ verifyThatNonManoArtifactsWereSet(manifest);
}
}
- private void verifyThatNonManoArtifactsWereSet(PnfCSARArchive pnfCSARArchive) {
- Map<String, Map<String, List<String>>> nonManoArtifacts = pnfCSARArchive.getManifest().getNonMano();
+ private void verifyThatMetadataWasSet(PnfCSARArchive.PnfManifest manifest) {
+ CSARArchive.Manifest.Metadata metadata = manifest.getMetadata();
+ assertThat(metadata.getProductName()).isEqualTo("RadioNode");
+ assertThat(metadata.getProviderId()).isEqualTo("Ericsson");
+ assertThat(metadata.getPackageVersion()).isEqualTo("1.0");
+ assertThat(metadata.getReleaseDateTime()).isEqualTo("2019-01-14T11:25:00+00:00");
+ }
+
+ private void verifyThatSourcesSectionWasSet(PnfCSARArchive.PnfManifest manifest) {
+
+ List<String> sources = manifest.getSources();
+ assertThat(sources).contains("Definitions/MainServiceTemplate.yaml", "Definitions/etsi_nfv_sol001_vnfd_2_5_1_types.yaml");
+ }
+
+ private void verifyThatNonManoArtifactsWereSet(PnfCSARArchive.PnfManifest manifest) {
+ Map<String, Map<String, List<String>>> nonManoArtifacts = manifest.getNonMano();
assertThat(nonManoArtifacts.get("onap_ves_events").get("source"))
.isEqualTo(Lists.newArrayList("Artifacts/Events/VES_registration.yml")
);
@@ -66,12 +80,4 @@ public class PnfCSARArchiveTest {
);
}
- private void verifyThatMetadataWasSet(PnfCSARArchive pnfCSARArchive) {
- CSARArchive.Manifest.Metadata metadata = pnfCSARArchive.getManifest().getMetadata();
- assertThat(metadata.getProductName()).isEqualTo("RadioNode");
- assertThat(metadata.getProviderId()).isEqualTo("Ericsson");
- assertThat(metadata.getPackageVersion()).isEqualTo("1.0");
- assertThat(metadata.getReleaseDateTime()).isEqualTo("2019-01-14T11:25:00+00:00");
- }
-
} \ No newline at end of file
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java
index f680438..2f3a050 100644
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java
@@ -20,6 +20,7 @@ import org.apache.commons.lang3.tuple.Pair;
import org.junit.Before;
import org.junit.Test;
+import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;
@@ -34,7 +35,7 @@ public class PnfManifestParserTest {
@Before
public void setUp() throws URISyntaxException, IOException {
- pnfManifestParser = PnfManifestParser.getInstance("./src/test/resources/pnf/MainServiceTemplate.mf");
+ pnfManifestParser = PnfManifestParser.getInstance(new File("./src/test/resources/pnf/MainServiceTemplate.mf"));
}
@Test
@@ -52,6 +53,19 @@ public class PnfManifestParserTest {
@Test
+ public void shouldFetchSourcesSectionFromFile() {
+
+ Pair<List<String>, List<CSARArchive.CSARError>> sourcesPair = pnfManifestParser.fetchSourcesSection();
+ List<String> sources = sourcesPair.getKey();
+ List<CSARArchive.CSARError> errors = sourcesPair.getValue();
+
+ assertThat(sources).contains("Definitions/MainServiceTemplate.yaml", "Definitions/etsi_nfv_sol001_vnfd_2_5_1_types.yaml");
+ assertThat(errors.size()).isEqualTo(0);
+ }
+
+
+
+ @Test
public void shouldFetchNonManoArtifactsFromFile() {
Pair<Map<String, Map<String, List<String>>>, List<CSARArchive.CSARError>> mapListPair = pnfManifestParser.fetchNonManoArtifacts();
Map<String, Map<String, List<String>>> nonManoArtifacts = mapListPair.getKey();
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/IntegrationTestUtils.java b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/IntegrationTestUtils.java
new file mode 100644
index 0000000..32ac187
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/IntegrationTestUtils.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2019 Nokia
+ * <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 com.google.common.collect.Lists;
+import org.onap.cli.fw.error.OnapCommandException;
+import org.onap.cli.fw.error.OnapCommandInvalidParameterValue;
+import org.onap.cli.fw.input.OnapCommandParameter;
+import org.onap.cli.fw.output.OnapCommandResult;
+import org.onap.cli.fw.output.OnapCommandResultAttribute;
+import org.onap.cvc.csar.CSARArchive;
+import org.onap.cvc.csar.cc.VTPValidatePnfCSARBase;
+
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+class IntegrationTestUtils {
+
+ private IntegrationTestUtils() {
+
+ }
+
+ private static String absoluteFilePath(String relativeFilePath) throws URISyntaxException {
+ return VTPValidatePnfCSARBase.class.getClassLoader().getResource(relativeFilePath)
+ .toURI().getPath();
+ }
+
+ static void configureTestCase(VTPValidatePnfCSARBase testCase, String fileName) throws OnapCommandException, URISyntaxException {
+ configureCommandAttributes(testCase);
+
+ testCase.initializeSchema("vtp-validate-csar-r146092.yaml");
+
+ configurePathToCsar(testCase, fileName);
+ }
+
+ private static void configureCommandAttributes(VTPValidatePnfCSARBase testCase) {
+ OnapCommandResult onapCommandResult = new OnapCommandResult();
+ OnapCommandResultAttribute onapCommandResultAttributeCode = new OnapCommandResultAttribute();
+ onapCommandResultAttributeCode.setName("code");
+ OnapCommandResultAttribute onapCommandResultAttributeMessage = new OnapCommandResultAttribute();
+ onapCommandResultAttributeMessage.setName("message");
+ OnapCommandResultAttribute onapCommandResultAttributeFile = new OnapCommandResultAttribute();
+ onapCommandResultAttributeFile.setName("file");
+ OnapCommandResultAttribute onapCommandResultAttributeLineNo = new OnapCommandResultAttribute();
+ onapCommandResultAttributeLineNo.setName("line-no");
+ List<OnapCommandResultAttribute> records = Lists.newArrayList(onapCommandResultAttributeCode, onapCommandResultAttributeMessage, onapCommandResultAttributeFile, onapCommandResultAttributeLineNo);
+ onapCommandResult.setRecords(records);
+ testCase.setResult(onapCommandResult);
+ }
+
+ private static void configurePathToCsar(VTPValidatePnfCSARBase testCase, String fileName) throws URISyntaxException, OnapCommandInvalidParameterValue {
+ String pathToFile = absoluteFilePath(fileName);
+ Set<OnapCommandParameter> parameters = testCase.getParameters();
+ OnapCommandParameter csar = parameters.stream().filter(op -> op.getName().equals("csar")).findFirst().get();
+ csar.setValue(pathToFile);
+ }
+
+ static List<String> convertToMessagesList(List<CSARArchive.CSARError> errors) {
+ return errors.stream().map(CSARArchive.CSARError::getMessage).collect(Collectors.toList());
+ }
+}
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
new file mode 100644
index 0000000..d5cb153
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR146092IntegrationTest.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2019 Nokia
+ * <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 org.junit.Before;
+import org.junit.Test;
+import org.onap.cvc.csar.CSARArchive;
+
+import java.util.List;
+
+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;
+
+
+public class VTPValidateCSARR146092IntegrationTest {
+
+ private VTPValidateCSARR146092 testCase;
+
+ @Before
+ public void setUp() {
+ testCase = new VTPValidateCSARR146092();
+ }
+
+ @Test
+ public void shouldReturnProperRequestNumber() {
+ assertThat(testCase.getVnfReqsNo()).isEqualTo("R146092");
+ }
+
+ @Test
+ public void shouldReportThatMandatoryNonManoArtifactsAreNotAvailable() throws Exception {
+ // given
+ configureTestCase(testCase, "pnf/r146092/missingNonManoArtifactInManifest.csar");
+
+ // when
+ testCase.execute();
+
+ // then
+ List<CSARArchive.CSARError> errors = testCase.getErrors();
+ assertThat(errors.size()).isEqualTo(5);
+ assertThat(convertToMessagesList(errors)).contains(
+ "Missing. Entry [non_mano_artifact_sets]",
+ "Missing. Entry [onap_ves_events]",
+ "Missing. Entry [onap_pm_dictionary]",
+ "Missing. Entry [onap_yang_module]",
+ "Missing. Entry [onap_others]"
+ );
+ }
+
+ @Test
+ public void shouldReportThatMandatoryNonManoArtifactSetEntryHasNotAllFields() throws Exception {
+ // given
+ configureTestCase(testCase, "pnf/r146092/missingFieldsInNonManoArtifactManifest.csar");
+
+ // when
+ testCase.execute();
+
+ // then
+ List<CSARArchive.CSARError> errors = testCase.getErrors();
+ assertThat(errors.size()).isEqualTo(4);
+ assertThat(convertToMessagesList(errors)).contains(
+ "Missing. Entry [onap_ves_events]",
+ "Missing. Entry [onap_pm_dictionary]",
+ "Missing. Entry [onap_yang_module]",
+ "Missing. Entry [onap_others]"
+ );
+ }
+
+
+ @Test
+ public void shouldReportThatNonManoArtifactEntryHasAnySource() throws Exception {
+ // given
+ configureTestCase(testCase, "pnf/r146092/noSourceElementInNonManoArtifactEntryManifest.csar");
+
+ // when
+ testCase.execute();
+
+ // then
+ List<CSARArchive.CSARError> errors = testCase.getErrors();
+ assertThat(errors.size()).isEqualTo(1);
+ assertThat(convertToMessagesList(errors)).contains(
+ "Missing. Entry [source under onap_ves_events]"
+ );
+ }
+
+
+ @Test
+ public void shouldReportThatNonManoArtifactEntryHasSourceWithUnknownFile() throws Exception {
+ // given
+ configureTestCase(testCase, "pnf/r146092/sourceElementWithUnknownFileInNonManoArtifactEntryManifest.csar");
+
+ // when
+ testCase.execute();
+
+ // then
+ List<CSARArchive.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]"
+ );
+ }
+
+} \ No newline at end of file
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR293901IntegrationTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR293901IntegrationTest.java
index eca3c1a..cd1dc06 100644
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR293901IntegrationTest.java
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR293901IntegrationTest.java
@@ -17,22 +17,15 @@
package org.onap.cvc.csar.cc.sol004;
-import com.google.common.collect.Lists;
import org.junit.Before;
import org.junit.Test;
-import org.onap.cli.fw.error.OnapCommandException;
-import org.onap.cli.fw.error.OnapCommandInvalidParameterValue;
-import org.onap.cli.fw.input.OnapCommandParameter;
-import org.onap.cli.fw.output.OnapCommandResult;
-import org.onap.cli.fw.output.OnapCommandResultAttribute;
import org.onap.cvc.csar.CSARArchive;
-import java.net.URISyntaxException;
import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
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;
public class VTPValidateCSARR293901IntegrationTest {
@@ -40,7 +33,7 @@ public class VTPValidateCSARR293901IntegrationTest {
private VTPValidateCSARR293901 testCase;
@Before
- public void setUp(){
+ public void setUp() {
testCase = new VTPValidateCSARR293901();
}
@@ -52,7 +45,7 @@ public class VTPValidateCSARR293901IntegrationTest {
@Test
public void shouldReportThatMandatoryEntriesAreNotAvailable() throws Exception {
// given
- configureTestCase(testCase, "pnf/noMandatoryEntriesInTOSCAMeta.csar");
+ configureTestCase(testCase, "pnf/r293901/noMandatoryEntriesInTOSCAMeta.csar");
// when
testCase.execute();
@@ -70,7 +63,7 @@ public class VTPValidateCSARR293901IntegrationTest {
@Test
public void shouldDoNotReportAnyErrorWhenAllMandatoryEntriesWereDefined() throws Exception {
// given
- configureTestCase(testCase, "pnf/allMandatoryEntriesDefinedInTOSCAMeta.csar");
+ configureTestCase(testCase, "pnf/r293901/allMandatoryEntriesDefinedInTOSCAMeta.csar");
// when
testCase.execute();
@@ -83,7 +76,7 @@ public class VTPValidateCSARR293901IntegrationTest {
@Test
public void shouldReportAnyErrorWhneThereIsNoTOSCAMetaFileInTOSCADirectory() throws Exception {
// given
- configureTestCase(testCase, "pnf/noTOSCAMetaInTOSCADirectory.csar");
+ configureTestCase(testCase, "pnf/r293901/noTOSCAMetaInTOSCADirectory.csar");
// when
testCase.execute();
@@ -98,45 +91,4 @@ public class VTPValidateCSARR293901IntegrationTest {
"Missing. Entry [ETSI-Entry-Change-Log]"
);
}
-
- private String resolvePathToFile(String s) throws URISyntaxException {
- return VTPValidateCSARR293901IntegrationTest.class.getClassLoader().getResource(s)
- .toURI().getPath();
- }
-
- private void configureTestCase(VTPValidateCSARR293901 testCase, String fileName) throws OnapCommandException, URISyntaxException {
- configureCommandAttributes(testCase);
-
- testCase.initializeSchema("vtp-validate-csar-r293901.yaml");
-
- configurePathToCsar(testCase, fileName);
- }
-
- private void configureCommandAttributes(VTPValidateCSARR293901 testCase) {
- OnapCommandResult onapCommandResult = new OnapCommandResult();
- OnapCommandResultAttribute onapCommandResultAttributeCode = new OnapCommandResultAttribute();
- onapCommandResultAttributeCode.setName("code");
- OnapCommandResultAttribute onapCommandResultAttributeMessage = new OnapCommandResultAttribute();
- onapCommandResultAttributeMessage.setName("message");
- OnapCommandResultAttribute onapCommandResultAttributeFile = new OnapCommandResultAttribute();
- onapCommandResultAttributeFile.setName("file");
- OnapCommandResultAttribute onapCommandResultAttributeLineNo = new OnapCommandResultAttribute();
- onapCommandResultAttributeLineNo.setName("line-no");
- List<OnapCommandResultAttribute> records = Lists.newArrayList(onapCommandResultAttributeCode, onapCommandResultAttributeMessage, onapCommandResultAttributeFile, onapCommandResultAttributeLineNo);
- onapCommandResult.setRecords(records);
- testCase.setResult(onapCommandResult);
- }
-
- private void configurePathToCsar(VTPValidateCSARR293901 testCase, String fileName) throws URISyntaxException, OnapCommandInvalidParameterValue {
- String pathToFile = resolvePathToFile(fileName);
- Set<OnapCommandParameter> parameters = testCase.getParameters();
- OnapCommandParameter csar = parameters.stream().filter(op -> op.getName().equals("csar")).findFirst().get();
- csar.setValue(pathToFile);
- }
-
- private List<String> convertToMessagesList(List<CSARArchive.CSARError> errors) {
- return errors.stream().map(CSARArchive.CSARError::getMessage).collect(Collectors.toList());
- }
-
-
} \ No newline at end of file
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR57019IntegrationTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR57019IntegrationTest.java
new file mode 100644
index 0000000..8ec88ea
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR57019IntegrationTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2019 Nokia
+ * <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 org.junit.Before;
+import org.junit.Test;
+import org.onap.cvc.csar.CSARArchive;
+
+import java.util.List;
+
+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;
+
+
+public class VTPValidateCSARR57019IntegrationTest {
+
+ private VTPValidateCSARR57019 testCase;
+
+ @Before
+ public void setUp() {
+ testCase = new VTPValidateCSARR57019();
+ }
+
+ @Test
+ public void shouldReturnProperRequestNumber() {
+ assertThat(testCase.getVnfReqsNo()).isEqualTo("R57019");
+ }
+
+ @Test
+ public void shouldReportThatMandatoryEntriesInMetadataAreNotAvailable() throws Exception {
+ // given
+ configureTestCase(testCase, "pnf/r57019/noMandatoryEntriesInMetadataManifest.csar");
+
+ // when
+ testCase.execute();
+
+ // then
+ List<CSARArchive.CSARError> errors = testCase.getErrors();
+ assertThat(errors.size()).isEqualTo(5);
+ assertThat(convertToMessagesList(errors)).contains(
+ "Missing. Entry [pnfd_provider]",
+ "Missing. Entry [pnfd_name]",
+ "Missing. Entry [pnfd_release_date_time]",
+ "Missing. Entry [pnfd_archive_version]",
+ "Invalid. Entry [pnfd_archivee_version]"
+ );
+ }
+
+ @Test
+ public void shouldDoNotReportAnyErrorWhenAllMandatoryEntriesInMetadataWereDefined() throws Exception {
+ // given
+ configureTestCase(testCase, "pnf/r57019/allMandatoryEntriesDefinedInMetadataManifest.csar");
+
+ // when
+ testCase.execute();
+
+ // then
+ List<CSARArchive.CSARError> errors = testCase.getErrors();
+ assertThat(errors.size()).isEqualTo(0);
+ }
+
+} \ No newline at end of file
diff --git a/csarvalidation/src/test/resources/pnf/MainServiceTemplate.mf b/csarvalidation/src/test/resources/pnf/MainServiceTemplate.mf
index c0c0f97..4ffa857 100644
--- a/csarvalidation/src/test/resources/pnf/MainServiceTemplate.mf
+++ b/csarvalidation/src/test/resources/pnf/MainServiceTemplate.mf
@@ -5,8 +5,8 @@ metadata:
pnfd_release_date_time: 2019-01-14T11:25:00+00:00
#The manifest file shall include a list of all files contained in or referenced from the VNF package with their location
-#source: Definitions/MainServiceTemplate.yaml
-#source: Definitions/etsi_nfv_sol001_vnfd_2_5_1_types.yaml
+source: Definitions/MainServiceTemplate.yaml
+source: Definitions/etsi_nfv_sol001_vnfd_2_5_1_types.yaml
non_mano_artifact_sets:
diff --git a/csarvalidation/src/test/resources/pnf/dummyPnfv2.csar b/csarvalidation/src/test/resources/pnf/dummyPnfv2.csar
index 778f45c..dd45b66 100644
--- a/csarvalidation/src/test/resources/pnf/dummyPnfv2.csar
+++ b/csarvalidation/src/test/resources/pnf/dummyPnfv2.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r146092/missingFieldsInNonManoArtifactManifest.csar b/csarvalidation/src/test/resources/pnf/r146092/missingFieldsInNonManoArtifactManifest.csar
new file mode 100644
index 0000000..545dd16
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r146092/missingFieldsInNonManoArtifactManifest.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r146092/missingNonManoArtifactInManifest.csar b/csarvalidation/src/test/resources/pnf/r146092/missingNonManoArtifactInManifest.csar
new file mode 100644
index 0000000..0bb0e16
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r146092/missingNonManoArtifactInManifest.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r146092/noSourceElementInNonManoArtifactEntryManifest.csar b/csarvalidation/src/test/resources/pnf/r146092/noSourceElementInNonManoArtifactEntryManifest.csar
new file mode 100644
index 0000000..edeaf9b
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r146092/noSourceElementInNonManoArtifactEntryManifest.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r146092/sourceElementWithUnknownFileInNonManoArtifactEntryManifest.csar b/csarvalidation/src/test/resources/pnf/r146092/sourceElementWithUnknownFileInNonManoArtifactEntryManifest.csar
new file mode 100644
index 0000000..434d614
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r146092/sourceElementWithUnknownFileInNonManoArtifactEntryManifest.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/allMandatoryEntriesDefinedInTOSCAMeta.csar b/csarvalidation/src/test/resources/pnf/r293901/allMandatoryEntriesDefinedInTOSCAMeta.csar
index f22366a..f22366a 100644
--- a/csarvalidation/src/test/resources/pnf/allMandatoryEntriesDefinedInTOSCAMeta.csar
+++ b/csarvalidation/src/test/resources/pnf/r293901/allMandatoryEntriesDefinedInTOSCAMeta.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/noMandatoryEntriesInTOSCAMeta.csar b/csarvalidation/src/test/resources/pnf/r293901/noMandatoryEntriesInTOSCAMeta.csar
index 9ef56cf..9ef56cf 100644
--- a/csarvalidation/src/test/resources/pnf/noMandatoryEntriesInTOSCAMeta.csar
+++ b/csarvalidation/src/test/resources/pnf/r293901/noMandatoryEntriesInTOSCAMeta.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/noTOSCAMetaInTOSCADirectory.csar b/csarvalidation/src/test/resources/pnf/r293901/noTOSCAMetaInTOSCADirectory.csar
index 7ab26c3..7ab26c3 100644
--- a/csarvalidation/src/test/resources/pnf/noTOSCAMetaInTOSCADirectory.csar
+++ b/csarvalidation/src/test/resources/pnf/r293901/noTOSCAMetaInTOSCADirectory.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r57019/allMandatoryEntriesDefinedInMetadataManifest.csar b/csarvalidation/src/test/resources/pnf/r57019/allMandatoryEntriesDefinedInMetadataManifest.csar
new file mode 100644
index 0000000..3311713
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r57019/allMandatoryEntriesDefinedInMetadataManifest.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r57019/noMandatoryEntriesInMetadataManifest.csar b/csarvalidation/src/test/resources/pnf/r57019/noMandatoryEntriesInMetadataManifest.csar
new file mode 100644
index 0000000..6b16ed5
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r57019/noMandatoryEntriesInMetadataManifest.csar
Binary files differ