From 873fbb49dcd3092d2591a4eca13470713ca443ea Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Thu, 21 Mar 2019 10:16:55 +0530 Subject: Fix the sol004 minor issues Issue-ID: VNFSDK-352 Change-Id: I13fb8f0bc13d033c93d516e771afcd3440e0949d Signed-off-by: Kanagaraj Manickam k00365106 --- .../src/main/java/org/onap/cvc/csar/CSARArchive.java | 4 +++- .../org/onap/cvc/csar/cc/sol001/VTPValidateCSARR35854.java | 11 +++++++++-- .../org/onap/cvc/csar/cc/sol001/VTPValidateCSARR65486.java | 11 ++++++++++- .../org/onap/cvc/csar/cc/sol004/VTPValidateCSARR04298.java | 2 +- .../org/onap/cvc/csar/cc/sol004/VTPValidateCSARR10087.java | 4 +++- .../org/onap/cvc/csar/cc/sol004/VTPValidateCSARR13390.java | 2 +- .../org/onap/cvc/csar/cc/sol004/VTPValidateCSARR26881.java | 2 +- .../org/onap/cvc/csar/cc/sol004/VTPValidateCSARR77786.java | 2 +- 8 files changed, 29 insertions(+), 9 deletions(-) (limited to 'csarvalidation/src/main/java') diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java b/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java index 24cef0e..294522f 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/CSARArchive.java @@ -97,10 +97,12 @@ public class CSARArchive { public static final String Entry_Definition__tosca_definitions_version__simple_1_0 = "tosca_simple_yaml_1_0"; public static final String Entry_Definition__tosca_definitions_version__simple_1_1 = "tosca_simple_yaml_1_1"; + public static final String Entry_Definition__tosca_definitions_version__simple_1_2 = "tosca_simple_yaml_1_2"; protected static final String[] Entry_Definition__tosca_definitions_versions = new String[] { Entry_Definition__tosca_definitions_version__simple_1_0, - Entry_Definition__tosca_definitions_version__simple_1_1 + Entry_Definition__tosca_definitions_version__simple_1_1, + Entry_Definition__tosca_definitions_version__simple_1_2 }; public static final String Entry_Definition__metadata = "metadata"; diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR35854.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR35854.java index 1b442cb..3ab9e78 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR35854.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR35854.java @@ -18,14 +18,21 @@ package org.onap.cvc.csar.cc.sol001; import org.onap.cli.fw.schema.OnapCommandSchema; import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARError; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissingToscaDefinitionVersion; +import org.onap.cvc.csar.CSARArchive.CSARErrorInvalidEntryValueToscaDefinitionVersion; import org.onap.cvc.csar.cc.VTPValidateCSARBase; @OnapCommandSchema(schema = "vtp-validate-csar-r35854.yaml") public class VTPValidateCSARR35854 extends VTPValidateCSARBase { - @Override protected void validateCSAR(CSARArchive csar) throws Exception { - + for (CSARError e : csar.getErrors()) { + if (e instanceof CSARErrorEntryMissingToscaDefinitionVersion || + e instanceof CSARErrorInvalidEntryValueToscaDefinitionVersion) { + this.errors.add(e); + } + } } @Override diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR65486.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR65486.java index 0f4f64d..0889589 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR65486.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol001/VTPValidateCSARR65486.java @@ -18,6 +18,9 @@ package org.onap.cvc.csar.cc.sol001; import org.onap.cli.fw.schema.OnapCommandSchema; import org.onap.cvc.csar.CSARArchive; +import org.onap.cvc.csar.CSARArchive.CSARError; +import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissingToscaDefinitionVersion; +import org.onap.cvc.csar.CSARArchive.CSARErrorInvalidEntryValueToscaDefinitionVersion; import org.onap.cvc.csar.cc.VTPValidateCSARBase; @OnapCommandSchema(schema = "vtp-validate-csar-r65486.yaml") @@ -25,7 +28,13 @@ public class VTPValidateCSARR65486 extends VTPValidateCSARBase { @Override protected void validateCSAR(CSARArchive csar) throws Exception { - + //Just check for the version entry for now + for (CSARError e : csar.getErrors()) { + if (e instanceof CSARErrorEntryMissingToscaDefinitionVersion || + e instanceof CSARErrorInvalidEntryValueToscaDefinitionVersion) { + this.errors.add(e); + } + } } @Override diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR04298.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR04298.java index 6503c54..1be9814 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR04298.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR04298.java @@ -34,7 +34,7 @@ public class VTPValidateCSARR04298 extends VTPValidateCSARBase { @Override protected void validateCSAR(CSARArchive csar) throws Exception { - if (csar.getTestsFolder() == null) { + if (csar.getTestsFolder() == null || csar.getTestsFolder().listFiles().length == 0) { this.errors.add(new CSARErrorEntryMissingTestFolderNotFound()); } } diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR10087.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR10087.java index 31298fa..0e80add 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR10087.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR10087.java @@ -22,6 +22,7 @@ import org.onap.cvc.csar.CSARArchive.CSARError; import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissingToscaDefinitionMetadataTemplateName; import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissingToscaDefinitionNotFound; import org.onap.cvc.csar.CSARArchive.CSARErrorEntryMissingToscaMetaDefinition; +import org.onap.cvc.csar.CSARArchive.CSARErrorInvalidEntryValueManifestNotFound; import org.onap.cvc.csar.cc.VTPValidateCSARBase; @OnapCommandSchema(schema = "vtp-validate-csar-r10087.yaml") @@ -33,7 +34,8 @@ public class VTPValidateCSARR10087 extends VTPValidateCSARBase { for (CSARError e : csar.getErrors()) { if (e instanceof CSARErrorEntryMissingToscaMetaDefinition || e instanceof CSARErrorEntryMissingToscaDefinitionNotFound || - e instanceof CSARErrorEntryMissingToscaDefinitionMetadataTemplateName) { + e instanceof CSARErrorEntryMissingToscaDefinitionMetadataTemplateName || + e instanceof CSARErrorInvalidEntryValueManifestNotFound) { this.errors.add(e); } } diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR13390.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR13390.java index 17c3018..d33ed3f 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR13390.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR13390.java @@ -26,7 +26,7 @@ public class VTPValidateCSARR13390 extends VTPValidateCSARBase { public static class CSARErrorEntryMissingAnsiblePlaybookNotFound extends CSARErrorEntryMissing { public CSARErrorEntryMissingAnsiblePlaybookNotFound() { - super("cookbooks", CSARArchive.CSAR_Archive); + super("playbooks", CSARArchive.CSAR_Archive); this.setCode("0x1000"); } } diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR26881.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR26881.java index e036ce6..f06b84a 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR26881.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR26881.java @@ -33,7 +33,7 @@ public class VTPValidateCSARR26881 extends VTPValidateCSARBase { @Override protected void validateCSAR(CSARArchive csar) throws Exception { - if (!csar.getFileFromCsar("artifacts").exists()) { + if (!csar.getFileFromCsar("Artifacts").exists()) { errors.add(new CSARErrorEntryMissingArtifactsNotFound()); } } diff --git a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR77786.java b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR77786.java index efb258b..bf55530 100644 --- a/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR77786.java +++ b/csarvalidation/src/main/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR77786.java @@ -26,7 +26,7 @@ public class VTPValidateCSARR77786 extends VTPValidateCSARBase { public static class CSARErrorEntryMissingAnsiblePlaybookNotFound extends CSARErrorEntryMissing { public CSARErrorEntryMissingAnsiblePlaybookNotFound() { - super("cookbooks", + super("playbooks", CSARArchive.CSAR_Archive); this.setCode("0x1000"); } -- cgit 1.2.3-korg