diff options
author | 2018-01-02 11:25:39 +0200 | |
---|---|---|
committer | 2018-01-02 14:18:33 +0200 | |
commit | badc6daeca01c3c6dda5d2d5d1d7bacec2c24f48 (patch) | |
tree | 85fcb81edd7c9c2c69d686030886395d396c580f /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp | |
parent | 27670b1e5ef236a7f473f2ce14bbbee82271de44 (diff) |
Unit Tests
Change-Id: I6b863f3762eaad4f17967d77fc5ad64b23ee9d3a
Issue-ID: SDC-860
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp')
2 files changed, 12 insertions, 9 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"); |