From 0d4544eb82a2ca79d7724e5c1da70d3943db76eb Mon Sep 17 00:00:00 2001 From: Bogumil Zebek Date: Fri, 15 Mar 2019 10:43:42 +0100 Subject: Update manifest parser Change-Id: I420fd9fb97450cbcc2afc15632717182e18f0333 Issue-ID: VNFSDK-384 Signed-off-by: Zebek Bogumil --- .../java/org/onap/cvc/csar/PnfCSARArchiveTest.java | 23 ++++++++------ .../org/onap/cvc/csar/PnfManifestParserTest.java | 19 +++++++---- .../org/onap/cvc/csar/PnfMetadataParserTest.java | 37 +++++++++++----------- .../cvc/csar/PnfNonManoArtifactsParserTest.java | 9 +++--- 4 files changed, 50 insertions(+), 38 deletions(-) (limited to 'csarvalidation/src/test/java') 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 4a211a5..d7370e4 100644 --- a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfCSARArchiveTest.java +++ b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfCSARArchiveTest.java @@ -50,18 +50,23 @@ public class PnfCSARArchiveTest { private void verifyThatNonManoArtifactsWereSet(PnfCSARArchive pnfCSARArchive) { Map>> nonManoArtifacts = pnfCSARArchive.getManifest().getNonMano(); - assertThat(nonManoArtifacts.get("prv.onap.ves_event").get("Source")) - .isEqualTo(Lists.newArrayList("Artifacts/Deployment/Events/RadioNode_Pnf_v1.yml") + assertThat(nonManoArtifacts.get("onap_ves_events").get("source")) + .isEqualTo(Lists.newArrayList("Artifacts/Events/VES_registration.yml") ); - assertThat(nonManoArtifacts.get("prv.onap.pm_dictionary").get("Source")) - .isEqualTo(Lists.newArrayList("Artifacts/Deployment/Measurements/PM_Dictionary.yml") + assertThat(nonManoArtifacts.get("onap_pm_dictionary").get("source")) + .isEqualTo(Lists.newArrayList("Artifacts/Measurements/PM_Dictionary.yaml") ); - assertThat(nonManoArtifacts.get("prv.onap.yang_modules").get("Source")) + assertThat(nonManoArtifacts.get("onap_yang_module").get("source")) + .isEqualTo(Lists.newArrayList("Artifacts/Yang_module/Yang_module.yaml") + ); + assertThat(nonManoArtifacts.get("onap_others").get("source")) .isEqualTo(Lists.newArrayList( - "Artifacts/Deployment/Yang_module/yang-module1.yang", - "Artifacts/Deployment/Yang_module/yang-module2.yang" - ) - ); + "Artifacts/scripts/install.sh", + "Artifacts/Informational/user_guide.txt", + "Artifacts/Other/installation_guide.txt", + "Artifacts/Other/review_log.txt" + ) + ); } private void verifyThatMetadataWasSet(PnfCSARArchive pnfCSARArchive) { 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 96a66c3..f680438 100644 --- a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java +++ b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfManifestParserTest.java @@ -57,16 +57,21 @@ public class PnfManifestParserTest { Map>> nonManoArtifacts = mapListPair.getKey(); List errors= mapListPair.getValue(); - assertThat(nonManoArtifacts.get("prv.onap.ves_event").get("Source")) - .isEqualTo(Lists.newArrayList("Artifacts/Deployment/Events/RadioNode_Pnf_v1.yml") + assertThat(nonManoArtifacts.get("onap_ves_events").get("source")) + .isEqualTo(Lists.newArrayList("Artifacts/Events/VES_registration.yml") ); - assertThat(nonManoArtifacts.get("prv.onap.pm_dictionary").get("Source")) - .isEqualTo(Lists.newArrayList("Artifacts/Deployment/Measurements/PM_Dictionary.yml") + assertThat(nonManoArtifacts.get("onap_pm_dictionary").get("source")) + .isEqualTo(Lists.newArrayList("Artifacts/Measurements/PM_Dictionary.yaml") ); - assertThat(nonManoArtifacts.get("prv.onap.yang_modules").get("Source")) + assertThat(nonManoArtifacts.get("onap_yang_module").get("source")) + .isEqualTo(Lists.newArrayList("Artifacts/Yang_module/Yang_module.yaml") + ); + assertThat(nonManoArtifacts.get("onap_others").get("source")) .isEqualTo(Lists.newArrayList( - "Artifacts/Deployment/Yang_module/yang-module1.yang", - "Artifacts/Deployment/Yang_module/yang-module2.yang" + "Artifacts/scripts/install.sh", + "Artifacts/Informational/user_guide.txt", + "Artifacts/Other/installation_guide.txt", + "Artifacts/Other/review_log.txt" ) ); assertThat(errors.size()).isEqualTo(0); diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfMetadataParserTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfMetadataParserTest.java index 500fdd6..3d46334 100644 --- a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfMetadataParserTest.java +++ b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfMetadataParserTest.java @@ -55,10 +55,10 @@ public class PnfMetadataParserTest { // given List lines = Lists.newArrayList( "metadata:", - "pnf_product_name: RadioNode", - "pnf_provider_id: Ericsson", - "pnf_package_version: 1.0", - "pnf_release_date_time: 2019-01-14T11:25:00+00:00", + "pnfd_name: RadioNode", + "pnfd_provider: Ericsson", + "pnfd_archive_version: 1.0", + "pnfd_release_date_time: 2019-01-14T11:25:00+00:00", "extra_param_1: some value", "extra_param_2: some value" ); @@ -83,10 +83,11 @@ public class PnfMetadataParserTest { // given List lines = Lists.newArrayList( "metadata:", - "pnf_product_name: RadioNode", - "pnf_provider_id: Ericsson", - "pnf_package_version: 1.0", - "pnf_release_date_time: 2019-01-14T11:25:00+00:00", + "pnfd_name: RadioNode", + "pnfd_provider: Ericsson", + "pnfd_archive_version: 1.0", + "# Ignore this comment", + "pnfd_release_date_time: 2019-01-14T11:25:00+00:00", "non_mano_artifact_sets:", "param_name: some value" ); @@ -108,10 +109,10 @@ public class PnfMetadataParserTest { // given List lines = Lists.newArrayList( "metadata:", - "pnf_product_name: RadioNode", - "pnf_provider_id: Ericsson", - "pnf_package_version: 1.0", - "pnf_release_date_time: 2019-01-14T11:25:00+00:00", + "pnfd_name: RadioNode", + "pnfd_provider: Ericsson", + "pnfd_archive_version: 1.0", + "pnfd_release_date_time: 2019-01-14T11:25:00+00:00", "unknown_section:", "param_name: some value" ); @@ -130,14 +131,14 @@ public class PnfMetadataParserTest { @Test - public void shouldReportAWarningWhenTokenWithOutColonWasFoundDuringMetadataProcessing() { + public void shouldReportAInvalidWhenTokenWithOutColonWasFoundDuringMetadataProcessing() { // given List lines = Lists.newArrayList( "metadata:", - "pnf_product_name RadioNode", - "pnf_provider_id: Ericsson", - "pnf_package_version: 1.0", - "pnf_release_date_time: 2019-01-14T11:25:00+00:00" + "pnfd_name RadioNode", + "pnfd_provider: Ericsson", + "pnfd_archive_version: 1.0", + "pnfd_release_date_time: 2019-01-14T11:25:00+00:00" ); // when @@ -148,7 +149,7 @@ public class PnfMetadataParserTest { List errors = data.getRight(); assertThat(errors.size()).isEqualTo(1); assertThat(errors.stream().map(CSARArchive.CSARError::getMessage).collect(Collectors.toList())).contains( - "Warning. Entry [pnf_product_name RadioNode]" + "Invalid. Entry [pnfd_name RadioNode]" ); } diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfNonManoArtifactsParserTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfNonManoArtifactsParserTest.java index 95526bb..91d2648 100644 --- a/csarvalidation/src/test/java/org/onap/cvc/csar/PnfNonManoArtifactsParserTest.java +++ b/csarvalidation/src/test/java/org/onap/cvc/csar/PnfNonManoArtifactsParserTest.java @@ -56,12 +56,13 @@ public class PnfNonManoArtifactsParserTest { // given List lines = Lists.newArrayList( "non_mano_artifact_sets:", - "prv.onap.ves_event: # if private else onap_ves_event if public", - "Source: Artifacts/Deployment/Events/RadioNode_Pnf_v1.yml", + "# Ignore this comment", + "onap_ves_events: # if private else onap_ves_event if public", + "source: Artifacts/Events/VES_registration.yml", "extra_param_1: some value", "extra_param_2: some value", - "prv.onap.pm_dictionary: # if private else onap_pm_dictionary if public", - "Source: Artifacts/Deployment/Measurements/PM_Dictionary.yml", + "onap_pm_dictionary: # if private else onap_pm_dictionary if public", + "source: Artifacts/Measurements/PM_Dictionary.yaml", "param name: # if private else onap_yang_modules if public", "key: value" ); -- cgit 1.2.3-korg