diff options
Diffstat (limited to 'openecomp-be/backend')
39 files changed, 460 insertions, 299 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java b/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java index 36493e2b14..f9b6bfe8a9 100644 --- a/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java @@ -694,11 +694,13 @@ public class ActionManagerImpl implements ActionManager { String artifactName = artifactMetadata.getArtifactName(); String generatedArtifactUuId = generateActionArtifactUuId(action, artifactName); if (generatedArtifactUuId.equals(artifactUuId)) { - ActionArtifactEntity artifactDeleteEntity = - new ActionArtifactEntity(artifact.getArtifactUuId(), - getEffectiveVersion(action.getVersion())); - actionLogPreProcessor(ActionSubOperation.DELETE_ACTION_ARTIFACT, TARGET_ENTITY_DB); - actionArtifactDao.delete(artifactDeleteEntity); + if (artifact != null) { + ActionArtifactEntity artifactDeleteEntity = + new ActionArtifactEntity(artifact.getArtifactUuId(), + getEffectiveVersion(action.getVersion())); + actionLogPreProcessor(ActionSubOperation.DELETE_ACTION_ARTIFACT, TARGET_ENTITY_DB); + actionArtifactDao.delete(artifactDeleteEntity); + } actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); log.metrics(""); } @@ -1041,11 +1043,11 @@ public class ActionManagerImpl implements ActionManager { action.setActionUuId(existingAction.getActionUuId()); } catch (IllegalArgumentException iae) { String message = iae.getMessage(); - switch (message) { - case VERSION_STRING_VIOLATION_MSG: - throw new ActionException(ACTION_UPDATE_NOT_ALLOWED_CODE, message); - default: - throw iae; + if(message == VERSION_STRING_VIOLATION_MSG) { + throw new ActionException(ACTION_UPDATE_NOT_ALLOWED_CODE, message); + } + else { + throw iae; } } } diff --git a/openecomp-be/backend/openecomp-sdc-application-config-manager/src/main/java/org/openecomp/sdc/applicationconfig/impl/ApplicationConfigManagerImpl.java b/openecomp-be/backend/openecomp-sdc-application-config-manager/src/main/java/org/openecomp/sdc/applicationconfig/impl/ApplicationConfigManagerImpl.java index 9dbdf760de..376cfca933 100644 --- a/openecomp-be/backend/openecomp-sdc-application-config-manager/src/main/java/org/openecomp/sdc/applicationconfig/impl/ApplicationConfigManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-application-config-manager/src/main/java/org/openecomp/sdc/applicationconfig/impl/ApplicationConfigManagerImpl.java @@ -29,6 +29,8 @@ 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.datatypes.error.ErrorLevel; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; @@ -41,6 +43,9 @@ import java.util.Collection; * Created by Talio on 8/8/2016. */ public class ApplicationConfigManagerImpl implements ApplicationConfigManager { + + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private static final String SCHEMA_GENERATOR_INITIALIZATION_ERROR = "SCHEMA_GENERATOR_INITIALIZATION_ERROR"; private static final String SCHEMA_GENERATOR_INITIALIZATION_ERROR_MSG = @@ -52,6 +57,7 @@ public class ApplicationConfigManagerImpl implements ApplicationConfigManager { try { applicationConfig.insertValue(namespace, key, value); } catch (Exception exception) { + log.debug("",exception); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.INSERT_INTO_APPLICATION_CONFIG, ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), diff --git a/openecomp-be/backend/openecomp-sdc-validation-manager/src/main/java/org/openecomp/sdc/validation/errors/ValidationInvalidErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-validation-manager/src/main/java/org/openecomp/sdc/validation/errors/ValidationInvalidErrorBuilder.java index b8015c0962..7b0d325d64 100644 --- a/openecomp-be/backend/openecomp-sdc-validation-manager/src/main/java/org/openecomp/sdc/validation/errors/ValidationInvalidErrorBuilder.java +++ b/openecomp-be/backend/openecomp-sdc-validation-manager/src/main/java/org/openecomp/sdc/validation/errors/ValidationInvalidErrorBuilder.java @@ -53,13 +53,13 @@ public class ValidationInvalidErrorBuilder extends BaseErrorBuilder { } private String toString(Map<String, List<ErrorMessage>> errors) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); errors.entrySet().stream() .forEach(entry -> singleErrorToString(sb, entry.getKey(), entry.getValue())); return sb.toString(); } - private void singleErrorToString(StringBuffer sb, String fileName, List<ErrorMessage> errors) { + private void singleErrorToString(StringBuilder sb, String fileName, List<ErrorMessage> errors) { sb.append(System.lineSeparator()); sb.append(fileName); sb.append(sb.append(": ")); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java index 1acd44511a..edbf165ec1 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java @@ -20,6 +20,8 @@ package org.openecomp.sdc.vendorlicense.impl; +import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE; + import org.openecomp.core.util.UniqueValueUtil; import org.openecomp.sdc.activityLog.ActivityLogManager; import org.openecomp.sdc.activityLog.ActivityLogManagerFactory; @@ -77,14 +79,11 @@ import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collection; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; -import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE; - public class VendorLicenseManagerImpl implements VendorLicenseManager { private VersioningManager versioningManager; private VendorLicenseFacade vendorLicenseFacade; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java index c71b591a04..07fdeeeee8 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java @@ -29,10 +29,10 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.vendorlicense.dao.LimitDao; import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; -import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric; -import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdc.vendorlicense.dao.types.LimitType; import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes; @@ -52,10 +52,10 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import static org.mockito.Mockito.when; - public class LimitTest { + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private final String USER1 = "limitTestUser1"; private final String LT1_NAME = "LT1 name"; @@ -92,7 +92,7 @@ public class LimitTest { } @BeforeMethod - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); } @@ -150,6 +150,7 @@ public class LimitTest { vendorLicenseManagerImpl.updateLimit(limitEntity2,USER1); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java index 53e9857a32..ab6262d8ca 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java @@ -230,4 +230,4 @@ public class VendorLicenseFacadeImplTest { return ep; } */ -}
\ No newline at end of file +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java index aa606913e1..dd3560615e 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java @@ -21,6 +21,9 @@ package org.openecomp.sdc.vendorlicense.impl; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.doReturn; + import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -129,7 +132,7 @@ public class FeatureGroupTest { } @BeforeMethod - public void setUp() throws Exception{ + public void setUp() { MockitoAnnotations.initMocks(this); } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java index acd1ce8cce..f0dd383a1f 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java @@ -26,6 +26,8 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao; import org.openecomp.sdc.vendorlicense.dao.LimitDao; import org.openecomp.sdc.vendorlicense.dao.types.*; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/UploadInvalidErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/UploadInvalidErrorBuilder.java index 91912bc0c9..f808d542f1 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/UploadInvalidErrorBuilder.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/UploadInvalidErrorBuilder.java @@ -59,13 +59,13 @@ public class UploadInvalidErrorBuilder extends BaseErrorBuilder { } private String toString(Map<String, List<ErrorMessage>> errors) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); errors.entrySet().stream() .forEach(entry -> singleErrorToString(sb, entry.getKey(), entry.getValue())); return sb.toString(); } - private void singleErrorToString(StringBuffer sb, String fileName, List<ErrorMessage> errors) { + private void singleErrorToString(StringBuilder sb, String fileName, List<ErrorMessage> errors) { sb.append(System.lineSeparator()); sb.append(fileName); sb.append(sb.append(": ")); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java index 86774381e0..5dc1446601 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelManagerImpl.java @@ -12,7 +12,6 @@ import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManager; import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager; -import org.openecomp.sdc.vendorsoftwareproduct.ComponentManagerFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity; import org.openecomp.sdc.vendorsoftwareproduct.errors.ComponentDependencyModelErrorBuilder; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java index 05a088f76a..dac68b5c47 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerFactoryImpl.java @@ -24,7 +24,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager; import org.openecomp.sdc.vendorsoftwareproduct.ComponentManagerFactory; import org.openecomp.sdc.vendorsoftwareproduct.NicManagerFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java index 42c8d12b3a..b5ca183ab7 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java @@ -52,7 +52,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComponentCo import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComponentQuestionnaireSchemaInput; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput; -import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils; import org.openecomp.sdc.versioning.VersioningUtil; import org.openecomp.sdc.versioning.dao.types.Version; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java index fc5857bb59..be90b08af9 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java @@ -12,7 +12,6 @@ import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager; -import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; @@ -20,7 +19,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; -import org.openecomp.sdc.vendorsoftwareproduct.errors.ComputeErrorBuilder; import org.openecomp.sdc.vendorsoftwareproduct.errors.DuplicateComputeInComponentErrorBuilder; import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder; import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerFactoryImpl.java index aef8be1fef..92ec7b7d2e 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerFactoryImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerFactoryImpl.java @@ -3,16 +3,11 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl; import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManager; import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDaoFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager; public class DeploymentFlavorManagerFactoryImpl extends DeploymentFlavorManagerFactory { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java index 5bf144e77e..0873eaf921 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java @@ -10,7 +10,6 @@ import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManager; -import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java index 9daec08d49..82b71399aa 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java @@ -37,12 +37,17 @@ import org.openecomp.sdc.versioning.dao.types.Version; import java.util.Collection; import java.util.stream.Collectors; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; + public class ImageManagerImpl implements ImageManager { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); private VendorSoftwareProductInfoDao vspInfoDao; private ImageDao imageDao; private CompositionEntityDataManager compositionEntityDataManager; + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + public ImageManagerImpl( VendorSoftwareProductInfoDao vspInfoDao, ImageDao imageDao, @@ -276,6 +281,7 @@ public class ImageManagerImpl implements ImageManager { final ImageFormat imageFormat = ImageFormat.valueOf(format); } } catch (IllegalArgumentException exception) { + log.debug("", exception); ErrorCode errorCode = ImageErrorBuilder.getInvalidImageFormatErrorBuilder(); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.UPDATE_IMAGE, ErrorLevel.ERROR.name(), diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java index 06e54528b7..8bdc7fdfce 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java @@ -6,6 +6,8 @@ import org.openecomp.sdc.generator.core.services.ManualVspToscaGenerationService import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel; import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage; import org.openecomp.sdc.generator.datatypes.tosca.VspModelInfo; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; import org.openecomp.sdc.logging.types.LoggerConstants; @@ -27,6 +29,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { private ManualVspDataCollectionService manualVspDataCollectionService = new ManualVspDataCollectionService(); + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + @Override public VspModelInfo gatherVspInformation(String vspId, Version version, String user) { mdcDataDebugMessage.debugEntryMessage(null, null); @@ -36,6 +40,7 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { try { releaseVendor = manualVspDataCollectionService.getReleaseVendor(vspId, version, user); } catch (Exception ex) { + log.debug("", ex); releaseVendor = Optional.empty(); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), @@ -49,6 +54,7 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { try { allowedFlavors = manualVspDataCollectionService.getAllowedFlavors(vspId, version, user); } catch (Exception ex) { + log.debug("", ex); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect allowed flavors : " @@ -65,6 +71,7 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { vspComponentImages = manualVspDataCollectionService.getVspComponentImages(vspId, version, user); } catch (Exception ex) { + log.debug("", ex); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component images : " @@ -80,6 +87,7 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { try { vspComponents = manualVspDataCollectionService.getVspComponents(vspId, version, user); } catch (Exception ex) { + log.debug("", ex); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp components : " @@ -95,6 +103,7 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { try { vspComponentNics = manualVspDataCollectionService.getVspComponentNics(vspId, version, user); } catch (Exception ex) { + log.debug("", ex); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component nics : " diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java index fcf54eef2f..0f4d73f8c5 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java @@ -73,6 +73,8 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager { private static final Logger logger = LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class); + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + MonitoringUploadsManagerImpl(ComponentArtifactDao componentArtifactDao, ActivityLogManager activityLogManager) { this.componentArtifactDao = componentArtifactDao; @@ -145,6 +147,7 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager { uploadedFileData); } catch (Exception exception) { + log.debug("", exception); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.UPLOAD_MONITORING_FILE, ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid " + type.toString() + "zip file"); @@ -259,6 +262,7 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager { contentMap = CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.ZIP, uploadedFileData); VendorSoftwareProductUtils.validateContentZipData(contentMap, errors); } catch (IOException exception) { + log.debug("", exception); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_MONITORING_FILE, ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), "Invalid Monitoring zip file"); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java index 339e05c16f..4df00fd74a 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImpl.java @@ -26,6 +26,8 @@ import org.openecomp.sdc.activityLog.ActivityLogManager; import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; import org.openecomp.sdc.logging.types.LoggerConstants; @@ -53,6 +55,8 @@ public class ProcessManagerImpl implements ProcessManager { private VendorSoftwareProductDao vendorSoftwareProductDao; + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + public ProcessManagerImpl(VendorSoftwareProductDao vendorSoftwareProductDao, ActivityLogManager activityLogManager) { this.vendorSoftwareProductDao = vendorSoftwareProductDao; this.activityLogManager = activityLogManager; @@ -170,6 +174,7 @@ public class ProcessManagerImpl implements ProcessManager { fos.write(retrieved.getArtifact().array()); fos.close(); } catch (IOException exception) { + log.debug("", exception); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.GET_PROCESS_ARTIFACT, ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't get process artifact"); @@ -216,6 +221,7 @@ public class ProcessManagerImpl implements ProcessManager { try { artifact = FileUtils.toByteArray(artifactFile); } catch (RuntimeException exception) { + log.debug("", exception); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.UPLOAD_PROCESS_ARTIFACT, ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't upload process artifact"); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java index c9f4159a4e..f4015ab848 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java @@ -22,7 +22,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; -import org.openecomp.core.converter.datatypes.Constants; import org.openecomp.core.enrichment.api.EnrichmentManager; import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory; import org.openecomp.core.model.dao.EnrichedServiceModelDao; @@ -143,13 +142,13 @@ import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductManager { - private static String VALIDATION_VSP_ID = "validationOnlyVspId"; + private String VALIDATION_VSP_ID = "validationOnlyVspId"; private static final String VALIDATION_VSP_NAME = "validationOnlyVspName"; //private static final String VALIDATION_VSP_USER = "validationOnlyVspUser"; private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); private static final Logger logger = - LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class); + LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class); private OrchestrationTemplateDao orchestrationTemplateDao; private VendorSoftwareProductInfoDao vspInfoDao; @@ -186,21 +185,21 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa * @param nicDao the nic dao */ public VendorSoftwareProductManagerImpl( - VersioningManager versioningManager, - VendorSoftwareProductDao vendorSoftwareProductDao, - OrchestrationTemplateDao orchestrationTemplateDataDao, - VendorSoftwareProductInfoDao vspInfoDao, - VendorLicenseFacade vendorLicenseFacade, - ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDao, - EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> enrichedServiceModelDao, - HealingManager healingManager, - VendorLicenseArtifactsService licenseArtifactsService, - InformationArtifactGenerator informationArtifactGenerator, - PackageInfoDao packageInfoDao, - ActivityLogManager activityLogManager, - DeploymentFlavorDao deploymentFlavorDao, - NicDao nicDao, - ManualVspToscaManager manualVspToscaManager) { + VersioningManager versioningManager, + VendorSoftwareProductDao vendorSoftwareProductDao, + OrchestrationTemplateDao orchestrationTemplateDataDao, + VendorSoftwareProductInfoDao vspInfoDao, + VendorLicenseFacade vendorLicenseFacade, + ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDao, + EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> enrichedServiceModelDao, + HealingManager healingManager, + VendorLicenseArtifactsService licenseArtifactsService, + InformationArtifactGenerator informationArtifactGenerator, + PackageInfoDao packageInfoDao, + ActivityLogManager activityLogManager, + DeploymentFlavorDao deploymentFlavorDao, + NicDao nicDao, + ManualVspToscaManager manualVspToscaManager) { this.versioningManager = versioningManager; this.vendorSoftwareProductDao = vendorSoftwareProductDao; this.orchestrationTemplateDao = orchestrationTemplateDataDao; @@ -222,11 +221,11 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa private void registerToVersioning() { vendorSoftwareProductDao.registerVersioning( - VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE); + VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE); serviceModelDao.registerVersioning( - VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE); + VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE); enrichedServiceModelDao.registerVersioning( - VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE); + VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE); } @Override @@ -235,13 +234,13 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Checkout_Entity.toString()); Version newVersion = versioningManager - .checkout(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, - vendorSoftwareProductId, user); + .checkout(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, + vendorSoftwareProductId, user); if (newVersion != null) { ActivityLogEntity activityLogEntity = - new ActivityLogEntity(vendorSoftwareProductId, String.valueOf(newVersion.getMajor() + 1), - ActivityType.CHECKOUT.toString(), user, true, "", ""); + new ActivityLogEntity(vendorSoftwareProductId, String.valueOf(newVersion.getMajor() + 1), + ActivityType.CHECKOUT.toString(), user, true, "", ""); activityLogManager.addActionLog(activityLogEntity, user); } @@ -255,18 +254,18 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa mdcDataDebugMessage.debugEntryMessage("VSP id", vendorSoftwareProductId); Version version = - getVersionInfo(vendorSoftwareProductId, VersionableEntityAction.Read, user) - .getActiveVersion(); + getVersionInfo(vendorSoftwareProductId, VersionableEntityAction.Read, user) + .getActiveVersion(); String preVspName = vspInfoDao - .get(new VspDetails(vendorSoftwareProductId, version)).getName(); + .get(new VspDetails(vendorSoftwareProductId, version)).getName(); Version newVersion = versioningManager.undoCheckout( - VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, - vendorSoftwareProductId, user); + VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, + vendorSoftwareProductId, user); String postVspName = vspInfoDao - .get(new VspDetails(vendorSoftwareProductId, newVersion)) - .getName(); + .get(new VspDetails(vendorSoftwareProductId, newVersion)) + .getName(); updateUniqueName(preVspName, postVspName); @@ -280,13 +279,13 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa mdcDataDebugMessage.debugEntryMessage("VSP id", vendorSoftwareProductId); Version newVersion = versioningManager.checkin( - VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, - vendorSoftwareProductId, user, null); + VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, + vendorSoftwareProductId, user, null); if (newVersion != null) { ActivityLogEntity activityLogEntity = - new ActivityLogEntity(vendorSoftwareProductId, String.valueOf(newVersion.getMajor() + 1), - ActivityType.CHECKIN.toString(), user, true, "", ""); + new ActivityLogEntity(vendorSoftwareProductId, String.valueOf(newVersion.getMajor() + 1), + ActivityType.CHECKIN.toString(), user, true, "", ""); activityLogManager.addActionLog(activityLogEntity, user); } @@ -303,48 +302,56 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa VspDetails vspDetails = getVsp(vspId, version, user); UploadDataEntity uploadData = orchestrationTemplateDao.getOrchestrationTemplate(vspId, version); ToscaServiceModel serviceModel = - serviceModelDao.getServiceModel(vspId, vspDetails.getVersion()); + serviceModelDao.getServiceModel(vspId, vspDetails.getVersion()); ValidationResponse validationResponse = new ValidationResponse(); validationResponse - .setVspErrors(validateCompletedVendorSoftwareProduct(vspDetails, uploadData, serviceModel), - LoggerServiceName.Submit_VSP, LoggerTragetServiceName.SUBMIT_VSP); + .setVspErrors(validateCompletedVendorSoftwareProduct(vspDetails, uploadData, serviceModel), + LoggerServiceName.Submit_VSP, LoggerTragetServiceName.SUBMIT_VSP); if (isCyclicDependencyInComponents(vspId, vspDetails.getVersion())) { Collection<ErrorCode> vspErrors = validationResponse.getVspErrors() == null - ? new ArrayList<>() - : validationResponse.getVspErrors(); + ? new ArrayList<>() + : validationResponse.getVspErrors(); vspErrors.add(ComponentDependencyModelErrorBuilder - .getcyclicDependencyComponentErrorBuilder()); + .getcyclicDependencyComponentErrorBuilder()); validationResponse.setVspErrors(vspErrors, LoggerServiceName.Submit_VSP, - LoggerTragetServiceName.SUBMIT_VSP); + LoggerTragetServiceName.SUBMIT_VSP); } validationResponse.setLicensingDataErrors(validateLicensingData(vspDetails)); validationResponse - .setUploadDataErrors(validateUploadData(uploadData,vspDetails), LoggerServiceName.Submit_VSP, - LoggerTragetServiceName.SUBMIT_VSP); + .setUploadDataErrors(validateUploadData(uploadData, vspDetails), + LoggerServiceName.Submit_VSP, + LoggerTragetServiceName.SUBMIT_VSP); validationResponse.setQuestionnaireValidationResult( - validateQuestionnaire(vspDetails.getId(), vspDetails.getVersion(), vspDetails - .getOnboardingMethod())); + validateQuestionnaire(vspDetails.getId(), vspDetails.getVersion(), vspDetails + .getOnboardingMethod())); if (vspDetails.getOnboardingMethod().equals("Manual")) { - Collection<ErrorCode> deploymentFlavourValidationErrList = deploymentFlavorValidation(vspDetails.getId(), vspDetails.getVersion()); + Collection<ErrorCode> deploymentFlavourValidationErrList = + deploymentFlavorValidation(vspDetails.getId(), vspDetails.getVersion()); if (validationResponse.getVspErrors() != null) { - if(deploymentFlavourValidationErrList != null) + if (deploymentFlavourValidationErrList != null) { validationResponse.getVspErrors().addAll(deploymentFlavourValidationErrList); + } } else { - validationResponse.setVspErrors(deploymentFlavourValidationErrList, LoggerServiceName.Submit_VSP, + validationResponse + .setVspErrors(deploymentFlavourValidationErrList, LoggerServiceName.Submit_VSP, LoggerTragetServiceName.SUBMIT_VSP); } - Set<CompositionEntityValidationData> compositionEntityValidationData = componentValidation(vspDetails.getId(), vspDetails.getVersion()); + Set<CompositionEntityValidationData> compositionEntityValidationData = + componentValidation(vspDetails.getId(), vspDetails.getVersion()); if (validationResponse.getQuestionnaireValidationResult() != null) { - if(!CollectionUtils.isEmpty(compositionEntityValidationData)) - validationResponse.getQuestionnaireValidationResult().getValidationData().addAll(compositionEntityValidationData); + if (!CollectionUtils.isEmpty(compositionEntityValidationData)) { + validationResponse.getQuestionnaireValidationResult().getValidationData() + .addAll(compositionEntityValidationData); + } } else { - validationResponse.setQuestionnaireValidationResult(CollectionUtils.isEmpty(compositionEntityValidationData) ? null : + validationResponse.setQuestionnaireValidationResult( + CollectionUtils.isEmpty(compositionEntityValidationData) ? null : new QuestionnaireValidationResult(compositionEntityValidationData)); } @@ -353,16 +360,16 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa serviceModel = manualVspToscaManager.generateToscaModel(vspModelInfo); } validationResponse.setCompilationErrors( - compile(vspId, vspDetails.getVersion(), serviceModel), - LoggerServiceName.Submit_VSP, LoggerTragetServiceName.SUBMIT_VSP); + compile(vspId, vspDetails.getVersion(), serviceModel), + LoggerServiceName.Submit_VSP, LoggerTragetServiceName.SUBMIT_VSP); if (validationResponse.isValid()) { Version newVersion = versioningManager.submit( - VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, - vspId, user, null); + VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, + vspId, user, null); ActivityLogEntity activityLogEntity = new ActivityLogEntity(vspDetails.getId(), String - .valueOf(newVersion.getMajor()), - ActivityType.SUBMIT.toString(), user, true, "", ""); + .valueOf(newVersion.getMajor()), + ActivityType.SUBMIT.toString(), user, true, "", ""); activityLogManager.addActionLog(activityLogEntity, user); } @@ -373,7 +380,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa private boolean isCyclicDependencyInComponents(String vendorSoftwareProductId, Version version) { final Collection<ComponentDependencyModelEntity> componentDependencyModelEntities = - vendorSoftwareProductDao.listComponentDependencies(vendorSoftwareProductId, version); + vendorSoftwareProductDao.listComponentDependencies(vendorSoftwareProductId, version); ComponentDependencyTracker dependencyTracker = new ComponentDependencyTracker(); for (ComponentDependencyModelEntity entity : componentDependencyModelEntities) { @@ -388,42 +395,44 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa Set<CompositionEntityValidationData> validationData = new HashSet<>(); Collection<ErrorCode> errorCodeList = new ArrayList<>(); Collection<DeploymentFlavorEntity> deploymentFlavors = - vendorSoftwareProductDao.listDeploymentFlavors(vspId, version); + vendorSoftwareProductDao.listDeploymentFlavors(vspId, version); if (!CollectionUtils.isEmpty(deploymentFlavors)) { deploymentFlavors.forEach(deploymentFlavor -> { DeploymentFlavorEntity deployment = vendorSoftwareProductDao.getDeploymentFlavor(vspId, - version, deploymentFlavor.getId()); + version, deploymentFlavor.getId()); DeploymentFlavor deploymentlocalFlavor = deployment.getDeploymentFlavorCompositionData(); if (deploymentlocalFlavor != null) { - if (deploymentlocalFlavor.getFeatureGroupId() == null ) { + if (deploymentlocalFlavor.getFeatureGroupId() == null) { ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder. - getFeatureGroupMandatoryErrorBuilder(deploymentlocalFlavor.getModel()); + getFeatureGroupMandatoryErrorBuilder(deploymentlocalFlavor.getModel()); errorCodeList.add(deploymentFlavorErrorBuilder); } List<ComponentComputeAssociation> componetComputeAssociations = new ArrayList<>(); componetComputeAssociations = deploymentlocalFlavor.getComponentComputeAssociations(); if (CollectionUtils.isEmpty(componetComputeAssociations)) { CompositionEntityValidationData compositionEntityValidationData = new - CompositionEntityValidationData(CompositionEntityType.deployment,deploymentFlavor - .getId()); + CompositionEntityValidationData(CompositionEntityType.deployment, deploymentFlavor + .getId()); compositionEntityValidationData.setEntityName(deployment - .getDeploymentFlavorCompositionData().getModel()); + .getDeploymentFlavorCompositionData().getModel()); ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder - .getInvalidComponentComputeAssociationErrorBuilder(deploymentlocalFlavor.getModel()); + .getInvalidComponentComputeAssociationErrorBuilder( + deploymentlocalFlavor.getModel()); errorCodeList.add(deploymentFlavorErrorBuilder); } else { componetComputeAssociations.forEach(componetComputeAssociation -> { if (componetComputeAssociation == null - || !(componetComputeAssociation.getComponentId() != null - && componetComputeAssociation.getComputeFlavorId() != null)) { + || !(componetComputeAssociation.getComponentId() != null + && componetComputeAssociation.getComputeFlavorId() != null)) { CompositionEntityValidationData compositionEntityValidationData = new - CompositionEntityValidationData(CompositionEntityType.deployment, - deploymentFlavor.getId()); + CompositionEntityValidationData(CompositionEntityType.deployment, + deploymentFlavor.getId()); compositionEntityValidationData.setEntityName(deployment - .getDeploymentFlavorCompositionData().getModel()); + .getDeploymentFlavorCompositionData().getModel()); ErrorCode deploymentFlavorErrorBuilder = DeploymentFlavorErrorBuilder - .getInvalidComponentComputeAssociationErrorBuilder(deploymentlocalFlavor.getModel()); + .getInvalidComponentComputeAssociationErrorBuilder( + deploymentlocalFlavor.getModel()); errorCodeList.add(deploymentFlavorErrorBuilder); } @@ -439,7 +448,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa mdcDataDebugMessage.debugEntryMessage("VSP id", vspId); Set<CompositionEntityValidationData> validationData = new HashSet<>(); - Collection<ComponentEntity> components = vendorSoftwareProductDao.listComponents(vspId,version); + Collection<ComponentEntity> components = + vendorSoftwareProductDao.listComponents(vspId, version); if (!CollectionUtils.isEmpty(components)) { components.forEach(component -> { validateImage(vspId, version, validationData, component); @@ -454,19 +464,20 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa private void validateNic(String vspId, Version version, Set<CompositionEntityValidationData> validationData, ComponentEntity component) { - Collection<NicEntity> nics = nicDao.list(new NicEntity(vspId,version, component.getId(),null)); + Collection<NicEntity> nics = + nicDao.list(new NicEntity(vspId, version, component.getId(), null)); if (CollectionUtils.isNotEmpty(nics)) { nics.forEach(nicEntity -> { NicEntity nic = nicDao.get(new NicEntity(vspId, version, component.getId(), - nicEntity.getId())); + nicEntity.getId())); NetworkType networkType = nic.getNicCompositionData().getNetworkType(); String networkId = nic.getNicCompositionData().getNetworkId(); if (networkType.equals(NetworkType.Internal) && networkId == null) { CompositionEntityValidationData compositionEntityValidationData = new - CompositionEntityValidationData(CompositionEntityType.nic, nic.getId()); + CompositionEntityValidationData(CompositionEntityType.nic, nic.getId()); compositionEntityValidationData.setEntityName(nic.getNicCompositionData().getName()); ErrorCode nicInternalNetworkErrorBuilder = NicInternalNetworkErrorBuilder - .getNicNullNetworkIdInternalNetworkIdErrorBuilder(); + .getNicNullNetworkIdInternalNetworkIdErrorBuilder(); List<String> errors = new ArrayList<>(); errors.add(nicInternalNetworkErrorBuilder.message()); compositionEntityValidationData.setErrors(errors); @@ -479,15 +490,15 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa private void validateImage(String vspId, Version version, Set<CompositionEntityValidationData> validationData, ComponentEntity component) { - Collection<ImageEntity> images = vendorSoftwareProductDao.listImages(vspId,version, - component.getId()); + Collection<ImageEntity> images = vendorSoftwareProductDao.listImages(vspId, version, + component.getId()); if (CollectionUtils.isEmpty(images)) { CompositionEntityValidationData compositionEntityValidationData = new - CompositionEntityValidationData(component.getType(),component.getId()); + CompositionEntityValidationData(component.getType(), component.getId()); compositionEntityValidationData.setEntityName(component.getComponentCompositionData() - .getDisplayName()); + .getDisplayName()); ErrorCode vfcMissingImageErrorBuilder = - ComponentErrorBuilder.VfcMissingImageErrorBuilder(); + ComponentErrorBuilder.VfcMissingImageErrorBuilder(); List<String> errors = new ArrayList<>(); errors.add(vfcMissingImageErrorBuilder.message()); compositionEntityValidationData.setErrors(errors); @@ -496,9 +507,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa } - private List<ErrorCode> validateCompletedVendorSoftwareProduct( - VspDetails vspDetails, UploadDataEntity uploadData, Object serviceModel) { + VspDetails vspDetails, UploadDataEntity uploadData, Object serviceModel) { List<ErrorCode> errors = new ArrayList<>(); @@ -520,10 +530,10 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa if (vspDetails.getOnboardingMethod().equals("Manual")) { //Manual Onboarding specific validations Collection<DeploymentFlavorEntity> deploymentFlavorEntities = vendorSoftwareProductDao - .listDeploymentFlavors(vspDetails.getId(), vspDetails.getVersion()); - if (CollectionUtils.isEmpty(deploymentFlavorEntities) ) { + .listDeploymentFlavors(vspDetails.getId(), vspDetails.getVersion()); + if (CollectionUtils.isEmpty(deploymentFlavorEntities)) { ErrorCode vspMissingDeploymentFlavorErrorBuilder = - VendorSoftwareProductInvalidErrorBuilder.VspMissingDeploymentFlavorErrorBuilder(); + VendorSoftwareProductInvalidErrorBuilder.VspMissingDeploymentFlavorErrorBuilder(); errors.add(vspMissingDeploymentFlavorErrorBuilder); } errors.addAll(validateMandatoryLicenseFields(vspDetails)); @@ -531,11 +541,11 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa //Heat flow specific VSP validations if (uploadData == null || uploadData.getContentData() == null || serviceModel == null) { errors.add(VendorSoftwareProductInvalidErrorBuilder - .VendorSoftwareProductMissingServiceModelErrorBuilder(vspDetails.getId(), - vspDetails.getVersion())); + .VendorSoftwareProductMissingServiceModelErrorBuilder(vspDetails.getId(), + vspDetails.getVersion())); } if (vspDetails.getVlmVersion() != null || vspDetails.getLicenseAgreement() != null - || vspDetails.getFeatureGroups() != null) { + || vspDetails.getFeatureGroups() != null) { errors.addAll(validateMandatoryLicenseFields(vspDetails)); } } @@ -546,7 +556,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa List<ErrorCode> errors = new ArrayList<>(); if (vspDetails.getVlmVersion() == null) { errors.add(createMissingMandatoryFieldError( - "licensing version (in the format of: {integer}.{integer})")); + "licensing version (in the format of: {integer}.{integer})")); } if (vspDetails.getLicenseAgreement() == null) { errors.add(createMissingMandatoryFieldError("license agreement")); @@ -565,13 +575,13 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa mdcDataDebugMessage.debugEntryMessage(null); mdcDataDebugMessage.debugExitMessage(null); return SchemaGenerator - .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.vsp, schemaInput); + .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.vsp, schemaInput); } private static void sortVspListByModificationTimeDescOrder( - List<VersionedVendorSoftwareProductInfo> vsps) { + List<VersionedVendorSoftwareProductInfo> vsps) { vsps.sort((o1, o2) -> o2.getVspDetails().getWritetimeMicroSeconds() - .compareTo(o1.getVspDetails().getWritetimeMicroSeconds())); + .compareTo(o1.getVspDetails().getWritetimeMicroSeconds())); } @@ -584,21 +594,22 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa enrichedServiceModelDao.deleteAll(vendorSoftwareProductId, version); EnrichmentManager<ToscaServiceModel> enrichmentManager = - EnrichmentManagerFactory.getInstance().createInterface(); + EnrichmentManagerFactory.getInstance().createInterface(); enrichmentManager.init(vendorSoftwareProductId, version); enrichmentManager.setModel(serviceModel); Map<String, List<ErrorMessage>> enrichErrors = enrichmentManager.enrich(); if (MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, enrichErrors))) { logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.ENRICHMENT_COMPLETED - + vendorSoftwareProductId); + + vendorSoftwareProductId); } else { enrichErrors.values().forEach(errorList -> - auditIfContainsErrors(errorList,vendorSoftwareProductId,AuditMessages.ENRICHMENT_ERROR)); + auditIfContainsErrors(errorList, vendorSoftwareProductId, + AuditMessages.ENRICHMENT_ERROR)); } enrichedServiceModelDao - .storeServiceModel(vendorSoftwareProductId, version, enrichmentManager.getModel()); + .storeServiceModel(vendorSoftwareProductId, version, enrichmentManager.getModel()); return enrichErrors; } @@ -607,15 +618,15 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa mdcDataDebugMessage.debugEntryMessage("VSP id", vspDetails.getId()); if (vspDetails.getVendorId() == null || vspDetails.getVlmVersion() == null - || vspDetails.getLicenseAgreement() == null - || CollectionUtils.isEmpty(vspDetails.getFeatureGroups())) { + || vspDetails.getLicenseAgreement() == null + || CollectionUtils.isEmpty(vspDetails.getFeatureGroups())) { return null; } mdcDataDebugMessage.debugExitMessage("VSP id", vspDetails.getId()); return vendorLicenseFacade - .validateLicensingData(vspDetails.getVendorId(), vspDetails.getVlmVersion(), - vspDetails.getLicenseAgreement(), vspDetails.getFeatureGroups()); + .validateLicensingData(vspDetails.getVendorId(), vspDetails.getVlmVersion(), + vspDetails.getLicenseAgreement(), vspDetails.getFeatureGroups()); } @Override @@ -623,6 +634,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa try { validateUniqueName(VALIDATION_VSP_NAME); } catch (Exception ignored) { + logger.debug("",ignored); return VALIDATION_VSP_ID; } VspDetails validationVsp = new VspDetails(); @@ -630,8 +642,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa vspInfoDao.create(validationVsp); Version version = versioningManager.create( - VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, - validationVsp.getId(), user); + VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, + validationVsp.getId(), user); validationVsp.setVersion(version); createUniqueName(VALIDATION_VSP_NAME); @@ -649,15 +661,15 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa vspInfoDao.create(vspDetails);//id will be set in the dao vspInfoDao.updateQuestionnaireData(vspDetails.getId(), null, - new JsonSchemaDataGenerator(getVspQuestionnaireSchema(null)).generateData()); + new JsonSchemaDataGenerator(getVspQuestionnaireSchema(null)).generateData()); Version version = versioningManager - .create(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, - vspDetails.getId(), user); + .create(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, + vspDetails.getId(), user); vspDetails.setVersion(version); ActivityLogEntity activityLogEntity = new ActivityLogEntity(vspDetails.getId(), String - .valueOf(vspDetails.getVersion().getMajor() + 1), - ActivityType.CREATE_NEW.toString(), user, true, "", ""); + .valueOf(vspDetails.getVersion().getMajor() + 1), + ActivityType.CREATE_NEW.toString(), user, true, "", ""); activityLogManager.addActionLog(activityLogEntity, user); String vspName = vspDetails.getName(); createUniqueName(vspName); @@ -670,8 +682,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa mdcDataDebugMessage.debugEntryMessage(null); Map<String, VersionInfo> idToVersionsInfo = versioningManager.listEntitiesVersionInfo( - VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, user, - VersionableEntityAction.Read); + VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, user, + VersionableEntityAction.Read); List<VersionedVendorSoftwareProductInfo> vsps = new ArrayList<>(); for (Map.Entry<String, VersionInfo> entry : idToVersionsInfo.entrySet()) { @@ -696,11 +708,12 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa vsps.add(new VersionedVendorSoftwareProductInfo(vsp, versionInfo)); } } catch (RuntimeException rte) { + logger.debug("",rte); logger.error( - "Error trying to retrieve vsp[" + entry.getKey() + "] version[" + version.toString - () + "] " + - "message:" + rte - .getMessage()); + "Error trying to retrieve vsp[" + entry.getKey() + "] version[" + version.toString + () + "] " + + "message:" + rte + .getMessage()); } } @@ -718,11 +731,11 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa VspDetails retrieved = vspInfoDao.get(vspDetails); if (!retrieved.getOnboardingMethod().equals(vspDetails.getOnboardingMethod())) { final ErrorCode onboardingMethodUpdateErrorCode = OnboardingMethodErrorBuilder - .getOnboardingUpdateError(); + .getOnboardingUpdateError(); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.UPDATE_VSP, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), onboardingMethodUpdateErrorCode.message()); + LoggerTragetServiceName.UPDATE_VSP, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), onboardingMethodUpdateErrorCode.message()); throw new CoreException(onboardingMethodUpdateErrorCode); } @@ -744,18 +757,18 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa final List<String> featureGroups = vspDetails.getFeatureGroups(); if (featureGroups != null) { final Collection<DeploymentFlavorEntity> deploymentFlavorEntities = deploymentFlavorDao - .list(new DeploymentFlavorEntity(vspDetails.getId(), vspDetails - .getVersion(), null)); + .list(new DeploymentFlavorEntity(vspDetails.getId(), vspDetails + .getVersion(), null)); if (Objects.nonNull(deploymentFlavorEntities)) { deploymentFlavorEntities.forEach(deploymentFlavorEntity -> { final String featureGroupId = - deploymentFlavorEntity.getDeploymentFlavorCompositionData().getFeatureGroupId(); - if ( !featureGroups.contains(featureGroupId)) { + deploymentFlavorEntity.getDeploymentFlavorCompositionData().getFeatureGroupId(); + if (!featureGroups.contains(featureGroupId)) { DeploymentFlavor deploymentFlavorCompositionData = - deploymentFlavorEntity.getDeploymentFlavorCompositionData(); + deploymentFlavorEntity.getDeploymentFlavorCompositionData(); deploymentFlavorCompositionData.setFeatureGroupId(null); deploymentFlavorEntity.setDeploymentFlavorCompositionData - (deploymentFlavorCompositionData); + (deploymentFlavorCompositionData); vendorSoftwareProductDao.updateDeploymentFlavor(deploymentFlavorEntity); } }); @@ -771,17 +784,17 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa VspDetails vsp = vspInfoDao.get(new VspDetails(vspId, version)); if (vsp == null) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.GET_VSP, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Requested VSP not found"); + LoggerTragetServiceName.GET_VSP, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Requested VSP not found"); throw new CoreException(new VendorSoftwareProductNotFoundErrorBuilder(vspId).build()); } vsp.setValidationData(orchestrationTemplateDao.getValidationData(vspId, version)); - if(Objects.isNull(vsp.getOnboardingOrigin())){ + if (Objects.isNull(vsp.getOnboardingOrigin())) { vsp.setOnboardingOrigin(OnboardingTypesEnum.ZIP.toString()); } - if(Objects.isNull(vsp.getNetworkPackageName())){ + if (Objects.isNull(vsp.getNetworkPackageName())) { vsp.setNetworkPackageName("Upload File"); } @@ -792,12 +805,12 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa @Override public Version callAutoHeal(String vspId, VersionInfo versionInfo, VspDetails vendorSoftwareProductInfo, String user) - throws Exception { + throws Exception { switch (versionInfo.getStatus()) { case Locked: if (user.equals(versionInfo.getLockingUser())) { autoHeal(vspId, versionInfo.getActiveVersion(), vendorSoftwareProductInfo, - versionInfo.getLockingUser()); + versionInfo.getLockingUser()); } return versionInfo.getActiveVersion(); case Available: @@ -818,6 +831,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa createPackage(vspId, finalVersion, user); return finalVersion; } catch (IOException ex) { + logger.debug("",ex); throw new Exception(ex.getMessage()); } default: @@ -833,12 +847,12 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa mdcDataDebugMessage.debugEntryMessage("VSP id", vspId); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.DELETE_VSP, ErrorLevel.ERROR.name(), - LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Unsupported operation"); + LoggerTragetServiceName.DELETE_VSP, ErrorLevel.ERROR.name(), + LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Unsupported operation"); mdcDataDebugMessage.debugExitMessage("VSP id", vspId); throw new UnsupportedOperationException( - VendorSoftwareProductConstants.UNSUPPORTED_OPERATION_ERROR); + VendorSoftwareProductConstants.UNSUPPORTED_OPERATION_ERROR); } @Override @@ -848,8 +862,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa VersionInfo versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user); version = VersionStatus.Locked.equals(versionInfo.getStatus()) - ? versionInfo.getActiveVersion() - : checkout(vspId, user); + ? versionInfo.getActiveVersion() + : checkout(vspId, user); version.setStatus(VersionStatus.Locked); Optional<String> errorMessages = @@ -911,24 +925,24 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa if (version == null) { errorMessage = "Package not found"; MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.GET_TRANSLATED_FILE, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage); + LoggerTragetServiceName.GET_TRANSLATED_FILE, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage); throw new CoreException(new PackageNotFoundErrorBuilder(vspId).build()); } else if (!version.isFinal()) { errorMessage = "Invalid requested version"; MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.GET_VERSION_INFO, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage); + LoggerTragetServiceName.GET_VERSION_INFO, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage); throw new CoreException(new RequestedVersionInvalidErrorBuilder().build()); } PackageInfo packageInfo = - packageInfoDao.get(new PackageInfo(vspId, version)); + packageInfoDao.get(new PackageInfo(vspId, version)); if (packageInfo == null) { errorMessage = "Package not found"; MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.GET_TRANSLATED_FILE, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage); + LoggerTragetServiceName.GET_TRANSLATED_FILE, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage); throw new CoreException(new PackageNotFoundErrorBuilder(vspId, version).build()); } @@ -936,8 +950,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa if (translatedFileBuffer == null) { errorMessage = "Package not found"; MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.GET_TRANSLATED_FILE, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage); + LoggerTragetServiceName.GET_TRANSLATED_FILE, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage); throw new CoreException(new PackageInvalidErrorBuilder(vspId, version).build()); } @@ -950,10 +964,10 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa } catch (IOException exception) { errorMessage = "Can't create package"; MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.CREATE_TRANSLATED_FILE, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage); + LoggerTragetServiceName.CREATE_TRANSLATED_FILE, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), errorMessage); throw new CoreException(new TranslationFileCreationErrorBuilder(vspId, version).build(), - exception); + exception); } mdcDataDebugMessage.debugExitMessage("VSP id", vspId); @@ -976,12 +990,12 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa try (final ZipOutputStream zos = new ZipOutputStream(baos); ZipInputStream zipStream = new ZipInputStream( - new ByteArrayInputStream(contentData.array()))) { + new ByteArrayInputStream(contentData.array()))) { zos.write(contentData.array()); } catch (IOException exception) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.GET_UPLOADED_HEAT, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't get uploaded HEAT"); + LoggerTragetServiceName.GET_UPLOADED_HEAT, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't get uploaded HEAT"); throw new CoreException(new FileCreationErrorBuilder(vspId).build(), exception); } @@ -995,11 +1009,11 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa if (!version.isFinal()) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.CREATE_PACKAGE, ErrorLevel.ERROR.name(), - LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create package"); + LoggerTragetServiceName.CREATE_PACKAGE, ErrorLevel.ERROR.name(), + LoggerErrorCode.PERMISSION_ERROR.getErrorCode(), "Can't create package"); throw new CoreException( - new CreatePackageForNonFinalVendorSoftwareProductErrorBuilder(vspId, version) - .build()); + new CreatePackageForNonFinalVendorSoftwareProductErrorBuilder(vspId, version) + .build()); } ToscaServiceModel toscaServiceModel = enrichedServiceModelDao.getServiceModel(vspId, version); @@ -1009,13 +1023,13 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa PackageInfo packageInfo = createPackageInfo(vspId, vspDetails); ToscaFileOutputServiceCsarImpl toscaServiceTemplateServiceCsar = - new ToscaFileOutputServiceCsarImpl(); + new ToscaFileOutputServiceCsarImpl(); FileContentHandler licenseArtifacts = licenseArtifactsService - .createLicenseArtifacts(vspDetails.getId(), vspDetails.getVendorId(), vlmVersion, - vspDetails.getFeatureGroups(), user); + .createLicenseArtifacts(vspDetails.getId(), vspDetails.getVendorId(), vlmVersion, + vspDetails.getFeatureGroups(), user); //todo add tosca validation here packageInfo.setTranslatedFile(ByteBuffer.wrap( - toscaServiceTemplateServiceCsar.createOutputFile(toscaServiceModel, licenseArtifacts))); + toscaServiceTemplateServiceCsar.createOutputFile(toscaServiceModel, licenseArtifacts))); packageInfoDao.create(packageInfo); @@ -1046,7 +1060,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa VspQuestionnaireEntity retrieved = vspInfoDao.getQuestionnaire(vspId, version); VersioningUtil.validateEntityExistence(retrieved, new VspQuestionnaireEntity(vspId, version), - VspDetails.ENTITY_TYPE); + VspDetails.ENTITY_TYPE); String questionnaireData = retrieved.getQuestionnaireData(); @@ -1072,7 +1086,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa private Map<String, List<ErrorMessage>> validateUploadData(UploadDataEntity uploadData, VspDetails vspDetails) - throws IOException { + throws IOException { Map<String, List<ErrorMessage>> validationErrors = new HashMap<>(); if (uploadData == null || uploadData.getContentData() == null) { @@ -1080,24 +1094,26 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa } FileContentHandler fileContentMap = - CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.getOnboardingTypesEnum - (vspDetails.getOnboardingOrigin()), - uploadData.getContentData().array()); - //todo - check - ValidationManager validationManager = - ValidationManagerUtil.initValidationManager(fileContentMap); - validationErrors.putAll(validationManager.validate()); + CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.getOnboardingTypesEnum + (vspDetails.getOnboardingOrigin()), + uploadData.getContentData().array()); + + if (vspDetails.getOnboardingOrigin().equals(OnboardingTypesEnum.ZIP.name().toLowerCase())) { + ValidationManager validationManager = + ValidationManagerUtil.initValidationManager(fileContentMap); + validationErrors.putAll(validationManager.validate()); + } return - MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, validationErrors)) - ? null : validationErrors; + MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, validationErrors)) + ? null : validationErrors; } private VersionInfo getVersionInfo(String vendorSoftwareProductId, VersionableEntityAction action, String user) { return versioningManager.getEntityVersionInfo( - VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, - vendorSoftwareProductId, user, action); + VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, + vendorSoftwareProductId, user, action); } @@ -1108,9 +1124,9 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa // The apis of CompositionEntityDataManager used here are stateful! // so, it must be re-created from scratch when it is used! CompositionEntityDataManager compositionEntityDataManager = - CompositionEntityDataManagerFactory.getInstance().createInterface(); + CompositionEntityDataManagerFactory.getInstance().createInterface(); compositionEntityDataManager - .addEntity(vspInfoDao.getQuestionnaire(vspId, version), null); + .addEntity(vspInfoDao.getQuestionnaire(vspId, version), null); Collection<NicEntity> nics = vendorSoftwareProductDao.listNicsByVsp(vspId, version); @@ -1121,27 +1137,27 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa Nic nic = nicEntity.getNicCompositionData(); if (nic != null && nic.getName() != null) { List<String> nicNames = - nicNamesByComponent.computeIfAbsent(nicEntity.getComponentId(), k -> new ArrayList<>()); + nicNamesByComponent.computeIfAbsent(nicEntity.getComponentId(), k -> new ArrayList<>()); nicNames.add(nic.getName()); } } Collection<ComponentEntity> components = - vendorSoftwareProductDao.listComponentsCompositionAndQuestionnaire(vspId, version); + vendorSoftwareProductDao.listComponentsCompositionAndQuestionnaire(vspId, version); components.forEach(component -> compositionEntityDataManager.addEntity(component, - new ComponentQuestionnaireSchemaInput(nicNamesByComponent.get(component.getId()), - JsonUtil.json2Object(component.getQuestionnaireData(), Map.class)))); + new ComponentQuestionnaireSchemaInput(nicNamesByComponent.get(component.getId()), + JsonUtil.json2Object(component.getQuestionnaireData(), Map.class)))); Collection<ComputeEntity> computes = vendorSoftwareProductDao.listComputesByVsp(vspId, version); computes.forEach(compute -> compositionEntityDataManager.addEntity(compute, null)); - if ("Manual".equals(onboardingMethod) ) { + if ("Manual".equals(onboardingMethod)) { Collection<ImageEntity> images = vendorSoftwareProductDao.listImagesByVsp(vspId, version); images.forEach(image -> compositionEntityDataManager.addEntity(image, null)); } Map<CompositionEntityId, Collection<String>> errorsByEntityId = - compositionEntityDataManager.validateEntitiesQuestionnaire(); + compositionEntityDataManager.validateEntitiesQuestionnaire(); if (MapUtils.isNotEmpty(errorsByEntityId)) { compositionEntityDataManager.buildTrees(); compositionEntityDataManager.addErrorsToTrees(errorsByEntityId); @@ -1151,7 +1167,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa mdcDataDebugMessage.debugExitMessage("VSP id", vspId); return new QuestionnaireValidationResult( - compositionEntityDataManager.getAllErrorsByVsp(vspId)); + compositionEntityDataManager.getAllErrorsByVsp(vspId)); } mdcDataDebugMessage.debugExitMessage("VSP id", vspId); @@ -1172,11 +1188,11 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa File infoArtifactFile; try { infoArtifactAsByteBuffer = ByteBuffer.wrap(informationArtifactGenerator.generate(vspId, - version).getBytes()); + version).getBytes()); infoArtifactFile = - new File( - String.format(VendorSoftwareProductConstants.INFORMATION_ARTIFACT_NAME, vspName)); + new File( + String.format(VendorSoftwareProductConstants.INFORMATION_ARTIFACT_NAME, vspName)); OutputStream out = new BufferedOutputStream(new FileOutputStream(infoArtifactFile)); out.write(infoArtifactAsByteBuffer.array()); out.close(); @@ -1190,18 +1206,18 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa void validateUniqueName(String vspName) { UniqueValueUtil.validateUniqueValue( - VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, vspName); + VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, vspName); } void createUniqueName(String vspName) { UniqueValueUtil.createUniqueValue( - VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, vspName); + VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, vspName); } void updateUniqueName(String oldVspName, String newVspName) { UniqueValueUtil.updateUniqueValue( - VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, - oldVspName, newVspName); + VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + oldVspName, newVspName); } @Override @@ -1210,12 +1226,12 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa return vendorSoftwareProductDao.listComputesByVsp(vspId, version); } - private void auditIfContainsErrors(List<ErrorMessage> errorList, String vspId,String auditType) { + private void auditIfContainsErrors(List<ErrorMessage> errorList, String vspId, String auditType) { errorList.forEach(errorMessage -> { if (errorMessage.getLevel().equals(ErrorLevel.ERROR)) { logger.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(), - vspId)); + vspId)); } }); } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java index 44c9d155c6..5615f8f6b5 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VspManagerFactoryImpl.java @@ -28,7 +28,6 @@ import org.openecomp.sdc.vendorlicense.VendorLicenseArtifactServiceFactory; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory; import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory; @@ -36,7 +35,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.factory.InformationArtifactGeneratorFactory; -import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor; import org.openecomp.sdc.versioning.VersioningManagerFactory; public class VspManagerFactoryImpl extends VspManagerFactory { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireValidationResult.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireValidationResult.java index 3e059f4ccb..2599d4723d 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireValidationResult.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireValidationResult.java @@ -22,7 +22,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.types; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData; -import java.util.List; import java.util.Set; public class QuestionnaireValidationResult { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java index e3fa0a8480..45ba4fb434 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java @@ -14,7 +14,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity; import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; -import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator; + import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelTest.java index c6374375f9..c3f78b6cb0 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelTest.java @@ -5,24 +5,17 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.Spy; -import org.openecomp.core.utilities.CommonMethods; import org.openecomp.sdc.common.errors.CoreException; -import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManager; -import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManagerFactory; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager; import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; -import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; import org.openecomp.sdc.vendorsoftwareproduct.errors.ComponentDependencyModelErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.errors.VersioningErrorCodes; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -31,10 +24,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import static org.mockito.Mockito.doReturn; - public class ComponentDependencyModelTest { + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + @Spy @InjectMocks private ComponentDependencyModelManagerImpl componentDependencyModelManager; @@ -90,7 +83,7 @@ public class ComponentDependencyModelTest { ComponentDependencyModelErrorBuilder.getNoSourceComponentErrorBuilder().id(), ComponentDependencyModelErrorBuilder.getNoSourceComponentErrorBuilder().message()); - entities.removeAll(entities); + entities.clear(); entities.add(createModelEntity("", sourceComp2Id)); testCreate_negative(entities, vsp1Id, VERSION01, USER1, ComponentDependencyModelErrorBuilder.getNoSourceComponentErrorBuilder().id(), @@ -142,6 +135,7 @@ public class ComponentDependencyModelTest { user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); Assert.assertEquals(exception.getMessage(), expectedErrorMsg); } 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 7cfcb05589..ee8295cafc 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 @@ -6,6 +6,8 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.vendorsoftwareproduct.NicManager; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; @@ -35,6 +37,9 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; public class ComponentManagerImplTest { + + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private static final String COMP_NOT_EXIST_MSG = "Vendor Software Product Component with Id 1 does not exist for Vendor Software Product with id VSP_ID and version 0.1"; private static final String USER = "componentsTestUser"; @@ -140,6 +145,7 @@ public class ComponentManagerImplTest { try { ComponentEntity created = componentManager.createComponent(expected, USER); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals("Creation of only one VFC per VSP allowed.", exception.code().message()); Assert.assertEquals(VendorSoftwareProductErrorCodes.VSP_VFC_COUNT_EXCEED, exception.code().id()); @@ -189,6 +195,7 @@ public class ComponentManagerImplTest { try { CompositionEntityValidationData created = componentManager.updateComponent(expected, USER); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals("VFC with specified name already present in given VSP.", exception.code().message()); Assert.assertEquals(VendorSoftwareProductErrorCodes.VSP_VFC_DUPLICATE_NAME, @@ -426,6 +433,7 @@ public class ComponentManagerImplTest { componentManager.createComponent(component, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -436,6 +444,7 @@ public class ComponentManagerImplTest { componentManager.getComponent(vspId, version, componentId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -447,6 +456,7 @@ public class ComponentManagerImplTest { .updateComponent(new ComponentEntity(vspId, version, componentId), user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -457,6 +467,7 @@ public class ComponentManagerImplTest { componentManager.listComponents(vspId, version, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -467,6 +478,7 @@ public class ComponentManagerImplTest { componentManager.deleteComponents(vspId, version, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -477,6 +489,7 @@ public class ComponentManagerImplTest { componentManager.deleteComponent(vspId, version, componentId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",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/ComputeManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java index bda77d0aa1..eda5693cce 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 @@ -1,30 +1,33 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl; -import org.junit.runner.RunWith; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + 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.errors.ValidationErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; -import org.openecomp.sdc.vendorsoftwareproduct.errors.DuplicateComputeInComponentErrorBuilder; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity; import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager; -import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator; import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.ListComputeResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse; -import org.openecomp.sdc.vendorsoftwareproduct.types.composition.*; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.errors.VersioningErrorCodes; import org.testng.Assert; @@ -36,14 +39,10 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class ComputeManagerImplTest { + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private static final String COMPUTE_NOT_EXIST_MSG = "Vendor Software Product COMPUTE with Id compute1 does not exist for Vendor Software Product with " + "id VSP_ID and version 0.1"; @@ -153,6 +152,7 @@ public class ComputeManagerImplTest { Assert.fail(); } catch (CoreException ex) { + log.debug("",ex); Assert.assertEquals(VendorSoftwareProductErrorCodes.DUPLICATE_COMPUTE_NAME_NOT_ALLOWED, ex.code().id()); } @@ -227,6 +227,7 @@ public class ComputeManagerImplTest { computeManager.updateCompute(computeEntity, USER); } catch (CoreException ex) { + log.debug("",ex); Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.UPDATE_COMPUTE_NOT_ALLOWED); } @@ -315,6 +316,7 @@ public class ComputeManagerImplTest { computeManager.deleteCompute(vspId, version, componentId, computeId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -325,6 +327,7 @@ public class ComputeManagerImplTest { computeManager.getCompute(vspId, version, componentId, computeId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -335,6 +338,7 @@ public class ComputeManagerImplTest { computeManager.listCompute(vspId, version, componentId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); Assert.assertEquals(exception.getMessage(), expectedErrorMsg); } @@ -348,6 +352,7 @@ public class ComputeManagerImplTest { computeManager.updateCompute(new ComputeEntity(vspId, version, componentId, computeId), user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -357,6 +362,7 @@ public class ComputeManagerImplTest { computeManager.createCompute(computeEntity1, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",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/DeploymentFlavorManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java index 804af537df..82715d3fe6 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 @@ -11,6 +11,8 @@ import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; @@ -38,6 +40,9 @@ import java.util.Collection; import java.util.List; public class DeploymentFlavorManagerImplTest { + + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private static final String USER = "depFlavorTestUser"; private static final String VSP_ID = "VSP_ID"; private static final Version VERSION = new Version(0, 1); @@ -108,6 +113,7 @@ public class DeploymentFlavorManagerImplTest { Assert.fail(); } catch (CoreException ex) { + log.debug("",ex); Assert.assertEquals(VendorSoftwareProductErrorCodes.DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED, ex.code().id()); } @@ -137,6 +143,7 @@ public class DeploymentFlavorManagerImplTest { Assert.fail(); } catch (CoreException ex) { + log.debug("",ex); Assert.assertEquals(VendorSoftwareProductErrorCodes.FEATURE_GROUP_NOT_EXIST_FOR_VSP, ex.code().id()); } @@ -164,6 +171,7 @@ public class DeploymentFlavorManagerImplTest { deploymentFlavorManager.createDeploymentFlavor(expected, USER); } catch (CoreException ex) { + log.debug("",ex); Assert.assertEquals(VendorSoftwareProductErrorCodes.INVALID_COMPONENT_COMPUTE_ASSOCIATION, ex.code().id()); Assert.assertEquals("Invalid request,for valid association please provide ComponentId for Compute Flavor", @@ -198,6 +206,7 @@ public class DeploymentFlavorManagerImplTest { deploymentFlavorManager.createDeploymentFlavor(expected, USER); } catch (CoreException ex) { + log.debug("",ex); Assert.assertEquals(VendorSoftwareProductErrorCodes.INVALID_COMPUTE_FLAVOR_ID, ex.code().id()); } @@ -232,6 +241,7 @@ public class DeploymentFlavorManagerImplTest { deploymentFlavorManager.createDeploymentFlavor(expected, USER); } catch (CoreException ex) { + log.debug("",ex); Assert.assertEquals(VendorSoftwareProductErrorCodes.SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED, ex.code().id()); } @@ -347,6 +357,7 @@ public class DeploymentFlavorManagerImplTest { deploymentFlavorManager.listDeploymentFlavors(vspId, version, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); Assert.assertEquals(exception.getMessage(), expectedErrorMsg); } @@ -358,6 +369,7 @@ public class DeploymentFlavorManagerImplTest { deploymentFlavorManager.createDeploymentFlavor(deploymentFlavorEntity, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -369,6 +381,7 @@ public class DeploymentFlavorManagerImplTest { deploymentFlavorManager.deleteDeploymentFlavor(vspId, version, deploymentFlavorId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -395,6 +408,7 @@ public class DeploymentFlavorManagerImplTest { .updateDeploymentFlavor(deploymentFlavorEntity, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -405,6 +419,7 @@ public class DeploymentFlavorManagerImplTest { deploymentFlavorManager.getDeploymentFlavor(vspId, version, deploymentFlavorId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",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 741b1bf2ea..9f932b9fdf 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 @@ -3,16 +3,19 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl; import static org.mockito.Matchers.anyObject; import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; 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.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager; import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; @@ -31,11 +34,10 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; - public class ImageManagerImplTest { + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private static final String IMAGE_NOT_EXIST_MSG = "Vendor Software Product Image with Id image1 does not exist for Vendor Software Product with" + " " + @@ -194,6 +196,7 @@ public class ImageManagerImplTest { imageManager.updateImage(imageEntity, USER); } catch (CoreException ex) { + log.debug("",ex); Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED); } @@ -267,7 +270,6 @@ public class ImageManagerImplTest { String json = "{\"md5\" :\"FFDSD33SS\"}"; doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); doReturn(new ImageEntity()).when(imageDao).get(anyObject()); - imageManager.updateImageQuestionnaire(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, json, USER); verify(imageDao).updateQuestionnaireData(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, json); } @@ -292,6 +294,7 @@ public class ImageManagerImplTest { imageManager.updateImageQuestionnaire(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, json, USER); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), VendorSoftwareProductErrorCodes.DUPLICATE_IMAGE_VERSION_NOT_ALLOWED); } @@ -318,6 +321,7 @@ public class ImageManagerImplTest { Assert.fail(); } catch(CoreException ex) { + log.debug("",ex); Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED); } } @@ -338,6 +342,7 @@ public class ImageManagerImplTest { Assert.fail(); } catch(CoreException ex) { + log.debug("",ex); Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.VFC_IMAGE_INVALID_FORMAT); } } @@ -348,6 +353,7 @@ public class ImageManagerImplTest { imageManager.listImages(vspId, version, componentId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); Assert.assertEquals(exception.getMessage(), expectedErrorMsg); } @@ -358,6 +364,7 @@ public class ImageManagerImplTest { imageManager.createImage(image, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -369,6 +376,7 @@ public class ImageManagerImplTest { imageManager.deleteImage(vspId, version, componentId, nicId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -388,6 +396,7 @@ public class ImageManagerImplTest { imageManager.updateImage(new ImageEntity(vspId, version, componentId, imageId), user); Assert.fail(); } catch (CoreException exception) { + log.debug("",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/ManualVspToscaManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java index b65071ac51..ecfe0e6372 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 @@ -47,6 +47,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.services.ManualVspDataCollectionS import org.openecomp.sdc.versioning.dao.types.Version; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -95,6 +96,15 @@ public class ManualVspToscaManagerImplTest { private ManualVspDataCollectionService manualVspDataCollectionServiceMock; /* + private static List<String> supportedCapabilities = new ArrayList<>(); + private static List<String> supportedRequirements = new ArrayList<>(); + + static { + //TODO : Read from configuration + supportedCapabilities.addAll(Arrays.asList("host", "os", "endpoint", "scalable")); + supportedRequirements.addAll(Arrays.asList("link")); + } + @Test public void testGatherVspInformationInvalidVsp() { MockitoAnnotations.initMocks(this); @@ -439,9 +449,9 @@ public class ManualVspToscaManagerImplTest { private void validateSubstitutionCapabilities(Map<String, List<String>> capabilities, String componentName) { - List<String> supportedCapabilities = GeneratorUtils.supportedCapabilities; - Assert.assertEquals(supportedCapabilities.size(), capabilities.size()); - for (String capability : supportedCapabilities) { + List<String> SupportedCapabilities = supportedCapabilities; + Assert.assertEquals(SupportedCapabilities.size(), capabilities.size()); + for (String capability : SupportedCapabilities) { String expectedCapabilityId = capability + "_" + componentName; Assert.assertEquals(true, capabilities.containsKey(expectedCapabilityId)); List<String> expectedCapabilityValue = new ArrayList<>(2); @@ -454,10 +464,10 @@ public class ManualVspToscaManagerImplTest { private void validateSubstitutionRequirements(Map<String, List<String>> requirements, List<Nic> nics) { - List<String> supportedRequirements = GeneratorUtils.supportedRequirements; + List<String> SupportedRequirements = supportedRequirements; for(Nic nic : nics) { String nicNodeTemplateId = nic.getName() + PORT_NODE_TEMPLATE_ID_SUFFIX; - for (String requirement : supportedRequirements) { + for (String requirement : SupportedRequirements) { String expectedRequirementId = requirement + "_" + nicNodeTemplateId; Assert.assertEquals(true, requirements.containsKey(expectedRequirementId)); List<String> expectedRequirementValue = new ArrayList<>(2); @@ -498,11 +508,11 @@ public class ManualVspToscaManagerImplTest { List<Map<String, RequirementDefinition>> requirements = deploymentFlavorNodeType.getRequirements(); - List<String> supportedRequirements = GeneratorUtils.supportedRequirements; + List<String> SupportedRequirements = supportedRequirements; for (Nic nic : nics) { boolean found = false; String nicNodeTemplateId = nic.getName() + PORT_NODE_TEMPLATE_ID_SUFFIX; - for (String requirementId : supportedRequirements) { + for (String requirementId : SupportedRequirements) { String expectedRequirementId = requirementId + "_" + nicNodeTemplateId; for (Map<String, RequirementDefinition> requirement : requirements) { if (requirement.containsKey(expectedRequirementId)) { @@ -515,8 +525,8 @@ public class ManualVspToscaManagerImplTest { } Map<String, CapabilityDefinition> capabilities = deploymentFlavorNodeType.getCapabilities(); - List<String> supportedCapabilities = GeneratorUtils.supportedCapabilities; - for (String capabilityId : supportedCapabilities) { + List<String> SupportedCapabilities = supportedCapabilities; + for (String capabilityId : SupportedCapabilities) { String expectedCapabilityId = capabilityId + "_" + componentName; Assert.assertEquals (true, capabilities.containsKey(expectedCapabilityId)); } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java index 534c630e40..e4dd39cfda 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java @@ -5,6 +5,8 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.openecomp.core.enrichment.types.MonitoringUploadType; import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MonitoringUploadStatus; @@ -27,6 +29,8 @@ import static org.mockito.Mockito.verify; public class MonitoringUploadsManagerImplTest { + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private static final String USER1 = "ComponentsUploadTestUser"; private static final String COMPONENT_ID = "COMPONENT_ID"; private static final String VSP_ID = "vspId"; @@ -66,6 +70,7 @@ public class MonitoringUploadsManagerImplTest { MonitoringUploadType.VES_EVENTS, USER1); Assert.fail(); } catch (Exception exception) { + log.debug("",exception); Assert.assertEquals(exception.getMessage(), "Invalid zip file"); } } @@ -80,6 +85,7 @@ public class MonitoringUploadsManagerImplTest { MonitoringUploadType.SNMP_TRAP, USER1); Assert.fail(); } catch (Exception exception) { + log.debug("",exception); Assert.assertEquals(exception.getMessage(), "Zip file should not contain folders"); } } @@ -94,6 +100,7 @@ public class MonitoringUploadsManagerImplTest { MonitoringUploadType.VES_EVENTS, USER1); Assert.fail(); } catch (Exception exception) { + log.debug("",exception); Assert.assertEquals(exception.getMessage(), "Wrong VES EVENT Artifact was uploaded - all files contained in Artifact must be YAML " + "files (using .yaml/.yml extensions)"); @@ -157,7 +164,7 @@ public class MonitoringUploadsManagerImplTest { try { return url.openStream(); } catch (IOException exception) { - exception.printStackTrace(); + log.debug("",exception); return null; } } 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 f8710b8cc6..ebdbc6af7d 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 @@ -25,6 +25,8 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.openecomp.sdc.common.errors.CoreException; +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.type.NetworkEntity; import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; @@ -49,6 +51,8 @@ import static org.mockito.Mockito.verify; public class NetworkManagerImplTest { + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private static final String USER1 = "networksTestUser1"; private static final String USER2 = "networksTestUser2"; private static final String VSP_ID = "vsp"; @@ -239,6 +243,7 @@ public class NetworkManagerImplTest { networkManager.createNetwork(network, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -249,6 +254,7 @@ public class NetworkManagerImplTest { networkManager.getNetwork(vspId, version, networkId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -259,6 +265,7 @@ public class NetworkManagerImplTest { networkManager.updateNetwork(new NetworkEntity(vspId, version, networkId), user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -269,6 +276,7 @@ public class NetworkManagerImplTest { networkManager.listNetworks(vspId, version, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -279,6 +287,7 @@ public class NetworkManagerImplTest { networkManager.deleteNetwork(vspId, version, networkId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",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/NicManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java index fe275e9d68..ba04e91c63 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 @@ -1,16 +1,22 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + 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.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager; import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; -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; @@ -29,13 +35,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class NicManagerImplTest { + + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private static final String NIC_NOT_EXIST_MSG = "Vendor Software Product NIC with Id nic1 does not exist for Vendor Software Product with " + "id VSP_ID and version 0.1"; @@ -129,6 +132,7 @@ public class NicManagerImplTest { try { NicEntity created = nicManager.createNic(nicEntity,USER); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED, exception.code().id()); } @@ -154,6 +158,7 @@ public class NicManagerImplTest { try { NicEntity created = nicManager.createNic(nicEntity,USER); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals("Invalid request, NIC with name "+ nic.getName() + " already exist for component with ID "+ nicEntity.getComponentId() +".", exception.code().message()); @@ -176,6 +181,7 @@ public class NicManagerImplTest { try { NicEntity created = nicManager.createNic(nicEntity,USER); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals("Invalid request,NetworkId not allowed for External Networks", exception.code().message()); Assert.assertEquals(VendorSoftwareProductErrorCodes.NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK, @@ -198,6 +204,7 @@ public class NicManagerImplTest { try { NicEntity created = nicManager.createNic(nicEntity,USER); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals("Invalid request, Network Description not allowed for Internal Networks", exception.code().message()); Assert.assertEquals(VendorSoftwareProductErrorCodes @@ -344,6 +351,7 @@ public class NicManagerImplTest { Assert.fail(); } catch (CoreException ex) { + log.debug("",ex); Assert.assertEquals(VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED, ex.code().id()); } @@ -442,6 +450,7 @@ public class NicManagerImplTest { nicManager.createNic(nic, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -452,6 +461,7 @@ public class NicManagerImplTest { nicManager.getNic(vspId, version, componentId, nicId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -462,6 +472,7 @@ public class NicManagerImplTest { nicManager.updateNic(new NicEntity(vspId, version, componentId, nicId), user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -473,6 +484,7 @@ public class NicManagerImplTest { nicManager.deleteNic(vspId, version, componentId, nicId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",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/ProcessManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImplTest.java index f756e44776..478bdfbbba 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 @@ -11,6 +11,8 @@ import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; 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.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessType; @@ -35,6 +37,7 @@ import static org.mockito.Matchers.eq; public class ProcessManagerImplTest { + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); private static final String USER1 = "processesTestUser"; private static final String VSP_ID = "vsp"; @@ -315,6 +318,7 @@ public class ProcessManagerImplTest { processManager.getProcess(vspId, version, componentId, processId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -327,6 +331,7 @@ public class ProcessManagerImplTest { .updateProcess(new ProcessEntity(vspId, version, componentId, processId), user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -337,6 +342,7 @@ public class ProcessManagerImplTest { processManager.getProcessArtifact(vspId, version, componentId, processId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -350,6 +356,7 @@ public class ProcessManagerImplTest { vspId, version, componentId, processId, user); Assert.fail(); } catch (CoreException exception) { + log.error("",exception); Assert.assertEquals(exception.code().id(), expectedErrorCode); } } @@ -360,6 +367,7 @@ public class ProcessManagerImplTest { processManager.deleteProcessArtifact(vspId, VERSION, componentId, processId, user); Assert.fail(); } catch (CoreException exception) { + log.debug("",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/VendorSoftwareProductManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java index e0e00f8d9d..77a847a2af 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 @@ -40,6 +40,8 @@ import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.healing.api.HealingManager; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; @@ -101,6 +103,9 @@ import static org.mockito.Mockito.verify; public class VendorSoftwareProductManagerImplTest { + + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private static final String INVALID_VERSION_MSG = "Invalid requested version."; private static String VSP_ID = "vspId"; @@ -669,6 +674,7 @@ public class VendorSoftwareProductManagerImplTest { url.openStream(), USER1, "zip", "notZipFile"); candidateManager.process(VSP_ID, VERSION01, USER1); } catch (Exception ce) { + log.debug("",ce); Assert.assertEquals(ce.getMessage(), Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage()); } @@ -688,14 +694,19 @@ public class VendorSoftwareProductManagerImplTest { throws IOException { List<String> fileNames = new ArrayList<>(); - ZipInputStream zip = new ZipInputStream(new FileInputStream(csar)); - ZipEntry ze; - - while ((ze = zip.getNextEntry()) != null) { - String name = ze.getName(); - if (name.contains(folderName)) { - fileNames.add(name); + FileInputStream fileInputStream = new FileInputStream(csar); + try { + ZipInputStream zip = new ZipInputStream(fileInputStream); + ZipEntry ze; + + while ((ze = zip.getNextEntry()) != null) { + String name = ze.getName(); + if (name.contains(folderName)) { + fileNames.add(name); + } } + }finally { + fileInputStream.close(); } return fileNames; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java index a85153ecef..2f85f30dc5 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java @@ -23,6 +23,8 @@ package org.openecomp.sdc.vendorsoftwareproduct.services.impl.composition; import org.apache.commons.io.FileUtils; import org.mockito.InjectMocks; import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; import org.openecomp.sdc.tosca.services.ToscaUtil; @@ -52,6 +54,10 @@ import java.util.Map; */ public class CompositionDataExtractorImplTest { + + private static final Logger log = (Logger) LoggerFactory.getLogger + (CompositionDataExtractorImplTest.class.getName()); + @InjectMocks private static CompositionDataExtractorImpl compositionDataExtractor; @@ -108,6 +114,7 @@ public class CompositionDataExtractorImplTest { try { yamlFile.close(); } catch (IOException ignore) { + log.debug("",ignore); } } catch (FileNotFoundException exception) { throw exception; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/TreeBaseTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/TreeBaseTest.java index 42eee1fb10..2174a6894a 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/TreeBaseTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/TreeBaseTest.java @@ -22,6 +22,8 @@ package org.openecomp.sdc.vendorsoftwareproduct.tree; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.heat.services.tree.HeatTreeManager; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import java.io.File; import java.net.URISyntaxException; @@ -32,6 +34,8 @@ import java.net.URL; */ public class TreeBaseTest { + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + String INPUT_DIR; @@ -44,18 +48,21 @@ public class TreeBaseTest { try { inputDir = new File(url.toURI()); } catch (URISyntaxException exception) { - exception.printStackTrace(); + log.debug("",exception); } - File[] files = inputDir.listFiles(); - for (File inputFile : files) { - try { - heatTreeManager.addFile(inputFile.getName(), FileUtils.loadFileToInputStream( - INPUT_DIR.replace("/", File.separator) + File.separator + inputFile.getName())); - } catch (Exception e) { - e.printStackTrace(); - throw e; + + if(inputDir != null) { + File[] files = inputDir.listFiles(); + for (File inputFile : files) { + try { + heatTreeManager.addFile(inputFile.getName(), FileUtils.loadFileToInputStream( + INPUT_DIR.replace("/", File.separator) + File.separator + inputFile.getName())); + } catch (Exception e) { + throw e; + } } } return heatTreeManager; + } } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java index dfb7409bd0..df386b12cd 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java @@ -21,6 +21,9 @@ package org.openecomp.sdc.vendorsoftwareproduct.tree; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; + import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -29,6 +32,8 @@ import org.openecomp.core.model.dao.ServiceModelDao; import org.openecomp.core.model.types.ServiceElement; import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; import org.openecomp.sdc.healing.api.HealingManager; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VSPCommon.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VSPCommon.java index 6bfe9e5eac..947f33922e 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VSPCommon.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VSPCommon.java @@ -21,6 +21,8 @@ package org.openecomp.sdc.vendorsoftwareproduct.utils; import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; import org.openecomp.sdc.versioning.dao.types.Version; @@ -35,6 +37,8 @@ import java.util.zip.ZipOutputStream; public class VSPCommon { + private static final Logger log = (Logger) LoggerFactory.getLogger(VSPCommon.class.getName()); + public static VspDetails createVspDetails(String id, Version version, String name, String desc, String vendorName, String vlm, String icon, String category, String subCategory, @@ -92,7 +96,7 @@ public class VSPCommon { zos.write(data); zos.closeEntry(); } catch (IOException exception) { - exception.printStackTrace(); + log.debug("",exception); } } } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ZipFileUtils.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ZipFileUtils.java index 12324ed777..b2a6f2fe87 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ZipFileUtils.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ZipFileUtils.java @@ -20,6 +20,9 @@ package org.openecomp.sdc.vendorsoftwareproduct.utils; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -33,6 +36,7 @@ import java.util.zip.ZipOutputStream; * @since November 08, 2016 */ public class ZipFileUtils { + private static final Logger log = (Logger) LoggerFactory.getLogger(ZipFileUtils.class.getName()); public InputStream getZipInputStream(String name) { URL url = getClass().getResource(name); File templateDir = new File(url.getFile()); @@ -44,7 +48,7 @@ public class ZipFileUtils { try { zos.close(); } catch (IOException exception) { - exception.printStackTrace(); + log.debug("",exception); } return new ByteArrayInputStream(baos.toByteArray()); } |