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/ComputeManagerImplTest.java54
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java68
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java59
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java156
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java61
5 files changed, 331 insertions, 67 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java
index c8f473c8c7..103762c56d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java
@@ -140,11 +140,12 @@ public class ComputeManagerImplTest {
}
@Test
- public void testCreateManualImageWithDuplicateName() {
+ public void testCreateManualComputeWithDuplicateName() {
ComputeEntity expected = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
ComputeEntity expectedDiffName = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+ expectedDiffName.setId(COMPUTE1_ID + "Name");
ComputeData computeData = expectedDiffName.getComputeCompositionData();
computeData.setName(COMPUTE1_ID + "Name");
expectedDiffName.setComputeCompositionData(computeData);
@@ -162,6 +163,28 @@ public class ComputeManagerImplTest {
}
}
+ @Test
+ public void testCreateManualComputeWithIncorrectNameFormat() {
+ ComputeEntity expected = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+ doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+ ComputeEntity expectedDiffName = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+ ComputeData computeData = expectedDiffName.getComputeCompositionData();
+ computeData.setName(COMPUTE1_ID + "Name/*");
+ expectedDiffName.setComputeCompositionData(computeData);
+ List<ComputeEntity> vfcImageList = new ArrayList<ComputeEntity>();
+ vfcImageList.add(expectedDiffName);
+ doReturn(vfcImageList).when(computeDao).list(anyObject());
+
+ try {
+ computeManager.createCompute(expectedDiffName, USER);
+ Assert.fail();
+ }
+ catch (CoreException ex) {
+ Assert.assertEquals(VendorSoftwareProductErrorCodes.COMPUTE_NAME_FORMAT_NOT_ALLOWED,
+ ex.code().id());
+ }
+ }
@Test
public void testUpdateNonExistingComputeId_negative() {
@@ -192,6 +215,33 @@ public class ComputeManagerImplTest {
}
@Test
+ public void testUpdateComputeWithIncorrectNameFormat() {
+ doReturn(createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID))
+ .when(computeDao).get(anyObject());
+
+ doReturn(new CompositionEntityValidationData(CompositionEntityType.compute, COMPUTE1_ID))
+ .when(compositionEntityDataManagerMock)
+ .validateEntity(anyObject(), anyObject(), anyObject());
+
+ doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+ ComputeEntity computeEntity = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
+ ComputeData computeData = new ComputeData();
+ computeData.setName(COMPUTE1_ID + "name/*");
+ computeData.setDescription(COMPUTE1_ID + "desc updated");
+ computeEntity.setComputeCompositionData(computeData);
+
+ try {
+ computeManager.updateCompute(computeEntity, USER);
+ Assert.fail();
+ }
+ catch (CoreException ex) {
+ Assert.assertEquals(VendorSoftwareProductErrorCodes.COMPUTE_NAME_FORMAT_NOT_ALLOWED,
+ ex.code().id());
+ }
+ }
+
+ @Test
public void testIllegalComputeUpdate() {
doReturn(createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID))
.when(computeDao).get(anyObject());
@@ -207,7 +257,7 @@ public class ComputeManagerImplTest {
ComputeEntity computeEntity = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID);
ComputeData computeData = new ComputeData();
- computeData.setName(COMPUTE1_ID + " name updated");
+ computeData.setName(COMPUTE1_ID + "_name_updated");
computeData.setDescription(COMPUTE1_ID + " desc updated");
computeEntity.setComputeCompositionData(computeData);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java
index e082b25435..598b97b34e 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java
@@ -22,8 +22,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
-import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
-import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
@@ -99,7 +97,7 @@ public class DeplomentFlavorManagerImplTest {
DeploymentFlavorEntity expectedDiffName = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID);
DeploymentFlavor deploymentFlavor = expectedDiffName.getDeploymentFlavorCompositionData();
- deploymentFlavor.setModel(DF1_ID + " Name");
+ deploymentFlavor.setModel(DF1_ID + "Name");
expectedDiffName.setDeploymentFlavorCompositionData(deploymentFlavor);
List<DeploymentFlavorEntity> list = new ArrayList<DeploymentFlavorEntity>();
list.add(expectedDiffName);
@@ -116,6 +114,28 @@ public class DeplomentFlavorManagerImplTest {
}
@Test
+ public void testCreateManualDepFlavorWithIncorrectNameFormat() {
+ DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID);
+ doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+ DeploymentFlavorEntity expectedDiffName = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID);
+ DeploymentFlavor deploymentFlavor = expectedDiffName.getDeploymentFlavorCompositionData();
+ deploymentFlavor.setModel(DF1_ID + "Name/*");
+ expectedDiffName.setDeploymentFlavorCompositionData(deploymentFlavor);
+ List<DeploymentFlavorEntity> list = new ArrayList<DeploymentFlavorEntity>();
+ list.add(expectedDiffName);
+ doReturn(list).when(deploymentFlavorDaoMock).list(anyObject());
+
+ try {
+ deploymentFlavorManager.createDeploymentFlavor(expectedDiffName, USER);
+ Assert.fail();
+ }
+ catch (CoreException ex) {
+ Assert.assertEquals(VendorSoftwareProductErrorCodes.DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED,
+ ex.code().id());
+ }
+ }
+ @Test
public void testCreateManualDepFlavorWithFGNotInVSP() {
DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID);
final DeploymentFlavor deploymentFlavor =
@@ -253,7 +273,7 @@ public class DeplomentFlavorManagerImplTest {
Assert.assertEquals(deploymentFlavorEntities.size(), 2);
for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) {
Assert.assertEquals(deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel()
- , DF1_ID.equals(deploymentFlavorEntity.getId()) ? DF1_ID+" name" : DF2_ID+" name" );
+ , DF1_ID.equals(deploymentFlavorEntity.getId()) ? DF1_ID+"name" : DF2_ID+"name" );
}
}
@@ -286,7 +306,7 @@ public class DeplomentFlavorManagerImplTest {
DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(VSP_ID, VERSION, DF1_ID);
DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
- deploymentFlavor.setModel(DF1_ID + " name");
+ deploymentFlavor.setModel(DF1_ID + "_name");
deploymentFlavor.setDescription(DF1_ID + " desc updated");
deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
@@ -296,6 +316,36 @@ public class DeplomentFlavorManagerImplTest {
verify(deploymentFlavorDaoMock).update(deploymentFlavorEntity);
}
+ @Test
+ public void testManualUpdateDepFlavorIncorrectNameFormat() {
+ doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+ doReturn(createDeploymentFlavor(VSP_ID, VERSION, DF1_ID))
+ .when(deploymentFlavorDaoMock).get(anyObject());
+
+ doReturn(new CompositionEntityValidationData(CompositionEntityType.image, DF1_ID))
+ .when(compositionEntityDataManagerMock)
+ .validateEntity(anyObject(), anyObject(), anyObject());
+
+ VspDetails vspDetails = new VspDetails(VSP_ID, VERSION);
+ doReturn(vspDetails).when(vspInfoDao).get(anyObject());
+
+ DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(VSP_ID, VERSION, DF1_ID);
+ DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+ deploymentFlavor.setModel(DF1_ID + "_name/*");
+ deploymentFlavor.setDescription(DF1_ID + " desc updated");
+ deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
+
+ try {
+ deploymentFlavorManager.updateDeploymentFlavor(deploymentFlavorEntity, USER);
+ Assert.fail();
+ }
+ catch (CoreException ex) {
+ Assert.assertEquals(VendorSoftwareProductErrorCodes.DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED,
+ ex.code().id());
+ }
+ }
+
@Test
public void testGetNonExistingDepFlavorId_negative() {
testGet_negative(VSP_ID, VERSION, "non existing image id", USER,
@@ -378,7 +428,7 @@ public class DeplomentFlavorManagerImplTest {
DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, deploymentFlavorId);
DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
- deploymentFlavor.setModel(deploymentFlavorId + " name");
+ deploymentFlavor.setModel(deploymentFlavorId + "name");
deploymentFlavor.setDescription(deploymentFlavorId + " desc");
deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
@@ -388,8 +438,12 @@ public class DeplomentFlavorManagerImplTest {
private void testUpdate_negative(String vspId, Version version, String
deploymentFlavorId, String user, String expectedErrorCode) {
try {
+ DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, deploymentFlavorId);
+ DeploymentFlavor deploymentFlavor = new DeploymentFlavor();
+ deploymentFlavor.setModel("Name");
+ deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor);
deploymentFlavorManager
- .updateDeploymentFlavor(new DeploymentFlavorEntity(vspId, version, deploymentFlavorId), user);
+ .updateDeploymentFlavor(deploymentFlavorEntity, user);
Assert.fail();
} catch (CoreException exception) {
Assert.assertEquals(exception.code().id(), expectedErrorCode);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java
index ec676e517b..c29cb42953 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java
@@ -84,7 +84,7 @@ public class ImageManagerImplTest {
Assert.assertEquals(images.size(), 2);
for (ImageEntity image : images) {
Assert.assertEquals(image.getImageCompositionData().getFileName(),
- IMAGE1_ID.equals(image.getId()) ? IMAGE1_ID+" name" : IMAGE2_ID+" name" );
+ IMAGE1_ID.equals(image.getId()) ? IMAGE1_ID+"_name" : IMAGE2_ID+"_name" );
}
}
@@ -105,13 +105,35 @@ public class ImageManagerImplTest {
}
@Test
+ public void testCreateManualImageWithIncorrectNameFormat() {
+ ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+ doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+ ImageEntity expectedDiffName = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+ Image image = expectedDiffName.getImageCompositionData();
+ image.setFileName(IMAGE1_ID + " Name*/");
+ expectedDiffName.setImageCompositionData(image);
+ List<ImageEntity> vfcImageList = new ArrayList<ImageEntity>();
+ vfcImageList.add(expectedDiffName);
+ doReturn(vfcImageList).when(imageDao).list(anyObject());
+ try {
+ imageManager.createImage(expectedDiffName, USER);
+ Assert.fail();
+ }
+ catch (CoreException ex) {
+ Assert.assertEquals(VendorSoftwareProductErrorCodes.IMAGE_NAME_FORMAT_NOT_ALLOWED,
+ ex.code().id());
+ }
+ }
+
+ @Test
public void testCreateManualImageWithDuplicateName() {
ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
ImageEntity expectedDiffName = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
Image image = expectedDiffName.getImageCompositionData();
- image.setFileName(IMAGE1_ID + " Name");
+ image.setFileName(IMAGE1_ID + "_Name");
expectedDiffName.setImageCompositionData(image);
List<ImageEntity> vfcImageList = new ArrayList<ImageEntity>();
vfcImageList.add(expectedDiffName);
@@ -143,7 +165,7 @@ public class ImageManagerImplTest {
ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
Image imageData = new Image();
- imageData.setFileName(IMAGE1_ID + " name");
+ imageData.setFileName(IMAGE1_ID + "_name");
imageData.setDescription(IMAGE1_ID + " desc updated");
imageEntity.setImageCompositionData(imageData);
@@ -154,6 +176,33 @@ public class ImageManagerImplTest {
}
@Test
+ public void testUpdateImageWithIncorrectNameFormat() {
+ doReturn(createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID))
+ .when(imageDao).get(anyObject());
+
+ doReturn(new CompositionEntityValidationData(CompositionEntityType.image, IMAGE1_ID))
+ .when(compositionEntityDataManagerMock)
+ .validateEntity(anyObject(), anyObject(), anyObject());
+
+ doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+ ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
+ Image imageData = new Image();
+ imageData.setFileName(IMAGE1_ID + "name/*");
+ imageData.setDescription(IMAGE1_ID + " desc updated");
+ imageEntity.setImageCompositionData(imageData);
+
+ try {
+ imageManager.updateImage(imageEntity, USER);
+ Assert.fail();
+ }
+ catch (CoreException ex) {
+ Assert.assertEquals(VendorSoftwareProductErrorCodes.IMAGE_NAME_FORMAT_NOT_ALLOWED,
+ ex.code().id());
+ }
+ }
+
+ @Test
public void testIllegalImageUpdate() {
doReturn(createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID))
.when(imageDao).get(anyObject());
@@ -169,7 +218,7 @@ public class ImageManagerImplTest {
ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID);
Image imageData = new Image();
- imageData.setFileName(IMAGE1_ID + " name updated");
+ imageData.setFileName(IMAGE1_ID + "_name_updated");
imageData.setDescription(IMAGE1_ID + " desc updated");
imageEntity.setImageCompositionData(imageData);
@@ -345,7 +394,7 @@ public class ImageManagerImplTest {
static ImageEntity createImage(String vspId, Version version, String compId, String imageId) {
ImageEntity imageEntity = new ImageEntity(vspId, version, compId, imageId);
Image imageData = new Image();
- imageData.setFileName(imageId + " name");
+ imageData.setFileName(imageId + "_name");
imageData.setDescription(imageId + " desc");
imageEntity.setImageCompositionData(imageData);
return imageEntity;
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java
index 4bbbec166e..8ea853c5fa 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java
@@ -1,6 +1,9 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
import static org.openecomp.sdc.generator.util.GeneratorConstants.ALLOWED_FLAVORS_PROPERTY;
+import static org.openecomp.sdc.generator.util.GeneratorConstants.IMAGES_PROPERTY;
import static org.openecomp.sdc.generator.util.GeneratorConstants.PORT_NODE_TEMPLATE_ID_SUFFIX;
import static org.openecomp.sdc.tosca.services.ToscaConstants.BINDING_REQUIREMENT_ID;
import static org.openecomp.sdc.tosca.services.ToscaConstants.COUNT_PROPERTY_NAME;
@@ -10,6 +13,10 @@ import static org.openecomp.sdc.translator.services.heattotosca.Constants.GLOBAL
import org.junit.Assert;
import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
import org.openecomp.sdc.generator.core.utils.GeneratorUtils;
import org.openecomp.sdc.generator.datatypes.tosca.ComputeFlavor;
import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel;
@@ -36,43 +43,112 @@ import org.openecomp.sdc.tosca.services.ToscaUtil;
import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl;
import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
+import org.openecomp.sdc.vendorsoftwareproduct.services.ManualVspDataCollectionService;
+import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
public class ManualVspToscaManagerImplTest {
+ private static final String USER = "manualVspToscaTestUser";
+ private static final String INVALID_VSP_ID = "Invalid_Vsp_Id";
+ private static final String VSP_ID = "Vsp_Id_1";
+ private static final String VSP_VERSION = "1.0";
+
+ private static final String RELEASE_VENDOR = "Vendor-1";
private static final String COMPONENT_ID = "Component_id";
private static final String COMPONENT_NAME = "Component_name";
private static final String SP_PART_NUMBER_1 = "Part_number_123";
private static final String FEATURE_GROUP_ID_1 = "Feature_Group_id_1";
private static final String MANUFACTURER_REF_1 = "Manufacturer_Ref_1";
- private static final String VENDOR_MODEL_1 = "VLM_1";
+ private static final String VENDOR_MODEL_1 = "Deployment_Flavor_Model_1";
private static final int NUM_CPUS_1 = 1;
- private static final String DISK_SIZE_1 = "2GB";
- private static final String MEM_SIZE_1 = "8GB";
+ private static final String DISK_SIZE_1 = "2 GB";
+ private static final String MEM_SIZE_1 = "8 GB";
private static final String SP_PART_NUMBER_2 = "Part_number_345";
private static final String FEATURE_GROUP_ID_2 = "Feature_Group_id_2";
private static final String MANUFACTURER_REF_2 = "Manufacturer_Ref_2";
- private static final String VENDOR_MODEL_2 = "VLM_2";
+ private static final String VENDOR_MODEL_2 = "Deployment_Flavor_Model_2";
private static final int NUM_CPUS_2 = 4;
- private static final String DISK_SIZE_2 = "3GB";
- private static final String MEM_SIZE_2 = "2GB";
+ private static final String DISK_SIZE_2 = "3 GB";
+ private static final String MEM_SIZE_2 = "2 GB";
private static final String IMAGE_VERSION_1 = "3.16.1";
private static final String IMAGE_HASH_1 = "65edfgye3256hjutve";
private static final String IMAGE_FILE_NAME_1 = "image-file-name1";
- private static final String IMAGE_FILE_FORMAT_1 = "qcow2";
private static final String IMAGE_VERSION_2 = "3.1.9";
private static final String IMAGE_HASH_2 = "84rtedfe3256hjutaw";
private static final String IMAGE_FILE_NAME_2 = "image-file-name1";
- private static final String IMAGE_FILE_FORMAT_2 = "iso";
private ManualVspToscaManager manualVspToscaManager = new ManualVspToscaManagerImpl();
+ @Spy
+ @InjectMocks
+ private ManualVspToscaManagerImpl manualVspToscaManagerMock;
+
+ @Mock
+ private ManualVspDataCollectionService manualVspDataCollectionServiceMock;
+
+ @Test
+ public void testGatherVspInformationInvalidVsp() {
+ MockitoAnnotations.initMocks(this);
+ VspModelInfo expectedVspData = new VspModelInfo();
+ doThrow(new RuntimeException())
+ .when(manualVspDataCollectionServiceMock)
+ .getReleaseVendor(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER);
+ doThrow(new RuntimeException())
+ .when(manualVspDataCollectionServiceMock)
+ .getAllowedFlavors(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER);
+ doThrow(new RuntimeException())
+ .when(manualVspDataCollectionServiceMock)
+ .getVspComponentImages(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER);
+ doThrow(new RuntimeException())
+ .when(manualVspDataCollectionServiceMock)
+ .getVspComponents(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER);
+ doThrow(new RuntimeException())
+ .when(manualVspDataCollectionServiceMock)
+ .getVspComponentNics(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER);
+ VspModelInfo vspModelInfo = manualVspToscaManagerMock.gatherVspInformation(INVALID_VSP_ID,
+ Version.valueOf(VSP_VERSION), USER);
+ Assert.assertEquals(expectedVspData, vspModelInfo);
+ }
+
+
+ @Test
+ public void testGatherVspInformationValidVsp() {
+ MockitoAnnotations.initMocks(this);
+ Map<String, DeploymentFlavorModel> deploymentFlavorData = getDeploymentFlavorData();
+ Map<String, List<Nic>> componentNics = getComponentNics();
+ Map<String, String> componentData = getComponentData();
+ Map<String, List<MultiFlavorVfcImage>> vfcImageData = getVfcImageData();
+ doReturn(Optional.of(RELEASE_VENDOR)).when(manualVspDataCollectionServiceMock)
+ .getReleaseVendor(VSP_ID, Version.valueOf(VSP_VERSION), USER);
+ doReturn(deploymentFlavorData).when(manualVspDataCollectionServiceMock)
+ .getAllowedFlavors(VSP_ID, Version.valueOf(VSP_VERSION), USER);
+ doReturn(vfcImageData).when(manualVspDataCollectionServiceMock)
+ .getVspComponentImages(VSP_ID, Version.valueOf(VSP_VERSION), USER);
+ doReturn(componentData).when(manualVspDataCollectionServiceMock)
+ .getVspComponents(VSP_ID, Version.valueOf(VSP_VERSION), USER);
+ doReturn(componentNics).when(manualVspDataCollectionServiceMock)
+ .getVspComponentNics(VSP_ID, Version.valueOf(VSP_VERSION), USER);
+ VspModelInfo vspModelInfo = manualVspToscaManagerMock.gatherVspInformation(VSP_ID,
+ Version.valueOf(VSP_VERSION), USER);
+
+ VspModelInfo expectedVspData = new VspModelInfo();
+ expectedVspData.setReleaseVendor(RELEASE_VENDOR);
+ expectedVspData.setComponents(getComponentData());
+ expectedVspData.setMultiFlavorVfcImages(getVfcImageData());
+ expectedVspData.setAllowedFlavors(getDeploymentFlavorData());
+ expectedVspData.setNics(getComponentNics());
+
+ Assert.assertEquals(expectedVspData, vspModelInfo);
+ }
+
@Test
public void testGenerateToscaInvalidVspId() {
VspModelInfo emptyVspCollectedData = new VspModelInfo();
@@ -87,7 +163,7 @@ public class ManualVspToscaManagerImplTest {
@Test
public void testGenerateToscaNoComponent() {
VspModelInfo vspCollectedData = new VspModelInfo();
- vspCollectedData.setReleaseVendor("Vendor-1");
+ vspCollectedData.setReleaseVendor(RELEASE_VENDOR);
vspCollectedData.setComponents(null);
vspCollectedData.setMultiFlavorVfcImages(null);
vspCollectedData.setAllowedFlavors(getDeploymentFlavorData());
@@ -111,7 +187,6 @@ public class ManualVspToscaManagerImplTest {
manualVspToscaManager.generateToscaModel(vspCollectedData);
Assert.assertNotNull(toscaServiceModel);
Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
- //Service model should contain only the packed global types
Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size());
Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate();
@@ -131,7 +206,6 @@ public class ManualVspToscaManagerImplTest {
manualVspToscaManager.generateToscaModel(vspCollectedData);
Assert.assertNotNull(toscaServiceModel);
Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
- //Service model should contain only the packed global types
Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size());
Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate();
@@ -139,8 +213,8 @@ public class ManualVspToscaManagerImplTest {
Assert.assertNotNull(mainServiceTemplate);
String componentName = vspCollectedData.getComponents().get(COMPONENT_ID);
Assert.assertNull(mainServiceTemplate.getTopology_template().getNode_templates()
- .get(componentName + GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX)
- .getProperties());
+ .get(componentName + GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX)
+ .getProperties().get(IMAGES_PROPERTY));
}
@Test
@@ -154,7 +228,6 @@ public class ManualVspToscaManagerImplTest {
manualVspToscaManager.generateToscaModel(vspCollectedData);
Assert.assertNotNull(toscaServiceModel);
Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
- //Service model should contain only the packed global types
Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size());
Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
String componentName = vspCollectedData.getComponents().get(COMPONENT_ID);
@@ -171,7 +244,7 @@ public class ManualVspToscaManagerImplTest {
@Test
public void testGenerateToscaNoManufacturerRefNumAndFeatureGroup() {
VspModelInfo vspCollectedData = new VspModelInfo();
- vspCollectedData.setReleaseVendor("Vendor-1");
+ vspCollectedData.setReleaseVendor(RELEASE_VENDOR);
vspCollectedData.setComponents(getComponentData());
vspCollectedData.setMultiFlavorVfcImages(getVfcImageData());
Map<String, DeploymentFlavorModel> deploymentFlavorData = getDeploymentFlavorData();
@@ -184,7 +257,6 @@ public class ManualVspToscaManagerImplTest {
manualVspToscaManager.generateToscaModel(vspCollectedData);
Assert.assertNotNull(toscaServiceModel);
Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
- //Service model should contain only the packed global types
Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size());
Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate();
@@ -204,7 +276,7 @@ public class ManualVspToscaManagerImplTest {
@Test
public void testGenerateToscaNoDeploymentFlavor() {
VspModelInfo vspCollectedData = new VspModelInfo();
- vspCollectedData.setReleaseVendor("Vendor-1");
+ vspCollectedData.setReleaseVendor(RELEASE_VENDOR);
vspCollectedData.setComponents(getComponentData());
vspCollectedData.setMultiFlavorVfcImages(getVfcImageData());
vspCollectedData.setAllowedFlavors(null);
@@ -213,7 +285,6 @@ public class ManualVspToscaManagerImplTest {
manualVspToscaManager.generateToscaModel(vspCollectedData);
Assert.assertNotNull(toscaServiceModel);
Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
- //Service model should contain only the packed global types
Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size());
Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate();
@@ -228,7 +299,7 @@ public class ManualVspToscaManagerImplTest {
@Test
public void testGenerateToscaCompleteData() {
VspModelInfo vspCollectedData = new VspModelInfo();
- vspCollectedData.setReleaseVendor("Vendor-1");
+ vspCollectedData.setReleaseVendor(RELEASE_VENDOR);
vspCollectedData.setComponents(getComponentData());
vspCollectedData.setMultiFlavorVfcImages(getVfcImageData());
vspCollectedData.setAllowedFlavors(getDeploymentFlavorData());
@@ -237,31 +308,23 @@ public class ManualVspToscaManagerImplTest {
manualVspToscaManager.generateToscaModel(vspCollectedData);
Assert.assertNotNull(toscaServiceModel);
Assert.assertNotNull(toscaServiceModel.getServiceTemplates());
- //Service model should contain only the packed global types
Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size());
Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates();
String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate();
ServiceTemplate mainServiceTemplate = serviceTemplates.get(entryDefinitionServiceTemplate);
Assert.assertNotNull(mainServiceTemplate);
String componentName = vspCollectedData.getComponents().get(COMPONENT_ID);
-
- Assert.assertNotNull(mainServiceTemplate.getTopology_template().getNode_templates()
- .get(componentName + GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX));
Assert.assertNotNull(mainServiceTemplate.getTopology_template().getNode_templates()
.get(componentName + GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX));
//Validate vnf configuration node template
validateVnfConfigurationNodeTemplate(mainServiceTemplate, componentName);
- //Validate vfc node template
- validateVfcNodeTemplateinMainServiceTemplate(mainServiceTemplate, componentName);
//Validate vnf node template
validateVnfNodeTemplate(mainServiceTemplate, componentName);
-
//Validate substitution service template
ServiceTemplate substitutionServiceTemplate = toscaServiceModel.getServiceTemplates()
.get(componentName + GeneratorConstants.TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX);
List<Nic> nics = vspCollectedData.getNics().get(COMPONENT_ID);
validateSubstitutionServiceTemplate(substitutionServiceTemplate, nics, componentName);
-
//Validate global substitution service template
ServiceTemplate globalSubstitutionServiceTemplate = toscaServiceModel.getServiceTemplates()
.get(ToscaUtil.getServiceTemplateFileName(GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME));
@@ -284,24 +347,18 @@ public class ManualVspToscaManagerImplTest {
Assert.assertEquals(deploymentFlavorData, allowedFlavors);
}
- private void validateVfcNodeTemplateinMainServiceTemplate(ServiceTemplate mainServiceTemplate,
- String componentName) {
- NodeTemplate vfcNodeTemplate =
- mainServiceTemplate.getTopology_template().getNode_templates()
- .get(componentName + GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX);
- Assert.assertNotNull(vfcNodeTemplate);
- Assert.assertEquals(ToscaNodeType.MULTIFLAVOR_VFC_NODE_TYPE, vfcNodeTemplate.getType());
+ private void validateImagePropertyData(NodeTemplate vnfNodeTemplate, String componentName) {
Map<String, MultiFlavorVfcImage> vfcImages = (Map<String, MultiFlavorVfcImage>)
- vfcNodeTemplate.getProperties().get(GeneratorConstants.IMAGES_PROPERTY);
+ vnfNodeTemplate.getProperties().get(GeneratorConstants.IMAGES_PROPERTY);
Assert.assertNotNull(vfcImages);
Assert.assertEquals(2, vfcImages.size());
MultiFlavorVfcImage image1 = vfcImages.get(IMAGE_VERSION_1);
MultiFlavorVfcImage expectedImage1 = getImageData(IMAGE_VERSION_1, IMAGE_HASH_1,
- IMAGE_FILE_NAME_1, "md5", IMAGE_FILE_FORMAT_1);
+ IMAGE_FILE_NAME_1, "md5");
Assert.assertEquals(expectedImage1, image1);
MultiFlavorVfcImage image2 = vfcImages.get(IMAGE_VERSION_2);
MultiFlavorVfcImage expectedImage2 = getImageData(IMAGE_VERSION_2, IMAGE_HASH_2,
- IMAGE_FILE_NAME_2, "md5", IMAGE_FILE_FORMAT_2);
+ IMAGE_FILE_NAME_2, "md5");
Assert.assertEquals(expectedImage2, image2);
}
@@ -311,12 +368,11 @@ public class ManualVspToscaManagerImplTest {
mainServiceTemplate.getTopology_template().getNode_templates()
.get(componentName + GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX);
Assert.assertNotNull(vnfNodeTemplate);
- Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName,
- vnfNodeTemplate.getType());
+ Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE, vnfNodeTemplate.getType());
Assert.assertNotNull(vnfNodeTemplate.getDirectives());
Assert.assertEquals(true, vnfNodeTemplate.getDirectives().contains(ToscaConstants
.NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE));
-
+ validateImagePropertyData(vnfNodeTemplate, componentName);
Map<String, Object> serviceTemplateFilterProperty = (Map<String, Object>) vnfNodeTemplate
.getProperties().get(SERVICE_TEMPLATE_FILTER_PROPERTY_NAME);
Assert.assertNotNull(serviceTemplateFilterProperty);
@@ -372,8 +428,8 @@ public class ManualVspToscaManagerImplTest {
private void validateSubstitutionMappings(SubstitutionMapping substitutionMappings,
List<Nic> nics,
String componentName) {
- Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName,
- substitutionMappings.getNode_type());
+ Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE, substitutionMappings
+ .getNode_type());
Map<String, List<String>> capabilities = substitutionMappings.getCapabilities();
validateSubstitutionCapabilities(capabilities, componentName);
Map<String, List<String>> requirements = substitutionMappings.getRequirements();
@@ -420,7 +476,7 @@ public class ManualVspToscaManagerImplTest {
Map<String, NodeType> nodeTypes = globalSubstitutionServiceTemplate.getNode_types();
Assert.assertEquals(1, nodeTypes.size());
NodeType deploymentFlavorNodeType =
- nodeTypes.get(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName);
+ nodeTypes.get(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE);
Assert.assertNotNull(deploymentFlavorNodeType);
Map<String, PropertyDefinition> properties = deploymentFlavorNodeType.getProperties();
Assert.assertNotNull(properties);
@@ -475,9 +531,9 @@ public class ManualVspToscaManagerImplTest {
Map<String, List<MultiFlavorVfcImage>> imageData = new HashMap<>();
List<MultiFlavorVfcImage> images = new ArrayList<>(2);
MultiFlavorVfcImage image1 = getImageData(IMAGE_VERSION_1, IMAGE_HASH_1, IMAGE_FILE_NAME_1,
- "md5", IMAGE_FILE_FORMAT_1);
+ "md5");
MultiFlavorVfcImage image2 = getImageData(IMAGE_VERSION_2, IMAGE_HASH_2, IMAGE_FILE_NAME_2,
- "md5", IMAGE_FILE_FORMAT_2);
+ "md5");
images.add(image1);
images.add(image2);
imageData.put(COMPONENT_ID, images);
@@ -522,10 +578,10 @@ public class ManualVspToscaManagerImplTest {
return computeFlavor;
}
- private VendorInfo getVendorInfo(String manufacturerRefNumber, String vlmId) {
+ private VendorInfo getVendorInfo(String manufacturerRefNumber, String deploymentFlavorModel) {
VendorInfo vendorInfo = new VendorInfo();
vendorInfo.setManufacturer_reference_number(manufacturerRefNumber);
- vendorInfo.setVendor_model(vlmId);
+ vendorInfo.setVendor_model(deploymentFlavorModel);
return vendorInfo;
}
@@ -535,13 +591,13 @@ public class ManualVspToscaManagerImplTest {
return licenseFlavor;
}
- private MultiFlavorVfcImage getImageData(String imageVersion, String fileHash, String fileName,
- String fileHashType, String fileFormat) {
+ private MultiFlavorVfcImage getImageData(String imageVersion, String fileHash,
+ String fileName, String fileHashType) {
MultiFlavorVfcImage image = new MultiFlavorVfcImage();
image.setSoftware_version(imageVersion);
image.setFile_hash(fileHash);
image.setFile_hash_type(fileHashType);
- image.setFile_name(fileName+"-"+IMAGE_VERSION_2+"."+fileFormat);
+ image.setFile_name(fileName);
return image;
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java
index b2cfba7672..fe275e9d68 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java
@@ -110,6 +110,31 @@ public class NicManagerImplTest {
}
@Test
+ public void testCreateWithIncorrectNicNameFormat() {
+ NicEntity nicEntity = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID);
+ Nic nic = nicEntity.getNicCompositionData();
+ nic.setNetworkType(NetworkType.Internal);
+ nicEntity.setNicCompositionData(nic);
+ doReturn(true).when(vspInfoDao).isManual(anyObject(),anyObject());
+ Collection<NicEntity> nicEntities = new ArrayList<>();
+
+ NicEntity nicEntityDiffName = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID);
+ Nic newNameNic = nicEntityDiffName.getNicCompositionData();
+ newNameNic.setName(NIC1_ID + "_Name/*");
+ nicEntityDiffName.setNicCompositionData(newNameNic);
+ nicEntities.add(nicEntityDiffName);
+ doReturn(nicEntities).when(nicDao).list(anyObject());
+ doReturn(nicEntity).when(compositionEntityDataManagerMock).createNic(anyObject());
+
+ try {
+ NicEntity created = nicManager.createNic(nicEntity,USER);
+ } catch (CoreException exception) {
+ Assert.assertEquals(VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED,
+ exception.code().id());
+ }
+ }
+
+ @Test
public void testCreateWithDupNicName() {
NicEntity nicEntity = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID);
Nic nic = nicEntity.getNicCompositionData();
@@ -120,7 +145,7 @@ public class NicManagerImplTest {
NicEntity nicEntityDiffName = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID);
Nic newNameNic = nicEntityDiffName.getNicCompositionData();
- newNameNic.setName(NIC1_ID + " Name");
+ newNameNic.setName(NIC1_ID + "_Name");
nicEntityDiffName.setNicCompositionData(newNameNic);
nicEntities.add(nicEntityDiffName);
doReturn(nicEntities).when(nicDao).list(anyObject());
@@ -282,7 +307,7 @@ public class NicManagerImplTest {
NicEntity nicEntity = new NicEntity(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID);
Nic nicData = new Nic();
- nicData.setName(NIC1_ID + " name updated");
+ nicData.setName(NIC1_ID + "_name_updated");
nicData.setDescription(NIC1_ID + " desc updated");
nicData.setNetworkId(NETWORK1_ID);
nicEntity.setNicCompositionData(nicData);
@@ -294,6 +319,36 @@ public class NicManagerImplTest {
verify(nicDao, never()).update(nicEntity);
}
+ @Test
+ public void testUpdateIncorrectNameFormat() {
+ doReturn(createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID))
+ .when(nicDao).get(anyObject());
+
+ CompositionEntityValidationData toBeReturned =
+ new CompositionEntityValidationData(CompositionEntityType.nic, NIC1_ID);
+ toBeReturned.setErrors(Arrays.asList("error1", "error2"));
+ doReturn(toBeReturned)
+ .when(compositionEntityDataManagerMock)
+ .validateEntity(anyObject(), anyObject(), anyObject());
+ doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
+
+ NicEntity nicEntity = new NicEntity(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID);
+ Nic nicData = new Nic();
+ nicData.setName(NIC1_ID + "_name_updated/*");
+ nicData.setDescription(NIC1_ID + " desc updated");
+ nicData.setNetworkId(NETWORK1_ID);
+ nicEntity.setNicCompositionData(nicData);
+
+ try {
+ nicManager.updateNic(nicEntity, USER);
+ Assert.fail();
+ }
+ catch (CoreException ex) {
+ Assert.assertEquals(VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED,
+ ex.code().id());
+ }
+ }
+
@Test
public void testGetNonExistingNicId_negative() {
@@ -426,7 +481,7 @@ public class NicManagerImplTest {
String networkId) {
NicEntity nicEntity = new NicEntity(vspId, version, compId, nicId);
Nic nicData = new Nic();
- nicData.setName(nicId + " name");
+ nicData.setName(nicId + "_name");
nicData.setDescription(nicId + " desc");
nicData.setNetworkId(networkId);
nicEntity.setNicCompositionData(nicData);