diff options
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test')
23 files changed, 783 insertions, 0 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidatorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidatorTest.java new file mode 100644 index 0000000000..bedf599cf5 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ONAPCsarValidatorTest.java @@ -0,0 +1,73 @@ +package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.sdc.common.utils.SdcCommon; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.assertTrue; + + +public class ONAPCsarValidatorTest { + + ONAPCsarValidator onapCsarValidator; + private FileContentHandler contentHandler; + private List<String> folderList; + + @Before + public void setUp() throws IOException{ + onapCsarValidator = new ONAPCsarValidator(); + contentHandler = new FileContentHandler(); + folderList = new ArrayList<>(); + + contentHandler.addFile("TOSCA-Metadata/TOSCA.meta", ValidatorUtil.getFileResource("/validation.files/metafile/nonSOL004WithMetaDirectoryCompliantMetaFile.meta")); + contentHandler.addFile("MainServiceTemplate.mf", ValidatorUtil.getFileResource("/validation.files/manifest/sampleManifest.mf")); + contentHandler.addFile(TestConstants.TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(TestConstants.SAMPLE_DEFINITION_FILE_PATH)); + } + + @Test + public void testGivenCSARPackage_withValidContent_thenNoErrorsReturned() { + assertExpectedErrors("Valid CSAR Package should have 0 errors", + onapCsarValidator.validateContent(contentHandler, folderList), 0); + } + + @Test + public void testGivenCSARPackage_withInvalidManifestFile_thenErrorsReturned() throws IOException{ + contentHandler = new FileContentHandler(); + contentHandler.addFile("TOSCA-Metadata/TOSCA.meta", ValidatorUtil.getFileResource("/validation.files/metafile/nonSOL004WithMetaDirectoryCompliantMetaFile.meta")); + contentHandler.addFile("MainServiceTemplate.mf", ValidatorUtil.getFileResource("/validation.files/manifest/invalidManifest.mf")); + contentHandler.addFile(TestConstants.TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(TestConstants.SAMPLE_DEFINITION_FILE_PATH)); + + assertExpectedErrors("CSAR package with invalid manifest file should have errors", onapCsarValidator.validateContent(contentHandler, folderList), 1); + + } + + @Test + public void testGivenCSARPackage_withUnwantedFolders_thenErrorsReturned(){ + + folderList.add("Files/"); + assertExpectedErrors("CSAR package with unwanted folders should fail with errors", onapCsarValidator.validateContent(contentHandler, folderList), 1); + } + + @Test + public void testGivenCSARPackage_withUnwantedFiles_thenErrorsReturned(){ + + contentHandler.addFile("ExtraFile.text", "".getBytes()); + assertExpectedErrors("CSAR package with unwanted files should fail with errors", + onapCsarValidator.validateContent(contentHandler, folderList), 1); + } + + private void assertExpectedErrors( String testCase, Map<String, List<ErrorMessage>> errors, int expectedErrors){ + if(expectedErrors > 0){ + List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE); + assertTrue(testCase, errorMessages.size() == expectedErrors); + }else{ + assertTrue(testCase,errors.size() == expectedErrors); + } + } +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java new file mode 100644 index 0000000000..8584d482b4 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java @@ -0,0 +1,405 @@ +package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.sdc.common.utils.SdcCommon; +import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.assertTrue; +import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.TestConstants.*; + +public class SOL004MetaDirectoryValidatorTest { + + private SOL004MetaDirectoryValidator sol004MetaDirectoryValidator; + private FileContentHandler handler; + private String metaFile; + + @Before + public void setUp(){ + sol004MetaDirectoryValidator = new SOL004MetaDirectoryValidator(); + handler = new FileContentHandler(); + metaFile = + "TOSCA-Meta-File-Version: 1.0\n"+ + "CSAR-Version: 1.1\n"+ + "Created-by: Vendor\n"+ + "Entry-Definitions: Definitions/MainServiceTemplate.yaml\n"+ + "Entry-Manifest: Definitions/MainServiceTemplate.mf\n"+ + "Entry-Change-Log: Artifacts/changeLog.text\n"; + } + + @Test + public void testGivenTOSCAMetaFile_whenEntryHasNoValue_thenErrorIsReturned() throws IOException{ + + String metaFileWithInvalidEntry = "TOSCA-Meta-File-Version: \n" + + "Entry-Definitions: Definitions/MainServiceTemplate.yaml"; + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFileWithInvalidEntry.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(TestConstants.SAMPLE_DEFINITION_FILE_PATH)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE); + assertTrue(errors.size() == 1 && errorMessages.size() == 1); + } + + @Test + public void testGivenTOSCAMeta_withAllSupportedEntries_thenNoErrorsReturned() throws IOException{ + + String entryTestFilePath = "Files/Tests"; + String entryLicenseFilePath = "Files/Licenses"; + + List<String> folderList = new ArrayList<>(); + folderList.add("Files/Tests/"); + folderList.add("Files/Licenses/"); + + metaFile = metaFile + + "Entry-Tests: "+ entryTestFilePath + "\n" + + "Entry-Licenses: "+ entryLicenseFilePath +"\n"; + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_MANIFEST_FILE_PATH)); + handler.addFile(SAMPLE_SOURCE, "".getBytes()); + handler.addFile(SAMPLE_DEFINITION_IMPORT_FILE_PATH, "".getBytes()); + handler.addFile(entryTestFilePath, "".getBytes()); + handler.addFile(entryLicenseFilePath, "".getBytes()); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, folderList); + assertTrue(errors.size() == 0); + } + + @Test + public void testGivenTOSCAMeta_withUnsupportedEntry_thenWarningIsReturned(){ + + metaFile = "Entry-Events: Definitions/events.log"; + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE); + assertTrue(errors.size() == 1 && errorMessages.size() == 1); + assertTrue(errorMessages.get(0).getLevel() == ErrorLevel.ERROR); + + } + + @Test + public void testGivenTOSCAMetaFile_withInvalidTOSCAMetaFileVersionAndCSARVersion_thenErrorIsReturned() throws IOException{ + + String metaFile = + "TOSCA-Meta-File-Version: " + Integer.MAX_VALUE + + "\nCSAR-Version: " + Integer.MAX_VALUE + + "\nCreated-by: Bilal Iqbal" + + "\nEntry-Definitions: Definitions/MainServiceTemplate.yaml" + + "\nEntry-Manifest: Definitions/MainServiceTemplate.mf"+ + "\nEntry-Change-Log: Artifacts/changeLog.text"; + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(TestConstants.SAMPLE_DEFINITION_FILE_PATH)); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_MANIFEST_FILE_PATH)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE); + assertTrue(errors.size() == 1 && errorMessages.size() == 2); + } + + @Test + public void testGivenTOSCAMetaFile_withNonExistentFileReferenced_thenErrorsReturned(){ + + metaFile = metaFile + + "Entry-Tests: Files/Tests\n" + + "Entry-License: Files/Licenses\n"; + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE); + assertTrue(errors.size() == 1 && errorMessages.size() == 5); + } + + + @Test + public void testGivenDefinitionFile_whenValidImportStatementExist_thenNoErrorsReturned() throws IOException{ + + String definitionFileWithValidImports = "/validation.files/definition/definitionFileWithValidImports.yaml"; + + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_MANIFEST_FILE_PATH)); + handler.addFile(SAMPLE_SOURCE, "".getBytes()); + handler.addFile("Definitions/etsi_nfv_sol001_pnfd_2_5_1_types.yaml", ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(definitionFileWithValidImports)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertTrue(errors.size() == 0); + } + + @Test + public void testGivenDefinitionFile_whenMultipleDefinitionsImportStatementExist_thenNoErrorsReturned() throws IOException{ + + byte [] sampleDefinitionFile1 = ValidatorUtil.getFileResource("/validation.files/definition/sampleDefinitionFile1.yaml"); + byte [] sampleDefinitionFile2 = ValidatorUtil.getFileResource("/validation.files/definition/sampleDefinitionFile2.yaml"); + byte [] sampleDefinitionFile3 = ValidatorUtil.getFileResource("/validation.files/definition/sampleDefinitionFile3.yaml"); + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_MANIFEST_FILE_PATH)); + handler.addFile(SAMPLE_SOURCE, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, sampleDefinitionFile1); + handler.addFile("Definitions/etsi_nfv_sol001_pnfd_2_5_1_types.yaml", sampleDefinitionFile2); + handler.addFile("Definitions/etsi_nfv_sol001_pnfd_2_5_2_types.yaml", sampleDefinitionFile3); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertTrue(errors.size() == 0); + } + + @Test + public void testGivenDefinitionFile_whenInvalidImportStatementExist_thenErrorIsReturned() throws IOException{ + + String definitionFileWithInvalidImports = "/validation.files/definition/definitionFileWithInvalidImport.yaml"; + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_MANIFEST_FILE_PATH)); + handler.addFile(SAMPLE_SOURCE, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(definitionFileWithInvalidImports)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE); + assertTrue(errors.size() == 1 && errorMessages.size() == 1); + } + + @Test + public void testGivenDefinitionFile_whenReferencedImportDoesNotExist_thenErrorIsReturned() throws IOException{ + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_MANIFEST_FILE_PATH)); + handler.addFile(SAMPLE_SOURCE, "".getBytes()); + handler.addFile("Definitions/etsi_nfv_sol001_pnfd_2_5_1_types.yaml", "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource("/validation.files/definition/sampleDefinitionFile2.yaml")); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE); + assertTrue(errors.size() == 1 && errorMessages.size() == 1); + + } + + @Test + public void testGivenDefinitionFile_withInvalidYAML_thenErrorIsReturned() throws IOException{ + + String definitionFileWithInvalidYAML = "/validation.files/definition/invalidDefinitionFile.yaml"; + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_MANIFEST_FILE_PATH)); + handler.addFile(SAMPLE_SOURCE, "".getBytes()); + + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(definitionFileWithInvalidYAML)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE); + assertTrue(errors.size() == 1 && errorMessages.size() == 1); + } + + @Test + public void testGivenManifestFile_withValidSourceAndNonManoSources_thenNoErrorIsReturned() throws IOException{ + + String nonManoSource = "Artifacts/Deployment/Measurements/PM_Dictionary.yaml"; + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource("/validation.files/manifest/validManifest.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + handler.addFile(SAMPLE_SOURCE, "".getBytes()); + handler.addFile(SAMPLE_DEFINITION_IMPORT_FILE_PATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + handler.addFile(nonManoSource, "".getBytes()); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertTrue(errors.size() == 0); + } + + @Test + public void testGivenManifestFile_withNonExistentSourceFile_thenErrorIsReturned() throws IOException{ + String nonManoSource = "Artifacts/Deployment/Measurements/PM_Dictionary.yaml"; + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource("/validation.files/manifest/validManifest.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + handler.addFile(SAMPLE_DEFINITION_IMPORT_FILE_PATH, "".getBytes()); + handler.addFile(nonManoSource, "".getBytes()); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE); + assertTrue(errors.size() == 1 && errorMessages.size() == 1); + } + + @Test + public void testGivenManifestFile_withInvalidData_thenErrorIsReturned() throws IOException{ + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource("/validation.files/manifest/invalidManifest.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + handler.addFile(SAMPLE_DEFINITION_IMPORT_FILE_PATH, "".getBytes()); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE); + assertTrue(errors.size() == 1 && errorMessages.size() == 1); + } + + @Test + public void testGivenManifestAndDefinitionFile_withSameNames_thenNoErrorReturned() throws IOException { + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource("/validation.files/manifest/sampleManifest.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + handler.addFile(SAMPLE_DEFINITION_IMPORT_FILE_PATH, "".getBytes()); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertTrue(errors.size() == 0); + } + + @Test + public void testGivenManifestAndMainDefinitionFile_withDifferentNames_thenErrorIsReturned() throws IOException { + metaFile = + "TOSCA-Meta-File-Version: 1.0\n"+ + "CSAR-Version: 1.1\n"+ + "Created-by: Vendor\n"+ + "Entry-Definitions: Definitions/MainServiceTemplate.yaml\n"+ + "Entry-Manifest: Definitions/MainServiceTemplate2.mf\n"+ + "Entry-Change-Log: Artifacts/changeLog.text\n"; + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile("Definitions/MainServiceTemplate2.mf", ValidatorUtil.getFileResource("/validation.files/manifest/sampleManifest.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + handler.addFile(SAMPLE_DEFINITION_IMPORT_FILE_PATH, "".getBytes()); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertExpectedErrors("Main TOSCA definitions file and Manifest file with different name should return error", + errors, 1); + } + + @Test + public void testGivenManifestFile_withDifferentExtension_thenErrorIsReturned() throws IOException { + metaFile = + "TOSCA-Meta-File-Version: 1.0\n"+ + "CSAR-Version: 1.1\n"+ + "Created-by: Vendor\n"+ + "Entry-Definitions: Definitions/MainServiceTemplate.yaml\n"+ + "Entry-Manifest: Definitions/MainServiceTemplate.txt\n"+ + "Entry-Change-Log: Artifacts/changeLog.text\n"; + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile("Definitions/MainServiceTemplate.txt", ValidatorUtil.getFileResource("/validation.files/manifest/sampleManifest.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + handler.addFile(SAMPLE_DEFINITION_IMPORT_FILE_PATH, "".getBytes()); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertExpectedErrors("Manifest file with different extension than .mf should return error", + errors, 1); + } + + @Test + public void testGivenManifestFile_withValidVnfMetadata_thenNoErrorsReturned() throws IOException{ + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource("/validation.files/manifest/sampleManifest.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertExpectedErrors("Manifest with valid vnf mandatory values should not return any errors", errors, 0); + } + + @Test + public void testGivenManifestFile_withValidPnfMetadata_thenNoErrorsReturned() throws IOException { + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource("/validation.files/manifest/sampleManifest2.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertExpectedErrors("Manifest with valid pnf mandatory values should not return any errors", errors, 0); + } + + @Test + public void testGivenManifestFile_withMetadataContainingMixedPnfVnfMetadata_thenErrorIsReturned() throws IOException { + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource("/validation.files/manifest/manifestInvalidMetadata.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertExpectedErrors("Manifest with mixed metadata should return error", errors, 1); + } + + + @Test + public void testGivenManifestFile_withMetadataMissingPnfOrVnfMandatoryEntries_thenErrorIsReturned() throws IOException{ + + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource("/validation.files/manifest/manifestInvalidMetadata2.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertExpectedErrors("Manifest with missing vnf or pnf mandatory entries should return error", errors, 1); + } + + @Test + public void testGivenManifestFile_withMetadataMissingMandatoryPnfEntries_thenErrorIsReturned() throws IOException{ + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource("/validation.files/manifest/manifestInvalidMetadata4.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertExpectedErrors("Manifest with metadata missing pnf mandatory entries should return error", errors, 3); + + } + + @Test + public void testGivenManifestFile_withMetadataMissingMandatoryVnfEntries_thenErrorIsReturned() throws IOException{ + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource("/validation.files/manifest/manifestInvalidMetadata5.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertExpectedErrors("Manifest with metadata missing vnf mandatory entries should return error", errors, 4); + + } + + @Test + public void testGivenManifestFile_withMetadataEntriesExceedingTheLimit_thenErrorIsReturned() throws IOException{ + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, ValidatorUtil.getFileResource("/validation.files/manifest/manifestInvalidMetadata3.mf")); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_DEFINITION_FILEPATH, ValidatorUtil.getFileResource(SAMPLE_DEFINITION_FILE_PATH)); + + Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler, Collections.emptyList()); + assertExpectedErrors("Manifest with more than 4 metadata entries should return error", errors, 2); + } + + private void assertExpectedErrors( String testCase, Map<String, List<ErrorMessage>> errors, int expectedErrors){ + if(expectedErrors > 0){ + List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE); + assertTrue(testCase, errorMessages.size() == expectedErrors); + }else{ + assertTrue(testCase,errors.size() == expectedErrors); + } + } +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/TestConstants.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/TestConstants.java new file mode 100644 index 0000000000..0a88ebc37d --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/TestConstants.java @@ -0,0 +1,25 @@ +package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation; + +class TestConstants { + + + public static final String SAMPLE_DEFINITION_IMPORT_FILE_PATH = "Definitions/etsi_nfv_sol001_pnfd_2_5_1_types.yaml"; + public static final String SAMPLE_SOURCE = "Artifacts/Deployment/Events/RadioNode_pnf_v1.yaml"; + public static final String SAMPLE_DEFINITION_FILE_PATH = "/validation.files/definition/sampleDefinitionFile.yaml"; + public static final String SAMPLE_MANIFEST_FILE_PATH = "/validation.files/manifest/sampleManifest.mf"; + + public static final String ENTRY_DEFINITIONS = "Entry-Definitions"; + public static final String ENTRY_MANIFEST = "Entry-Manifest"; + public static final String ENTRY_CHANGE_LOG = "Entry-Change-Log"; + + public static final String ENTRY_SEPARATOR = ":"; + + public static final String TOSCA_DEFINITION_FILEPATH = "Definitions/MainServiceTemplate.yaml"; + public static final String TOSCA_MANIFEST_FILEPATH = "Definitions/MainServiceTemplate.mf"; + public static final String TOSCA_CHANGELOG_FILEPATH = "Artifacts/changeLog.text"; + public static final String TOSCA_METADATA_FILEPATH = "TOSCA-Metadata/TOSCA.meta"; + + private TestConstants(){ + + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactoryTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactoryTest.java new file mode 100644 index 0000000000..287662283c --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorFactoryTest.java @@ -0,0 +1,88 @@ +package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.core.utilities.file.FileContentHandler; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.TestConstants.ENTRY_CHANGE_LOG; +import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.TestConstants.ENTRY_DEFINITIONS; +import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.TestConstants.ENTRY_MANIFEST; +import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.TestConstants.ENTRY_SEPARATOR; +import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.TestConstants.TOSCA_CHANGELOG_FILEPATH; +import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.TestConstants.TOSCA_DEFINITION_FILEPATH; +import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.TestConstants.TOSCA_MANIFEST_FILEPATH; +import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.TestConstants.TOSCA_METADATA_FILEPATH; + +public class ValidatorFactoryTest { + + private String metaFile; + private FileContentHandler handler; + + @Before + public void setUp(){ + handler = new FileContentHandler(); + metaFile = + "TOSCA-Meta-File-Version: 1.0\n" + + "CSAR-Version: 1.1\n" + + "Created-by: Bilal Iqbal\n"; + } + + @Test(expected = IOException.class) + public void testGivenEmptyMetaFile_thenIOExceptionIsThrown() throws IOException{ + handler.addFile(TOSCA_METADATA_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_DEFINITION_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + + ValidatorFactory.getValidator(handler); + } + + @Test + public void testGivenEmptyBlock0_thenONAPCsarValidatorIsReturned() throws IOException{ + handler.addFile(TOSCA_METADATA_FILEPATH, " ".getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_DEFINITION_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + + assertEquals(ONAPCsarValidator.class, ValidatorFactory.getValidator(handler).getClass()); + } + + + @Test + public void testGivenNonSOL004MetaDirectoryCompliantMetaFile_thenONAPCSARValidatorIsReturned() throws IOException{ + metaFile = metaFile + + ENTRY_DEFINITIONS + ENTRY_SEPARATOR + TOSCA_DEFINITION_FILEPATH; + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + + assertEquals(ONAPCsarValidator.class, ValidatorFactory.getValidator(handler).getClass()); + } + + @Test + public void testGivenSOL004MetaDirectoryCompliantMetafile_thenONAPCsarValidatorIsReturned() throws IOException{ + + metaFile = metaFile + + ENTRY_DEFINITIONS + ENTRY_SEPARATOR + TOSCA_DEFINITION_FILEPATH + "\n" + + ENTRY_MANIFEST + ENTRY_SEPARATOR + TOSCA_MANIFEST_FILEPATH + "\n" + + ENTRY_CHANGE_LOG + ENTRY_SEPARATOR + TOSCA_CHANGELOG_FILEPATH + "\n"; + handler.addFile(TOSCA_METADATA_FILEPATH, metaFile.getBytes(StandardCharsets.UTF_8)); + + assertEquals(SOL004MetaDirectoryValidator.class, ValidatorFactory.getValidator(handler).getClass()); + } + + @Test + public void testGivenMultiBlockMetadataWithSOL00CompliantMetaFile_thenSOL004MetaDirectoryValidatorReturned() throws IOException { + + handler.addFile(TOSCA_METADATA_FILEPATH, ValidatorUtil.getFileResource("/validation.files/metafile/metaFileWithMultipleBlocks.meta")); + handler.addFile(TOSCA_DEFINITION_FILEPATH, "".getBytes()); + handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + handler.addFile(TOSCA_MANIFEST_FILEPATH, "".getBytes(StandardCharsets.UTF_8)); + + assertEquals(SOL004MetaDirectoryValidator.class, ValidatorFactory.getValidator(handler).getClass()); + + } + +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorUtil.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorUtil.java new file mode 100644 index 0000000000..91e3807a79 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/ValidatorUtil.java @@ -0,0 +1,22 @@ +package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation; + +import org.apache.commons.io.IOUtils; + +import java.io.IOException; +import java.io.InputStream; + +/** + * Provides util methods for Validation Test classes. + */ + +class ValidatorUtil { + + private ValidatorUtil(){ + + } + + public static byte[] getFileResource(String filePath) throws IOException{ + InputStream inputStream = ClassLoader.class.getClass().getResourceAsStream(filePath); + return IOUtils.toByteArray(inputStream); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/definitionFileWithInvalidImport.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/definitionFileWithInvalidImport.yaml new file mode 100644 index 0000000000..432a86a985 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/definitionFileWithInvalidImport.yaml @@ -0,0 +1,6 @@ +tosca_definitions_version: tosca_simple_yaml_1_2 + +description: example definition file for testing + +imports: + - file: diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/definitionFileWithValidImports.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/definitionFileWithValidImports.yaml new file mode 100644 index 0000000000..392a568c82 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/definitionFileWithValidImports.yaml @@ -0,0 +1,15 @@ +tosca_definitions_version: tosca_simple_yaml_1_2 + +description: example definition file for testing + +imports: + - etsi_nfv_sol001_pnfd_2_5_1_types.yaml + - file: etsi_nfv_sol001_pnfd_2_5_1_types.yaml + - repository: <some_repository> + - namespace_uri: <some_namespace_uri> + - definitionFile3: etsi_nfv_sol001_pnfd_2_5_1_types.yaml + - definitionFile4: etsi_nfv_sol001_pnfd_2_5_1_types.yaml + - definitionFile5: + file: etsi_nfv_sol001_pnfd_2_5_1_types.yaml + - definitionFile6: + file: etsi_nfv_sol001_pnfd_2_5_1_types.yaml
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/invalidDefinitionFile.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/invalidDefinitionFile.yaml new file mode 100644 index 0000000000..6a2df5ec70 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/invalidDefinitionFile.yaml @@ -0,0 +1,49 @@ +tosca_definitions_version: tosca_simple_profile_yaml_1_1 +description: Sample yaml definition file for validation purpose + +node_types: + MyCompany.MyVnf.1_0.1_0: # node type of MyVnf + derived_from: tosca.nodes.nfv.VNF # this line has invalid tabbing + properties: + descriptor_id: + type: string + constraints: [ valid_values: [ b1bb0ce7-ebca-4fa7-95ed-4840d70a1177 ] ] + default: b1bb0ce7-ebca-4fa7-95ed-4840d70a1177 + provider: + type: string + constraints: [ valid_values: [ MyCompany ] ] + default: MyCompany + product_name: + type: string + constraints: [ valid_values: [ MyVnf ] ] + default: Myvnf + software_version: + type: string + constraints: [ valid_values: [ '1.0' ] ] + default: '1.0' + descriptor_version: + type: string + constraints: [ valid_values: [ '1.0' ] ] + default: '1.0' + flavour_id: + type: string + constraints: [ valid_values: [ simple ] ] #only one and only allowed one DF in this example + default: simple + flavour_description: + type: string + vnfm_info: + type: list + interfaces: + Nfv: + instantiate: + inputs: + parameter_1: + type: string + required: false + default: value_1 + parameter_2: + type: string + required: false + default: value_2 + terminate: + implementation: terminate.workbook.mistral.yaml
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/sampleDefinitionFile.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/sampleDefinitionFile.yaml new file mode 100644 index 0000000000..cab7950763 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/sampleDefinitionFile.yaml @@ -0,0 +1,4 @@ +tosca_definitions_version: tosca_simple_yaml_1_2 + +description: example definition file for testing + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/sampleDefinitionFile1.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/sampleDefinitionFile1.yaml new file mode 100644 index 0000000000..3187f4f292 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/sampleDefinitionFile1.yaml @@ -0,0 +1,7 @@ +tosca_definitions_version: tosca_simple_yaml_1_2 + +description: example definition file for testing + +imports: + - etsi_nfv_sol001_pnfd_2_5_1_types.yaml + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/sampleDefinitionFile2.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/sampleDefinitionFile2.yaml new file mode 100644 index 0000000000..0b7f774140 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/sampleDefinitionFile2.yaml @@ -0,0 +1,7 @@ +tosca_definitions_version: tosca_simple_yaml_1_2 + +description: example definition file for testing + +imports: + - etsi_nfv_sol001_pnfd_2_5_2_types.yaml + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/sampleDefinitionFile3.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/sampleDefinitionFile3.yaml new file mode 100644 index 0000000000..4df199d767 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/definition/sampleDefinitionFile3.yaml @@ -0,0 +1,6 @@ +tosca_definitions_version: tosca_simple_yaml_1_2 + +description: example definition file for testing + +imports: + - etsi_nfv_sol001_pnfd_2_5_1_types.yaml
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/invalidManifest.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/invalidManifest.mf new file mode 100644 index 0000000000..08e211c8d8 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/invalidManifest.mf @@ -0,0 +1,3 @@ +Source: #This should start with metadata: + + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata.mf new file mode 100644 index 0000000000..53395c9f34 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata.mf @@ -0,0 +1,7 @@ +metadata: + pnf_product_name: RadioNode + vnf_provider_id: Bilal Iqbal + pnf_package_version: 1.0 + vnf_release_date_time: 2019-12-14T11:25:00+00:00 + +Source: Definitions/MainServiceTemplate.yaml
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata2.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata2.mf new file mode 100644 index 0000000000..64fcdc247b --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata2.mf @@ -0,0 +1,7 @@ +metadata: + invalid_product_name: RadioNode + invalid_provider_id: Bilal Iqbal + invalid_package_version: 1.0 + invalid_release_date_time: 2019-12-14T11:25:00+00:00 + +Source: Definitions/MainServiceTemplate.yaml
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata3.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata3.mf new file mode 100644 index 0000000000..ea92856e43 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata3.mf @@ -0,0 +1,11 @@ +metadata: + pnf_product_name: RadioNode + pnf_provider_id: Bilal Iqbal + pnf_package_version: 1.0 + pnf_release_date_time: 2019-12-14T11:25:00+00:00 + vnf_product_name: RadioNode + vnf_provider_id: Bilal Iqbal + vnf_package_version: 1.0 + vnf_release_date_time: 2019-12-14T11:26:00+00:00 + +Source: Definitions/MainServiceTemplate.yaml
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata4.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata4.mf new file mode 100644 index 0000000000..bce6beef01 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata4.mf @@ -0,0 +1,5 @@ +metadata: + pnf_product_name: RadioNode + pnf_release_date_time: 2019-12-14T11:25:00+00:00 + +Source: Definitions/MainServiceTemplate.yaml
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata5.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata5.mf new file mode 100644 index 0000000000..aabbd470f7 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata5.mf @@ -0,0 +1,4 @@ +metadata: + vnf_product_name: RadioNode + +Source: Definitions/MainServiceTemplate.yaml
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/sampleManifest.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/sampleManifest.mf new file mode 100644 index 0000000000..a7aebd6cae --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/sampleManifest.mf @@ -0,0 +1,7 @@ +metadata: + vnf_product_name: RadioNode + vnf_provider_id: Bilal Iqbal + vnf_package_version: 1.0 + vnf_release_date_time: 2019-12-14T11:25:00+00:00 + +Source: Definitions/MainServiceTemplate.yaml
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/sampleManifest2.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/sampleManifest2.mf new file mode 100644 index 0000000000..cfdf539be5 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/sampleManifest2.mf @@ -0,0 +1,7 @@ +metadata: + pnf_product_name: RadioNode + pnf_provider_id: Bilal Iqbal + pnf_package_version: 1.0 + pnf_release_date_time: 2019-12-14T11:25:00+00:00 + +Source: Definitions/MainServiceTemplate.yaml
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/validManifest.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/validManifest.mf new file mode 100644 index 0000000000..f34feafdf7 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/validManifest.mf @@ -0,0 +1,11 @@ +metadata: + pnf_product_name: RadioNode + pnf_provider_id: Bilal Iqbal + pnf_package_version: 1.0 + pnf_release_date_time: 2019-12-14T11:25:00+00:00 + +Source: Artifacts/Deployment/Events/RadioNode_pnf_v1.yaml + +non_mano_artifact_sets: + onap_pm_events: + Source: Artifacts/Deployment/Measurements/PM_Dictionary.yaml
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/metafile/metaFileWithMultipleBlocks.meta b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/metafile/metaFileWithMultipleBlocks.meta new file mode 100644 index 0000000000..38440a2133 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/metafile/metaFileWithMultipleBlocks.meta @@ -0,0 +1,10 @@ +TOSCA-Meta-File-Version: 1.0 +CSAR-Version: 1.1 +Created-by: Bilal Iqbal +Entry-Definitions: Definitions/MainServiceTemplate.yml +Entry-Manifest: Definitions/MainServiceTemplate.mf +Entry-Change-Log: Definitions/changeLog.text + +Entry-Definitions: Definitions/MainServiceTemplate2.yml +Entry-Manifest: Definitions/MainServiceTemplate2.mf +Entry-Change-Log: Definitions/changeLog2.text
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/metafile/nonSOL004WithMetaDirectoryCompliantMetaFile.meta b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/metafile/nonSOL004WithMetaDirectoryCompliantMetaFile.meta new file mode 100644 index 0000000000..eea0795386 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/metafile/nonSOL004WithMetaDirectoryCompliantMetaFile.meta @@ -0,0 +1,4 @@ +TOSCA-Meta-File-Version: 1.0 +CSAR-Version: 1.1 +Created-by: Bilal Iqbal +Entry-Definitions: Definitions/MainServiceTemplate.yaml |