aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerFactoryImpl.java4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java17
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java44
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java6
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImplTest.java93
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java6
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImplTest.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java6
10 files changed, 81 insertions, 116 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerFactoryImpl.java
index 34aaa0fee6..a427b74c4f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerFactoryImpl.java
@@ -23,13 +23,15 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager;
import org.openecomp.sdc.vendorsoftwareproduct.NetworkManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
public class NetworkManagerFactoryImpl extends NetworkManagerFactory {
private static final NetworkManager INSTANCE =
new NetworkManagerImpl(
NetworkDaoFactory.getInstance().createInterface(),
- CompositionEntityDataManagerFactory.getInstance().createInterface());
+ CompositionEntityDataManagerFactory.getInstance().createInterface(),
+ VendorSoftwareProductInfoDaoFactory.getInstance().createInterface());
@Override
public NetworkManager createInterface() {
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java
index 86d604da7c..c2408308de 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImpl.java
@@ -27,7 +27,6 @@ import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.CompositionEditNotAllowedErrorBuilder;
@@ -49,15 +48,17 @@ public class NetworkManagerImpl implements NetworkManager {
private final NetworkDao networkDao;
private final CompositionEntityDataManager compositionEntityDataManager;
- private static final VendorSoftwareProductInfoDao VSP_INFO_DAO
- = VendorSoftwareProductInfoDaoFactory.getInstance().createInterface();
+ private final VendorSoftwareProductInfoDao VSPInfoDao;
+
private static final String VSP_ID = "VSP id";
private static final String VSP_ID_NETWORK_ID = "VSP id, network id";
public NetworkManagerImpl(NetworkDao networkDao,
- CompositionEntityDataManager compositionEntityDataManager) {
+ CompositionEntityDataManager compositionEntityDataManager,
+ VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao) {
this.networkDao = networkDao;
this.compositionEntityDataManager = compositionEntityDataManager;
+ this.VSPInfoDao = vendorSoftwareProductInfoDao;
}
@Override
@@ -72,7 +73,7 @@ public class NetworkManagerImpl implements NetworkManager {
public NetworkEntity createNetwork(NetworkEntity network) {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, network.getVspId());
- if (!VSP_INFO_DAO.isManual(network.getVspId(), network.getVersion())) {
+ if (!VSPInfoDao.isManual(network.getVspId(), network.getVersion())) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.CREATE_NETWORK, ErrorLevel.ERROR.name(),
LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create network");
@@ -94,7 +95,7 @@ public class NetworkManagerImpl implements NetworkManager {
NetworkEntity retrieved = getValidatedNetwork(network.getVspId(), network.getVersion(), network.getId());
NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput();
- schemaInput.setManual(!VSP_INFO_DAO.isManual(network.getVspId(), network.getVersion()));
+ schemaInput.setManual(!VSPInfoDao.isManual(network.getVspId(), network.getVersion()));
schemaInput.setNetwork(retrieved.getNetworkCompositionData());
CompositionEntityValidationData validationData = compositionEntityDataManager
@@ -118,7 +119,7 @@ public class NetworkManagerImpl implements NetworkManager {
Network network = networkEntity.getNetworkCompositionData();
NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput();
- schemaInput.setManual(!VSP_INFO_DAO.isManual(vspId, version));
+ schemaInput.setManual(!VSPInfoDao.isManual(vspId, version));
schemaInput.setNetwork(network);
CompositionEntityResponse<Network> response = new CompositionEntityResponse<>();
@@ -143,7 +144,7 @@ public class NetworkManagerImpl implements NetworkManager {
public void deleteNetwork(String vspId, Version version, String networkId) {
MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID_NETWORK_ID, vspId, networkId);
- if (!VSP_INFO_DAO.isManual(vspId, version)) {
+ if (!VSPInfoDao.isManual(vspId, version)) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.DELETE_NETWORK, ErrorLevel.ERROR.name(),
LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't delete network");
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java
index c7aa81873b..047015e16a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java
@@ -21,6 +21,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -59,6 +60,11 @@ public class ComponentManagerImplTest {
MockitoAnnotations.initMocks(this);
}
+ @AfterMethod
+ public void tearDown() {
+ componentManager = null;
+ }
+
@Test
public void testListWhenNone() {
Collection<ComponentEntity> components = componentManager.listComponents(VSP_ID, VERSION);
@@ -89,10 +95,6 @@ public class ComponentManagerImplTest {
VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED);
}
- /* @Test
- public void testCreate() {
- COMP1_ID = testCreate(VSP_ID);
- }*/
@Test
public void testCreate() {
ComponentEntity expected = new ComponentEntity(VSP_ID, null, null);
@@ -131,7 +133,7 @@ public class ComponentManagerImplTest {
doReturn(vspComponentList).when(componentDaoMock).list(anyObject());
try {
- ComponentEntity created = componentManager.createComponent(expected);
+ componentManager.createComponent(expected);
} catch (CoreException exception) {
Assert.assertEquals("Creation of only one VFC per VSP allowed.", exception.code().message());
Assert.assertEquals(VendorSoftwareProductErrorCodes.VSP_VFC_COUNT_EXCEED,
@@ -180,7 +182,7 @@ public class ComponentManagerImplTest {
.validateEntity(anyObject(), anyObject(), anyObject());
try {
- CompositionEntityValidationData created = componentManager.updateComponent(expected);
+ componentManager.updateComponent(expected);
} catch (CoreException exception) {
Assert.assertEquals("VFC with specified name already present in given VSP.",
exception.code().message());
@@ -326,7 +328,7 @@ public class ComponentManagerImplTest {
}
@Test
- public void testComponentNullQuestionnaire() throws Exception {
+ public void testComponentNullQuestionnaire() {
doReturn(new ComponentEntity(VSP_ID, VERSION, COMP1_ID)).when(componentDaoMock)
.getQuestionnaireData(VSP_ID, VERSION, COMP1_ID);
String schema = "schema string";
@@ -335,7 +337,7 @@ public class ComponentManagerImplTest {
QuestionnaireResponse questionnaire =
componentManager.getQuestionnaire(VSP_ID, VERSION, COMP1_ID);
Assert.assertNotNull(questionnaire);
- Assert.assertEquals(questionnaire.getData(), null);
+ Assert.assertNull(questionnaire.getData());
Assert.assertEquals(questionnaire.getSchema(), schema);
Assert.assertNull(questionnaire.getErrorMessage());
}
@@ -389,20 +391,6 @@ public class ComponentManagerImplTest {
.updateQuestionnaireData(VSP_ID, VERSION, COMP1_ID, "questionnaire data");
}
-/*
- @Test(dependsOnMethods = "testDelete")
- public void testDeleteList() {
- ComponentEntity comp3 = new ComponentEntity(VSP_ID, null, null);
- comp3.setName("comp3 name");
- comp3.setDescription("comp3 desc");
- componentManager.createComponent(comp3, USER);
-
- componentManager.deleteComponents(VSP_ID, USER);
-
- Collection<ComponentEntity> actual = componentManager.listComponents(VSP_ID, null, USER);
- Assert.assertEquals(actual.size(), 0);
- }*/
-
private void testGet(String vspId, Version version, String componentId,
ComponentEntity expected) {
@@ -443,16 +431,6 @@ public class ComponentManagerImplTest {
}
}
- private void testList_negative(String vspId, Version version,
- String expectedErrorCode) {
- try {
- componentManager.listComponents(vspId, version);
- Assert.fail();
- } catch (CoreException exception) {
- Assert.assertEquals(exception.code().id(), expectedErrorCode);
- }
- }
-
private void testDeleteList_negative(String vspId, Version version,
String expectedErrorCode) {
try {
@@ -474,7 +452,7 @@ public class ComponentManagerImplTest {
}
- public static ComponentEntity createComponent(String vspId, Version version, String compId) {
+ private static ComponentEntity createComponent(String vspId, Version version, String compId) {
ComponentEntity componentEntity = new ComponentEntity(vspId, version, compId);
ComponentData compData = new ComponentData();
compData.setName(compId + " name");
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 9058a73632..265ba007d4 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
@@ -7,6 +7,7 @@ import org.mockito.Spy;
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.session.SessionContextProviderFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
@@ -22,6 +23,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -64,6 +66,11 @@ public class ComputeManagerImplTest {
MockitoAnnotations.initMocks(this);
}
+ @AfterMethod
+ public void tearDown() {
+ computeManager = null;
+ }
+
@Test
public void testListWhenNone() {
Collection<ListComputeResponse> computes =
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java
index 6a5e7fa70c..35893409df 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java
@@ -24,6 +24,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavo
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -62,6 +63,11 @@ public class DeploymentFlavorManagerImplTest {
MockitoAnnotations.initMocks(this);
}
+ @AfterMethod
+ public void tearDown() {
+ deploymentFlavorManager = null;
+ }
+
@Test
public void testListWhenNone() {
final Collection<DeploymentFlavorEntity> deploymentFlavorEntities =
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 d9b4188f5e..553e433ccb 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
@@ -19,6 +19,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -57,6 +58,12 @@ public class ImageManagerImplTest {
MockitoAnnotations.initMocks(this);
}
+ @AfterMethod
+ public void tearDown() {
+ imageManager = null;
+ }
+
+
@Test
public void testListWhenNone() {
final Collection<ImageEntity> imageEntities =
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImplTest.java
index 54687dc80d..f3cb2035da 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImplTest.java
@@ -20,14 +20,17 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl;
+
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.session.SessionContextProviderFactory;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
@@ -38,6 +41,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -54,6 +58,7 @@ public class NetworkManagerImplTest {
private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
private static final String VSP_ID = "vsp";
+ private static final String USER_ID = "test_user1";
private static final Version VERSION = new Version("version_id");
private static final String NETWORK1_ID = "network1";
private static final String NETWORK2_ID = "network2";
@@ -62,6 +67,9 @@ public class NetworkManagerImplTest {
private NetworkDao networkDaoMock;
@Mock
private CompositionEntityDataManager compositionEntityDataManagerMock;
+ @Mock
+ private VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao;
+
@InjectMocks
@Spy
private NetworkManagerImpl networkManager;
@@ -78,6 +86,13 @@ public class NetworkManagerImplTest {
@BeforeMethod
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
+ SessionContextProviderFactory.getInstance().createInterface().create(USER_ID);
+ }
+
+ @AfterMethod
+ public void tearDown() {
+ networkManager = null;
+ SessionContextProviderFactory.getInstance().createInterface().close();
}
@Test
@@ -98,52 +113,12 @@ public class NetworkManagerImplTest {
Assert.assertEquals(actual.size(), 2);
}
-/* @Test(dependsOnMethods = "testListWhenNone")
- public void testCreate() {
- NETWORK1_ID = testCreate(VSP_ID);
- }
-
- private String testCreate(String vspId) {
- NetworkEntity expected = new NetworkEntity(vspId, null, null);
- Network networkData = new Network();
- networkData.setName("network1 name");
- networkData.setDhcp(true);
- expected.setNetworkCompositionData(networkData);
-
-
- NetworkEntity created = networkManager.createNetwork(expected);
- Assert.assertNotNull(created);
- expected.setId(created.getId());
- expected.setVersion(VERSION01);
-
- NetworkEntity actual = networkDaoMock.getNetwork(vspId, VERSION01, created.getId());
-
- Assert.assertEquals(actual, expected);
- return created.getId();
- }
-
- @Test(dependsOnMethods = {"testCreate"})
- public void testCreateWithExistingName_negative() {
- NetworkEntity network = new NetworkEntity(VSP_ID, null, null);
- Network networkData = new Network();
- networkData.setName("network1 name");
- networkData.setDhcp(true);
- network.setNetworkCompositionData(networkData);
- testCreate_negative(network, UniqueValueUtil.UNIQUE_VALUE_VIOLATION);
- }*/
-
@Test
public void testCreateOnUploadVsp_negative() {
testCreate_negative(new NetworkEntity(VSP_ID, VERSION, null),
VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED);
}
- /* @Test(dependsOnMethods = {"testCreate"})
- public void testCreateWithExistingNameUnderOtherVsp() {
- testCreate(vsp2Id);
- }
- */
-
@Test
public void testUpdateNonExistingNetworkId_negative() {
testUpdate_negative(VSP_ID, VERSION, NETWORK1_ID,
@@ -161,6 +136,7 @@ public class NetworkManagerImplTest {
doReturn(toBeReturned)
.when(compositionEntityDataManagerMock)
.validateEntity(anyObject(), anyObject(), anyObject());
+ doReturn(false).when(vendorSoftwareProductInfoDao).isManual(anyObject(),anyObject());
NetworkEntity networkEntity = new NetworkEntity(VSP_ID, VERSION, NETWORK1_ID);
Network networkData = new Network();
@@ -188,6 +164,7 @@ public class NetworkManagerImplTest {
doReturn(network)
.when(networkDaoMock).get(anyObject());
doReturn("schema string").when(networkManager).getCompositionSchema(anyObject());
+ doReturn(false).when(vendorSoftwareProductInfoDao).isManual(anyObject(),anyObject());
CompositionEntityResponse<Network> response =
networkManager.getNetwork(VSP_ID, VERSION, NETWORK1_ID);
@@ -196,40 +173,6 @@ public class NetworkManagerImplTest {
Assert.assertNotNull(response.getSchema());
}
- /*
- @Test(dependsOnMethods = {"testUpdateOnUploadVsp", "testList"})
- public void testCreateWithERemovedName() {
- testCreate(VSP_ID);
- }
-
- @Test(dependsOnMethods = "testList")
- public void testDeleteNonExistingNetworkId_negative() {
- testDelete_negative(VSP_ID, "non existing network id", VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
- }*/
-
-/*
- @Test(dependsOnMethods = "testList")
- public void testDelete() {
- networkManager.deleteNetwork(VSP_ID, NETWORK1_ID);
- NetworkEntity actual = networkDaoMock.getNetwork(VSP_ID, VERSION01, NETWORK1_ID);
- Assert.assertNull(actual);
- }
-
-
-
- @Test(dependsOnMethods = "testDelete")
- public void testDeleteList() {
- NetworkEntity network3 = new NetworkEntity(VSP_ID, null, null);
- network3.setName("network3 name");
- network3.setDescription("network3 desc");
- networkManager.createNetwork(network3);
-
- networkManager.deleteNetworks(VSP_ID);
-
- Collection<NetworkEntity> actual = networkManager.listNetworks(VSP_ID, null);
- Assert.assertEquals(actual.size(), 0);
- }*/
-
@Test(dependsOnMethods = "testList")
public void testDeleteOnUploadVsp_negative() {
testDelete_negative(VSP_ID, VERSION, NETWORK1_ID,
@@ -238,6 +181,7 @@ public class NetworkManagerImplTest {
private void testCreate_negative(NetworkEntity network, String expectedErrorCode) {
try {
+ doReturn(false).when(vendorSoftwareProductInfoDao).isManual(anyObject(),anyObject());
networkManager.createNetwork(network);
Assert.fail();
} catch (CoreException exception) {
@@ -281,6 +225,7 @@ public class NetworkManagerImplTest {
private void testDelete_negative(String vspId, Version version, String networkId,
String expectedErrorCode) {
try {
+ doReturn(false).when(vendorSoftwareProductInfoDao).isManual(anyObject(),anyObject());
networkManager.deleteNetwork(vspId, version, networkId);
Assert.fail();
} catch (CoreException exception) {
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 959b501c19..dd71073cbd 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
@@ -23,6 +23,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -68,6 +69,11 @@ public class NicManagerImplTest {
MockitoAnnotations.initMocks(this);
}
+ @AfterMethod
+ public void tearDown() {
+ nicManager = null;
+ }
+
@Test
public void testListWhenNone() {
Collection<NicEntity> nics = nicManager.listNics(VSP_ID, VERSION, COMPONENT_ID);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImplTest.java
index b925ab9270..1df437ef7b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImplTest.java
@@ -18,6 +18,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessType;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -61,6 +62,12 @@ public class ProcessManagerImplTest {
MockitoAnnotations.initMocks(this);
}
+ @AfterMethod
+ public void tearDown() {
+ processManager = null;
+ }
+
+
@Test
public void testListWhenNone() {
Collection<ProcessEntity> processes =
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 7721817c3b..9ef408c460 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
@@ -69,6 +69,7 @@ import org.openecomp.sdc.versioning.errors.EntityNotExistErrorBuilder;
import org.openecomp.sdc.versioning.types.VersionInfo;
import org.openecomp.sdc.versioning.types.VersionableEntityAction;
import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -151,6 +152,11 @@ public class VendorSoftwareProductManagerImplTest {
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
}
+
+ @AfterMethod
+ public void tearDown(){
+ vendorSoftwareProductManager = null;
+ }
/*
@Test
public void testListWhenNone() {