summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java33
1 files changed, 31 insertions, 2 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("{}")