summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test
diff options
context:
space:
mode:
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/impl/VendorSoftwareProductManagerImplTest.java33
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestInvalidMetadata4.mf4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/sampleManifest2.mf8
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/validManifest.mf8
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidNonManoToscaPNF.mf7
5 files changed, 48 insertions, 12 deletions
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 3900059234..e53642dc74 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
@@ -35,6 +35,7 @@ import org.openecomp.core.model.types.ServiceElement;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
@@ -84,6 +85,8 @@ import java.util.Optional;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyObject;
@@ -159,7 +162,7 @@ public class VendorSoftwareProductManagerImplTest {
}
@Test
- public void testCreatePackageEtsi(){
+ public void testCreatePackageEtsiVNF(){
try(InputStream metadataInput = getClass().getResourceAsStream("/vspmanager.csar/metadata/ValidETSItosca.meta");
InputStream manifestInput = getClass().getResourceAsStream("/vspmanager.csar/manifest/ValidNonManoTosca.mf")) {
@@ -176,7 +179,8 @@ public class VendorSoftwareProductManagerImplTest {
when(vspInfoDaoMock.get(any())).thenReturn(vsp);
when(licenseArtifactsServiceMock.createLicenseArtifacts(any(),any(), any(), any())).thenReturn(new FileContentHandler());
- vendorSoftwareProductManager.createPackage("0", new Version());
+ PackageInfo packageInfo = vendorSoftwareProductManager.createPackage("0", new Version());
+ assertEquals(packageInfo.getResourceType(), ResourceTypeEnum.VF.name());
} catch (IOException e) {
fail();
}
@@ -204,6 +208,31 @@ public class VendorSoftwareProductManagerImplTest {
}
@Test
+ public void testCreatePackageEtsiPNF(){
+ try(InputStream metadataInput = getClass().getResourceAsStream("/vspmanager.csar/metadata/ValidETSItosca.meta");
+ InputStream manifestInput = getClass().getResourceAsStream("/vspmanager.csar/manifest/ValidNonManoToscaPNF.mf")) {
+
+ FileContentHandler handler = new FileContentHandler();
+ handler.addFile(TOSCA_META_PATH_FILE_NAME, IOUtils.toByteArray(metadataInput));
+ handler.addFile(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME, IOUtils.toByteArray(manifestInput));
+ ToscaServiceModel toscaMetadata = new ToscaServiceModel(handler, new HashMap<>(), "");
+ when(enrichedServiceModelDaoMock.getServiceModel(any(), any())).thenReturn(toscaMetadata );
+ VspDetails vsp =
+ createVspDetails("0", new Version(), "Vsp_PNF", "Test-vsp-pnf", "vendorName", "esy", "icon",
+ "category", "subCategory", "123", null);
+ //want to avoid triggering populateVersionsForVlm method
+ vsp.setVlmVersion(null);
+
+ when(vspInfoDaoMock.get(any())).thenReturn(vsp);
+ when(licenseArtifactsServiceMock.createLicenseArtifacts(any(),any(), any(), any())).thenReturn(new FileContentHandler());
+ PackageInfo packageInfo = vendorSoftwareProductManager.createPackage("0", new Version());
+ assertEquals(packageInfo.getResourceType(), ResourceTypeEnum.PNF.name());
+ } catch (IOException e) {
+ fail();
+ }
+ }
+
+ @Test
public void testCreate() {
//doReturn(VERSION01).when(versioningManagerMock).create(anyObject(), anyObject(), anyObject());
doReturn("{}")
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
index 04f2fa18de..b4ef43f60a 100644
--- 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
@@ -1,3 +1,3 @@
metadata:
- pnf_product_name: RadioNode
- pnf_release_date_time: 2019-12-14T11:25:00+00:00
+ pnfd_name: RadioNode
+ pnfd_release_date_time: 2019-12-14T11:25:00+00:00
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
index c6cb025038..fdeb261165 100644
--- 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
@@ -1,8 +1,8 @@
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
+ pnfd_name: RadioNode
+ pnfd_provider: Bilal Iqbal
+ pnfd_archive_version: 1.0
+ pnfd_release_date_time: 2019-12-14T11:25:00+00:00
Source: Definitions/MainServiceTemplate.yaml
Algorithm: SHA-abc
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
index f34feafdf7..6d9ea720f7 100644
--- 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
@@ -1,8 +1,8 @@
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
+ pnfd_name: RadioNode
+ pnfd_provider: Bilal Iqbal
+ pnfd_archive_version: 1.0
+ pnfd_release_date_time: 2019-12-14T11:25:00+00:00
Source: Artifacts/Deployment/Events/RadioNode_pnf_v1.yaml
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidNonManoToscaPNF.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidNonManoToscaPNF.mf
new file mode 100644
index 0000000000..bda3264f5d
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidNonManoToscaPNF.mf
@@ -0,0 +1,7 @@
+metadata:
+pnfd_name: MRF
+pnfd_provider: SunShineCompany
+pnfd_archive_version: 1.0
+pnfd_release_date_time: 2017-01-01T10:00:00+03:00
+
+Source: MainServiceTemplate.yaml \ No newline at end of file