aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test
diff options
context:
space:
mode:
authorshrek2000 <orenkle@amdocs.com>2017-09-11 15:45:37 +0300
committershrek2000 <orenkle@amdocs.com>2017-09-12 10:38:35 +0300
commitc8a540b3c234449163f6fb1899807bba951113b4 (patch)
treea8aae0dd0f6a0feb27369914e9e3fa321740e7ed /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test
parent82d454fd3e8c9fdf66517d01a99019a379dbfdb6 (diff)
Create new VSP, onboard from TOSCA file - UI
Change-Id: I018c6d07a4b9ec7e6b1507ab37e2550865423cfe Issue-ID: SDC-230 Signed-off-by: shrek2000 <orenkle@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImplTest.java8
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java188
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java139
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java58
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java221
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmock.csarbin0 -> 4211 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockBrokenMF.csarbin0 -> 4022 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail1.csarbin0 -> 4372 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail2.csarbin0 -> 3263 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail3.csarbin0 -> 4521 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf11
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf18
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf12
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf15
16 files changed, 421 insertions, 261 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java
index 948d46ba10..3e42a23c6a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java
@@ -48,7 +48,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.Com
import org.openecomp.sdc.versioning.dao.types.Version;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
import java.io.InputStream;
import java.util.List;
@@ -112,7 +111,7 @@ public class QuestionnaireDataServiceTest {
public void testQuestionnaireDataAfterIllegalUpload() {
InputStream zipInputStream = uploadFileTest.getZipInputStream("/missingYml");
UploadFileResponse uploadFileResponse = candidateManager
- .upload(vspId, VERSION, zipInputStream, USER1);
+ .upload(vspId, VERSION, zipInputStream, USER1, "zip", "missingYml");
InformationArtifactData informationArtifactData = questionnaireDataService
.generateQuestionnaireDataForInformationArtifact(vspId, vspActiveVersion);
@@ -124,7 +123,7 @@ public class QuestionnaireDataServiceTest {
InputStream zipInputStream = uploadFileTest.getZipInputStream(filePath);
UploadFileResponse uploadFileResponse = candidateManager
.upload(vspId, VERSION,
- zipInputStream, USER1);
+ zipInputStream, USER1,"zip", "file");
candidateManager.process(vspId, VERSION, USER1);
Assert.assertTrue(MapUtils.isEmpty(
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImplTest.java
index e6d06f2e2c..252e152740 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImplTest.java
@@ -6,6 +6,7 @@ import org.mockito.MockitoAnnotations;
import org.openecomp.core.model.dao.ServiceModelDao;
import org.openecomp.core.model.types.ServiceElement;
import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.healing.api.HealingManager;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
@@ -23,7 +24,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.utils.ZipFileUtils;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -90,7 +90,7 @@ public class OrchestrationTemplateCandidateManagerImplTest {
doReturn("{}").when(candidateServiceMock).createManifest(anyObject(), anyObject());
doReturn(Optional.empty()).when(candidateServiceMock)
- .fetchZipFileByteArrayInputStream(anyObject(), anyObject(), anyObject(), anyObject());
+ .fetchZipFileByteArrayInputStream(anyObject(), anyObject(), anyObject(), OnboardingTypesEnum.ZIP, anyObject());
OrchestrationTemplateActionResponse response =
@@ -123,7 +123,7 @@ public class OrchestrationTemplateCandidateManagerImplTest {
UploadFileResponse uploadFileResponse = candidateManager
.upload(VSP_ID, VERSION01, new ZipFileUtils().getZipInputStream("/legalUploadWithWarning"),
- USER1);
+ USER1, "zip", "legalUploadWithWarning");
Assert.assertTrue(uploadFileResponse.getStatus() == UploadFileStatus.Success);
Assert.assertTrue(
uploadFileResponse.getErrors().get("uploadFile").get(0).getLevel() == ErrorLevel.WARNING);
@@ -136,7 +136,7 @@ public class OrchestrationTemplateCandidateManagerImplTest {
public void testUploadWithManifest() {
UploadFileResponse uploadFileResponse = candidateManager
.upload(VSP_ID, VERSION01, new ZipFileUtils().getZipInputStream("/legalUploadWithWarning"),
- USER1);
+ USER1, "zip", "legalUploadWithWarning");
Assert.assertTrue(uploadFileResponse.getStatus() == UploadFileStatus.Success);
Assert.assertTrue(
uploadFileResponse.getErrors().get("uploadFile").get(0).getLevel() == ErrorLevel.WARNING);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
index 4ead8a57d2..e0e00f8d9d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
@@ -39,7 +39,6 @@ import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.common.errors.Messages;
-import org.openecomp.sdc.common.errors.ValidationErrorBuilder;
import org.openecomp.sdc.healing.api.HealingManager;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition;
@@ -54,14 +53,10 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
import org.openecomp.sdc.vendorsoftwareproduct.impl.mock.EnrichmentManagerFactoryImpl;
import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
@@ -92,7 +87,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -357,7 +351,7 @@ public class VendorSoftwareProductManagerImplTest {
"subCategory", "456", fgs);
List<String> updFgs = new ArrayList<String>();
- //updFgs.add("fg2");
+ updFgs.add("fg2");
VspDetails updatedVsp =
createVspDetails(VSP_ID, VERSION01, "VSP1_updated", null, "vendorName", "vlm1Id", "icon",
"category_updated",
@@ -659,7 +653,7 @@ public class VendorSoftwareProductManagerImplTest {
InputStream zis = getFileInputStream("/vspmanager/zips/missingYml.zip");
UploadFileResponse uploadFileResponse =
- candidateManager.upload(VSP_ID, VERSION01, zis, USER1);
+ candidateManager.upload(VSP_ID, VERSION01, zis, USER1, "zip", "missingYml");
Assert.assertEquals(uploadFileResponse.getErrors().size(), 0);
}
@@ -672,7 +666,7 @@ public class VendorSoftwareProductManagerImplTest {
try {
candidateManager
.upload(VSP_ID, VERSION01,
- url.openStream(), USER1);
+ url.openStream(), USER1, "zip", "notZipFile");
candidateManager.process(VSP_ID, VERSION01, USER1);
} catch (Exception ce) {
Assert.assertEquals(ce.getMessage(), Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage());
@@ -680,107 +674,7 @@ public class VendorSoftwareProductManagerImplTest {
verify(activityLogManagerMock, never()).addActionLog(any(ActivityLogEntity.class), eq(USER1));
}
-/*
- @Test
- public void testEnrichModelInSubmit() {
- UniqueValueUtil
- .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME,
- "VSP_syb");
- VspDetails vspDetails = vendorSoftwareProductManager.createVsp(
- createVspDetails(null, null, "VSP_syb", "Test-vsp_syb", "vendorName", "vlm1Id", "icon",
- "category", "subCategory", "456", null), USER1);
- String id = vspDetails.getId();
-
- //upload file
- InputStream zis = getFileInputStream("/vspmanager/zips/fullComposition.zip");
- candidateManager.upload(id, VERSION01, zis, USER1);
- OrchestrationTemplateActionResponse uploadFileResponse =
- candidateManager.process(id, VERSION01, USER1);
-
- //check in
- vendorSoftwareProductManager.checkin(id, USER1);
- //submit
- try {
- ValidationResponse result = vendorSoftwareProductManager.submit(id, USER1);
- } catch (IOException exception) {
- Assert.fail();
- }
- VersionedVendorSoftwareProductInfo details =
- vendorSoftwareProductManager.getVsp(id, null, USER1);
- Collection<ComponentEntity> components =vendorSoftwareProductManager
- .listComponents(id, details.getVersionInfo().getActiveVersion(), USER1);
-
- ToscaServiceModel model =
- (ToscaServiceModel) EnrichedServiceModelDaoFactory.getInstance().createInterface()
- .getServiceModel(id, details.getVersionInfo().getActiveVersion());
-
- Map<String, CapabilityDefinition> capabilities = new HashMap<>();
- for (ComponentEntity component : components) {
- model.getServiceTemplates().
- entrySet().
- stream().
- filter(entryValue -> entryValue.getValue() != null &&
- entryValue.getValue().getNode_types() != null &&
- entryValue.getValue().
- getNode_types().
- containsKey(component.getComponentCompositionData().getName())).
- forEach(entryValue -> entryValue.getValue().getNode_types().
- values().
- stream().
- filter(type -> MapUtils.isNotEmpty(type.getCapabilities())).
- forEach(type -> type.getCapabilities().
- entrySet().
- forEach(entry -> addCapability(entryValue.getKey(), capabilities, entry.getKey(),
- entry.getValue()))));
-
- }
-
- Assert.assertNotNull(capabilities);
- }
-
- @Test(dependsOnMethods = {"testCreatePackage"})
- public void testEnrichedFilesDeletedOnNewUpload() throws IOException {
- Version activeVersion;
- createPackageFromUpload(VSP_ID, USER1, "/fullComposition");
- activeVersion = vendorSoftwareProductManager.getVsp(VSP_ID, null, USER1).getVersionInfo()
- .getActiveVersion();
-
- List<ServiceArtifact> firstExternalArtifacts = enrichedServiceModelDaoMock
- .getExternalArtifacts(VSP_ID, activeVersion);
- ToscaServiceModel firstServiceModel = enrichedServiceModelDaoMock.getServiceModel(VSP_ID,
- activeVersion);
-
- createPackageFromUpload(VSP_ID, USER1, "/emptyComposition");
- activeVersion = vendorSoftwareProductManager.getVsp(VSP_ID, null, USER1).getVersionInfo()
- .getActiveVersion();
-
- List<ServiceArtifact> secondExternalArtifacts = enrichedServiceModelDaoMock
- .getExternalArtifacts(VSP_ID, activeVersion);
- ToscaServiceModel secondServiceModel = enrichedServiceModelDaoMock.getServiceModel(VSP_ID,
- activeVersion);
-
- Assert.assertNotEquals(firstExternalArtifacts, secondExternalArtifacts);
- Assert.assertNotEquals(firstServiceModel, secondServiceModel);
-
- }
-
- @Test(dependsOnMethods = {"testMibsDeletedInCsar"})
- public void testServiceTemplatesAreDeletedInCsarOnNewUpload() throws IOException {
- String nestedPath = "Definitions" + File.separator + "nested";
-
- uploadFileAndProcess(VSP_ID, USER1, "/vspmanager/zips/fullCompositionNested.zip");
- checkinSubmitCreatePackage(VSP_ID, USER1);
- List<String> nestedFileNamesServiceTemplates =
- getWantedFileNamesFromCsar(nestedPath);
-
- uploadFileAndProcess(VSP_ID, USER1, "/vspmanager/zips/fullComposition.zip");
- checkinSubmitCreatePackage(VSP_ID, USER1);
- List<String> emptyNestedNamesList = getWantedFileNamesFromCsar(nestedPath);
-
- Assert.assertEquals(emptyNestedNamesList.size(), 0);
- Assert.assertNotEquals(emptyNestedNamesList.size(), nestedFileNamesServiceTemplates.size());
- }*/
private List<String> getWantedFileNamesFromCsar(String pathInCsar)
throws IOException {
@@ -806,21 +700,6 @@ public class VendorSoftwareProductManagerImplTest {
return fileNames;
}
- /*
- //Disabled for sonar null pointer issue for componentEntities
- private Pair<String, String> uploadMib(String vspId, String user, String filePath,
- String fileName) {
- List<ComponentEntity> componentEntities = null;
- //(List<ComponentEntity>) vendorSoftwareProductManager.listComponents(vspId, null, user);
- monitoringUploadsManager.upload(getFileInputStream(filePath),
- fileName, vspId,
- VERSION01, componentEntities.get(0).getId(), MonitoringUploadType.SNMP_POLL, user);
- //TODO: add validate of addActionLog() func call
-
- return new ImmutablePair<>(componentEntities.get(0).getId(),
- componentEntities.get(0).getComponentCompositionData()
- .getDisplayName());
- }*/
private void createPackageFromUpload(String vspId, String user, String filePath)
throws IOException {
@@ -830,7 +709,7 @@ public class VendorSoftwareProductManagerImplTest {
private void uploadFileAndProcess(String vspId, String user, String filePath) {
vendorSoftwareProductManager.checkout(vspId, user);
- candidateManager.upload(vspId, VERSION01, getFileInputStream(filePath), user);
+ candidateManager.upload(vspId, VERSION01, getFileInputStream(filePath), user, "zip", "file");
candidateManager.process(vspId, VERSION01, user);
}
@@ -888,7 +767,7 @@ public class VendorSoftwareProductManagerImplTest {
*/
private void testLegalUpload(String vspId, Version version, InputStream upload, String user) {
- candidateManager.upload(vspId, VERSION01, upload, USER1);
+ candidateManager.upload(vspId, VERSION01, upload, USER1, "zip", "file");
candidateManager.process(vspId, VERSION01, user);
UploadDataEntity uploadData =
@@ -919,23 +798,6 @@ public class VendorSoftwareProductManagerImplTest {
}
- // private void assertInfoArtifactIsInRightPathInCsar(String vspId, String zipFileName)
-// throws IOException {
-// ZipInputStream inputZipStream = new ZipInputStream(new FileInputStream(new File(zipFileName)));
-// boolean isInfoArtifactInZip = false;
-//
-// ZipEntry zipEntry;
-// while ((zipEntry = inputZipStream.getNextEntry()) != null) {
-// String currentEntryName = zipEntry.getName();
-// if(currentEntryName.equals("Artifacts\\Informative\\Guide\\VSP_" +
-// vspId + "_Information.txt")){
-// isInfoArtifactInZip = true;
-// break;
-// }
-// }
-//
-// Assert.assertTrue(isInfoArtifactInZip);
-// }
static VspDetails createVspDetails(String id, Version version, String name, String desc,
String vendorName, String vlm, String icon,
String category, String subCategory,
@@ -969,45 +831,7 @@ public class VendorSoftwareProductManagerImplTest {
Assert.assertEquals(actual.getFeatureGroups(), expected.getFeatureGroups());
}
-
-// @Test
-// public void testDownloadFile() throws IOException {
-// VspDetails expectedVsp = VSPCommon.createVspDetails(null, null, String.format("VSP-test-%s", vlm1Id), "Test-vsp", "vendorName", "vlm1Id", "icon", "category", "subCategory", "123", null);
-// VspDetails createdVsp = vendorSoftwareProductManager.createVsp(expectedVsp, USER1);
-//
-// id005 = createdVsp.getId();
-// Assert.assertNotNull(id005);
-// Assert.assertNotNull(createdVsp.getVersion());
-//
-// try (InputStream zipInputStream = new ZipFileUtils().getZipInputStream("/legalUploadWithWarning")) {
-//
-// UploadFileResponse uploadFileResponse = vendorSoftwareProductManager.upload(id005, zipInputStream, USER1);
-// vendorSoftwareProductManager.process(id005, USER1);
-// Optional<File> fileCandidate = vendorSoftwareProductManager.get(id005, USER1);
-//
-// File latestHeatPackage = fileCandidate.get();
-//
-// zipInputStream.reset();
-// byte[] uploaded = IOUtils.toByteArray(zipInputStream);
-//
-// Optional<FileContentHandler> zipContentMap = vendorSoftwareProductManager.getZipContentMap(uploadFileResponse, uploaded);
-// FileContentHandler fileContentHandler = new FileContentHandler();
-// if(zipContentMap.isPresent()){
-// fileContentHandler = zipContentMap.get();
-// }
-//
-// uploaded = IOUtils.toByteArray(fileContentHandler.getFiles().values());
-//
-// byte[] downloaded;
-// try (BufferedInputStream fileStream = new BufferedInputStream(new FileInputStream(latestHeatPackage))) {
-// downloaded = IOUtils.toByteArray(fileStream);
-// }
-//
-// Assert.assertTrue(Arrays.equals(uploaded, downloaded));
-// }
-// }
-
- // todo ********************** move to common **************************************
+ // todo ********************** move to common **************************************
private void mockVersioning(VersionableEntityAction action) {
VersionInfo versionInfo = new VersionInfo();
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java
index 236b7e7594..dfb7409bd0 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java
@@ -27,6 +27,7 @@ import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.openecomp.core.model.dao.ServiceModelDao;
import org.openecomp.core.model.types.ServiceElement;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.healing.api.HealingManager;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
@@ -37,92 +38,86 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.impl.OrchestrationTemplateCandidateManagerImpl;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
-import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
import org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructuremodule.CandidateServiceImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
import org.openecomp.sdc.vendorsoftwareproduct.utils.VSPCommon;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import java.net.URL;
import java.util.zip.ZipOutputStream;
import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doReturn;
+import static org.testng.Assert.assertEquals;
public class UploadFileTest {
- private static final String USER1 = "vspTestUser1";
-
- public static final Version VERSION01 = new Version(0, 1);
- @Mock
- private VendorSoftwareProductDao vendorSoftwareProductDaoMock;
- @Mock
- private OrchestrationTemplateDao orchestrationTemplateDataDaoMock;
- @Spy
- private CandidateServiceImpl candidateService;
- @Mock
- private HealingManager healingManagerMock;
- @Mock
- private CompositionDataExtractor compositionDataExtractorMock;
- @Mock
- private ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDaoMock;
- @Mock
- private CompositionEntityDataManager compositionEntityDataManagerMock;
- @Mock
- private VendorSoftwareProductInfoDao vspInfoDaoMock;
-
- @InjectMocks
- private OrchestrationTemplateCandidateManagerImpl candidateManager;
-
- private static String vlm1Id;
- public static String id001 = null;
- public static String id002 = null;
-
- public static Version activeVersion002 = null;
-
-
- @BeforeMethod
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void testUploadFile() {
- VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
- doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
- candidateManager.upload(id001, activeVersion002, getZipInputStream("/legalUpload"), USER1);
- }
-
-
- private void testLegalUpload(String vspId, Version version, InputStream upload, String user) {
- candidateManager.upload(vspId, activeVersion002, upload, user);
-
- UploadDataEntity uploadData =
- orchestrationTemplateDataDaoMock.getOrchestrationTemplate(vspId, version);
-
- }
-
- public InputStream getZipInputStream(String name) {
- URL url = this.getClass().getResource(name);
- File templateDir = new File(url.getFile());
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ZipOutputStream zos = new ZipOutputStream(baos);
-
- VSPCommon.zipDir(templateDir, "", zos, true);
- try {
- zos.close();
- } catch (IOException e) {
- e.printStackTrace();
+ private static final String USER1 = "vspTestUser1";
+
+ public static final Version VERSION01 = new Version(0, 1);
+ @Mock
+ private VendorSoftwareProductDao vendorSoftwareProductDaoMock;
+ @Mock
+ private OrchestrationTemplateDao orchestrationTemplateDataDaoMock;
+ @Spy
+ private CandidateServiceImpl candidateService;
+ @Mock
+ private HealingManager healingManagerMock;
+ @Mock
+ private CompositionDataExtractor compositionDataExtractorMock;
+ @Mock
+ private ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDaoMock;
+ @Mock
+ private CompositionEntityDataManager compositionEntityDataManagerMock;
+ @Mock
+ private VendorSoftwareProductInfoDao vspInfoDaoMock;
+
+ @InjectMocks
+ private OrchestrationTemplateCandidateManagerImpl candidateManager;
+
+ private static String vlm1Id;
+ public static String id001 = null;
+ public static String id002 = null;
+
+ public static Version activeVersion002 = null;
+
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testUploadFile() {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+ candidateManager.upload(id001, activeVersion002, getZipInputStream("/legalUpload"), USER1, OnboardingTypesEnum.ZIP.toString(), "legalUpload");
+ }
+
+
+ private void testLegalUpload(String vspId, Version version, InputStream upload, String user) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(vspId, activeVersion002,
+ upload, user, OnboardingTypesEnum.ZIP.toString(),"file" );
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.ZIP);
+ UploadDataEntity uploadData =
+ orchestrationTemplateDataDaoMock.getOrchestrationTemplate(vspId, version);
+
+ }
+
+ public InputStream getZipInputStream(String name) {
+ URL url = this.getClass().getResource(name);
+ File templateDir = new File(url.getFile());
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try (ZipOutputStream zos = new ZipOutputStream(baos)) {
+ VSPCommon.zipDir(templateDir, "", zos, true);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return new ByteArrayInputStream(baos.toByteArray());
}
- return new ByteArrayInputStream(baos.toByteArray());
- }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java
new file mode 100644
index 0000000000..3332e81e36
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java
@@ -0,0 +1,58 @@
+package org.openecomp.sdc.vendorsoftwareproduct.upload.csar;
+
+import org.junit.Test;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.OnboardingManifest;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.*;
+
+public class ManifestParsingTest {
+
+ @Test
+ public void testSuccessfulParsing() throws IOException {
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/manifest/ValidTosca.mf")) {
+ OnboardingManifest onboardingManifest = new OnboardingManifest(is);
+ assertTrue(onboardingManifest.isValid());
+ assertEquals(onboardingManifest.getMetadata().size(), 4);
+ assertEquals(onboardingManifest.getSources().size(), 5);
+ }
+ }
+
+ @Test
+ public void testNoMetadataParsing() throws IOException {
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca1.mf")) {
+ OnboardingManifest onboardingManifest = new OnboardingManifest(is);
+ assertFalse(onboardingManifest.isValid());
+ assertTrue(onboardingManifest.getErrors().stream().
+ filter(error -> error.contains(Messages.MANIFEST_INVALID_LINE.getErrorMessage().substring(0, 10)))
+ .findAny().isPresent());
+ }
+ }
+
+ @Test
+ public void testBrokenMDParsing() throws IOException {
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca2.mf")) {
+ OnboardingManifest onboardingManifest = new OnboardingManifest(is);
+ assertFalse(onboardingManifest.isValid());
+ assertTrue(onboardingManifest.getErrors().stream().
+ filter(error -> error.contains(Messages.MANIFEST_INVALID_LINE.getErrorMessage().substring(0, 10)))
+ .findAny().isPresent());
+ }
+ }
+
+ @Test
+ public void testNoMetaParsing() throws IOException {
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca4.mf")) {
+ OnboardingManifest onboardingManifest = new OnboardingManifest(is);
+ assertFalse(onboardingManifest.isValid());
+ assertTrue(onboardingManifest.getErrors().stream().
+ filter(error -> error.contains(Messages.MANIFEST_NO_METADATA.getErrorMessage().substring(0, 10)))
+ .findAny().isPresent());
+ }
+ }
+
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java
new file mode 100644
index 0000000000..a7fc0e1ba0
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java
@@ -0,0 +1,221 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.vendorsoftwareproduct.upload.csar;
+
+
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.openecomp.core.model.dao.ServiceModelDao;
+import org.openecomp.core.model.types.ServiceElement;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.healing.api.HealingManager;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.OrchestrationTemplateCandidateManagerImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
+import org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructuremodule.CandidateServiceImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructuremodule.ManifestCreatorNamingConventionImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.List;
+import java.util.function.Predicate;
+
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doReturn;
+
+public class UploadCSARFileTest {
+ private static final String USER1 = "vspTestUser1";
+
+ public static final Version VERSION01 = new Version(0, 1);
+
+ @Mock
+ private VendorSoftwareProductDao vendorSoftwareProductDaoMock;
+ @Mock
+ private OrchestrationTemplateDao orchestrationTemplateDataDaoMock;
+
+ @Spy
+ private CandidateServiceImpl candidateService;
+ @Mock
+ private HealingManager healingManagerMock;
+ @Mock
+ private CompositionDataExtractor compositionDataExtractorMock;
+ @Mock
+ private ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDaoMock;
+ @Mock
+ private CompositionEntityDataManager compositionEntityDataManagerMock;
+ @Mock
+ private VendorSoftwareProductInfoDao vspInfoDaoMock;
+ @Mock
+ private OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDao;
+ @Mock
+ private ManifestCreatorNamingConventionImpl manifestCreator;
+
+ private OrchestrationTemplateCandidateManagerImpl candidateManager;
+
+
+ public static String id001 = null;
+
+ public static Version activeVersion002 = null;
+
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ candidateService = new CandidateServiceImpl(manifestCreator,orchestrationTemplateCandidateDao);
+ candidateManager = new OrchestrationTemplateCandidateManagerImpl( vendorSoftwareProductDaoMock,
+ vspInfoDaoMock,
+ orchestrationTemplateDataDaoMock,
+ candidateService, healingManagerMock,
+ compositionDataExtractorMock,
+ serviceModelDaoMock,
+ compositionEntityDataManagerMock,
+ null,
+ null,
+ null,
+ null,
+ null);
+ }
+
+ @Test
+ public void testSuccessfulUploadFile() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/SDCmock.csar")) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001, activeVersion002, is, USER1, "csar", "SDCmock");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertEquals(0, uploadFileResponse.getErrors().size());
+ assertTrue(uploadFileResponse.getErrors().isEmpty());
+ }
+ }
+
+ @Test
+ public void testFail1UploadFile() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/SDCmockFail1.csar")) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001, activeVersion002, is, USER1,
+ "csar", "SDCmockFail1");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertEquals(1, uploadFileResponse.getErrors().size());
+ assertTrue( uploadFileResponse.getErrors().values().stream()
+ .filter(getListPredicate(Messages.CSAR_FILES_NOT_ALLOWED
+ .getErrorMessage().substring(0, 7))).findAny().isPresent());
+ }
+ }
+
+ private Predicate<List<ErrorMessage>> getListPredicate(String substring) {
+ return error -> isEquals(substring, error);
+ }
+
+ private boolean isEquals(String substring, List<ErrorMessage> error) {
+ return error.iterator().next().getMessage().contains(substring);
+ }
+
+ @Test
+ public void testFail2UploadFile() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/SDCmockFail2.csar")) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001, activeVersion002, is, USER1,
+ "csar", "SDCmockFail2");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertEquals(1, uploadFileResponse.getErrors().size());
+ assertTrue( uploadFileResponse.getErrors().values().stream()
+ .filter(getListPredicate(Messages.CSAR_FILE_NOT_FOUND
+ .getErrorMessage().substring(0,7))).findAny().isPresent());
+ }
+ }
+ @Test
+ public void testFail3UploadFile() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/SDCmockFail3.csar")) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001, activeVersion002, is, USER1,
+ "csar", "SDCmockFail3");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertEquals(1, uploadFileResponse.getErrors().size());
+ }
+ }
+
+ @Test
+ public void testUploadFileIsNotZip() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = new ByteArrayInputStream( "Thia is not a zip file".getBytes() );) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001, activeVersion002, is, USER1,
+ "csar", "file");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertFalse(uploadFileResponse.getErrors().isEmpty());
+ assertTrue( uploadFileResponse.getErrors().values().stream()
+ .filter(getListPredicate(Messages.CSAR_FILE_NOT_FOUND
+ .getErrorMessage().substring(0,7))).findAny().isPresent());
+ }
+ }
+ @Test
+ public void testUploadFileIsEmpty() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = new ByteArrayInputStream( new byte[]{} )) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001,
+ activeVersion002, is, USER1, "csar", "file");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertEquals(1, uploadFileResponse.getErrors().size());
+ }
+ }
+
+ @Test
+ public void testMFError() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/SDCmockBrokenMF.csar")) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001, activeVersion002, is, USER1, "csar", "SDCmockBrokenMF");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertEquals(1, uploadFileResponse.getErrors().size());
+ assertTrue( uploadFileResponse.getErrors()
+ .values().stream()
+ .filter(getListPredicate(Messages.MANIFEST_NO_METADATA.getErrorMessage())).findAny().isPresent());
+
+ }
+ }
+
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmock.csar b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmock.csar
new file mode 100644
index 0000000000..f69efd2bb8
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmock.csar
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockBrokenMF.csar b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockBrokenMF.csar
new file mode 100644
index 0000000000..02593a1d2f
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockBrokenMF.csar
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail1.csar b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail1.csar
new file mode 100644
index 0000000000..5e3ee6f387
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail1.csar
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail2.csar b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail2.csar
new file mode 100644
index 0000000000..4874578ad9
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail2.csar
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail3.csar b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail3.csar
new file mode 100644
index 0000000000..c009a042e4
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail3.csar
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf
new file mode 100644
index 0000000000..f28014e2d6
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf
@@ -0,0 +1,11 @@
+
+
+source: MainServiceTemplate.yaml
+
+source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
+
+source: Artifacts/install.sh
+
+source: Artifacts/create_stack.sh
+
+source: Licenses/license.xml
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf
new file mode 100644
index 0000000000..95f7a41d68
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf
@@ -0,0 +1,18 @@
+metadata:
+ vnf_product_name: Mock
+ vnf_provider_id: ZTE
+
+source: MainServiceTemplate.yaml
+
+ vnf_package_version: 1.0
+ vnf_release_data_time: 2017.01.01T10:00+03:00
+
+
+
+source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
+
+source: Artifacts/install.sh
+
+source: Artifacts/create_stack.sh
+
+source: Licenses/license.xml
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf
new file mode 100644
index 0000000000..64e9445f7f
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf
@@ -0,0 +1,7 @@
+metadata:
+ vnf_product_name: Mock
+ vnf_provider_id: ZTE
+ vnf_package_version: 1.0
+ vnf_release_data_time: 2017.01.01T10:00+03:00
+
+
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf
new file mode 100644
index 0000000000..a563ddd581
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf
@@ -0,0 +1,12 @@
+metadata:
+
+
+source: MainServiceTemplate.yaml
+
+source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
+
+source: Artifacts/install.sh
+
+source: Artifacts/create_stack.sh
+
+source: Licenses/license.xml
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf
new file mode 100644
index 0000000000..88c67517ce
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf
@@ -0,0 +1,15 @@
+metadata:
+ vnf_product_name: Mock
+ vnf_provider_id: ZTE
+ vnf_package_version: 1.0
+ vnf_release_data_time: 2017.01.01T10:00+03:00
+
+source: MainServiceTemplate.yaml
+
+source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
+
+source: Artifacts/install.sh
+
+source: Artifacts/create_stack.sh
+
+source: Licenses/license.xml