diff options
261 files changed, 1100 insertions, 1142 deletions
diff --git a/build-tools/pom.xml b/build-tools/pom.xml index 952ebef380..24a6742b71 100644 --- a/build-tools/pom.xml +++ b/build-tools/pom.xml @@ -15,21 +15,4 @@ <version>1.1.0-SNAPSHOT</version> </parent> - <properties> - <pmd.version>5.8.1</pmd.version> - </properties> - - <dependencies> - <dependency> - <groupId>net.sourceforge.pmd</groupId> - <artifactId>pmd-core</artifactId> - <version>${pmd.version}</version> - </dependency> - <dependency> - <groupId>net.sourceforge.pmd</groupId> - <artifactId>pmd-java</artifactId> - <version>${pmd.version}</version> - </dependency> - </dependencies> - </project>
\ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml index 621274796f..ba7a7a0cfd 100644 --- a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml +++ b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml @@ -849,6 +849,7 @@ org.openecomp.datatypes.Root: properties: supplemental_data: type: map + required: false entry_schema: description: > A placeholder for missing properties that would be included in future ecomp model versions. diff --git a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.zip b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.zip Binary files differindex ffbe146f9b..c97ea2caa0 100644 --- a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.zip +++ b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.zip diff --git a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml index aaff11b0ed..da41c933f1 100644 --- a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml +++ b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml @@ -1103,4 +1103,27 @@ node_types: capability: tosca.capabilities.nfv.VirtualLinkable occurrences: - 0 - - UNBOUNDED
\ No newline at end of file + - UNBOUNDED + + tosca.nodes.nfv.VnfVirtualLinkDesc: + capabilities: + monitoring_parameters: + type: tosca.capabilities.nfv.Metric + virtual_linkable: + type: tosca.capabilities.nfv.VirtualLinkable + derived_from: tosca.nodes.Root + properties: + vl_flavours: + entry_schema: + type: string + type: map + description: + required: false + type: string + test_access: + entry_schema: + type: string + required: false + type: list + connectivity_type: + type: tosca.datatypes.nfv.ConnectivityType
\ No newline at end of file diff --git a/onboarding/pom.xml b/onboarding/pom.xml index 141ffc012d..667ed607b7 100644 --- a/onboarding/pom.xml +++ b/onboarding/pom.xml @@ -34,10 +34,11 @@ <mvn.swagger.version>3.1.0</mvn.swagger.version> <mvn.war.version>2.1.1</mvn.war.version> - <!-- Onboarding artifacts version --> + <!-- Onboarding artifacts version --> <openecomp.sdc.common.version>1.1.0-SNAPSHOT</openecomp.sdc.common.version> <!-- Onboarding 3rd party versions --> + <jtosca.version>1.1.1-SNAPSHOT</jtosca.version> <aspectj.version>1.8.9</aspectj.version> <bsh.version>2.0b5</bsh.version> <cassandra.version>2.1.9</cassandra.version> @@ -95,7 +96,8 @@ <zusammen.version>0.2.0</zusammen.version> <zusammen-state-store.version>0.2.1</zusammen-state-store.version> <skipSA>true</skipSA> - <build.tools.version>1.1.0-SNAPSHOT</build.tools.version> + <pmd.version>5.8.1</pmd.version> + <build.tools.version>${project.version}</build.tools.version> </properties> <build> @@ -146,6 +148,16 @@ <artifactId>build-tools</artifactId> <version>${build.tools.version}</version> </dependency> + <dependency> + <groupId>net.sourceforge.pmd</groupId> + <artifactId>pmd-core</artifactId> + <version>${pmd.version}</version> + </dependency> + <dependency> + <groupId>net.sourceforge.pmd</groupId> + <artifactId>pmd-java</artifactId> + <version>${pmd.version}</version> + </dependency> </dependencies> </plugin> </plugins> diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java index 369e90c928..5dc79ebdfe 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/ActionsForSwaggerFileUpload.java @@ -23,10 +23,10 @@ package org.openecomp.sdcrests.action.rest; import com.sun.jersey.multipart.FormDataParam; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.apache.cxf.jaxrs.ext.multipart.Attachment; import org.apache.cxf.jaxrs.ext.multipart.Multipart; import org.springframework.validation.annotation.Validated; +import java.io.InputStream; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; import javax.ws.rs.HeaderParam; @@ -39,8 +39,6 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.io.InputStream; - @Path("/workflow/v1.0/actions") @Produces(MediaType.APPLICATION_JSON) diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java index e6f5e6b1a3..53ebf0baab 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java @@ -830,7 +830,6 @@ public class ActionsImpl implements Actions { HttpServletRequest servletRequest) { ListResponseWrapper responseList = null; Map<String, String> errorMap = validateRequestHeaders(servletRequest); - ; Map<String, String> queryParamErrors = validateQueryParam(componentID); errorMap.putAll(queryParamErrors); if (errorMap.isEmpty()) { @@ -992,37 +991,36 @@ public class ActionsImpl implements Actions { if (StringUtils.isEmpty(requestJSON) || requestJSON.equals(REQUEST_EMPTY_BODY)) { requestBodyErrorMap.put(ACTION_INVALID_REQUEST_BODY_CODE, ACTION_REQUEST_BODY_EMPTY); } else { - switch (requestType) { - case ActionConstants.REQUEST_TYPE_CREATE_ACTION: - case ActionConstants.REQUEST_TYPE_UPDATE_ACTION: - //Semantic request specific validations - Action action = JsonUtil.json2Object(requestJSON, Action.class); - if (StringUtils.isEmpty(action.getName())) { - setErrorValue(ACTION_REQUEST_INVALID_GENERIC_CODE, ACTION_REQUEST_PARAM_NAME, - requestBodyErrorMap); - } else { - //Added check for action name not allowing whitespaces - if (action.getName().matches(whitespaceRegex)) { - requestBodyErrorMap - .put(ACTION_ARTIFACT_INVALID_NAME_CODE, ACTION_REQUEST_INVALID_NAME); - } + if(requestType == ActionConstants.REQUEST_TYPE_CREATE_ACTION){ + //placeholder for future implementation + } + if(requestType == ActionConstants.REQUEST_TYPE_UPDATE_ACTION){ + //Semantic request specific validations + Action action = JsonUtil.json2Object(requestJSON, Action.class); + if(StringUtils.isEmpty(action.getName())){ + setErrorValue(ACTION_REQUEST_INVALID_GENERIC_CODE, ACTION_REQUEST_PARAM_NAME, + requestBodyErrorMap); + } else { + //Added check for action names not allowing whitespaces + if (action.getName().matches(whitespaceRegex)){ + requestBodyErrorMap.put(ACTION_ARTIFACT_INVALID_NAME_CODE, ACTION_REQUEST_INVALID_NAME); } + } - if (action.getSupportedModels() != null && - !isIDPresentInMap(action.getSupportedModels(), SUPPORTED_MODELS_VERSION_ID)) { - setErrorValue(ACTION_REQUEST_INVALID_GENERIC_CODE, - ACTION_REQUEST_PARAM_SUPPORTED_MODELS, requestBodyErrorMap); - } - if (action.getSupportedComponents() != null && - !isIDPresentInMap(action.getSupportedComponents(), SUPPORTED_COMPONENTS_ID)) { - setErrorValue(ACTION_REQUEST_INVALID_GENERIC_CODE, - ACTION_REQUEST_PARAM_SUPPORTED_COMPONENTS, requestBodyErrorMap); - } - if (action.getArtifacts() != null) { - setErrorValue(ACTION_UPDATE_NOT_ALLOWED_CODE, ACTION_REQUEST_ARTIFACT_OPERATION_ALLOWED, - requestBodyErrorMap); - } - break; + if(action.getSupportedModels() != null && !isIDPresentInMap(action.getSupportedModels(), + SUPPORTED_MODELS_VERSION_ID)){ + setErrorValue(ACTION_REQUEST_INVALID_GENERIC_CODE, + ACTION_REQUEST_PARAM_SUPPORTED_MODELS, requestBodyErrorMap); + } + if(action.getSupportedComponents() != null && !isIDPresentInMap(action + .getSupportedComponents(), SUPPORTED_COMPONENTS_ID)){ + setErrorValue(ACTION_REQUEST_INVALID_GENERIC_CODE, + ACTION_REQUEST_PARAM_SUPPORTED_MODELS, requestBodyErrorMap); + } + if(action.getArtifacts() != null){ + setErrorValue(ACTION_UPDATE_NOT_ALLOWED_CODE, + ACTION_REQUEST_ARTIFACT_OPERATION_ALLOWED, requestBodyErrorMap); + } } } @@ -1037,11 +1035,8 @@ public class ActionsImpl implements Actions { if (errorMessage != null) { message = errorMessage + ", " + message; } else { - switch (key) { - case ACTION_REQUEST_INVALID_GENERIC_CODE: - message = ACTION_REQUEST_MISSING_MANDATORY_PARAM + message; - break; - } + if(key == ACTION_REQUEST_INVALID_GENERIC_CODE) + message = ACTION_REQUEST_MISSING_MANDATORY_PARAM + message; } errorMap.put(key, message); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/mapping/MapActivityLogEntityToActivityLogDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/mapping/MapActivityLogEntityToActivityLogDto.java index 2794315188..023dedf12c 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/mapping/MapActivityLogEntityToActivityLogDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/activity-log-rest/activity-log-rest-services/src/main/java/org/openecomp/sdcrests/activitylog/rest/mapping/MapActivityLogEntityToActivityLogDto.java @@ -23,7 +23,6 @@ package org.openecomp.sdcrests.activitylog.rest.mapping; import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; import org.openecomp.sdcrests.activitylog.types.ActivityLogDto; import org.openecomp.sdcrests.activitylog.types.ActivityStatus; -import org.openecomp.sdcrests.activitylog.types.ActivityType; import org.openecomp.sdcrests.mapping.MappingBase; public class MapActivityLogEntityToActivityLogDto extends MappingBase<ActivityLogEntity, ActivityLogDto> { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java index 4ffe4488da..c7f3f2598c 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java @@ -24,7 +24,6 @@ import org.openecomp.core.utilities.applicationconfig.dao.type.ApplicationConfig import org.openecomp.core.utilities.applicationconfig.type.ConfigurationData; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.applicationconfig.ApplicationConfigManager; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerServiceName; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/HealthCheck.java b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/HealthCheck.java index 2ed1d57f8f..446a80e3cc 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/HealthCheck.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/HealthCheck.java @@ -22,13 +22,15 @@ package org.openecomp.sdcrests.health.rest; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.openecomp.sdcrests.health.types.HealthInfoDtos; import org.springframework.validation.annotation.Validated; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.util.Collection; -import org.openecomp.sdcrests.health.types.HealthInfoDtos; @Path("/v1.0/healthcheck") @Produces(MediaType.APPLICATION_JSON) diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java index 047adaa25e..38858c0e7c 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java @@ -26,7 +26,6 @@ import org.openecomp.sdc.health.HealthCheckManagerFactory; import org.openecomp.sdc.health.data.HealthCheckResult; import org.openecomp.sdc.health.data.HealthCheckStatus; import org.openecomp.sdc.health.data.HealthInfo; -import org.openecomp.sdc.health.data.SiteMode; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.context.MdcUtil; @@ -36,10 +35,10 @@ import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; -import javax.inject.Named; -import javax.ws.rs.core.Response; import java.util.Arrays; import java.util.Collection; +import javax.inject.Named; +import javax.ws.rs.core.Response; @Named @Service("healthCheck") diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java index e59d3fb3b8..18465cd00c 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/ActionAuthenticationFilter.java @@ -20,6 +20,9 @@ package org.openecomp.server.filters; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; + import java.io.IOException; import java.security.Principal; import java.util.Base64; @@ -35,6 +38,7 @@ import javax.servlet.http.HttpServletResponse; public class ActionAuthenticationFilter implements Filter { + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); private boolean runningOnLocal = true; @Override @@ -58,6 +62,7 @@ public class ActionAuthenticationFilter implements Filter { String decodedCredentials = new String(Base64.getDecoder().decode(base64Credentials)); username = decodedCredentials.substring(0, decodedCredentials.indexOf(":")); } catch (Exception exception) { + log.debug("",exception); setResponseStatus((HttpServletResponse) arg1, HttpServletResponse.SC_FORBIDDEN); return; } @@ -82,6 +87,7 @@ public class ActionAuthenticationFilter implements Filter { .valueOf(username.substring(username.indexOf("-") + 1).toUpperCase()); return userPrivilege.ordinal() >= requiredPrivilege.ordinal(); } catch (Exception exception) { + log.debug("",exception); return false; } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java index 91f2656f16..2310c0f6ce 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/src/main/java/org/openecomp/sdcrests/mapping/MappingBase.java @@ -29,6 +29,9 @@ import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerServiceName; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; + /** * Base class for all mapping classes. Mapping classes will perform data mapping from source object * to target object Base class provides following<br> <ol> <li>provides life cycle of @@ -52,6 +55,8 @@ public abstract class MappingBase<S, T> { * @return <code>T</code> - instance of type <code>T</code> */ + private final Logger logger = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + public final T applyMapping(final S source, Class<T> clazz) { T target = (T) instantiateTarget(clazz); if (source == null || target == null) { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java index c0c759e123..b08bc10727 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java @@ -21,7 +21,6 @@ package org.openecomp.sdcrests.validation.rest; import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; import org.apache.cxf.jaxrs.ext.multipart.Multipart; import org.springframework.validation.annotation.Validated; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java index 0a737f32e8..fd5bea3380 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java @@ -23,13 +23,16 @@ package org.openecomp.sdcrests.validation.rest; import com.sun.jersey.multipart.FormDataParam; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.apache.cxf.jaxrs.ext.multipart.Multipart; import org.springframework.validation.annotation.Validated; -import javax.ws.rs.*; +import java.io.InputStream; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.io.InputStream; @Path("/v1.0/validation") diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java index b0467b6ef0..15675f14de 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java @@ -21,7 +21,6 @@ package org.openecomp.sdcrests.validation.rest.services; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java index 9a72a59070..a3a4e4d0d8 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java @@ -20,10 +20,12 @@ package org.openecomp.sdcrests.vendorlicense.rest; +import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM; +import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG; + import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupEntityDto; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupModelDto; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupRequestDto; @@ -32,7 +34,6 @@ import org.springframework.validation.annotation.Validated; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -42,13 +43,9 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM; -import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG; - @Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/feature-groups") @Produces(MediaType.APPLICATION_JSON) diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java index bfb2d51af0..bd31dc5607 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java @@ -6,7 +6,6 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; import org.springframework.validation.annotation.Validated; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java index 1152cc1eb3..a0226c1626 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java @@ -3,7 +3,6 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; -import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; public class MapLimitEntityToLimitDto extends MappingBase<LimitEntity, LimitEntityDto> { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java index 79cf750f74..18488ab83d 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java @@ -22,9 +22,6 @@ package org.openecomp.sdcrests.vendorlicense.types; import io.swagger.annotations.ApiModel; import org.codehaus.jackson.annotate.JsonIgnoreProperties; -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.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java index defff137d8..daeb9b0d10 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java @@ -2,10 +2,7 @@ package org.openecomp.sdcrests.vendorlicense.types; import io.swagger.annotations.ApiModel; import org.hibernate.validator.constraints.NotBlank; -import org.openecomp.sdc.vendorlicense.dao.types.LimitType; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @ApiModel(value = "LimitRequest") diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentDependencyModels.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentDependencyModels.java index 5df05d1cf1..d7ba65fce5 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentDependencyModels.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentDependencyModels.java @@ -1,11 +1,11 @@ package org.openecomp.sdcrests.vsp.rest; +import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM; import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; - import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyModelRequestDto; import org.springframework.validation.annotation.Validated; @@ -21,11 +21,6 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; - -import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM; - -import java.util.List; - @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/component-dependency-model") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Compute.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Compute.java index 13d9a049c8..d5125c92bf 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Compute.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Compute.java @@ -6,7 +6,6 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDetailsDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto; @@ -15,7 +14,6 @@ import org.springframework.validation.annotation.Validated; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -25,7 +23,6 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/DeploymentFlavors.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/DeploymentFlavors.java index 581b15199c..1ba2f71b4c 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/DeploymentFlavors.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/DeploymentFlavors.java @@ -6,7 +6,6 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorListResponseDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorRequestDto; @@ -14,8 +13,15 @@ import org.springframework.validation.annotation.Validated; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Images.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Images.java index 8939faa13f..ffa1675f91 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Images.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Images.java @@ -6,9 +6,6 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; -import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ImageData; -import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageRequestDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto; @@ -17,7 +14,6 @@ import org.springframework.validation.annotation.Validated; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -27,7 +23,6 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java index c29966b54b..21bd65eccb 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java @@ -26,7 +26,6 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicRequestDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto; @@ -35,7 +34,6 @@ import org.springframework.validation.annotation.Validated; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -45,7 +43,6 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java index 93dcbc4e32..458a1c63fd 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java @@ -20,26 +20,32 @@ package org.openecomp.sdcrests.vsp.rest; +import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM; +import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG; + import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.cxf.jaxrs.ext.multipart.Attachment; import org.apache.cxf.jaxrs.ext.multipart.Multipart; -import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto; import org.springframework.validation.annotation.Validated; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM; -import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG; - @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/processes") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java index 4366b2c3d1..1a68d49479 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java @@ -20,15 +20,14 @@ package org.openecomp.sdcrests.vsp.rest; +import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM; +import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG; + import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.apache.cxf.jaxrs.ext.multipart.Multipart; -import org.openecomp.sdc.vendorsoftwareproduct.types.FileDataStructureDto; -import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdcrests.vendorsoftwareproducts.types.PackageInfoDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto; -import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.VersionSoftwareProductActionRequestDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspComputeDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspCreationDto; @@ -38,11 +37,8 @@ import org.springframework.validation.annotation.Validated; import java.io.File; import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.InvocationTargetException; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -55,9 +51,6 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; - -import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM; -import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG; @Path("/v1.0/vendor-software-products") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelEntityToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelEntityToDto.java index 0c923fe82b..bc8a7d20d4 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelEntityToDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelEntityToDto.java @@ -1,16 +1,8 @@ package org.openecomp.sdcrests.vsp.rest.mapping; -import org.openecomp.sdc.common.errors.CoreException; -import org.openecomp.sdc.common.errors.ErrorCode; -import org.openecomp.sdc.datatypes.error.ErrorLevel; -import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity; -import org.openecomp.sdc.vendorsoftwareproduct.errors.ComponentDependencyModelErrorBuilder; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyModel; -import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentRelationType; public class MapComponentDependencyModelEntityToDto extends MappingBase<ComponentDependencyModelEntity, ComponentDependencyModel> { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelRequestToEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelRequestToEntity.java index baaa664938..d0956bb37d 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelRequestToEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelRequestToEntity.java @@ -29,6 +29,7 @@ public class MapComponentDependencyModelRequestToEntity extends ComponentRelationType.valueOf(source.getRelationType()); target.setRelation(source.getRelationType()); } catch (IllegalArgumentException exception) { + logger.debug("",exception); ErrorCode errorCode = ComponentDependencyModelErrorBuilder.getInvalidRelationTypeErrorBuilder(); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java index 7db9a0a9b1..ee9882369f 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeDetailsDtoToComputeEntity.java @@ -12,6 +12,6 @@ public class MapComputeDetailsDtoToComputeEntity extends MappingBase<ComputeDeta public void doMapping(ComputeDetailsDto source, ComputeEntity target) { ComputeDescription computeDesc = new ComputeDescription(source.getName(), source .getDescription()); - target.setCompositionData(computeDesc == null ? null : JsonUtil.object2Json(computeDesc)); + target.setCompositionData(JsonUtil.object2Json(computeDesc)); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeEntityToComputeDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeEntityToComputeDto.java index d7586471b5..53aa2afec3 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeEntityToComputeDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComputeEntityToComputeDto.java @@ -1,7 +1,6 @@ package org.openecomp.sdcrests.vsp.rest.mapping; import org.openecomp.core.utilities.json.JsonUtil; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity; import org.openecomp.sdc.vendorsoftwareproduct.types.ListComputeResponse; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDescription; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageCreationDto.java index 5710fbe02e..81f57a3e95 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageCreationDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageCreationDto.java @@ -1,9 +1,7 @@ package org.openecomp.sdcrests.vsp.rest.mapping; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; import org.openecomp.sdcrests.mapping.MappingBase; -import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentCreationDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageCreationDto; public class MapImageEntityToImageCreationDto extends MappingBase<ImageEntity, diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageDto.java index 62d37465e1..7a4ccf990c 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageDto.java @@ -1,7 +1,6 @@ package org.openecomp.sdcrests.vsp.rest.mapping; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; -import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ImageData; import org.openecomp.sdcrests.mapping.MappingBase; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageRequestDtoToImageEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageRequestDtoToImageEntity.java index 0b8a501f16..78cd13f4c7 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageRequestDtoToImageEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageRequestDtoToImageEntity.java @@ -1,18 +1,7 @@ package org.openecomp.sdcrests.vsp.rest.mapping; -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.context.impl.MdcDataErrorMessage; -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.dao.type.ImageEntity; -import org.openecomp.sdc.vendorsoftwareproduct.errors.ImageErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image; -import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ImageFormat; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageRequestDto; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java index 51955b7b69..fa7e9249c2 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java @@ -47,13 +47,12 @@ import org.openecomp.sdcrests.vsp.rest.mapping.MapCompositionEntityResponseToDto import org.openecomp.sdcrests.vsp.rest.mapping.MapCompositionEntityValidationDataToDto; import org.openecomp.sdcrests.vsp.rest.mapping.MapQuestionnaireResponseToQuestionnaireResponseDto; import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; -import org.openecomp.sdcrests.wrappers.StringWrapperResponse; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; +import java.util.Collection; import javax.inject.Named; import javax.ws.rs.core.Response; -import java.util.Collection; @Named @Service("components") diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImpl.java index ec445af0e8..599b5adac7 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImpl.java @@ -30,7 +30,6 @@ import org.openecomp.sdcrests.vsp.rest.mapping.MapComputeEntityToComputeCreation import org.openecomp.sdcrests.vsp.rest.mapping.MapComputeEntityToComputeDto; import org.openecomp.sdcrests.vsp.rest.mapping.MapQuestionnaireResponseToQuestionnaireResponseDto; import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImpl.java index adcdacaa88..03372269fc 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImpl.java @@ -25,7 +25,6 @@ import org.openecomp.sdcrests.vsp.rest.mapping.MapDeploymentFlavorEntityToDeploy import org.openecomp.sdcrests.vsp.rest.mapping.MapDeploymentFlavorRequestDtoToDeploymentFlavorEntity; import org.openecomp.sdcrests.vsp.rest.mapping.MapDeploymentFlavorToDeploymentDto; import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImpl.java index c939eb57ae..fcaf038dc0 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImpl.java @@ -1,7 +1,6 @@ package org.openecomp.sdcrests.vsp.rest.services; -import io.swagger.annotations.ApiParam; import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.logging.context.MdcUtil; import org.openecomp.sdc.logging.types.LoggerServiceName; @@ -9,39 +8,30 @@ import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager; import org.openecomp.sdc.vendorsoftwareproduct.ComponentManagerFactory; import org.openecomp.sdc.vendorsoftwareproduct.ImageManager; import org.openecomp.sdc.vendorsoftwareproduct.ImageManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image; -import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ImageData; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.types.VersionableEntityAction; -import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityResponseDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageCreationDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageRequestDto; import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto; import org.openecomp.sdcrests.vsp.rest.Images; -import org.openecomp.sdcrests.vsp.rest.mapping.MapCompositionEntityResponseToDto; import org.openecomp.sdcrests.vsp.rest.mapping.MapCompositionEntityValidationDataToDto; -import org.openecomp.sdcrests.vsp.rest.mapping.MapImageDataToImageDto; import org.openecomp.sdcrests.vsp.rest.mapping.MapImageEntityToImageCreationDto; import org.openecomp.sdcrests.vsp.rest.mapping.MapImageEntityToImageDto; import org.openecomp.sdcrests.vsp.rest.mapping.MapImageRequestDtoToImageEntity; import org.openecomp.sdcrests.vsp.rest.mapping.MapQuestionnaireResponseToQuestionnaireResponseDto; import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; import java.util.Collection; import javax.inject.Named; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.ws.rs.HeaderParam; import javax.ws.rs.core.Response; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java index 1612c964a1..73ca82ada3 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java @@ -49,13 +49,12 @@ import org.openecomp.sdcrests.vsp.rest.mapping.MapNicRequestDtoToNicEntity; import org.openecomp.sdcrests.vsp.rest.mapping.MapNicToNicDto; import org.openecomp.sdcrests.vsp.rest.mapping.MapQuestionnaireResponseToQuestionnaireResponseDto; import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; -import org.openecomp.sdcrests.wrappers.StringWrapperResponse; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; +import java.util.Collection; import javax.inject.Named; import javax.ws.rs.core.Response; -import java.util.Collection; @Named @Service("nics") diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java index 07cef57251..172c8940e9 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java @@ -27,12 +27,12 @@ import org.openecomp.sdcrests.vsp.rest.mapping.MapValidationResponseToDto; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; -import javax.inject.Named; -import javax.ws.rs.core.Response; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.util.Optional; +import javax.inject.Named; +import javax.ws.rs.core.Response; import static org.openecomp.core.utilities.file.FileUtils.getFileExtension; import static org.openecomp.core.utilities.file.FileUtils.getNetworkPackageName; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java index a175908cd1..6bc7a37eee 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java @@ -20,6 +20,8 @@ package org.openecomp.sdcrests.vsp.rest.services; +import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.GENERAL_COMPONENT_ID; + import org.apache.cxf.jaxrs.ext.multipart.Attachment; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; @@ -36,8 +38,6 @@ import org.springframework.stereotype.Service; import javax.inject.Named; import javax.ws.rs.core.Response; -import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.GENERAL_COMPONENT_ID; - @Named @Service("processes") @Scope(value = "prototype") diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentDependencyModel.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentDependencyModel.java index 4e908ed99d..097a00dad4 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentDependencyModel.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentDependencyModel.java @@ -1,8 +1,6 @@ package org.openecomp.sdcrests.vendorsoftwareproducts.types; -import org.hibernate.validator.constraints.NotBlank; - public class ComponentDependencyModel { private String sourceId; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComputeDetailsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComputeDetailsDto.java index 92ad0fdb0c..d3e68b8446 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComputeDetailsDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComputeDetailsDto.java @@ -2,7 +2,6 @@ package org.openecomp.sdcrests.vendorsoftwareproducts.types; import org.hibernate.validator.constraints.NotBlank; -import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; public class ComputeDetailsDto implements CompositionDataEntityDto { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java index baf6707ddf..3bc0b95626 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java @@ -5,7 +5,6 @@ import org.hibernate.validator.constraints.NotBlank; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation; import java.util.List; -import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; public class DeploymentFlavorRequestDto { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ImageRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ImageRequestDto.java index 4386245342..3210104376 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ImageRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ImageRequestDto.java @@ -2,9 +2,6 @@ package org.openecomp.sdcrests.vendorsoftwareproducts.types; import org.hibernate.validator.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - public class ImageRequestDto implements CompositionDataEntityDto { @NotBlank(message = "is mandatory and should not be empty") diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/NicRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/NicRequestDto.java index fdf953c80c..f4663fb2ae 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/NicRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/NicRequestDto.java @@ -24,7 +24,6 @@ import org.hibernate.validator.constraints.NotBlank; import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.ValidateString; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; public class NicRequestDto { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/QuestionnaireValidationResultDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/QuestionnaireValidationResultDto.java index c2bf49aa63..00f4569e5e 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/QuestionnaireValidationResultDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/QuestionnaireValidationResultDto.java @@ -20,7 +20,6 @@ package org.openecomp.sdcrests.vendorsoftwareproducts.types; -import java.util.List; import java.util.Set; public class QuestionnaireValidationResultDto { 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 9d2508fde2..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 @@ -142,7 +142,7 @@ 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"; @@ -634,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(); @@ -707,6 +708,7 @@ 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 () + "] " + @@ -829,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: 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()); } diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/CoreException.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/CoreException.java index 3b464ca107..b41d6647f5 100644 --- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/CoreException.java +++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/CoreException.java @@ -22,7 +22,7 @@ package org.openecomp.sdc.common.errors; public class CoreException extends RuntimeException { - private ErrorCode errorCode; + private final ErrorCode errorCode; public CoreException(ErrorCode errorCode) { this(errorCode, null); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java index 6d92330493..6b5c5f94c4 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java @@ -30,6 +30,8 @@ import org.openecomp.core.utilities.file.FileUtils; 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.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -48,6 +50,11 @@ public class ApplicationConfigImplDaoTest { private static ApplicationConfig applicationConfig = ApplicationConfigFactory.getInstance().createInterface(); + private final static Logger log = (Logger) LoggerFactory.getLogger + (ApplicationConfigImplDaoTest.class.getName()); + + private final Logger logger = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + @BeforeClass public static void init() { try { @@ -64,6 +71,7 @@ public class ApplicationConfigImplDaoTest { applicationConfigDao.create(applicationConfigEntity3); } catch (Exception e) { + log.debug("",e); throw new CoreException(new ErrorCode.ErrorCodeBuilder(). withCategory(ErrorCategory.APPLICATION). withId(SCHEMA_GENERATOR_INITIALIZATION_ERROR). @@ -91,6 +99,7 @@ public class ApplicationConfigImplDaoTest { try { applicationConfig.getConfigurationData("test - namespace", "aaa"); } catch (CoreException ce) { + logger.debug("", ce); Assert.assertEquals(ce.getMessage(), "Configuration for namespace test - namespace and key aaa was not found"); } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoryConfig.java b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoryConfig.java index d664cbee38..31822b6bdc 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoryConfig.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoryConfig.java @@ -35,7 +35,6 @@ public final class FactoryConfig { INSTANCE = CommonMethods.newInstance( "org.openecomp.core.factory.FactoriesConfigImpl", FactoriesConfiguration.class); } catch (Exception exception) { - exception.printStackTrace(); throw exception; } } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java index 4ecc26879a..93410bc581 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java @@ -28,6 +28,8 @@ import org.openecomp.core.utilities.CommonMethods; 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 java.util.Set; import java.util.stream.Collectors; @@ -38,6 +40,8 @@ class CassandraNoSqlDbImpl implements NoSqlDb { private final String keySpace; private final MappingManager mappingManager; + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + public CassandraNoSqlDbImpl(Session session) { this.session = session; @@ -109,6 +113,7 @@ class CassandraNoSqlDbImpl implements NoSqlDb { .collect(Collectors.toSet()); return versions.stream().collect(Collectors.joining(",")); } catch (Exception e){ + log.debug("",e); return "Failed to retrieve version"; } } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java index 7b9b2ca84f..4bc8262439 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java @@ -20,12 +20,13 @@ package org.openecomp.core.nosqldb.impl.cassandra; -import com.google.common.base.Optional; - import com.datastax.driver.core.Cluster; import com.datastax.driver.core.SSLOptions; import com.datastax.driver.core.Session; +import com.google.common.base.Optional; import org.openecomp.core.nosqldb.util.CassandraUtils; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import java.io.FileInputStream; import java.io.IOException; @@ -36,11 +37,14 @@ import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; -import java.util.Objects; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; public class CassandraSessionFactory { + + private static final Logger log = (Logger) LoggerFactory.getLogger + (CassandraSessionFactory.class.getName()); + public static Session getSession() { return ReferenceHolder.CASSANDRA; } @@ -112,7 +116,7 @@ public class CassandraSessionFactory { ctx.init(null, tmf.getTrustManagers(), new SecureRandom()); } catch (Exception exception) { - exception.printStackTrace(); + log.debug("",exception); } finally { if (tsf != null) { tsf.close(); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java index c00db41ed9..1f5e20fd0b 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java @@ -20,6 +20,8 @@ package org.openecomp.core.nosqldb.util; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.services.YamlUtil; import java.io.FileInputStream; @@ -58,6 +60,8 @@ public class ConfigurationManager { private static ConfigurationManager instance = null; private final LinkedHashMap<String, Object> cassandraConfiguration; + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private ConfigurationManager() { YamlUtil yamlUtil = new YamlUtil(); @@ -227,7 +231,7 @@ public class ConfigurationManager { try { is = new FileInputStream(file); } catch (FileNotFoundException exception) { - exception.printStackTrace(); + log.debug("",exception); } return is; } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java index fc96335daf..5c4f951a7b 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java @@ -32,7 +32,7 @@ import java.util.List; public class NoSqlDbTest { - private static NoSqlDb noSqlDb; + private NoSqlDb noSqlDb; /* @Test diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java index 0fb587cc68..6ff213c34c 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java @@ -23,6 +23,8 @@ package org.openecomp.core.utilities.file; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.services.YamlUtil; import java.io.ByteArrayInputStream; @@ -43,6 +45,8 @@ import java.util.zip.ZipInputStream; */ public class FileUtils { + //private final static Logger log = (Logger) LoggerFactory.getLogger(FileUtils.class.getName()); + /** * Allows to consume an input stream open against a resource with a given file name. * diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java index 5f0bc90845..8454bc61a8 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java @@ -117,6 +117,7 @@ public class JsonUtil { try { is.close(); } catch (IOException ignore) { + logger.debug("",ignore); //do nothing } } @@ -136,6 +137,7 @@ public class JsonUtil { try { return new JsonParser().parse(json).isJsonObject(); } catch (JsonSyntaxException jse) { + logger.debug("",jse); return false; } } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java index f4e8688d63..2ba447fd6a 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java @@ -12,7 +12,6 @@ import com.amdocs.zusammen.datatypes.item.Item; import com.amdocs.zusammen.datatypes.item.ItemVersion; import com.amdocs.zusammen.datatypes.item.ItemVersionData; import com.amdocs.zusammen.datatypes.itemversion.Tag; -import org.apache.commons.lang3.tuple.ImmutablePair; import java.util.Collection; import java.util.Optional; diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java index 2e63a8d50a..d061556e4c 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java @@ -12,8 +12,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; @@ -178,8 +176,7 @@ public class ComponentQuestionnaireHealer implements Healer { JsonObject computeQuestionnaireJsonObject = new JsonObject(); computeQuestionnaireJsonObject.add(VM_SIZING, vmSizing); - String computeQuestionnaire = computeQuestionnaireJsonObject != null ? - computeQuestionnaireJsonObject.toString() : null; + String computeQuestionnaire = computeQuestionnaireJsonObject.toString(); computeDao.updateQuestionnaireData(computeEntity.getVspId(), computeEntity.getVersion(), computeEntity.getComponentId(), computeEntity.getId(), computeQuestionnaire); compute.remove(VM_SIZING); diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java index 9800d02ba6..e3701743ec 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java @@ -31,6 +31,8 @@ import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.healing.interfaces.Healer; +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.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil; @@ -92,6 +94,8 @@ public class CompositionDataHealer implements Healer { private static CompositionEntityDataManager compositionEntityDataManager = CompositionEntityDataManagerFactory.getInstance().createInterface(); + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + public CompositionDataHealer() { } @@ -288,6 +292,7 @@ public class CompositionDataHealer implements Healer { serviceModelDao.storeServiceModel(vspId, version, translatorOutput.getToscaServiceModel()); } catch (Exception e) { + log.debug("", e); return Optional.empty(); } @@ -304,6 +309,7 @@ public class CompositionDataHealer implements Healer { OnboardingTypesEnum.ZIP, uploadData.getContentData().array()); return HeatToToscaUtil.loadAndTranslateTemplateData(fileContentHandler); } catch (Exception e) { + log.debug("", e); return null; } } diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java index 0d484440cf..4a0a5f9d63 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java @@ -27,6 +27,8 @@ import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.healing.interfaces.Healer; +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.vendorsoftwareproduct.dao.OrchestrationTemplateDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory; @@ -51,6 +53,8 @@ public class FileDataStructureHealer implements Healer { CandidateServiceFactory.getInstance().createInterface(); private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + public FileDataStructureHealer() { } @@ -104,6 +108,7 @@ public class FileDataStructureHealer implements Healer { healingResult = getFileDataStructureFromJson(candidateDataEntity.getFilesDataStructure()); }catch (Exception e){ + log.debug("", e); return Optional.empty(); } diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java index 44b6062e89..32cd8cbae3 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java @@ -12,6 +12,8 @@ import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.healing.interfaces.Healer; +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.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil; @@ -34,6 +36,8 @@ public class HeatToToscaTranslationHealer implements Healer { templateDao = ServiceTemplateDaoFactory.getInstance().createInterface(); private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + public HeatToToscaTranslationHealer(){ } @@ -58,24 +62,25 @@ public class HeatToToscaTranslationHealer implements Healer { .getContentData().array()); translatorOutput = HeatToToscaUtil.loadAndTranslateTemplateData(fileContentHandler); - }catch (Exception e){ + } catch (Exception e) { + log.debug("", e); return Optional.empty(); } - if(Objects.isNull(translatorOutput)){ + if (Objects.isNull(translatorOutput)) { return Optional.empty(); - } + } else { - if (translatorOutput != null && translatorOutput.getToscaServiceModel() == null) { - return Optional.empty(); - } + if (translatorOutput.getToscaServiceModel() == null) { + return Optional.empty(); + } //templateDao.deleteAll(vspId, version); - serviceModelDao.deleteAll(vspId,version); - serviceModelDao.storeServiceModel(vspId, version, - translatorOutput.getToscaServiceModel()); - mdcDataDebugMessage.debugExitMessage("VSP id", vspId); + serviceModelDao.deleteAll(vspId, version); + serviceModelDao.storeServiceModel(vspId, version, translatorOutput.getToscaServiceModel()); + mdcDataDebugMessage.debugExitMessage("VSP id", vspId); - return translatorOutput; + return translatorOutput; + } } } diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ValidationStructureHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ValidationStructureHealer.java index f92fbd1730..58ba3b7c35 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ValidationStructureHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ValidationStructureHealer.java @@ -9,6 +9,8 @@ import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.structure.Artifact; import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; @@ -34,6 +36,7 @@ public class ValidationStructureHealer implements Healer { VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(); private static final OrchestrationTemplateDao orchestrationTemplateDao = OrchestrationTemplateDaoFactory.getInstance().createInterface(); + private static final Logger logger = LoggerFactory.getLogger(JsonUtil.class); @Override public Object heal(Map<String, Object> healingParams) throws Exception { @@ -51,6 +54,7 @@ public class ValidationStructureHealer implements Healer { JsonUtil.json2Object(orchestrationTemplate.getValidationData(), OldValidationStructureTree .class); } catch (Exception e){ + logger.debug("",e); return Optional.empty(); } diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java index 6a82d8fa49..4accd790ab 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java @@ -11,14 +11,12 @@ import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory; import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; import org.openecomp.sdc.versioning.dao.types.Version; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Objects; @@ -55,6 +53,7 @@ public class VlmVersionHealer implements Healer { vendorLicenseModel = vendorLicenseFacade.getVendorLicenseModel(vspDetails.getVendorId(), null, user); } catch (Exception e){ + logger.debug("" + e); logger.debug("No Vlm was found for Vsp " + vspDetails.getName()); return Optional.empty(); } diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspQuestionnaireHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspQuestionnaireHealer.java index 78f2997660..0952a4c88f 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspQuestionnaireHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspQuestionnaireHealer.java @@ -23,9 +23,9 @@ package org.openecomp.sdc.healing.healers; import org.openecomp.core.utilities.json.JsonSchemaDataGenerator; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.healing.interfaces.Healer; +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.vendorsoftwareproduct.dao.VendorSoftwareProductDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity; @@ -44,6 +44,8 @@ public class VspQuestionnaireHealer implements Healer { VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(); private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + public VspQuestionnaireHealer() { } @@ -80,6 +82,7 @@ public class VspQuestionnaireHealer implements Healer { questionnaireData = new JsonSchemaDataGenerator(generatedSchema).generateData(); vspInfoDao.updateQuestionnaireData(vspId, version, questionnaireData); }catch(Exception e){ + log.debug("", e); return Optional.empty(); } mdcDataDebugMessage.debugExitMessage(null, null); diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java index 249dcaf4a5..f0bb253a4b 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java @@ -24,6 +24,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.heat.services.ErrorCodes; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import java.util.HashSet; import java.util.Set; @@ -33,6 +35,8 @@ public class HeatBoolean { private static Set<Object> heatFalse; private static Set<Object> heatTrue; + private final static Logger log = (Logger) LoggerFactory.getLogger(HeatBoolean.class.getName()); + static { @@ -90,6 +94,7 @@ public class HeatBoolean { Boolean answer = eval(value); return true; } catch (CoreException ce) { + log.debug("",ce); return false; } } diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java index dd487603e1..81bf2fa5a9 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java @@ -31,7 +31,7 @@ import java.util.function.Predicate; public class FileData { - public static Set<Type> heatFileTypes = + protected static final Set<Type> heatFileTypes = new HashSet<>(Arrays.asList(Type.HEAT, Type.HEAT_NET, Type.HEAT_VOL)); private Boolean isBase; private String file; diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java index def773d712..372c09cffe 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.heat.services.tree; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.core.utilities.json.JsonUtil; -import org.openecomp.sdc.tosca.services.YamlUtil; import org.openecomp.core.validation.types.GlobalValidationContext; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.datatypes.error.ErrorMessage; @@ -34,6 +33,7 @@ import org.openecomp.sdc.heat.datatypes.structure.Artifact; import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.tosca.services.YamlUtil; import java.io.InputStream; import java.util.HashMap; @@ -101,10 +101,14 @@ public class HeatTreeManager { .values().stream().filter(heatStructureTree -> tree.getHeat().contains(heatStructureTree)) .forEach(heatStructureTree -> tree.getHeat().remove(heatStructureTree)); - heatContentMap.getFileList().stream().filter(fileName -> !manifestFiles.contains(fileName)) + heatContentMap.getFileList().stream().filter(fileName -> isNotInManifestFiles(fileName)) .forEach(fileName -> addTreeOther(fileName)); } + private boolean isNotInManifestFiles(String fileName) { + return !manifestFiles.contains(fileName); + } + private void addTreeOther(String fileName) { if (tree.getOther() == null) { tree.setOther(new HashSet<>()); @@ -132,7 +136,9 @@ public class HeatTreeManager { Set<String> artifactSet = HeatTreeManagerUtil.getArtifactFiles(filename, hot, globalContext); addHeatArtifactFiles(fileHeatStructureTree, artifactSet); - } catch (Exception ignore) { /* invalid yaml no need to process reference */ } + } catch (Exception ignore) { /* invalid yaml no need to process reference */ + logger.debug("",ignore); + } } diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java index b8df50b87c..3802018c99 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java @@ -166,7 +166,7 @@ public class HeatTreeManagerUtil { Map<String, Object> resourceDefValueMap = resource.getProperties() == null ? null : (Map<String, Object>) resource.getProperties().get( PropertiesMapKeyTypes.RESOURCE_DEF.getKeyMap()); - if (MapUtils.isNotEmpty(resourceDefValueMap)) { + if (MapUtils.isNotEmpty(resourceDefValueMap) && resourceDefValueMap != null) { Object resourceDefType = resourceDefValueMap.get("type"); if (Objects.nonNull(resourceDefType)) { if (resourceDefType instanceof String) { diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java index c99eda7309..fc01e2e8b0 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java @@ -48,7 +48,7 @@ public class EnvironmentTest { } else { String heatResourceNameSuffix = heatResourceName.substring(lastIndexOfUnderscore + 1); try { - Integer.parseInt(heatResourceNameSuffix); + int heatResourceNameSuffixInt = Integer.parseInt(heatResourceNameSuffix); System.out.println(heatResourceName.substring(0, lastIndexOfUnderscore)); } catch (NumberFormatException ignored) { System.out.println(heatResourceName); diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java index ec5c7526e3..3715b0f999 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java @@ -22,6 +22,8 @@ package org.openecomp.sdc.heat.datatypes.model; import org.junit.Assert; import org.junit.Test; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.services.YamlUtil; import java.io.InputStream; @@ -32,6 +34,8 @@ import java.util.Map; public class HeatOrchestrationTemplateTest { + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + @Test public void testYamlToServiceTemplateObj() { YamlUtil yamlUtil = new YamlUtil(); @@ -99,6 +103,7 @@ public class HeatOrchestrationTemplateTest { yamlUtil.yamlToObject(yml, HeatOrchestrationTemplate.class); Assert.assertNotNull(heatOrchestrationTemplate); } catch (Exception ignored) { + log.debug("",ignored); } } diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/annotations/Debug.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/annotations/Debug.java index b00b85a814..049481141a 100644 --- a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/annotations/Debug.java +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/annotations/Debug.java @@ -20,11 +20,6 @@ package org.openecomp.sdc.logging.api.annotations; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - /** * Created by TALIO on 12/26/2016. */ diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/context/impl/MdcDataDebugMessage.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/context/impl/MdcDataDebugMessage.java index 01bc6f446e..b21504d752 100644 --- a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/context/impl/MdcDataDebugMessage.java +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/context/impl/MdcDataDebugMessage.java @@ -33,7 +33,7 @@ import java.util.Map; public class MdcDataDebugMessage extends MdcData { - private static Logger logger; + private Logger logger; private static Map<String, String> mapExitOrEntryToMessage; static { diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/servlet/LoggingFilter.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/servlet/LoggingFilter.java index f617ea6500..31b89464c9 100644 --- a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/servlet/LoggingFilter.java +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/servlet/LoggingFilter.java @@ -21,6 +21,8 @@ package org.openecomp.sdc.logging.servlet; import org.omg.CORBA.Request; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.slf4j.MDC; import javax.servlet.*; @@ -61,6 +63,8 @@ public class LoggingFilter implements Filter { private static final HostAddressCache HOST_ADDRESS = new HostAddressCache(); private static final String UNKNOWN = "UNKNOWN"; + private final static Logger log = (Logger) LoggerFactory.getLogger(LoggingFilter.class.getName()); + public void destroy() { } @@ -128,6 +132,7 @@ public class LoggingFilter implements Filter { lastUpdated.set(current); // set now to register the attempt even if failed hostAddress = InetAddress.getLocalHost(); } catch (UnknownHostException e) { + log.debug("",e); hostAddress = null; } } diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java index fd6c76c92c..25cd06d3ce 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java @@ -24,7 +24,7 @@ package org.openecomp.sdc.action; public class ActionConstants { // - public static final long MAX_ACTION_ARTIFACT_SIZE = 20 * 1024 * 1024; //20 MB + public static final long MAX_ACTION_ARTIFACT_SIZE = 20 * 1024 * 1024L; //20 MB //REST layer constants public static final String X_OPEN_ECOMP_INSTANCE_ID_HEADER_PARAM = "X-OPEN-ECOMP-InstanceID"; public static final String X_OPEN_ECOMP_REQUEST_ID_HEADER_PARAM = "X-OPEN-ECOMP-RequestID"; diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java index b7672644d2..cde97bc151 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java @@ -244,4 +244,31 @@ public class Action implements Comparable { return Integer.compare(objVersion.getMajor(), thisVersion.getMajor()); } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + Action action = (Action) o; + + if (!version.equals(action.version)) { + return false; + } + if (!name.equals(action.name)) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = version.hashCode(); + result = 31 * result + name.hashCode(); + return result; + } } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java index 293e4dec2a..1b9e119fbf 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java @@ -22,15 +22,15 @@ package org.openecomp.sdc.enrichment.impl; import static org.junit.Assert.assertEquals; -import org.openecomp.core.enrichment.api.EnrichmentManager; import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory; 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.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; +import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil; import org.openecomp.sdc.tosca.services.ToscaFileOutputService; import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; -import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil; -import org.openecomp.sdc.versioning.dao.types.Version; import org.testng.Assert; import org.testng.annotations.Test; @@ -53,6 +53,9 @@ import java.util.zip.ZipInputStream; public class EnrichmentManagerImplTest { + private final static Logger log = (Logger) LoggerFactory.getLogger + (EnrichmentManagerImplTest.class.getName()); + private static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath, String globalServiceTemplatesPath, @@ -103,6 +106,7 @@ public class EnrichmentManagerImplTest { try { yamlFile.close(); } catch (IOException ignore) { + log.debug("",ignore); } } catch (FileNotFoundException e) { throw e; diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java index ffc27106bb..57c1d19f03 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ExternalArtifactEnricher.java @@ -67,7 +67,7 @@ public class ExternalArtifactEnricher extends Enricher { externalArtifactEnricherInstance.enrich(this.data); } } catch (Exception e) { - e.printStackTrace(); + logger.debug("",e); logger.error(e.getMessage()); } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java index 44c1ef8c72..ff0e9b4838 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricher.java @@ -34,6 +34,8 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.enrichment.EnrichmentInfo; import org.openecomp.sdc.enrichment.inter.ExternalArtifactEnricherInterface; +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.tosca.datatypes.ToscaNodeType; import org.openecomp.sdc.tosca.services.DataModelUtil; @@ -61,6 +63,7 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface private ComponentArtifactDao componentArtifactDao; private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); /** * Enrich map. * @@ -225,6 +228,7 @@ public class MonitoringMibEnricher implements ExternalArtifactEnricherInterface mibs = FileUtils .getFileContentMapFromZip(FileUtils.toByteArray(monitoringArtifactInfo.getContent())); } catch (IOException ioException) { + log.debug("",ioException); ErrorMessage.ErrorMessageUtil .addMessage(mibServiceArtifact.getName() + "." + type.name(), errors) .add(new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage())); diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ToscaEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ToscaEnricher.java index 854d84ad84..f1804c8f62 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ToscaEnricher.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ToscaEnricher.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.enrichment.impl.tosca; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.enrichment.inter.Enricher; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java index 4196168b2c..0001cdf404 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java @@ -21,6 +21,8 @@ package org.openecomp.sdc.enrichment.impl.tosca; 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.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; import org.openecomp.sdc.tosca.services.ToscaFileOutputService; @@ -45,6 +47,9 @@ public class BaseToscaEnrichmentTest { protected String outputFilesPath; + private final static Logger log = (Logger) LoggerFactory.getLogger + (BaseToscaEnrichmentTest.class.getName()); + public static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath, String globalServiceTemplatesPath, String entryDefinitionServiceTemplate) @@ -93,6 +98,7 @@ public class BaseToscaEnrichmentTest { try { yamlFile.close(); } catch (IOException ignore) { + log.debug("",ignore); } } catch (FileNotFoundException exception) { throw exception; diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java index 1c13fbe760..2ef31d4597 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java @@ -20,12 +20,9 @@ package org.openecomp.core.model.dao; -import org.openecomp.core.model.types.ServiceArtifact; import org.openecomp.sdc.versioning.dao.VersionableDao; import org.openecomp.sdc.versioning.dao.types.Version; -import java.util.List; - public interface ServiceModelDao<M, E> extends VersionableDao { M getServiceModel(String vspId, Version version); diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java index e774eb6b1d..965bc89ca8 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java @@ -27,13 +27,14 @@ import org.openecomp.core.model.types.ServiceElement; import org.openecomp.core.model.types.ServiceTemplate; import org.openecomp.core.utilities.file.FileContentHandler; 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.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.tosca.datatypes.model.Import; import org.openecomp.sdc.tosca.datatypes.model.Old1610ServiceTemplate; import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil; import org.openecomp.sdc.versioning.dao.VersionableDao; import org.openecomp.sdc.versioning.dao.types.Version; -import sun.misc.IOUtils; import java.io.InputStream; import java.util.ArrayList; @@ -48,6 +49,8 @@ public class AbstractServiceModelDao implements VersionableDao { protected ServiceTemplateDaoInter templateDao; protected ServiceArtifactDaoInter artifactDao; + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + @Override public void registerVersioning(String versionableEntityType) { templateDao.registerVersioning(versionableEntityType); @@ -170,6 +173,7 @@ public class AbstractServiceModelDao implements VersionableDao { return new ToscaExtensionYamlUtil().yamlToObject(serviceTemplateContent, org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate.class); }catch (Exception e){ + log.debug("",e); System.out.println("Found vsp with old-versioned tosca service template"); Old1610ServiceTemplate old1610ServiceTemplate = new ToscaExtensionYamlUtil().yamlToObject(serviceTemplateContent, diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java index b038c70372..d018c9a87c 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java @@ -14,7 +14,6 @@ import org.openecomp.core.zusammen.api.ZusammenUtil; 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.versioning.dao.types.Version; public class EnrichedServiceModelDaoZusammenImpl extends ServiceModelDaoZusammenImpl implements EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> { diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java index a7fecdd806..88a1c756c9 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java @@ -186,6 +186,7 @@ public class ServiceModelDaoZusammenImpl return new ToscaExtensionYamlUtil(). yamlToObject(yamlContent, ServiceTemplate.class); }catch (Exception e){ + logger.debug("",e); return null; } } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java index d888bd311b..e34627d62b 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java @@ -41,21 +41,23 @@ public class ComputeFlavor { public boolean equals(Object obj) { if (this == obj) return true; - if (getClass() != obj.getClass()) + if (obj != null && getClass() != obj.getClass()) return false; ComputeFlavor other = (ComputeFlavor) obj; - if (num_cpus != other.num_cpus) - return false; - if (this.disk_size == null) { - if (other.disk_size != null) + if(other != null) { + if (num_cpus != other.num_cpus) return false; - } else if (!disk_size.equals(other.disk_size)) - return false; - if (this.mem_size == null) { - if (other.mem_size != null) + if (this.disk_size == null) { + if (other.disk_size != null) + return false; + } else if (!disk_size.equals(other.disk_size)) return false; - } else if (!mem_size.equals(other.mem_size)) - return false; + if (this.mem_size == null) { + if (other.mem_size != null) + return false; + } else if (!mem_size.equals(other.mem_size)) + return false; + } return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java index a0d5f40b8c..3bc338361e 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java @@ -53,29 +53,31 @@ public class DeploymentFlavorModel { public boolean equals(Object obj) { if (this == obj) return true; - if (getClass() != obj.getClass()) + if (obj != null && getClass() != obj.getClass()) return false; DeploymentFlavorModel other = (DeploymentFlavorModel) obj; - if (this.sp_part_number == null) { - if (other.sp_part_number != null) + if (other != null) { + if (this.sp_part_number == null) { + if (other.sp_part_number != null) + return false; + } else if (!sp_part_number.equals(other.sp_part_number)) return false; - } else if (!sp_part_number.equals(other.sp_part_number)) - return false; - if (this.vendor_info == null) { - if (other.vendor_info != null) + if (this.vendor_info == null) { + if (other.vendor_info != null) + return false; + } else if (!vendor_info.equals(other.vendor_info)) return false; - } else if (!vendor_info.equals(other.vendor_info)) - return false; - if (this.compute_flavor == null) { - if (other.compute_flavor != null) + if (this.compute_flavor == null) { + if (other.compute_flavor != null) + return false; + } else if (!compute_flavor.equals(other.compute_flavor)) return false; - } else if (!compute_flavor.equals(other.compute_flavor)) - return false; - if (this.license_flavor == null) { - if (other.license_flavor != null) + if (this.license_flavor == null) { + if (other.license_flavor != null) + return false; + } else if (!license_flavor.equals(other.license_flavor)) return false; - } else if (!license_flavor.equals(other.license_flavor)) - return false; + } return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java index f459d9e993..1cdeaca562 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java @@ -24,14 +24,16 @@ public class LicenseFlavor { public boolean equals(Object obj) { if (this == obj) return true; - if (getClass() != obj.getClass()) + if (obj != null && getClass() != obj.getClass()) return false; LicenseFlavor other = (LicenseFlavor) obj; - if (this.feature_group_uuid == null) { - if (other.feature_group_uuid != null) + if (other != null) { + if (this.feature_group_uuid == null) { + if (other.feature_group_uuid != null) + return false; + } else if (!feature_group_uuid.equals(other.feature_group_uuid)) return false; - } else if (!feature_group_uuid.equals(other.feature_group_uuid)) - return false; + } return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java index 6cd713e2d1..560a7765f2 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java @@ -54,29 +54,31 @@ public class MultiFlavorVfcImage { public boolean equals(Object obj) { if (this == obj) return true; - if (getClass() != obj.getClass()) + if (obj != null && getClass() != obj.getClass()) return false; MultiFlavorVfcImage other = (MultiFlavorVfcImage) obj; - if (this.file_name == null) { - if (other.file_name != null) + if (other != null) { + if (this.file_name == null) { + if (other.file_name != null) + return false; + } else if (!file_name.equals(other.file_name)) return false; - } else if (!file_name.equals(other.file_name)) - return false; - if (this.file_hash == null) { - if (other.file_hash != null) + if (this.file_hash == null) { + if (other.file_hash != null) + return false; + } else if (!file_hash.equals(other.file_hash)) return false; - } else if (!file_hash.equals(other.file_hash)) - return false; - if (this.file_hash_type == null) { - if (other.file_hash_type != null) + if (this.file_hash_type == null) { + if (other.file_hash_type != null) + return false; + } else if (!file_hash_type.equals(other.file_hash_type)) return false; - } else if (!file_hash_type.equals(other.file_hash_type)) - return false; - if (this.software_version == null) { - if (other.software_version != null) + if (this.software_version == null) { + if (other.software_version != null) + return false; + } else if (!software_version.equals(other.software_version)) return false; - } else if (!software_version.equals(other.software_version)) - return false; + } return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java index 22348f3083..0c2be2508c 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java @@ -32,19 +32,21 @@ public class VendorInfo { public boolean equals(Object obj) { if (this == obj) return true; - if (getClass() != obj.getClass()) + if (obj != null && getClass() != obj.getClass()) return false; VendorInfo other = (VendorInfo) obj; - if (this.manufacturer_reference_number == null) { - if (other.manufacturer_reference_number != null) + if (other != null) { + if (this.manufacturer_reference_number == null) { + if (other.manufacturer_reference_number != null) + return false; + } else if (!manufacturer_reference_number.equals(other.manufacturer_reference_number)) return false; - } else if (!manufacturer_reference_number.equals(other.manufacturer_reference_number)) - return false; - if (this.vendor_model == null) { - if (other.vendor_model != null) + if (this.vendor_model == null) { + if (other.vendor_model != null) + return false; + } else if (!vendor_model.equals(other.vendor_model)) return false; - } else if (!vendor_model.equals(other.vendor_model)) - return false; + } return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java index 025db1cafc..4372e7f98a 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java @@ -82,51 +82,53 @@ public class VspModelInfo { if (this == obj) { return true; } - if (getClass() != obj.getClass()) { + if (obj != null && getClass() != obj.getClass()) { return false; } VspModelInfo other = (VspModelInfo) obj; - if (this.releaseVendor == null) { - if (other.releaseVendor != null) { + if(other != null) { + if (this.releaseVendor == null) { + if (other.releaseVendor != null) { + return false; + } + } else if (!releaseVendor.equals(other.releaseVendor)) { return false; } - } else if (!releaseVendor.equals(other.releaseVendor)) { - return false; - } - if (this.components == null) { - if (other.components != null) { + if (this.components == null) { + if (other.components != null) { + return false; + } + } else if (!components.equals(other.components)) { return false; } - } else if (!components.equals(other.components)) { - return false; - } - if (this.allowedFlavors == null) { - if (other.allowedFlavors != null) { + if (this.allowedFlavors == null) { + if (other.allowedFlavors != null) { + return false; + } + } else if (!allowedFlavors.equals(other.allowedFlavors)) { return false; } - } else if (!allowedFlavors.equals(other.allowedFlavors)) { - return false; - } - if (this.multiFlavorVfcImages == null) { - if (other.multiFlavorVfcImages != null) { + if (this.multiFlavorVfcImages == null) { + if (other.multiFlavorVfcImages != null) { + return false; + } + } else if (!multiFlavorVfcImages.equals(other.multiFlavorVfcImages)) { return false; } - } else if (!multiFlavorVfcImages.equals(other.multiFlavorVfcImages)) { - return false; - } - if (this.multiFlavorVfcImages == null) { - if (other.multiFlavorVfcImages != null) { + if (this.multiFlavorVfcImages == null) { + if (other.multiFlavorVfcImages != null) { + return false; + } + } else if (!multiFlavorVfcImages.equals(other.multiFlavorVfcImages)) { return false; } - } else if (!multiFlavorVfcImages.equals(other.multiFlavorVfcImages)) { - return false; - } - if (this.nics == null) { - if (other.nics != null) { + if (this.nics == null) { + if (other.nics != null) { + return false; + } + } else if (!nics.equals(other.nics)) { return false; } - } else if (!nics.equals(other.nics)) { - return false; } return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java index 59b06ba7a8..7e493f2151 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java @@ -18,12 +18,9 @@ import org.openecomp.sdc.tosca.datatypes.model.RequirementDefinition; import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; import org.openecomp.sdc.tosca.services.DataModelUtil; import org.openecomp.sdc.tosca.services.ToscaAnalyzerService; +import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil; import org.openecomp.sdc.tosca.services.ToscaUtil; import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl; -import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil; -import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; import java.util.ArrayList; import java.util.Arrays; @@ -37,8 +34,8 @@ import java.util.Map; */ public class GeneratorUtils { - public static List<String> supportedCapabilities = new ArrayList<>(); - public static List<String> supportedRequirements = new ArrayList<>(); + private static List<String> supportedCapabilities = new ArrayList<>(); + private static List<String> supportedRequirements = new ArrayList<>(); protected static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); static { diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/src/main/java/com/att/sdc/tosca/datatypes/AttToscaPolicyType.java b/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/src/main/java/com/att/sdc/tosca/datatypes/AttToscaPolicyType.java index 8881ec5e40..fd893730c4 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/src/main/java/com/att/sdc/tosca/datatypes/AttToscaPolicyType.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/src/main/java/com/att/sdc/tosca/datatypes/AttToscaPolicyType.java @@ -10,12 +10,14 @@ import org.openecomp.sdc.tosca.services.ConfigConstants; public class AttToscaPolicyType { private static Configuration config = ConfigurationManager.lookup(); - public static String POLICY_TYPE_PREFIX = + public static final String POLICY_TYPE_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_POLICY_TYPE); - public static String PLACEMENT_VALET_AFFINITY = POLICY_TYPE_PREFIX + "placement.valet.Affinity"; - public static String PLACEMENT_VALET_EXCLUSIVITY = + public static final String PLACEMENT_VALET_AFFINITY = POLICY_TYPE_PREFIX + "placement.valet" + + ".Affinity"; + public static final String PLACEMENT_VALET_EXCLUSIVITY = POLICY_TYPE_PREFIX + "placement.valet.Exclusivity"; - public static String PLACEMENT_VALET_DIVERSITY = POLICY_TYPE_PREFIX + "placement.valet.Diversity"; + public static final String PLACEMENT_VALET_DIVERSITY = POLICY_TYPE_PREFIX + "placement.valet" + + ".Diversity"; } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/src/main/java/com/att/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationValetGroupAssignmentImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/src/main/java/com/att/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationValetGroupAssignmentImpl.java index e303276538..176c7c5e65 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/src/main/java/com/att/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationValetGroupAssignmentImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/src/main/java/com/att/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationValetGroupAssignmentImpl.java @@ -289,7 +289,7 @@ public class ResourceTranslationValetGroupAssignmentImpl extends ResourceTransla groupName = (String) groupNameProperty; } - if (!Strings.isNullOrEmpty(groupName)) { + if (groupName != null && !Strings.isNullOrEmpty(groupName)) { groupName = groupName.replace(" ", "_"); resourceId += "_" + groupName; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/src/test/java/com/att/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/src/test/java/com/att/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java index e8fddc3108..05bc7cb5f1 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/src/test/java/com/att/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/src/test/java/com/att/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java @@ -36,6 +36,8 @@ import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent; import org.openecomp.sdc.heat.datatypes.manifest.ManifestFile; +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; @@ -86,6 +88,8 @@ public class BaseResourceTranslationTest { private final String MANIFEST_NAME = SdcCommon.MANIFEST_NAME; private String validationFilename = "validationOutput.json"; + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + @Before public void setUp() throws IOException { initTranslatorAndTranslate(); @@ -286,6 +290,7 @@ public class BaseResourceTranslationTest { } } catch (Exception e) { + log.debug("",e); Assert.fail(e.getMessage()); } return serviceTemplateMap; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/composition/NodeTemplateInformation.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/composition/NodeTemplateInformation.java index bd1263da5f..cbcf02e9a6 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/composition/NodeTemplateInformation.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/composition/NodeTemplateInformation.java @@ -1,7 +1,6 @@ package org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.composition; import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate; -import org.openecomp.sdc.translator.services.heattotosca.UnifiedCompositionService; /** * Created by Talio on 4/4/2017. diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/NestedTemplateConsolidationData.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/NestedTemplateConsolidationData.java index b07c2039b8..0f41b00309 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/NestedTemplateConsolidationData.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/NestedTemplateConsolidationData.java @@ -1,8 +1,5 @@ package org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation; -import java.util.List; - - /** * The type nested template consolidation data. */ diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/impl/heattotosca/HeatToToscaTranslatorImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/impl/heattotosca/HeatToToscaTranslatorImpl.java index e09be6cdd9..54a0285026 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/impl/heattotosca/HeatToToscaTranslatorImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/impl/heattotosca/HeatToToscaTranslatorImpl.java @@ -21,8 +21,6 @@ package org.openecomp.sdc.translator.impl.heattotosca; import org.apache.commons.collections4.MapUtils; -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; import org.openecomp.core.translator.api.HeatToToscaTranslator; import org.openecomp.core.translator.datatypes.TranslatorOutput; import org.openecomp.core.utilities.file.FileUtils; @@ -32,7 +30,6 @@ import org.openecomp.core.validation.factory.ValidationManagerFactory; import org.openecomp.core.validation.util.MessageContainerUtil; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.common.utils.SdcCommon; -import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.heat.datatypes.manifest.FileData; @@ -40,7 +37,6 @@ import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent; import org.openecomp.sdc.heat.datatypes.manifest.ManifestFile; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext; -import org.openecomp.sdc.translator.services.heattotosca.ConfigConstants; import org.openecomp.sdc.translator.services.heattotosca.ConsolidationService; import org.openecomp.sdc.translator.services.heattotosca.TranslationService; import org.openecomp.sdc.translator.services.heattotosca.UnifiedCompositionManager; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationDataUtil.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationDataUtil.java index 74deb0487a..b86038d175 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationDataUtil.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationDataUtil.java @@ -340,14 +340,15 @@ public class ConsolidationDataUtil { if(Objects.isNull(entityConsolidationData)){ return; } + if (entityConsolidationData != null) { + if (entityConsolidationData.getNodesConnectedOut() == null) { + entityConsolidationData.setNodesConnectedOut(new HashMap<>()); + } - if (entityConsolidationData.getNodesConnectedOut() == null) { - entityConsolidationData.setNodesConnectedOut(new HashMap<>()); + entityConsolidationData.getNodesConnectedOut() + .computeIfAbsent(nodeTemplateId, k -> new ArrayList<>()) + .add(requirementAssignmentData); } - - entityConsolidationData.getNodesConnectedOut() - .computeIfAbsent(nodeTemplateId, k -> new ArrayList<>()) - .add(requirementAssignmentData); } /** @@ -398,14 +399,16 @@ public class ConsolidationDataUtil { serviceTemplate, translateTo.getHeatFileName(), dependentNodeTemplateId); } - if (entityConsolidationData.getNodesConnectedIn() == null) { - entityConsolidationData.setNodesConnectedIn(new HashMap<>()); - } + if (entityConsolidationData != null) { + if (entityConsolidationData.getNodesConnectedIn() == null) { + entityConsolidationData.setNodesConnectedIn(new HashMap<>()); + } - entityConsolidationData.getNodesConnectedIn() - .computeIfAbsent(sourceNodeTemplateId, k -> new ArrayList<>()) - .add(requirementAssignmentData); + entityConsolidationData.getNodesConnectedIn() + .computeIfAbsent(sourceNodeTemplateId, k -> new ArrayList<>()) + .add(requirementAssignmentData); + } } /** diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/NameExtractor.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/NameExtractor.java index fc4c3f8841..e732080cb5 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/NameExtractor.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/NameExtractor.java @@ -21,11 +21,6 @@ package org.openecomp.sdc.translator.services.heattotosca; import org.openecomp.sdc.heat.datatypes.model.Resource; -import org.openecomp.sdc.translator.datatypes.heattotosca.to.TranslateTo; - -import java.util.List; -import java.util.Map; -import java.util.Optional; public interface NameExtractor { diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/NameExtractorUtil.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/NameExtractorUtil.java index 8241603fed..b4d41f5b6c 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/NameExtractorUtil.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/NameExtractorUtil.java @@ -20,13 +20,10 @@ package org.openecomp.sdc.translator.services.heattotosca; -import org.openecomp.sdc.translator.datatypes.heattotosca.AttachedPropertyVal; -import org.openecomp.sdc.translator.datatypes.heattotosca.AttachedResourceId; import org.openecomp.sdc.translator.datatypes.heattotosca.PropertyRegexMatcher; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Optional; import java.util.regex.Pattern; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ContrailTranslationHelper.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ContrailTranslationHelper.java index a86f584bf0..d194a70e97 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ContrailTranslationHelper.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ContrailTranslationHelper.java @@ -21,16 +21,14 @@ package org.openecomp.sdc.translator.services.heattotosca.helper; import org.openecomp.core.utilities.file.FileUtils; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.heat.datatypes.HeatBoolean; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; -import org.openecomp.sdc.tosca.services.ToscaConstants; import org.openecomp.sdc.tosca.datatypes.ToscaFunctions; import org.openecomp.sdc.translator.datatypes.heattotosca.PropertyRegexMatcher; +import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext; import org.openecomp.sdc.translator.services.heattotosca.ConfigConstants; import org.openecomp.sdc.translator.services.heattotosca.NameExtractor; -import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext; import java.util.ArrayList; import java.util.Collections; @@ -127,17 +125,17 @@ public class ContrailTranslationHelper { tokenPropertyValue.get("token").add(stringWithToken); } else if (refParameter instanceof String) { if (includeBooleanValue) { - StringBuffer booleanBuffer = new StringBuffer(); + StringBuilder booleanBuilder = new StringBuilder(); String[] booleanValueList = ((String) refParameter).split(tokenChar); for (int i = 0; i < booleanValueList.length; i++) { if (i == 0) { - booleanBuffer.append(HeatBoolean.eval(booleanValueList[i])); + booleanBuilder.append(HeatBoolean.eval(booleanValueList[i])); } else { - booleanBuffer.append(tokenChar); - booleanBuffer.append(HeatBoolean.eval(booleanValueList[i])); + booleanBuilder.append(tokenChar); + booleanBuilder.append(HeatBoolean.eval(booleanValueList[i])); } } - tokenPropertyValue.get("token").add(booleanBuffer.toString()); + tokenPropertyValue.get("token").add(booleanBuilder.toString()); } else { tokenPropertyValue.get("token").add(refParameter); } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ResourceTranslationNeutronPortHelper.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ResourceTranslationNeutronPortHelper.java index a99c95c148..23f8e3695d 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ResourceTranslationNeutronPortHelper.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/ResourceTranslationNeutronPortHelper.java @@ -2,7 +2,6 @@ package org.openecomp.sdc.translator.services.heattotosca.helper; import java.util.ArrayList; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/VolumeTranslationHelper.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/VolumeTranslationHelper.java index f1cb33372e..ef75f315f6 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/VolumeTranslationHelper.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/VolumeTranslationHelper.java @@ -23,19 +23,18 @@ package org.openecomp.sdc.translator.services.heattotosca.helper; import static org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes.CINDER_VOLUME_RESOURCE_TYPE; import org.apache.commons.collections4.CollectionUtils; -import org.openecomp.sdc.common.utils.CommonUtil; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.tosca.services.YamlUtil; import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; import org.openecomp.sdc.heat.datatypes.model.Output; import org.openecomp.sdc.heat.datatypes.model.Resource; +import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; +import org.openecomp.sdc.tosca.services.YamlUtil; import org.openecomp.sdc.translator.datatypes.heattotosca.AttachedResourceId; +import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext; import org.openecomp.sdc.translator.datatypes.heattotosca.to.ResourceFileDataAndIDs; import org.openecomp.sdc.translator.datatypes.heattotosca.to.TranslateTo; import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil; -import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext; import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.ResourceTranslationBase; import java.util.ArrayList; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImpl.java index 6f7d7a921e..b2909d15b3 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImpl.java @@ -20,6 +20,7 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.functiontranslation; +import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.tosca.services.YamlUtil; import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; import org.openecomp.sdc.heat.datatypes.model.Resource; @@ -323,7 +324,7 @@ public class FunctionTranslationGetAttrImpl implements FunctionTranslation { if (attributeParamList.size() < 3) { return null; } - StringBuffer attributeFullPath = new StringBuffer(); + StringBuilder attributeFullPath = new StringBuilder(); attributeFullPath.append(attributeParamList.get(1)); for (int j = 2; j <= attributeIndex; j++) { if (isInteger(attributeParamList.get(j))) { @@ -340,11 +341,16 @@ public class FunctionTranslationGetAttrImpl implements FunctionTranslation { return false; } - try { + /*try { Integer.parseInt(String.valueOf(inputNumber)); return true; } catch (NumberFormatException exception) { return false; + }*/ + if(StringUtils.isNumeric(String.valueOf(inputNumber))){ + return true; + } else { + return false; } } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailPortToNetResourceConnection.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailPortToNetResourceConnection.java index efa0ddd8a9..272211f7cf 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailPortToNetResourceConnection.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailPortToNetResourceConnection.java @@ -21,7 +21,6 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VlanToInterfaceResourceConnection.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VlanToInterfaceResourceConnection.java index a757730cb1..65b1d469ab 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VlanToInterfaceResourceConnection.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VlanToInterfaceResourceConnection.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VmInterfaceToNetResourceConnection.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VmInterfaceToNetResourceConnection.java index 944afb0fc3..5afbf5be54 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VmInterfaceToNetResourceConnection.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VmInterfaceToNetResourceConnection.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/PortToNetResourceConnection.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/PortToNetResourceConnection.java index d3e8676ca1..25a604469e 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/PortToNetResourceConnection.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/PortToNetResourceConnection.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceConnectionUsingRequirementHelper.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceConnectionUsingRequirementHelper.java index 6ddd0c7334..d1962d8196 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceConnectionUsingRequirementHelper.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceConnectionUsingRequirementHelper.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate; import org.openecomp.sdc.tosca.datatypes.model.NodeType; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationCinderVolumeImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationCinderVolumeImpl.java index 04e71cc2c7..78d09577d9 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationCinderVolumeImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationCinderVolumeImpl.java @@ -20,14 +20,12 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.heat.datatypes.HeatBoolean; import org.openecomp.sdc.heat.services.HeatConstants; import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate; import org.openecomp.sdc.tosca.services.DataModelUtil; import org.openecomp.sdc.translator.datatypes.heattotosca.to.TranslateTo; -import org.openecomp.sdc.translator.services.heattotosca.Constants; import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil; import org.openecomp.sdc.translator.services.heattotosca.mapping.TranslatorHeatToToscaPropertyConverter; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailNetworkPolicyImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailNetworkPolicyImpl.java index 374858be0c..999441deb7 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailNetworkPolicyImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailNetworkPolicyImpl.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java index 3b9eb08f53..0b7e9eacfe 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImpl.java @@ -638,7 +638,7 @@ public class ResourceTranslationContrailServiceInstanceImpl extends ResourceTran NodeTemplate computeNodeTemplate = new NodeTemplate(); computeNodeTemplate.setType(computeNodeTypeId); - if (!computeNodeTemplateProperties.isEmpty()) { + if (computeNodeTemplateProperties != null && !computeNodeTemplateProperties.isEmpty()) { computeNodeTemplate.setProperties(computeNodeTemplateProperties); } String computeNodeTemplateId = translateTo.getTranslatedId(); diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VirtualNetworkImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VirtualNetworkImpl.java index d39d0f1c45..10ccf0f560 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VirtualNetworkImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VirtualNetworkImpl.java @@ -21,11 +21,10 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; import org.apache.commons.collections.CollectionUtils; -import org.openecomp.sdc.common.utils.CommonUtil; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType; import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; import org.openecomp.sdc.tosca.datatypes.ToscaRelationshipType; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VlanSubInterfaceImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VlanSubInterfaceImpl.java index e0e6c459a1..76396f77bc 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VlanSubInterfaceImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VlanSubInterfaceImpl.java @@ -20,12 +20,11 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; -import org.openecomp.sdc.common.utils.CommonUtil; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.services.HeatConstants; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate; import org.openecomp.sdc.tosca.services.DataModelUtil; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailVirtualNetworkImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailVirtualNetworkImpl.java index a6fc9ac2c1..f0c3c8b3f1 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailVirtualNetworkImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailVirtualNetworkImpl.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate; import org.openecomp.sdc.tosca.services.DataModelUtil; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronPortImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronPortImpl.java index f1bd6790c2..76a900f32e 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronPortImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronPortImpl.java @@ -33,14 +33,13 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.AttachedResourceId; import org.openecomp.sdc.translator.datatypes.heattotosca.to.TranslateTo; import org.openecomp.sdc.translator.datatypes.heattotosca.to.TranslatedHeatResource; import org.openecomp.sdc.translator.services.heattotosca.ConsolidationDataUtil; -import org.openecomp.sdc.translator.services.heattotosca.Constants; import org.openecomp.sdc.translator.services.heattotosca.ConsolidationEntityType; +import org.openecomp.sdc.translator.services.heattotosca.Constants; import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil; import org.openecomp.sdc.translator.services.heattotosca.ResourceTranslationFactory; import org.openecomp.sdc.translator.services.heattotosca.helper.ResourceTranslationNeutronPortHelper; import org.openecomp.sdc.translator.services.heattotosca.mapping.TranslatorHeatToToscaPropertyConverter; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSecurityGroupImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSecurityGroupImpl.java index 96e79aca60..94c853f750 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSecurityGroupImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSecurityGroupImpl.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate; import org.openecomp.sdc.tosca.services.DataModelUtil; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSubnetImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSubnetImpl.java index 76a8c447d1..5f8aead6e5 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSubnetImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSubnetImpl.java @@ -153,6 +153,7 @@ public class ResourceTranslationNeutronSubnetImpl extends ResourceTranslationBas Boolean booleanValue = HeatBoolean.eval(defaultVal); dhcpParameterDefinition.set_default(booleanValue); } catch (CoreException coreException) { + logger.debug("",coreException); //if value is not valid value for boolean set with dhcp_enabled default value = true dhcpParameterDefinition.set_default(true); logger.warn("Parameter '" + dhcpEnabledParameterName + "' used for " diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImpl.java index bd672e387f..7083ae0449 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImpl.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImpl.java @@ -21,7 +21,6 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; import org.openecomp.sdc.common.errors.CoreException; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; @@ -154,7 +153,7 @@ public class ResourceTranslationResourceGroupImpl extends ResourceTranslationBas mdcDataDebugMessage.debugEntryMessage(null, null); - if (propertyValue instanceof String && propertyValue != null) { + if (propertyValue != null && propertyValue instanceof String) { if (propertyValue.equals(indexVarValue)) { return getNewIndexVarValue(); } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/mapping/TranslatorHeatToToscaParameterConverter.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/mapping/TranslatorHeatToToscaParameterConverter.java index 23a4d7317b..35b617be99 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/mapping/TranslatorHeatToToscaParameterConverter.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/mapping/TranslatorHeatToToscaParameterConverter.java @@ -26,13 +26,10 @@ import org.openecomp.sdc.heat.datatypes.model.Output; import org.openecomp.sdc.heat.datatypes.model.Parameter; import org.openecomp.sdc.tosca.datatypes.model.Constraint; import org.openecomp.sdc.tosca.datatypes.model.EntrySchema; -import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate; import org.openecomp.sdc.tosca.datatypes.model.ParameterDefinition; import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; -import org.openecomp.sdc.tosca.datatypes.model.Template; import org.openecomp.sdc.tosca.datatypes.model.heatextend.ParameterDefinitionExt; import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext; -import org.openecomp.sdc.translator.services.heattotosca.ConsolidationDataUtil; import org.openecomp.sdc.translator.services.heattotosca.FunctionTranslationFactory; import java.util.ArrayList; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java index 43f4065044..27298ff9b4 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java @@ -27,6 +27,8 @@ import org.junit.Assert; import org.openecomp.core.translator.api.HeatToToscaTranslator; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.common.utils.SdcCommon; +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.GroupDefinition; import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate; @@ -50,6 +52,8 @@ public class TestUtils { private static String zipFilename = "VSP.zip"; private static String validationFilename = "validationOutput.json"; + private static Logger logger = (Logger) LoggerFactory.getLogger(TestUtils.class); + private TestUtils() { } @@ -105,6 +109,7 @@ public class TestUtils { serviceTemplateMap.put(fileList[i], serviceTemplate); } } catch (Exception e) { + logger.debug("",e); Assert.fail(e.getMessage()); } return serviceTemplateMap; @@ -162,6 +167,7 @@ public class TestUtils { try { yamlFile.close(); } catch (IOException ignore) { + logger.debug("",ignore); } } catch (FileNotFoundException e) { throw e; @@ -207,6 +213,7 @@ public class TestUtils { try { yamlFile.close(); } catch (IOException ignore) { + logger.debug("",ignore); } } catch (FileNotFoundException e) { throw e; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/single/TranslateHeatNestedSingle.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/single/TranslateHeatNestedSingle.java index 38df156efc..640da0c12b 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/single/TranslateHeatNestedSingle.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/single/TranslateHeatNestedSingle.java @@ -22,7 +22,6 @@ package org.openecomp.sdc.translator.impl.heattotosca.nested.single; import org.junit.Before; import org.junit.Test; -import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil; import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants; import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseResourceTranslationTest; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java index 03dd30fd09..085c329e7f 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java @@ -1,10 +1,14 @@ package org.openecomp.sdc.translator.services.heattotosca; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; @@ -30,11 +34,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - /** * Created by TALIO on 3/7/2017. */ diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java index c333391b9b..53dd79e5c8 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/ConsolidationDataTestUtil.java @@ -125,11 +125,14 @@ public class ConsolidationDataTestUtil { } for(String consolidatedKey : consolidatedMap.keySet()){ List<String> consolidatedList = consolidatedMap.get(consolidatedKey); - List<String> expectedList = expectedMap.get(consolidatedKey); - if(expectedList == null ){ - Assert.fail(); - } if(!CollectionUtils.isEqualCollection(consolidatedList,expectedList)){ - Assert.fail(); + if (expectedMap != null) { + List<String> expectedList = expectedMap.get(consolidatedKey); + if (expectedList == null) { + Assert.fail(); + } + if (!CollectionUtils.isEqualCollection(consolidatedList, expectedList)) { + Assert.fail(); + } } } } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java index 149f276903..b1946b3f9b 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java @@ -2,14 +2,17 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest; import java.io.IOException; public class UnifiedCompositionMixPatternFullTest extends BaseFullTranslationTest { + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + @Override @Before public void setUp() throws IOException { @@ -55,6 +58,7 @@ public class UnifiedCompositionMixPatternFullTest extends BaseFullTranslationTes try { testTranslationWithInit(); }catch(Exception e){ + log.debug("",e); Assert.assertEquals(e.getMessage(), "Resource with id lb_0_int_oam_int_0_port occures more " + "than once in different addOn files"); } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedSingleComputeFullTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedSingleComputeFullTest.java index cebe9ec505..a0ef039100 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedSingleComputeFullTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedSingleComputeFullTest.java @@ -1,7 +1,6 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java index 9f0a6d79b9..5de07203a1 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java @@ -25,8 +25,6 @@ import static org.junit.Assert.assertEquals; import org.apache.commons.collections4.MapUtils; import org.junit.Assert; import org.junit.Before; -import org.openecomp.config.api.Configuration; -import org.openecomp.config.api.ConfigurationManager; import org.openecomp.core.translator.api.HeatToToscaTranslator; import org.openecomp.core.translator.datatypes.TranslatorOutput; import org.openecomp.core.translator.factory.HeatToToscaTranslatorFactory; @@ -45,7 +43,6 @@ import org.openecomp.sdc.tosca.services.ToscaFileOutputService; import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; import org.openecomp.sdc.translator.TestUtils; import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext; -import org.openecomp.sdc.translator.services.heattotosca.ConfigConstants; import java.io.BufferedInputStream; import java.io.File; diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/java/com/att/sdc/validation/impl/validators/AttValetGroupAssignmentResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/java/com/att/sdc/validation/impl/validators/AttValetGroupAssignmentResourceValidatorTest.java index 76e10215e3..acb54f4140 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/java/com/att/sdc/validation/impl/validators/AttValetGroupAssignmentResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/src/test/java/com/att/sdc/validation/impl/validators/AttValetGroupAssignmentResourceValidatorTest.java @@ -1,8 +1,6 @@ package com.att.sdc.validation.impl.validators; import com.att.sdc.validation.datatypes.AttHeatResourceTypes; -import com.att.sdc.validation.datatypes.AttValetGroupTypeValues; -import org.openecomp.sdc.validation.Validator; import org.openecomp.core.validation.api.ValidationManager; import org.openecomp.core.validation.factory.ValidationManagerFactory; import org.openecomp.core.validation.types.GlobalValidationContext; diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java index 8bb95afacd..e3464db8d8 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java @@ -24,6 +24,8 @@ import org.openecomp.config.ConfigurationUtils; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; @@ -38,6 +40,8 @@ import java.util.stream.Collectors; public class HeatTreeManagerTest { + private Logger logger = LoggerFactory.getLogger(HeatTreeManagerTest.class); + @Test public void testHeatTreeCreation() { @@ -66,7 +70,7 @@ public class HeatTreeManagerTest { try { return FileUtils.toByteArray(new FileInputStream(file)); } catch (IOException e) { - e.printStackTrace(); + logger.debug("",e); } return new byte[0]; diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java index 485b4204c7..39362c7e10 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java @@ -225,6 +225,7 @@ public class HeatValidationService { throw new Exception("The file '" + nestedFileName + "' has no content"); } } catch (Exception exception) { + logger.debug("",exception); mdcDataDebugMessage.debugExitMessage("file", parentFileName); return; } @@ -242,6 +243,7 @@ public class HeatValidationService { throw new Exception("The file '" + parentFileName + "' has no content"); } } catch (Exception exception) { + logger.debug("",exception); mdcDataDebugMessage.debugExitMessage("file", parentFileName); return; } @@ -374,6 +376,7 @@ public class HeatValidationService { } } catch (Exception exception) { + logger.debug("",exception); logger.warn("HEAT Validator will not be executed on file " + nestedFileName + " due to illegal HEAT format"); @@ -462,6 +465,7 @@ public class HeatValidationService { throw new Exception("The file '" + resourceType + "' has no content"); } } catch (Exception exception) { + logger.debug("",exception); return; } nestedOutputMap = nestedHeatOrchestrationTemplate.getOutputs(); @@ -511,6 +515,7 @@ public class HeatValidationService { throw new Exception("The file '" + envFileName + "' has no content"); } } catch (Exception exception) { + logger.debug("",exception); mdcDataDebugMessage.debugExitMessage("env file", envFileName); return null; } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java index 39556795c7..7d90726dd1 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ContrailValidator.java @@ -48,7 +48,7 @@ import java.util.Optional; public class ContrailValidator implements Validator { - public static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + public static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); protected static Logger logger = (Logger) LoggerFactory.getLogger(ContrailValidator.class); @Override @@ -59,6 +59,7 @@ public class ContrailValidator implements Validator { try { manifestContent = ValidationUtil.checkValidationPreCondition(globalContext); } catch (Exception exception) { + logger.debug("",exception); return; } Map<String, FileData.Type> fileTypeMap = ManifestUtil.getFileTypeMap(manifestContent); @@ -148,6 +149,7 @@ public class ContrailValidator implements Validator { heatOrchestrationTemplate = new YamlUtil().yamlToObject(fileContent, HeatOrchestrationTemplate.class); } catch (Exception ignored) { + logger.debug("",ignored); // the HeatValidator should handle file that is failing to parse mdcDataDebugMessage.debugExitMessage("file", fileName); return Optional.empty(); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java index 2531150eab..569f2bb760 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java @@ -1,7 +1,6 @@ package org.openecomp.sdc.validation.impl.validators; import org.apache.commons.collections4.MapUtils; -import org.openecomp.sdc.validation.Validator; import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; import org.openecomp.core.validation.types.GlobalValidationContext; import org.openecomp.sdc.common.errors.Messages; @@ -11,12 +10,14 @@ import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent; import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.services.manifest.ManifestUtil; +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.types.LoggerErrorDescription; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; +import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.util.ValidationUtil; -import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Objects; @@ -29,6 +30,8 @@ public class ForbiddenResourceGuideLineValidator implements Validator { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); private static Set<String> forbiddenResources = new HashSet<>(); + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + @Override public void init(Map<String, Object> properties) { Map<String, Map<String, Object>> forbiddenResourcesMap = @@ -62,6 +65,7 @@ public class ForbiddenResourceGuideLineValidator implements Validator { try { manifestContent = ValidationUtil.checkValidationPreCondition(globalContext); } catch (Exception exception) { + log.debug("",exception); return; } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidator.java index 2712dab11c..1fda0ed783 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidator.java @@ -27,7 +27,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.Optional; import java.util.Set; public class HeatResourceValidator extends ResourceBaseValidator { @@ -48,7 +47,7 @@ public class HeatResourceValidator extends ResourceBaseValidator { try { manifestContent = ValidationUtil.checkValidationPreCondition(globalContext); } catch (Exception exception) { - + logger.debug("",exception); } Set<String> baseFiles = ManifestUtil.getBaseFiles(manifestContent); String baseFileName = CollectionUtils.isEmpty(baseFiles) ? null : baseFiles.iterator().next(); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java index ddc1bb49b9..5297453369 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java @@ -55,7 +55,7 @@ import java.util.Objects; import java.util.Set; public class HeatValidator implements Validator { - public static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + public static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); protected static Logger logger = (Logger) LoggerFactory.getLogger(HeatValidator.class); private static void validateAllRequiredArtifactsExist(String fileName, @@ -244,7 +244,7 @@ public class HeatValidator implements Validator { if (CollectionUtils.isNotEmpty(parametersNames)) { for (Map.Entry<String, Object> envEntry : envContent.getParameters().entrySet()) { String envParameter = envEntry.getKey(); - if (!parametersNames.contains(envParameter)) { + if (parametersNames != null && !parametersNames.contains(envParameter)) { globalContext.addMessage(envFile, ErrorLevel.ERROR, ErrorMessagesFormatBuilder .getErrorWithParameters( Messages.ENV_INCLUDES_PARAMETER_NOT_IN_HEAT.getErrorMessage(), envFile, @@ -278,7 +278,7 @@ public class HeatValidator implements Validator { Map<String, Parameter> parametersMap = heatOrchestrationTemplate.getParameters() == null ? null : heatOrchestrationTemplate.getParameters(); - if (MapUtils.isNotEmpty(parametersMap)) { + if (parametersMap != null && MapUtils.isNotEmpty(parametersMap)) { for (Map.Entry<String, Parameter> parameterEntry : parametersMap.entrySet()) { Parameter parameter = parameterEntry.getValue(); String parameterType = parameter.getType(); @@ -343,6 +343,7 @@ public class HeatValidator implements Validator { try { manifestContent = ValidationUtil.checkValidationPreCondition(globalContext); } catch (Exception exception) { + logger.debug("",exception); return; } String baseFileName; @@ -370,7 +371,8 @@ public class HeatValidator implements Validator { Set<String> manifestArtifacts = ManifestUtil.getArtifacts(manifestContent); globalContext.getFiles().stream() - .filter(fileName -> manifestArtifacts.contains(fileName) && !artifacts.contains(fileName)) + .filter(fileName -> isManifestArtifact(manifestArtifacts, fileName) && + isNotArtifact(artifacts, fileName)) .forEach(fileName -> globalContext.addMessage(fileName, ErrorLevel.WARNING, Messages.ARTIFACT_FILE_NOT_REFERENCED.getErrorMessage(), LoggerTragetServiceName.CHECK_FOR_ORPHAN_ARTIFACTS, @@ -380,6 +382,14 @@ public class HeatValidator implements Validator { } + private boolean isManifestArtifact(Set<String> manifestArtifacts, String fileName) { + return manifestArtifacts.contains(fileName); + } + + private boolean isNotArtifact(Set<String> artifacts, String fileName) { + return !artifacts.contains(fileName); + } + private void validate(String fileName, String envFileName, String baseFileName, Set<String> artifacts, Set<String> securityGroupsNamesFromBaseFileOutputs, GlobalValidationContext globalContext) { diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java index 43cafb494c..79c4dc2d96 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java @@ -45,7 +45,7 @@ import java.util.Optional; public class ManifestValidator implements Validator { - public static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + public static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); private static Logger logger = (Logger) LoggerFactory.getLogger(YamlValidator.class); @Override @@ -65,6 +65,7 @@ public class ManifestValidator implements Validator { throw new Exception("The manifest file '" + SdcCommon.MANIFEST_NAME + "' has no content"); } } catch (Exception re) { + logger.debug("",re); globalContext.addMessage(SdcCommon.MANIFEST_NAME, ErrorLevel.ERROR, Messages.INVALID_MANIFEST_FILE.getErrorMessage(), LoggerTragetServiceName.VALIDATE_MANIFEST_CONTENT, @@ -80,7 +81,7 @@ public class ManifestValidator implements Validator { LoggerTragetServiceName.VALIDATE_FILE_IN_ZIP, LoggerErrorDescription.MISSING_FILE)); globalContext.getFileContextMap().keySet().stream().filter(name -> - !manifestFiles.contains(name) && !SdcCommon.MANIFEST_NAME.equals(name) + isNotManifestFiles(manifestFiles, name) && isNotManifestName(name) ).forEach(name -> globalContext.addMessage(name, ErrorLevel.WARNING, Messages.MISSING_FILE_IN_MANIFEST.getErrorMessage(), @@ -90,6 +91,14 @@ public class ManifestValidator implements Validator { mdcDataDebugMessage.debugExitMessage(null, null); } + private boolean isNotManifestFiles(List<String> manifestFiles, String name) { + return !manifestFiles.contains(name); + } + + private boolean isNotManifestName(String name) { + return !SdcCommon.MANIFEST_NAME.equals(name); + } + private List<String> getManifestFileList(ManifestContent manifestContent, GlobalValidationContext context) { diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java index f3af7d7e48..04771e023e 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidator.java @@ -1,6 +1,8 @@ package org.openecomp.sdc.validation.impl.validators; import org.apache.commons.collections4.CollectionUtils; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.validation.Validator; import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; import org.openecomp.core.validation.types.GlobalValidationContext; @@ -26,7 +28,8 @@ import java.util.Set; * Created by TALIO on 2/15/2017. */ public class SharedResourceGuideLineValidator implements Validator { - public static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + public static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); @Override public void validate(GlobalValidationContext globalContext) { @@ -34,6 +37,7 @@ public class SharedResourceGuideLineValidator implements Validator { try { manifestContent = ValidationUtil.checkValidationPreCondition(globalContext); } catch (Exception exception) { + log.debug("",exception); return; } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java index 445e1c2e3d..0fded4f58e 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java @@ -39,7 +39,7 @@ import java.util.Map; import java.util.Optional; public class YamlValidator implements Validator { - public static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + public static final MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); private static final Logger logger = (Logger) LoggerFactory.getLogger(YamlValidator.class); @Override diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java index 5dc42c9b9a..d05f2813ff 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java @@ -90,25 +90,26 @@ public class NovaServerResourceValidator implements ResourceValidator { return; } - for (Object serverGroupValue : schedulerHintsMap.values()) { - if(!(serverGroupValue instanceof Map)){ - continue; - } - Map<String, Object> currentServerMap = (Map<String, Object>) serverGroupValue; - String serverResourceName = - currentServerMap == null ? null : (String) currentServerMap - .get(ResourceReferenceFunctions.GET_RESOURCE.getFunction()); - Resource serverResource = - serverResourceName == null || resourcesMap == null ? null - : resourcesMap.get(serverResourceName); - - if (serverResource != null && !serverResource.getType() - .equals(HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource())) { - globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder - .getErrorWithParameters(Messages.SERVER_NOT_DEFINED_FROM_NOVA.getErrorMessage(), - serverResourceName, resourceEntry.getKey()), - LoggerTragetServiceName.VALIDATE_SERVER_GROUP_EXISTENCE, - LoggerErrorDescription.SERVER_NOT_DEFINED_NOVA); + if (schedulerHintsMap != null) { + for (Object serverGroupValue : schedulerHintsMap.values()) { + if (!(serverGroupValue instanceof Map)) { + continue; + } + Map<String, Object> currentServerMap = (Map<String, Object>) serverGroupValue; + String serverResourceName = (String) currentServerMap + .get(ResourceReferenceFunctions.GET_RESOURCE.getFunction()); + Resource serverResource = + serverResourceName == null || resourcesMap == null ? null + : resourcesMap.get(serverResourceName); + + if (serverResource != null && !serverResource.getType() + .equals(HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource())) { + globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder + .getErrorWithParameters(Messages.SERVER_NOT_DEFINED_FROM_NOVA.getErrorMessage(), + serverResourceName, resourceEntry.getKey()), + LoggerTragetServiceName.VALIDATE_SERVER_GROUP_EXISTENCE, + LoggerErrorDescription.SERVER_NOT_DEFINED_NOVA); + } } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java index 6016ba0cb8..299eabf4e5 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java @@ -564,11 +564,12 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal private String getVmName(String nameToGetVmNameFrom, String stringToGetIndexOf) { int vmIndex = nameToGetVmNameFrom == null ? -1 : nameToGetVmNameFrom.indexOf(stringToGetIndexOf); - String vmName = vmIndex < 0 ? null - : trimNonAlphaNumericCharactersFromEndOfString(nameToGetVmNameFrom.substring(0, vmIndex)); - + String vmName = null; + if (nameToGetVmNameFrom != null) { + vmName = vmIndex < 0 ? null + : trimNonAlphaNumericCharactersFromEndOfString(nameToGetVmNameFrom.substring(0, vmIndex)); + } return vmName; - } private boolean isVmNameSync(List<String> namesToCompare) { diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java index 1a5b373833..f5d01d90e8 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java @@ -53,6 +53,7 @@ public class ResourceBaseValidator implements Validator { try { manifestContent = ValidationUtil.checkValidationPreCondition(globalContext); } catch (Exception exception) { + logger.debug("",exception); return; } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java index 3702e9253f..fa1946f987 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java @@ -15,6 +15,8 @@ import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.services.HeatStructureUtil; import org.openecomp.sdc.heat.services.manifest.ManifestUtil; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.Validator; @@ -36,6 +38,9 @@ import java.util.Objects; */ public class ValidationTestUtil { + private final static Logger log = (Logger) LoggerFactory.getLogger(ValidationTestUtil.class + .getName()); + public static GlobalValidationContext createGlobalContextFromPath(String path) { GlobalValidationContext globalValidationContext = new GlobalValidationContext(); Map<String, byte[]> contentMap = getContentMapByPath(path); @@ -71,7 +76,7 @@ public class ValidationTestUtil { fileContent = FileUtils.toByteArray(fis); contentMap.put(file.getName(), fileContent); } catch (IOException e) { - e.printStackTrace(); + log.debug("",e); } } return contentMap; @@ -178,6 +183,7 @@ public class ValidationTestUtil { CommonMethods.newInstance(validatorConf.getImplementationClass(), Validator.class); validator.init(validatorConf.getProperties()); } catch (IllegalArgumentException iae) { + log.debug("",iae); return null; } return validator; diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java index 3dcc7da876..41300f3852 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java @@ -17,6 +17,8 @@ import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions; import org.openecomp.sdc.heat.services.HeatStructureUtil; import org.openecomp.sdc.heat.services.manifest.ManifestUtil; +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; @@ -37,6 +39,7 @@ import static java.util.Objects.nonNull; public class ValidationUtil { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private final static Logger log = (Logger) LoggerFactory.getLogger(ValidationUtil.class.getName()); public static void removeExposedResourcesCalledByGetResource(String fileName, Set<String> actualExposedResources, @@ -138,6 +141,7 @@ public class ValidationUtil { throw new Exception("The file '" + envFileName + "' has no content"); } } catch (Exception exception) { + log.debug("",exception); mdcDataDebugMessage.debugExitMessage("file", envFileName); return null; } @@ -186,6 +190,7 @@ public class ValidationUtil { try { manifestContent = JsonUtil.json2Object(manifest.get(), ManifestContent.class); } catch (Exception exception) { + log.debug("",exception); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.VALIDATE_MANIFEST_CONTENT, ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_MANIFEST); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDao.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDao.java index 8e2e4889ba..25fd68b057 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDao.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDao.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.vendorlicense.dao; -import org.openecomp.core.dao.BaseDao; import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; import org.openecomp.sdc.versioning.dao.VersionableDao; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ChoiceOrOther.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ChoiceOrOther.java index 4483c67b65..7f5fc66ef4 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ChoiceOrOther.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ChoiceOrOther.java @@ -26,6 +26,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,8 @@ public class ChoiceOrOther<E extends Enum<E>> { "Enum used as part of ChoiceOrOther type must contain the value 'Other'"; public static final String OTHER_ENUM_VALUE = "Other"; + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + @Transient private E choice; @@ -117,9 +121,11 @@ public class ChoiceOrOther<E extends Enum<E>> { try { choice = E.valueOf(enumClass, result); } catch (IllegalArgumentException exception) { + log.debug("",exception); try { choice = E.valueOf(enumClass, OTHER_ENUM_VALUE); } catch (IllegalArgumentException ex) { + log.debug("",ex); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_CHOICE_VALUE, ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java index ff0eff8042..399cf28201 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java @@ -1,8 +1,5 @@ package org.openecomp.sdc.vendorlicense.dao.types; -import java.util.ArrayList; -import java.util.List; - public enum LimitType { ServiceProvider, Vendor; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java index 36f54ac45e..2f28142470 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java @@ -26,6 +26,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; @@ -43,6 +45,8 @@ public class MultiChoiceOrOther<E extends Enum<E>> { "Enum used as part of MultiChoiceOrOther type must contain the value 'Other'"; public static final String OTHER_ENUM_VALUE = "Other"; + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + @Transient private Set<E> choices; @Transient @@ -136,10 +140,11 @@ public class MultiChoiceOrOther<E extends Enum<E>> { try { choices.add(E.valueOf(enumClass, result)); } catch (IllegalArgumentException exception) { + log.debug("",exception); try { choices.add(E.valueOf(enumClass, OTHER_ENUM_VALUE)); } catch (IllegalArgumentException ex) { - + log.debug("",ex); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_CHOICE_VALUE, ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java index c36d255b31..78c26c83d3 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java @@ -12,8 +12,6 @@ import org.openecomp.core.zusammen.api.ZusammenAdaptor; import org.openecomp.core.zusammen.api.ZusammenUtil; 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.versioning.dao.types.Version; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java index 2f7e0ea50e..b2f2d488e9 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java @@ -30,6 +30,8 @@ import org.openecomp.core.utilities.CommonMethods; import org.openecomp.sdc.common.errors.CoreException; 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.MdcDataDebugMessage; import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; import org.openecomp.sdc.logging.types.LoggerConstants; @@ -89,6 +91,7 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { licenseKeyGroupDao = LicenseKeyGroupDaoFactory.getInstance().createInterface(); private static final LimitDao limitDao = LimitDaoFactory.getInstance().createInterface(); private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); /** * Instantiates a new Vendor license facade. @@ -409,6 +412,7 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { return Collections.singletonList(new RequestedVersionInvalidErrorBuilder().build()); } } catch (CoreException exception) { + log.debug("",exception); return Collections.singletonList(exception.code()); } @@ -417,6 +421,7 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { try { getLicenseAgreement(vlmId, licenseAgreementId, version); } catch (CoreException exception) { + log.debug("",exception); errorMessages.add(exception.code()); } @@ -433,6 +438,7 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { version).build()); } } catch (CoreException exception) { + log.debug("",exception); errorMessages.add(exception.code()); } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java index 282b4e6743..6dbed22db5 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java @@ -20,6 +20,9 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl; +import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH; +import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VNF_ARTIFACT_NAME_WITH_PATH; + import org.apache.commons.collections.CollectionUtils; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java index 3a3fbd16a3..5f71565843 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java @@ -23,6 +23,8 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types; import com.fasterxml.jackson.dataformat.xml.XmlMapper; 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.MdcDataErrorMessage; import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; @@ -34,6 +36,7 @@ import org.openecomp.sdc.vendorlicense.errors.JsonErrorBuilder; public abstract class XmlArtifact { XmlMapper xmlMapper = new XmlMapper(); + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); abstract void initMapper(); @@ -49,6 +52,7 @@ public abstract class XmlArtifact { try { xml = xmlMapper.writeValueAsString(this); } catch (com.fasterxml.jackson.core.JsonProcessingException exception) { + log.debug("",exception); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.WRITE_ARTIFACT_XML, ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_JSON); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java index dc0db0d96c..ac45528acd 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java @@ -21,23 +21,20 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; 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.OperationalScope; -import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; -import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; import java.util.Collection; import java.util.Set; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java index 8a2d17d9ff..ad1a9a6bdf 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java @@ -21,10 +21,7 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric; @@ -34,9 +31,9 @@ import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; -import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; import java.util.Collection; import java.util.Set; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java index 78bf531e82..5a8e9966cc 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java @@ -21,17 +21,14 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.xml.LicenseKeyTypeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; -import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; import java.util.Collection; import java.util.Set; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java index b25b93ff7c..4af4b592a9 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java @@ -21,10 +21,7 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentDependencyModelDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentDependencyModelDao.java index 1be4a5cda5..a980918c36 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentDependencyModelDao.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentDependencyModelDao.java @@ -2,7 +2,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao; import org.openecomp.core.dao.BaseDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.versioning.dao.VersionableDao; import org.openecomp.sdc.versioning.dao.types.Version; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NetworkDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NetworkDao.java index 348b777fe6..da57b0a2b4 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NetworkDao.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NetworkDao.java @@ -21,13 +21,10 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao; import org.openecomp.core.dao.BaseDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; import org.openecomp.sdc.versioning.dao.VersionableDao; import org.openecomp.sdc.versioning.dao.types.Version; -import java.util.Collection; - public interface NetworkDao extends VersionableDao, BaseDao<NetworkEntity> { diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ImageEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ImageEntity.java index 4950229486..7d22cdd13f 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ImageEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ImageEntity.java @@ -9,7 +9,6 @@ import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image; -import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; import org.openecomp.sdc.versioning.dao.types.Version; @Table(keyspace = "dox", name = "vsp_component_image") diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/QuestionnnaireDataServiceFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/QuestionnnaireDataServiceFactory.java index a1b9430e41..a45eb3db6f 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/QuestionnnaireDataServiceFactory.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/QuestionnnaireDataServiceFactory.java @@ -22,7 +22,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.factory; import org.openecomp.core.factory.api.AbstractComponentFactory; import org.openecomp.core.factory.api.AbstractFactory; -import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactGenerator; import org.openecomp.sdc.vendorsoftwareproduct.questionnaire.QuestionnaireDataService; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/InformationArtifactGenerator.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/InformationArtifactGenerator.java index 11d8e7b501..5813a18bd7 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/InformationArtifactGenerator.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/InformationArtifactGenerator.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.informationArtifact; import org.openecomp.sdc.versioning.dao.types.Version; import java.io.IOException; -import java.nio.ByteBuffer; /** * @author katyr diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGenerator.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGenerator.java index 6b1837fa10..edfbd8c94f 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGenerator.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGenerator.java @@ -25,6 +25,8 @@ import freemarker.template.TemplateException; 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.types.composition.CompositionEntityType; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput; @@ -35,6 +37,7 @@ import java.io.Writer; public class SchemaGenerator { public static final String SCHEMA_GENERATION_ERROR = "SCHEMA_GENERATION_ERROR"; + private final static Logger log = (Logger) LoggerFactory.getLogger(SchemaGenerator.class.getName()); /** * Generate string. @@ -56,6 +59,7 @@ public class SchemaGenerator { schemaTemplate.process(input, writer); return writer.toString(); } catch (IOException | TemplateException exception) { + log.debug("",exception); throw new CoreException( new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) .withId(SCHEMA_GENERATION_ERROR).withMessage(exception.getMessage()).build()); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/candidateheat/AnalyzedZipHeatFiles.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/candidateheat/AnalyzedZipHeatFiles.java index 5e04a1683c..3d652607ce 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/candidateheat/AnalyzedZipHeatFiles.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/candidateheat/AnalyzedZipHeatFiles.java @@ -24,7 +24,6 @@ import org.apache.commons.collections4.CollectionUtils; import java.util.Collection; import java.util.HashSet; -import java.util.Objects; import java.util.Set; /** diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductCreationFailedBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductCreationFailedBuilder.java index 45989ddbf0..6ca694364e 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductCreationFailedBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductCreationFailedBuilder.java @@ -3,9 +3,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao.errors; import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; -import org.openecomp.sdc.versioning.dao.types.Version; - -import java.text.MessageFormat; public class VendorSoftwareProductCreationFailedBuilder { private static final String VSP_CREATION_FAILED = "Failed to create VSP; %s"; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java index b46486eb32..aa611c0bd2 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java @@ -13,8 +13,6 @@ import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; import org.openecomp.sdc.versioning.VersioningManagerFactory; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.types.UniqueValueMetadata; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoFactoryImpl.java index e4f13b3ee1..7f3ae7531a 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoFactoryImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoFactoryImpl.java @@ -3,7 +3,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao.impl; import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ImageDaoZusammenImpl; public class ImageDaoFactoryImpl extends ImageDaoFactory { diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java index 37917284e0..0b29fdab27 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java @@ -29,7 +29,6 @@ import com.datastax.driver.mapping.annotations.Query; import org.openecomp.core.dao.impl.CassandraBaseDao; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java index 96bb16ca70..0a80b2ae51 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao.impl; -import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/NetworkDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/NetworkDaoZusammenImpl.java index 898ee434e8..b22c9f32ed 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/NetworkDaoZusammenImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/NetworkDaoZusammenImpl.java @@ -14,7 +14,6 @@ import org.openecomp.core.zusammen.api.ZusammenUtil; import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.dao.types.VersionStatus; import java.io.ByteArrayInputStream; import java.util.Collection; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateCandidateDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateCandidateDaoZusammenImpl.java index c101955292..ea51b770bf 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateCandidateDaoZusammenImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateCandidateDaoZusammenImpl.java @@ -16,7 +16,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidat import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData; import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.dao.types.VersionStatus; import java.io.ByteArrayInputStream; import java.nio.ByteBuffer; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java index 7ad7929ccb..517a01e58d 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java @@ -1,6 +1,5 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen; -import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo; import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement; import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; @@ -22,7 +21,6 @@ import org.openecomp.sdc.versioning.types.VersionableEntityStoreType; import java.io.ByteArrayInputStream; import java.util.Collection; import java.util.Date; -import java.util.Optional; import java.util.stream.Collectors; public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareProductInfoDao { diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VspZusammenUtil.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VspZusammenUtil.java index dde3603896..5e80d4c355 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VspZusammenUtil.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VspZusammenUtil.java @@ -51,8 +51,10 @@ class VspZusammenUtil { if (Objects.isNull(head)) { head = father = element; } else { - father.getSubElements().add(element); - father = element; + if (father != null) { + father.getSubElements().add(element); + father = element; + } } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/QuestionnaireDataServiceFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/QuestionnaireDataServiceFactoryImpl.java index 5c569dbf08..865c7f1189 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/QuestionnaireDataServiceFactoryImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/QuestionnaireDataServiceFactoryImpl.java @@ -21,7 +21,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.factory; -import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactGenerator; import org.openecomp.sdc.vendorsoftwareproduct.questionnaire.QuestionnaireDataService; import org.openecomp.sdc.vendorsoftwareproduct.quiestionnaire.QuestionnaireDataServiceImpl; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/impl/CompositionEntityDataManagerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/impl/CompositionEntityDataManagerFactoryImpl.java index 393325d437..a7e55bd290 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/impl/CompositionEntityDataManagerFactoryImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/factory/impl/CompositionEntityDataManagerFactoryImpl.java @@ -21,15 +21,11 @@ package org.openecomp.sdc.vendorsoftwareproduct.factory.impl; 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.ImageDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/quiestionnaire/QuestionnaireDataServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/quiestionnaire/QuestionnaireDataServiceImpl.java index 76d8210ca5..de29d5b8f0 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/quiestionnaire/QuestionnaireDataServiceImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/quiestionnaire/QuestionnaireDataServiceImpl.java @@ -22,13 +22,16 @@ package org.openecomp.sdc.vendorsoftwareproduct.quiestionnaire; import org.openecomp.core.utilities.json.JsonUtil; -import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.*; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity; import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactData; import org.openecomp.sdc.vendorsoftwareproduct.questionnaire.QuestionnaireDataService; import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.ComponentQuestionnaire; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java index 1499bccec2..100425858f 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java @@ -9,6 +9,8 @@ import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel; import org.openecomp.sdc.generator.datatypes.tosca.LicenseFlavor; import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage; import org.openecomp.sdc.generator.datatypes.tosca.VendorInfo; +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; @@ -71,6 +73,8 @@ public class ManualVspDataCollectionService { private static final VendorLicenseFacade vendorLicenseFacade = VendorLicenseFacadeFactory.getInstance().createInterface(); + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + /** * Gets vendor name for the vsp. @@ -312,26 +316,28 @@ public class ManualVspDataCollectionService { computeQuestionnaire = computeDao.getQuestionnaireData(vspId, version, componentId, computeFlavorId); } catch (Exception ex) { + log.debug("",ex); computeQuestionnaire = null; MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), "Failed to get compute questionnaire : " + ex.getMessage()); } - if (Objects.nonNull(computeQuestionnaire)) { + if (computeQuestionnaire != null && Objects.nonNull(computeQuestionnaire)) { String computeQuestionnaireData = computeQuestionnaire.getQuestionnaireData(); if (Objects.nonNull(computeQuestionnaireData)) { Compute compute; try { compute = JsonUtil.json2Object(computeQuestionnaireData, Compute.class); } catch (Exception ex) { + log.debug("",ex); compute = null; MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to parse compute questionnaire : " + ex.getMessage()); } - if (Objects.nonNull(compute.getVmSizing())) { + if (compute != null && Objects.nonNull(compute.getVmSizing())) { computeFlavor = new ComputeFlavor(); if (Objects.nonNull(compute.getVmSizing().getNumOfCPUs())) { computeFlavor.setNum_cpus(compute.getVmSizing().getNumOfCPUs()); @@ -392,13 +398,14 @@ public class ManualVspDataCollectionService { imageDetails = JsonUtil.json2Object(imageQuestionnaireDataEntity .getQuestionnaireData(), ImageDetails.class); } catch (Exception ex) { + log.debug("",ex); imageDetails = null; MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to parse image questionnaire : " + ex.getMessage()); } - if (Objects.nonNull(imageDetails) + if (imageDetails != null && Objects.nonNull(imageDetails) && Objects.nonNull(imageDetails.getVersion())) { //Image version is used as a key for the image block //So excluding the population if questionnaire data is absent or invalid diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java index a16fea19ab..93b95240d1 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java @@ -391,6 +391,7 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor { try { value= (String) inputEntry.getValue().get_default(); } catch (Exception e) { + logger.debug(e.getMessage(), e); value = inputEntry.getValue().get_default().toString(); } return value; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java index fffcc47932..39534cf9b7 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java @@ -273,7 +273,7 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa return true; } - result = result || isThereErrorsInSubTree(subEntity); + result = isThereErrorsInSubTree(subEntity) || result; if (result) { return true; } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/filedatastructuremodule/CandidateServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/filedatastructuremodule/CandidateServiceImpl.java index e5f1a4c3ac..c18a0cbedd 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/filedatastructuremodule/CandidateServiceImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/filedatastructuremodule/CandidateServiceImpl.java @@ -107,6 +107,7 @@ public class CandidateServiceImpl implements CandidateService { Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage())); } } catch (IOException e) { + logger.debug(e.getMessage(), e); mdcDataDebugMessage.debugExitMessage(null); return Optional.of(new ErrorMessage(ErrorLevel.ERROR, Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage())); @@ -141,12 +142,16 @@ public class CandidateServiceImpl implements CandidateService { (SdcCommon.MANIFEST_NAME)); List<String> structureArtifacts = structure.getArtifacts(); structureArtifacts.addAll(fileDataStructureFromManifest.getArtifacts().stream().filter - (artifact -> !structureArtifacts.contains(artifact)).collect((Collectors.toList()))); + (artifact -> isNotStrctureArtifact(structureArtifacts, artifact)).collect((Collectors.toList()))); handleArtifactsFromTree(tree, structure); return JsonUtil.object2Json(structure); } + private boolean isNotStrctureArtifact(List<String> structureArtifacts, String artifact) { + return !structureArtifacts.contains(artifact); + } + @Override public OrchestrationTemplateCandidateData createCandidateDataEntity( CandidateDataEntityTo candidateDataEntityTo, InputStream zipFileManifest, diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java index fe42f6ccd3..39c14e64fd 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java @@ -122,12 +122,15 @@ public class ServiceModelDaoFactoryTest { Assert.assertTrue(model instanceof ToscaServiceModel); if (model instanceof ToscaServiceModel) { - artifact001 = - (String) ((ToscaServiceModel) model).getArtifactFiles().getFileList().toArray()[0]; + setArtifact((ToscaServiceModel) model); } } - + private static void setArtifact(ToscaServiceModel model) + { + artifact001 = + (String) (model).getArtifactFiles().getFileList().toArray()[0]; + } private ToscaServiceModel getToscaServiceModel() { Map<String, ServiceTemplate> serviceTemplates = getServiceTemplates(baseServiceTemplateName); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java index ab36e8e5a1..9f2f733a64 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationArtifact/impl/TxtInformationArtifactGeneratorImplTest.java @@ -21,6 +21,11 @@ package org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.impl; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.anyString; +import static org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.impl.TxtInformationArtifactConstants.HEADER; +import static org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.impl.TxtInformationArtifactConstants.VFC_COMPUTE_CPU_OVER_SUBSCRIPTION; + import org.junit.Assert; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -36,8 +41,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.com import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.general.Hypervisor; import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.general.Recovery; import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.network.NetworkCapacity; -import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.storage.Backup; -import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.storage.Storage; import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.nic.IpConfiguration; import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.nic.Network; import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.nic.NicQuestionnaire; @@ -50,16 +53,10 @@ import org.openecomp.sdc.versioning.dao.types.Version; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import javax.annotation.processing.SupportedAnnotationTypes; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.anyString; -import static org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.impl.TxtInformationArtifactConstants.HEADER; -import static org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.impl.TxtInformationArtifactConstants.VFC_COMPUTE_CPU_OVER_SUBSCRIPTION; - public class TxtInformationArtifactGeneratorImplTest { private static final String NETWORK_DESC = "\"network desc\""; diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java index f0f67cf064..62d7c81cae 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/dao/types/Version.java @@ -22,9 +22,12 @@ package org.openecomp.sdc.versioning.dao.types; import com.datastax.driver.mapping.annotations.Transient; import com.datastax.driver.mapping.annotations.UDT; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; @UDT(name = "version", keyspace = "dox") public class Version { + private static final Logger logger = LoggerFactory.getLogger(Version.class); public static final String VERSION_STRING_VIOLATION_MSG = "Version string must be in the format of: {integer}.{integer}"; @@ -59,6 +62,7 @@ public class Version { try { version = new Version(Integer.parseInt(versionLevels[0]), Integer.parseInt(versionLevels[1])); } catch (Exception ex) { + logger.debug(ex.getMessage(), ex); throw new IllegalArgumentException(VERSION_STRING_VIOLATION_MSG); } diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java index d4bccc677b..d35de4f3d1 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java @@ -21,6 +21,10 @@ package org.openecomp.sdc.versioning.impl; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.verify; + import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.InjectMocks; @@ -29,7 +33,6 @@ import org.mockito.MockitoAnnotations; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.versioning.dao.VersionInfoDao; import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao; -import org.openecomp.sdc.versioning.dao.VersionableEntityDao; import org.openecomp.sdc.versioning.dao.types.UserCandidateVersion; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity; @@ -43,13 +46,8 @@ import org.testng.annotations.Test; import java.util.Collections; import java.util.HashSet; -import java.util.Map; import java.util.Set; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.verify; - public class VersioningManagerImplTest { private static final String USR1 = "usr1"; private static final String USR2 = "usr2"; diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml index 39f02becf8..fe3375a174 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml @@ -22,7 +22,7 @@ <dependency> <groupId>org.openecomp.sdc.jtosca</groupId> <artifactId>jtosca</artifactId> - <version>1.1.1-SNAPSHOT</version> + <version>${jtosca.version}</version> </dependency> <dependency> <groupId>org.openecomp.sdc</groupId> @@ -47,5 +47,5 @@ <artifactId>openecomp-tosca-converter-core</artifactId> <version>1.1.0-SNAPSHOT</version> - + </project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaArtifactType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaArtifactType.java index 9e353a25df..fd382b7899 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaArtifactType.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaArtifactType.java @@ -29,9 +29,9 @@ public class ToscaArtifactType { private static Configuration config = ConfigurationManager.lookup(); - public static String ARTIFACT_TYPE_PREFIX = + public static final String ARTIFACT_TYPE_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_ARTIFACT_TYPE); - public static String NATIVE_DEPLOYMENT = "tosca.artifacts.Deployment"; + public static final String NATIVE_DEPLOYMENT = "tosca.artifacts.Deployment"; } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaCapabilityType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaCapabilityType.java index b3a0e69c88..33dd9e142c 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaCapabilityType.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaCapabilityType.java @@ -29,26 +29,26 @@ public class ToscaCapabilityType { private static Configuration config = ConfigurationManager.lookup(); - public static String CAPABILITY_PREFIX = + public static final String CAPABILITY_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_CAPABILITY_TYPE); //TOSCA native types - public static String NATIVE_ROOT = "tosca.capabilities.Root"; - public static String NATIVE_NODE = "tosca.capabilities.Node"; - public static String NATIVE_CONTAINER = "tosca.capabilities.Container"; - public static String NATIVE_COMPUTE = "tosca.capabilities.Compute"; - public static String NATIVE_NETWORK_BINDABLE = "tosca.capabilities.network.Bindable"; - public static String NATIVE_SCALABLE = "tosca.capabilities.Scalable"; - public static String NATIVE_OPERATING_SYSTEM = "tosca.capabilities.OperatingSystem"; - public static String NATIVE_ENDPOINT_ADMIN = "tosca.capabilities.Endpoint.Admin"; - public static String NATIVE_ATTACHMENT = "tosca.capabilities.Attachment"; - public static String NATIVE_NETWORK_LINKABLE = "tosca.capabilities.network.Linkable"; - public static String NATIVE_NFV_METRIC = "tosca.capabilities.nfv.Metric"; + public static final String NATIVE_ROOT = "tosca.capabilities.Root"; + public static final String NATIVE_NODE = "tosca.capabilities.Node"; + public static final String NATIVE_CONTAINER = "tosca.capabilities.Container"; + public static final String NATIVE_COMPUTE = "tosca.capabilities.Compute"; + public static final String NATIVE_NETWORK_BINDABLE = "tosca.capabilities.network.Bindable"; + public static final String NATIVE_SCALABLE = "tosca.capabilities.Scalable"; + public static final String NATIVE_OPERATING_SYSTEM = "tosca.capabilities.OperatingSystem"; + public static final String NATIVE_ENDPOINT_ADMIN = "tosca.capabilities.Endpoint.Admin"; + public static final String NATIVE_ATTACHMENT = "tosca.capabilities.Attachment"; + public static final String NATIVE_NETWORK_LINKABLE = "tosca.capabilities.network.Linkable"; + public static final String NATIVE_NFV_METRIC = "tosca.capabilities.nfv.Metric"; //Additional types - public static String METRIC = CAPABILITY_PREFIX + "Metric"; - public static String METRIC_CEILOMETER = CAPABILITY_PREFIX + "metric.Ceilometer"; - public static String METRIC_SNMP_TRAP = CAPABILITY_PREFIX + "metric.SnmpTrap"; - public static String METRIC_SNMP_POLLING = CAPABILITY_PREFIX + "metric.SnmpPolling"; + public static final String METRIC = CAPABILITY_PREFIX + "Metric"; + public static final String METRIC_CEILOMETER = CAPABILITY_PREFIX + "metric.Ceilometer"; + public static final String METRIC_SNMP_TRAP = CAPABILITY_PREFIX + "metric.SnmpTrap"; + public static final String METRIC_SNMP_POLLING = CAPABILITY_PREFIX + "metric.SnmpPolling"; } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaDataType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaDataType.java index 37d1d2c4ba..3d5453ac0d 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaDataType.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaDataType.java @@ -29,75 +29,75 @@ public class ToscaDataType { private static Configuration config = ConfigurationManager.lookup(); - public static String DATA_TYPE_PREFIX = + public static final String DATA_TYPE_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_DATA_TYPE); //TOSCA native types - public static String NATIVE_ROOT = "tosca.datatypes.Root"; - public static String NATIVE_NETWORK_NETWORK_INFO = "tosca.datatypes.network.NetworkInfo"; - public static String NATIVE_NETWORK_PORT_INFO = "tosca.datatypes.network.PortInfo"; + public static final String NATIVE_ROOT = "tosca.datatypes.Root"; + public static final String NATIVE_NETWORK_NETWORK_INFO = "tosca.datatypes.network.NetworkInfo"; + public static final String NATIVE_NETWORK_PORT_INFO = "tosca.datatypes.network.PortInfo"; //Additional types - public static String NOVA_SERVER_PORT_EXTRA_PROPERTIES = + public static final String NOVA_SERVER_PORT_EXTRA_PROPERTIES = DATA_TYPE_PREFIX + "heat.novaServer.network.PortExtraProperties"; - public static String NETWORK_ADDRESS_PAIR = DATA_TYPE_PREFIX + "heat.network.AddressPair"; - public static String NEUTRON_PORT_FIXED_IPS = DATA_TYPE_PREFIX + "heat.neutron.port.FixedIps"; - public static String CONTRAIL_NETWORK_RULE = DATA_TYPE_PREFIX + "heat.contrail.network.rule.Rule"; - public static String CONTRAIL_NETWORK_RULE_LIST = + public static final String NETWORK_ADDRESS_PAIR = DATA_TYPE_PREFIX + "heat.network.AddressPair"; + public static final String NEUTRON_PORT_FIXED_IPS = DATA_TYPE_PREFIX + "heat.neutron.port.FixedIps"; + public static final String CONTRAIL_NETWORK_RULE = DATA_TYPE_PREFIX + "heat.contrail.network.rule.Rule"; + public static final String CONTRAIL_NETWORK_RULE_LIST = DATA_TYPE_PREFIX + "heat.contrail.network.rule.RuleList"; - public static String CONTRAIL_NETWORK_RULE_PORT_PAIRS = + public static final String CONTRAIL_NETWORK_RULE_PORT_PAIRS = DATA_TYPE_PREFIX + "heat.contrail.network.rule.PortPairs"; - public static String CONTRAIL_NETWORK_RULE_VIRTUAL_NETWORK = + public static final String CONTRAIL_NETWORK_RULE_VIRTUAL_NETWORK = DATA_TYPE_PREFIX + "heat.contrail.network.rule.VirtualNetwork"; - public static String CONTRAILV2_NETWORK_RULE = + public static final String CONTRAILV2_NETWORK_RULE = DATA_TYPE_PREFIX + "heat.contrailV2.network.rule.Rule"; - public static String CONTRAILV2_NETWORK_RULE_LIST = + public static final String CONTRAILV2_NETWORK_RULE_LIST = DATA_TYPE_PREFIX + "heat.contrailV2.network.rule.RuleList"; - public static String CONTRAILV2_NETWORK_RULE_SRC_PORT_PAIRS = + public static final String CONTRAILV2_NETWORK_RULE_SRC_PORT_PAIRS = DATA_TYPE_PREFIX + "heat.contrailV2.network.rule.SrcPortPairs"; - public static String CONTRAILV2_NETWORK_RULE_DST_PORT_PAIRS = + public static final String CONTRAILV2_NETWORK_RULE_DST_PORT_PAIRS = DATA_TYPE_PREFIX + "heat.contrailV2.network.rule.DstPortPairs"; - public static String CONTRAILV2_NETWORK_RULE_DST_VIRTUAL_NETWORK = + public static final String CONTRAILV2_NETWORK_RULE_DST_VIRTUAL_NETWORK = DATA_TYPE_PREFIX + "heat.contrailV2.network.rule.DstVirtualNetwork"; - public static String CONTRAILV2_NETWORK_RULE_SRC_VIRTUAL_NETWORK = + public static final String CONTRAILV2_NETWORK_RULE_SRC_VIRTUAL_NETWORK = DATA_TYPE_PREFIX + "heat.contrailV2.network.rule.SrcVirtualNetwork"; - public static String CONTRAILV2_VIRTUAL_MACHINE_INTERFACE_PROPERTIES = + public static final String CONTRAILV2_VIRTUAL_MACHINE_INTERFACE_PROPERTIES = DATA_TYPE_PREFIX + "heat.contrailV2.virtual.machine.interface.Properties"; - public static String CONTRAILV2_NETWORK_RULE_ACTION_LIST = + public static final String CONTRAILV2_NETWORK_RULE_ACTION_LIST = DATA_TYPE_PREFIX + "heat.contrailV2.network.rule.ActionList"; - public static String CONTRAILV2_VIRTUAL_NETWORK_IPAM_REF_DATA = + public static final String CONTRAILV2_VIRTUAL_NETWORK_IPAM_REF_DATA = DATA_TYPE_PREFIX + "heat.contrailV2.virtual.network.rule.IpamRefData"; - public static String CONTRAILV2_VIRTUAL_NETWORK_IPAM_REF_DATA_IPAM_SUBNET_LIST = + public static final String CONTRAILV2_VIRTUAL_NETWORK_IPAM_REF_DATA_IPAM_SUBNET_LIST = DATA_TYPE_PREFIX + "heat.contrailV2.virtual.network.rule.ref.data.IpamSubnetList"; - public static String CONTRAILV2_VIRTUAL_NETWORK_IPAM_REF_DATA_IPAM_SUBNET = + public static final String CONTRAILV2_VIRTUAL_NETWORK_IPAM_REF_DATA_IPAM_SUBNET = DATA_TYPE_PREFIX + "heat.contrailV2.virtual.network.rule.ref.data.IpamSubnet"; - public static String CONTRAILV2_VIRTUAL_NETWORK_POLICY_REF_DATA = + public static final String CONTRAILV2_VIRTUAL_NETWORK_POLICY_REF_DATA = DATA_TYPE_PREFIX + "heat.contrailV2.virtual.network.rule.RefData"; - public static String CONTRAILV2_VIRTUAL_NETWORK_POLICY_REF_DATA_SEQUENCE = + public static final String CONTRAILV2_VIRTUAL_NETWORK_POLICY_REF_DATA_SEQUENCE = DATA_TYPE_PREFIX + "heat.contrailV2.virtual.network.rule.RefDataSequence"; - public static String NOVA_SERVER_NETWORK_ADDRESS_INFO = + public static final String NOVA_SERVER_NETWORK_ADDRESS_INFO = DATA_TYPE_PREFIX + "heat.novaServer.network.AddressInfo"; - public static String NEUTRON_SUBNET = DATA_TYPE_PREFIX + "heat.network.neutron.Subnet"; - public static String NETWORK_ALLOCATION_POOL = DATA_TYPE_PREFIX + "heat.network.AllocationPool"; - public static String NETWORK_HOST_ROUTE = DATA_TYPE_PREFIX + "heat.network.subnet.HostRoute"; - public static String SUBSTITUTION_FILTERING = + public static final String NEUTRON_SUBNET = DATA_TYPE_PREFIX + "heat.network.neutron.Subnet"; + public static final String NETWORK_ALLOCATION_POOL = DATA_TYPE_PREFIX + "heat.network.AllocationPool"; + public static final String NETWORK_HOST_ROUTE = DATA_TYPE_PREFIX + "heat.network.subnet.HostRoute"; + public static final String SUBSTITUTION_FILTERING = DATA_TYPE_PREFIX + "heat.substitution.SubstitutionFiltering"; - public static String NEUTRON_SECURITY_RULES_RULE = + public static final String NEUTRON_SECURITY_RULES_RULE = DATA_TYPE_PREFIX + "heat.network.neutron.SecurityRules.Rule"; - public static String CONTRAIL_STATIC_ROUTE = + public static final String CONTRAIL_STATIC_ROUTE = DATA_TYPE_PREFIX + "heat.network.contrail.port.StaticRoute"; - public static String CONTRAIL_ADDRESS_PAIR = + public static final String CONTRAIL_ADDRESS_PAIR = DATA_TYPE_PREFIX + "heat.network.contrail.AddressPair"; - public static String CONTRAIL_INTERFACE_DATA = + public static final String CONTRAIL_INTERFACE_DATA = DATA_TYPE_PREFIX + "heat.network.contrail.InterfaceData"; - public static String CONTRAILV2_VIRTUAL_MACHINE_SUB_INTERFACE_PROPERTIES = + public static final String CONTRAILV2_VIRTUAL_MACHINE_SUB_INTERFACE_PROPERTIES = DATA_TYPE_PREFIX + "heat.contrailV2.virtual.machine.subInterface.Properties"; - public static String CONTRAILV2_VIRTUAL_MACHINE_SUB_INTERFACE_MAC_ADDRESS = + public static final String CONTRAILV2_VIRTUAL_MACHINE_SUB_INTERFACE_MAC_ADDRESS = DATA_TYPE_PREFIX + "heat.contrailV2.virtual.machine.subInterface.MacAddress"; - public static String CONTRAILV2_VIRTUAL_MACHINE_SUB_INTERFACE_ADDRESS_PAIRS = + public static final String CONTRAILV2_VIRTUAL_MACHINE_SUB_INTERFACE_ADDRESS_PAIRS = DATA_TYPE_PREFIX + "heat.contrailV2.virtual.machine.subInterface.AddressPairs"; - public static String CONTRAILV2_VIRTUAL_MACHINE_SUB_INTERFACE_ADDRESS_PAIR = + public static final String CONTRAILV2_VIRTUAL_MACHINE_SUB_INTERFACE_ADDRESS_PAIR = DATA_TYPE_PREFIX + "heat.contrailV2.virtual.machine.subInterface.AddressPair"; - public static String CONTRAILV2_VIRTUAL_MACHINE_SUB_INTERFACE_ADDRESS_PAIR_IP = + public static final String CONTRAILV2_VIRTUAL_MACHINE_SUB_INTERFACE_ADDRESS_PAIR_IP = DATA_TYPE_PREFIX + "heat.contrailV2.virtual.machine.subInterface.AddressPairIp"; } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaGroupType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaGroupType.java index c2070c34f4..a4a083b5c7 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaGroupType.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaGroupType.java @@ -28,14 +28,14 @@ public class ToscaGroupType { private static Configuration config = ConfigurationManager.lookup(); - public static String GROUP_TYPE_PREFIX = + public static final String GROUP_TYPE_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_GROUP_TYPE); //TOSCA native types - public static String NATIVE_ROOT = "tosca.groups.Root"; + public static final String NATIVE_ROOT = "tosca.groups.Root"; //Additional types - public static String HEAT_STACK = GROUP_TYPE_PREFIX + "heat.HeatStack"; + public static final String HEAT_STACK = GROUP_TYPE_PREFIX + "heat.HeatStack"; } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java index 745f77f7f5..d8e090261c 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java @@ -29,64 +29,64 @@ public class ToscaNodeType { private static Configuration config = ConfigurationManager.lookup(); - public static String VFC_NODE_TYPE_PREFIX = + public static final String VFC_NODE_TYPE_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_NODE_TYPE_VFC); - public static String CP_NODE_TYPE_PREFIX = + public static final String CP_NODE_TYPE_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_NODE_TYPE_CP); - public static String NETWORK_NODE_TYPE_PREFIX = + public static final String NETWORK_NODE_TYPE_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_NODE_TYPE_NETWORK); - public static String ABSTRACT_NODE_TYPE_PREFIX = + public static final String ABSTRACT_NODE_TYPE_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_NODE_TYPE_ABSTARCT); - public static String RULE_NODE_TYPE_PREFIX = + public static final String RULE_NODE_TYPE_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_NODE_TYPE_RULE); - public static String NODE_TYPE_PREFIX = + public static final String NODE_TYPE_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX); //TOSCA native types - public static String NATIVE_COMPUTE = "tosca.nodes.Compute"; - public static String NATIVE_ROOT = "tosca.nodes.Root"; - public static String NATIVE_BLOCK_STORAGE = "tosca.nodes.BlockStorage"; - public static String NATIVE_NETWORK = "tosca.nodes.network.Network"; - public static String NATIVE_NETWORK_PORT = "tosca.nodes.network.Port"; + public static final String NATIVE_COMPUTE = "tosca.nodes.Compute"; + public static final String NATIVE_ROOT = "tosca.nodes.Root"; + public static final String NATIVE_BLOCK_STORAGE = "tosca.nodes.BlockStorage"; + public static final String NATIVE_NETWORK = "tosca.nodes.network.Network"; + public static final String NATIVE_NETWORK_PORT = "tosca.nodes.network.Port"; //Additional types - public static String NOVA_SERVER = VFC_NODE_TYPE_PREFIX + "heat.nova.Server"; - public static String CINDER_VOLUME = VFC_NODE_TYPE_PREFIX + "heat.cinder.Volume"; - public static String COMPUTE = VFC_NODE_TYPE_PREFIX + "Compute"; - public static String CONTRAIL_COMPUTE = VFC_NODE_TYPE_PREFIX + "heat.contrail.Compute"; + public static final String NOVA_SERVER = VFC_NODE_TYPE_PREFIX + "heat.nova.Server"; + public static final String CINDER_VOLUME = VFC_NODE_TYPE_PREFIX + "heat.cinder.Volume"; + public static final String COMPUTE = VFC_NODE_TYPE_PREFIX + "Compute"; + public static final String CONTRAIL_COMPUTE = VFC_NODE_TYPE_PREFIX + "heat.contrail.Compute"; - public static String NEUTRON_SECURITY_RULES = + public static final String NEUTRON_SECURITY_RULES = RULE_NODE_TYPE_PREFIX + "heat.network.neutron.SecurityRules"; - public static String CONTRAILV2_NETWORK_RULE = + public static final String CONTRAILV2_NETWORK_RULE = RULE_NODE_TYPE_PREFIX + "heat.network.contrailV2.NetworkRules"; - public static String CONTRAIL_NETWORK_RULE = + public static final String CONTRAIL_NETWORK_RULE = RULE_NODE_TYPE_PREFIX + "heat.network.contrail.NetworkRules"; - public static String NEUTRON_NET = NETWORK_NODE_TYPE_PREFIX + "heat.network.neutron.Net"; - public static String CONTRAILV2_VIRTUAL_NETWORK = + public static final String NEUTRON_NET = NETWORK_NODE_TYPE_PREFIX + "heat.network.neutron.Net"; + public static final String CONTRAILV2_VIRTUAL_NETWORK = NETWORK_NODE_TYPE_PREFIX + "heat.network.contrailV2.VirtualNetwork"; - public static String CONTRAIL_VIRTUAL_NETWORK = + public static final String CONTRAIL_VIRTUAL_NETWORK = NETWORK_NODE_TYPE_PREFIX + "heat.network.contrail.VirtualNetwork"; - public static String NETWORK = NETWORK_NODE_TYPE_PREFIX + "network.Network"; + public static final String NETWORK = NETWORK_NODE_TYPE_PREFIX + "network.Network"; - public static String NEUTRON_PORT = CP_NODE_TYPE_PREFIX + "heat.network.neutron.Port"; - public static String CONTRAILV2_VIRTUAL_MACHINE_INTERFACE = + public static final String NEUTRON_PORT = CP_NODE_TYPE_PREFIX + "heat.network.neutron.Port"; + public static final String CONTRAILV2_VIRTUAL_MACHINE_INTERFACE = CP_NODE_TYPE_PREFIX + "heat.contrailV2.VirtualMachineInterface"; - public static String CONTRAIL_PORT = CP_NODE_TYPE_PREFIX + "heat.network.contrail.Port"; - public static String NETWORK_PORT = CP_NODE_TYPE_PREFIX + "network.Port"; - public static String NETWORK_SUB_INTERFACE = CP_NODE_TYPE_PREFIX + "network.SubInterface"; - public static String CONTRAILV2_VLAN_SUB_INTERFACE = CP_NODE_TYPE_PREFIX + public static final String CONTRAIL_PORT = CP_NODE_TYPE_PREFIX + "heat.network.contrail.Port"; + public static final String NETWORK_PORT = CP_NODE_TYPE_PREFIX + "network.Port"; + public static final String NETWORK_SUB_INTERFACE = CP_NODE_TYPE_PREFIX + "network.SubInterface"; + public static final String CONTRAILV2_VLAN_SUB_INTERFACE = CP_NODE_TYPE_PREFIX + "heat.network.contrailV2.VLANSubInterface"; - public static String ABSTRACT_SUBSTITUTE = ABSTRACT_NODE_TYPE_PREFIX + "AbstractSubstitute"; - public static String VFC_ABSTRACT_SUBSTITUTE = ABSTRACT_NODE_TYPE_PREFIX + "VFC"; - public static String CONTRAIL_ABSTRACT_SUBSTITUTE = + public static final String ABSTRACT_SUBSTITUTE = ABSTRACT_NODE_TYPE_PREFIX + "AbstractSubstitute"; + public static final String VFC_ABSTRACT_SUBSTITUTE = ABSTRACT_NODE_TYPE_PREFIX + "VFC"; + public static final String CONTRAIL_ABSTRACT_SUBSTITUTE = ABSTRACT_NODE_TYPE_PREFIX + "contrail.AbstractSubstitute"; - public static String COMPLEX_VFC_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "ComplexVFC"; + public static final String COMPLEX_VFC_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "ComplexVFC"; //Questionnaire to Tosca Types - public static String VNF_CONFIG_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "VnfConfiguration"; - public static String MULTIFLAVOR_VFC_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "MultiFlavorVFC"; - public static String MULTIDEPLOYMENTFLAVOR_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + public static final String VNF_CONFIG_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "VnfConfiguration"; + public static final String MULTIFLAVOR_VFC_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "MultiFlavorVFC"; + public static final String MULTIDEPLOYMENTFLAVOR_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "MultiDeploymentFlavor.CVFC"; } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaPolicyType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaPolicyType.java index ed0232929b..ad24e260b1 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaPolicyType.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaPolicyType.java @@ -28,13 +28,13 @@ public class ToscaPolicyType { private static Configuration config = ConfigurationManager.lookup(); - public static String POLICY_TYPE_PREFIX = + public static final String POLICY_TYPE_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_POLICY_TYPE); //TOSCA native types - public static String NATIVE_PLACEMENT = "tosca.policy.placement"; + public static final String NATIVE_PLACEMENT = "tosca.policy.placement"; //Additional types - public static String PLACEMENT_ANTILOCATE = POLICY_TYPE_PREFIX + "placement.Antilocate"; - public static String PLACEMENT_COLOCATE = POLICY_TYPE_PREFIX + "placement.Colocate"; + public static final String PLACEMENT_ANTILOCATE = POLICY_TYPE_PREFIX + "placement.Antilocate"; + public static final String PLACEMENT_COLOCATE = POLICY_TYPE_PREFIX + "placement.Colocate"; } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaRelationshipType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaRelationshipType.java index f1ef5ab234..0fcdc3a590 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaRelationshipType.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaRelationshipType.java @@ -28,16 +28,16 @@ public class ToscaRelationshipType { private static Configuration config = ConfigurationManager.lookup(); - public static String RELATIONSHIP_TYPE_PREFIX = + public static final String RELATIONSHIP_TYPE_PREFIX = config.getAsString(ConfigConstants.NAMESPACE, ConfigConstants.PREFIX_RELATIONSHIP_TYPE); - public static String NATIVE_ROOT = "tosca.relationships.Root"; - public static String NATIVE_ATTACHES_TO = "tosca.relationships.AttachesTo"; - public static String NATIVE_DEPENDS_ON = "tosca.relationships.DependsOn"; - public static String NATIVE_NETWORK_LINK_TO = "tosca.relationships.network.LinksTo"; - public static String NATIVE_NETWORK_BINDS_TO = "tosca.relationships.network.BindsTo"; - public static String CINDER_VOLUME_ATTACHES_TO = + public static final String NATIVE_ROOT = "tosca.relationships.Root"; + public static final String NATIVE_ATTACHES_TO = "tosca.relationships.AttachesTo"; + public static final String NATIVE_DEPENDS_ON = "tosca.relationships.DependsOn"; + public static final String NATIVE_NETWORK_LINK_TO = "tosca.relationships.network.LinksTo"; + public static final String NATIVE_NETWORK_BINDS_TO = "tosca.relationships.network.BindsTo"; + public static final String CINDER_VOLUME_ATTACHES_TO = RELATIONSHIP_TYPE_PREFIX + "VolumeAttachesTo"; - public static String ATTACHES_TO = RELATIONSHIP_TYPE_PREFIX + "AttachesTo"; + public static final String ATTACHES_TO = RELATIONSHIP_TYPE_PREFIX + "AttachesTo"; } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Old1610ServiceTemplate.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Old1610ServiceTemplate.java index 2ee7bca5bc..c4aa4ec6aa 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Old1610ServiceTemplate.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Old1610ServiceTemplate.java @@ -1,19 +1,5 @@ package org.openecomp.sdc.tosca.datatypes.model; -import org.openecomp.sdc.tosca.datatypes.model.ArtifactType; -import org.openecomp.sdc.tosca.datatypes.model.CapabilityType; -import org.openecomp.sdc.tosca.datatypes.model.DataType; -import org.openecomp.sdc.tosca.datatypes.model.GroupType; -import org.openecomp.sdc.tosca.datatypes.model.Import; -import org.openecomp.sdc.tosca.datatypes.model.InterfaceType; -import org.openecomp.sdc.tosca.datatypes.model.NodeType; -import org.openecomp.sdc.tosca.datatypes.model.PolicyType; -import org.openecomp.sdc.tosca.datatypes.model.RelationshipType; -import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; -import org.openecomp.sdc.tosca.datatypes.model.Template; -import org.openecomp.sdc.tosca.datatypes.model.TopologyTemplate; - -import java.util.List; import java.util.Map; /** diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java index df2459368e..0effd40519 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java @@ -25,6 +25,8 @@ import org.apache.commons.collections4.MapUtils; import org.openecomp.core.utilities.CommonMethods; 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; @@ -84,6 +86,7 @@ public class DataModelUtil { */ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private static final Logger logger = LoggerFactory.getLogger(DataModelUtil.class); /** * Add substitution mapping. @@ -1442,9 +1445,11 @@ public class DataModelUtil { ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream); clonedObjectValue = objectInputStream.readObject(); } catch (NotSerializableException ex) { - return getClonedObject(obj, obj.getClass()); + logger.debug(ex.getMessage(), ex); + return getClonedObject(obj, obj.getClass()); } catch (IOException | ClassNotFoundException ex) { - return null; + logger.debug(ex.getMessage(), ex); + return null; } return clonedObjectValue; } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java index 9a3ed8e73f..fb7010358b 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java @@ -25,6 +25,8 @@ import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.file.FileUtils; 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.MdcDataErrorMessage; import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; @@ -64,6 +66,7 @@ public class ToscaFileOutputServiceCsarImpl implements ToscaFileOutputService { private static final String META_FILE_DELIMITER = ":"; private static final String SPACE = " "; private static final String FILE_SEPARATOR = File.separator; + private static final Logger logger = LoggerFactory.getLogger(ToscaFileOutputServiceCsarImpl.class); @Override @@ -146,7 +149,7 @@ public class ToscaFileOutputServiceCsarImpl implements ToscaFileOutputService { try { zos.closeEntry(); } catch (IOException ignore) { - //do nothing + logger.debug(ignore.getMessage(), ignore); } } } @@ -169,7 +172,7 @@ public class ToscaFileOutputServiceCsarImpl implements ToscaFileOutputService { try { zos.closeEntry(); } catch (IOException ignore) { - //do nothing + logger.debug(ignore.getMessage(), ignore); } } } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/TestUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/TestUtil.java index 9a90d4539e..ca0c0ea506 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/TestUtil.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/TestUtil.java @@ -20,6 +20,8 @@ package org.openecomp.sdc.tosca; +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.ToscaExtensionYamlUtil; @@ -36,6 +38,8 @@ import java.util.Map; public class TestUtil { + private static final Logger logger = LoggerFactory.getLogger(TestUtil.class); + public static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath, String globalServiceTemplatesPath, String entryDefinitionServiceTemplate) @@ -84,6 +88,7 @@ public class TestUtil { try { yamlFile.close(); } catch (IOException ignore) { + logger.debug(ignore.getMessage(), ignore); } } catch (FileNotFoundException e) { throw e; diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java index e0f3e016fe..1711e41a65 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java @@ -70,7 +70,7 @@ public class MigrationMain { private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); private static int status = 0; - public static Map<String, VersionInfoEntity> versionInfoMap = new HashMap<>(); + private static Map<String, VersionInfoEntity> versionInfoMap = new HashMap<>(); public static void main(String[] args) { CassandraElementRepository cassandraElementRepository = new CassandraElementRepository(); @@ -116,8 +116,7 @@ public class MigrationMain { convertVsp(context, itemCassandraDao, versionCassandraDao, cassandraElementRepository); printMessage(logger, "Converted VSPs\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for VSPs ,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } @@ -125,9 +124,7 @@ public class MigrationMain { convertOrchestrationTemplateCandidate(context, cassandraElementRepository); printMessage(logger, "Converted OrchestrationTemplateCandidates\n"); } catch (Exception e) { - printMessage(logger, - "Could not perform migration for OrchestrationTemplateCandidates ,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } @@ -136,61 +133,49 @@ public class MigrationMain { convertComponent(context, cassandraElementRepository); printMessage(logger, "Converted Components\n"); } catch (Exception e) { - printMessage(logger, - "Could not perform migration for Components ,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertNic(context, cassandraElementRepository); printMessage(logger, "Converted Nics\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for Nics ,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertNetwork(context, cassandraElementRepository); printMessage(logger, "Converted Networks\n"); } catch (Exception e) { - printMessage(logger, - "Could not perform migration for Networks ,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertMibs(context, cassandraElementRepository); printMessage(logger, "Converted MIBs\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for MIBs,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertServiceArtifact(context, cassandraElementRepository); printMessage(logger, "Converted Service Artifacts\n"); } catch (Exception e) { - printMessage(logger, - "Could not perform migration for Service Artifacts,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertServiceTemplate(context, cassandraElementRepository); printMessage(logger, "Converted Service Templates\n"); } catch (Exception e) { - printMessage(logger, - "Could not perform migration for Service Templates,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertProcesses(context, cassandraElementRepository); printMessage(logger, "Converted Processes\n"); } catch (Exception e) { - printMessage(logger, - "Could not perform migration for Processes,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } @@ -199,40 +184,35 @@ public class MigrationMain { convertVlm(context, itemCassandraDao, versionCassandraDao, cassandraElementRepository); printMessage(logger, "Converted VLMs\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for VLMs,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertLKG(context, cassandraElementRepository); printMessage(logger, "Converted LKGs\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for LKGs,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertFeatureGroup(context, cassandraElementRepository); printMessage(logger, "Converted Feature Groups\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for Feature Groups,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertEP(context, cassandraElementRepository); printMessage(logger, "Converted EPs\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for EPs,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertLicenseAgreement(context, cassandraElementRepository); printMessage(logger, "Converted License Agreements\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for License Agreements,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } } @@ -482,5 +462,8 @@ public class MigrationMain { .getViewableVersions().contains(versionId)); } - + public static Map<String, VersionInfoEntity> getVersionInfoMap() + { + return versionInfoMap; + } } diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java index c6778544fd..e6ceb360bd 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java @@ -1,25 +1,17 @@ package org.openecomp.core.migration.convertors; import com.amdocs.zusammen.datatypes.item.ElementContext; -import com.amdocs.zusammen.datatypes.item.Info; -import com.amdocs.zusammen.datatypes.item.ItemVersionData; import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; import org.openecomp.core.migration.MigrationMain; -import org.openecomp.core.migration.loaders.VspInformation; import org.openecomp.core.migration.store.ElementHandler; 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.impl.zusammen.ElementPropertyName; -import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType; import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateDataEntity; -import java.util.HashSet; import java.util.List; -import java.util.Set; public class OrchestrationTemplateCandidateConvertor { diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java index 2e5fac830e..2e483747ed 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java @@ -5,9 +5,7 @@ import com.amdocs.zusammen.datatypes.item.Info; import com.amdocs.zusammen.datatypes.item.ItemVersionData; import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; -import org.openecomp.core.migration.loaders.VspInformation; import org.openecomp.core.migration.store.ElementHandler; -import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VendorLicenseModelDaoZusammenImpl; import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java index 76e35b56c4..15b8ad729a 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java @@ -7,11 +7,8 @@ import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; import org.openecomp.core.migration.store.ElementHandler; import org.openecomp.core.model.types.ServiceArtifact; import org.openecomp.core.utilities.file.FileUtils; -import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName; -import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType; import org.openecomp.sdc.model.impl.zusammen.StructureElement; - import java.util.HashSet; import java.util.List; import java.util.Set; diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java index b8c173843d..09da455847 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java @@ -25,7 +25,6 @@ import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateDataEntity; import java.util.Collection; diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java index bac4b6e440..26fc23cf5d 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java @@ -20,21 +20,14 @@ package org.openecomp.core.migration.loaders; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.UDTValue; import com.datastax.driver.mapping.Mapper; import com.datastax.driver.mapping.Result; import com.datastax.driver.mapping.UDTMapper; import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; -import org.openecomp.core.dao.impl.CassandraBaseDao; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; -import org.openecomp.sdc.versioning.VersioningManagerFactory; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; import java.util.Collection; diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java index 2a6efd22f3..725298b195 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java @@ -24,10 +24,8 @@ import com.datastax.driver.mapping.Mapper; import com.datastax.driver.mapping.Result; import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; -import org.openecomp.core.dao.impl.CassandraBaseDao; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; -import org.openecomp.sdc.versioning.dao.VersionInfoDao; import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity; import java.util.Collection; diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java index 34e7d79001..548a8d989b 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java @@ -104,7 +104,7 @@ public class ElementHandler { private static Id getVersionId(String itemId, Version versionId) { VersionInfoEntity versionInfo = - MigrationMain.versionInfoMap.get(itemId); + MigrationMain.getVersionInfoMap().get(itemId); if (versionInfo == null) { return new Id(versionId.toString()); } @@ -121,7 +121,7 @@ public class ElementHandler { private static boolean isActiveVersion(String itemId, Version versionId) { VersionInfoEntity versionInfo = - MigrationMain.versionInfoMap.get(itemId); + MigrationMain.getVersionInfoMap().get(itemId); return versionInfo != null && versionInfo.getActiveVersion().equals(versionId); } diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java index 97f5aaf265..801984ab24 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java @@ -94,7 +94,7 @@ public class ItemHandler { private static Id getVersionId(String itemId, Version versionId) { VersionInfoEntity versionInfo = - MigrationMain.versionInfoMap.get(itemId); + MigrationMain.getVersionInfoMap().get(itemId); if (versionInfo == null) { return new Id(versionId.toString()); } @@ -110,7 +110,7 @@ public class ItemHandler { } private static boolean isActiveVersion(String itemId, Version versionId) { VersionInfoEntity versionInfo = - MigrationMain.versionInfoMap.get(itemId); + MigrationMain.getVersionInfoMap().get(itemId); if (versionInfo == null) { return false; } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java index 685f70db98..487b4131e6 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java @@ -1,5 +1,7 @@ package org.openecomp.core.tools.Commands; +import static java.nio.file.Files.createDirectories; + import com.amdocs.zusammen.datatypes.SessionContext; import org.apache.commons.io.FileUtils; import org.openecomp.core.tools.Commands.exportdata.ElementHandler; @@ -18,12 +20,8 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; import java.util.HashSet; -import java.util.List; import java.util.Set; - -import static java.nio.file.Files.createDirectories; public class ExportDataCommand { private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class); @@ -45,7 +43,6 @@ public class ExportDataCommand { FileUtils.forceDelete(rootDir.toFile()); } catch (Exception ex) { logger.error(ex.getMessage(), ex); - ex.printStackTrace(); } } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java index 57486b81e3..cebff91160 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java @@ -24,19 +24,21 @@ public class ImportCommand { if (zippedFile == null){ logger.error("Import must have a valid file as an input."); } - zippedFile = zippedFile.replaceAll("\\r", ""); - if(filterItem != null) { - filterItem = filterItem.replaceAll("\\r", ""); + if (zippedFile != null) { + zippedFile = zippedFile.replaceAll("\\r", ""); + if (filterItem != null) { + filterItem = filterItem.replaceAll("\\r", ""); + } + Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY); + ExportDataCommand.initDir(rootDir); + ZipUtils.unzip(Paths.get(zippedFile), rootDir); + TreeWalker.walkFiles(context, rootDir, filterItem); + FileUtils.forceDelete(rootDir.toFile()); // clear all unzip data at the end. } - Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY); - ExportDataCommand.initDir(rootDir); - ZipUtils.unzip(Paths.get(zippedFile), rootDir); - TreeWalker.walkFiles(context, rootDir, filterItem); - FileUtils.forceDelete(rootDir.toFile()); // clear all unzip data at the end. + } catch (Exception ex) { logger.error(ex.getMessage(), ex); - ex.printStackTrace(); } } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java index 7058c57e85..031d1328b5 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java @@ -16,9 +16,9 @@ import java.util.*; public class ResetOldVersion { - public static Map<String, List<String>> itemVersionMap = new HashMap<>(); + private static Map<String, List<String>> itemVersionMap = new HashMap<>(); - public static int count =0; + private static int count =0; public static void reset(SessionContext context, String oldVersion,String emptyOldVersion) { diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java index 49eaaeaa76..e03b7ffa82 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java @@ -94,7 +94,6 @@ public class ElementHandler { } catch (Exception ex) { logger.error(ex.getMessage(), ex); - ex.printStackTrace(); } } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java index 710b731f8b..ebbfb56ed0 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java @@ -76,7 +76,6 @@ public class ItemHandler { write(itemFilePath, itemJson.getBytes()); } catch (Exception ex) { logger.error(ex.getMessage(), ex); - ex.printStackTrace(); } } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java index e8e703bff0..4ff562484c 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java @@ -51,7 +51,6 @@ public class VersionHandler { write(versionFilePath, versionJson.getBytes()); } catch (Exception ex) { logger.error(ex.getMessage(), ex); - ex.printStackTrace(); } } @@ -68,7 +67,6 @@ public class VersionHandler { } } catch (Exception ex) { logger.error(ex.getMessage(), ex); - ex.printStackTrace(); } } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java index d51458aff1..d439468e97 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java @@ -91,7 +91,6 @@ public class ElementImport { versionCassandraLoader.insertElementToVersion(elementEntity); } catch (Exception ex) { logger.error(ex.getMessage(), ex); - ex.printStackTrace(); } } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java index 9ec5d639c2..4dd4a1f2c8 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java @@ -25,7 +25,7 @@ public class ItemImport { return; } String itemJson = new String(Files.readAllBytes(itemPath)); - if (itemJson == null || itemJson.trim().isEmpty()) { + if (itemJson.trim().isEmpty()) { return; } Item item = JsonUtil.json2Object(itemJson, Item.class); @@ -35,7 +35,6 @@ public class ItemImport { System.out.println("Item Created :"+item.getInfo().getName()+" , "+item.getId()); } catch (Exception ex) { logger.error(ex.getMessage(), ex); - ex.printStackTrace(); } } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java index 15f8b02e2b..30c4152491 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java @@ -4,14 +4,10 @@ import com.amdocs.zusammen.datatypes.SessionContext; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import javax.validation.constraints.Min; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import java.util.stream.Stream; public class TreeWalker { diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java index 8f6c67d212..48433d8a90 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java @@ -26,7 +26,7 @@ public class VersionImport { return; } String versionJson = new String(Files.readAllBytes(versionPath)); - if (versionJson == null || versionJson.trim().isEmpty()) { + if (versionJson.trim().isEmpty()) { return; } VersionEntity versionEntity = JsonUtil.json2Object(versionJson, VersionEntity.class); diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java index 5da7407c9f..e9d4174d6c 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java @@ -26,7 +26,7 @@ public class VersionInfoImport { return; } String versionInfoJson = new String(Files.readAllBytes(versionInfoFilePath)); - if (versionInfoJson == null || versionInfoJson.trim().isEmpty()) { + if (versionInfoJson.trim().isEmpty()) { return; } VersionInfoEntity versionInfoEntity = JsonUtil.json2Object(versionInfoJson, VersionInfoEntity.class); diff --git a/openecomp-ui/src/nfvo-components/input/inputOptions/InputOptions.jsx b/openecomp-ui/src/nfvo-components/input/inputOptions/InputOptions.jsx deleted file mode 100644 index e8aadc4357..0000000000 --- a/openecomp-ui/src/nfvo-components/input/inputOptions/InputOptions.jsx +++ /dev/null @@ -1,246 +0,0 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -import React from 'react'; -import i18n from 'nfvo-utils/i18n/i18n.js'; -import classNames from 'classnames'; -import Select from 'nfvo-components/input/SelectInput.jsx'; - -export const other = {OTHER: 'Other'}; - -class InputOptions extends React.Component { - - static propTypes = { - values: React.PropTypes.arrayOf(React.PropTypes.shape({ - enum: React.PropTypes.string, - title: React.PropTypes.string - })), - isEnabledOther: React.PropTypes.bool, - label: React.PropTypes.string, - selectedValue: React.PropTypes.string, - multiSelectedEnum: React.PropTypes.oneOfType([ - React.PropTypes.string, - React.PropTypes.array - ]), - selectedEnum: React.PropTypes.string, - otherValue: React.PropTypes.string, - onEnumChange: React.PropTypes.func, - onOtherChange: React.PropTypes.func, - onBlur: React.PropTypes.func, - isRequired: React.PropTypes.bool, - isMultiSelect: React.PropTypes.bool, - hasError: React.PropTypes.bool, - disabled: React.PropTypes.bool - }; - - - static contextTypes = { - isReadOnlyMode: React.PropTypes.bool - }; - - state = { - otherInputDisabled: !this.props.otherValue - }; - - oldProps = { - selectedEnum: '', - otherValue: '', - multiSelectedEnum: [] - }; - - render() { - let {label, isRequired, values, otherValue, onOtherChange, isMultiSelect, onBlur, multiSelectedEnum, selectedEnum, hasError, validations, children} = this.props; - const dataTestId = this.props['data-test-id'] ? {'data-test-id': this.props['data-test-id']} : {}; - let currentMultiSelectedEnum = []; - let currentSelectedEnum = ''; - let {otherInputDisabled} = this.state; - if (isMultiSelect) { - currentMultiSelectedEnum = multiSelectedEnum; - if(!otherInputDisabled) { - currentSelectedEnum = multiSelectedEnum ? multiSelectedEnum.toString() : undefined; - } - } - else if(selectedEnum){ - currentSelectedEnum = selectedEnum; - } - if (!onBlur) { - onBlur = () => {}; - } - - let isReadOnlyMode = this.context.isReadOnlyMode; - - return( - <div className={classNames('form-group', {'required' : (validations && validations.required) || isRequired, 'has-error' : hasError})}> - {label && <label className='control-label'>{label}</label>} - {isMultiSelect && otherInputDisabled ? - <Select - {...dataTestId} - ref='_myInput' - value={currentMultiSelectedEnum} - className='options-input' - clearable={false} - required={isRequired} - disabled={isReadOnlyMode || Boolean(this.props.disabled)} - onBlur={() => onBlur()} - onMultiSelectChanged={value => this.multiSelectEnumChanged(value)} - options={this.renderMultiSelectOptions(values)} - multi/> : - <div className={classNames('input-options',{'has-error' : hasError})}> - <select - {...dataTestId} - ref={'_myInput'} - label={label} - className='form-control input-options-select' - value={currentSelectedEnum} - style={{'width' : otherInputDisabled ? '100%' : '100px'}} - onBlur={() => onBlur()} - disabled={isReadOnlyMode || Boolean(this.props.disabled)} - onChange={ value => this.enumChanged(value)} - type='select'> - {children || (values && values.length && values.map((val, index) => this.renderOptions(val, index)))} - {onOtherChange && <option key='other' value={other.OTHER}>{i18n(other.OTHER)}</option>} - </select> - - {!otherInputDisabled && <div className='input-options-separator'/>} - <input - className='form-control input-options-other' - placeholder={i18n('other')} - ref='_otherValue' - style={{'display' : otherInputDisabled ? 'none' : 'block'}} - disabled={isReadOnlyMode || Boolean(this.props.disabled)} - value={otherValue || ''} - onBlur={() => onBlur()} - onChange={() => this.changedOtherInput()}/> - </div> - } - </div> - ); - } - - renderOptions(val, index){ - return ( - <option key={index} value={val.enum}>{val.title}</option> - ); - } - - - renderMultiSelectOptions(values) { - let {onOtherChange} = this.props; - let optionsList = []; - if (onOtherChange) { - optionsList = values.map(option => { - return { - label: option.title, - value: option.enum, - }; - }).concat([{ - label: i18n(other.OTHER), - value: i18n(other.OTHER), - }]); - } - else { - optionsList = values.map(option => { - return { - label: option.title, - value: option.enum, - }; - }); - } - if (optionsList.length > 0 && optionsList[0].value === '') { - optionsList.shift(); - } - return optionsList; - } - - getValue() { - let res = ''; - let {isMultiSelect} = this.props; - let {otherInputDisabled} = this.state; - - if (otherInputDisabled) { - res = isMultiSelect ? this.refs._myInput.getValue() : this.refs._myInput.value; - } else { - res = this.refs._otherValue.value; - } - return res; - } - - enumChanged() { - let enumValue = this.refs._myInput.value; - let {onEnumChange, onOtherChange, isMultiSelect, onChange} = this.props; - this.setState({ - otherInputDisabled: !Boolean(onOtherChange) || enumValue !== other.OTHER - }); - - let value = isMultiSelect ? [enumValue] : enumValue; - if (onEnumChange) { - onEnumChange(value); - } - if (onChange) { - onChange(value); - } - } - - multiSelectEnumChanged(enumValue) { - let {onEnumChange, onOtherChange} = this.props; - let selectedValues = enumValue.map(enumVal => { - return enumVal.value; - }); - - if (this.state.otherInputDisabled === false) { - selectedValues.shift(); - } - else if (selectedValues.includes(i18n(other.OTHER))) { - selectedValues = [i18n(other.OTHER)]; - } - - this.setState({ - otherInputDisabled: !Boolean(onOtherChange) || !selectedValues.includes(i18n(other.OTHER)) - }); - onEnumChange(selectedValues); - } - - changedOtherInput() { - let {onOtherChange} = this.props; - onOtherChange(this.refs._otherValue.value); - } - - componentDidUpdate() { - let {otherValue, selectedEnum, onInputChange, multiSelectedEnum} = this.props; - if (this.oldProps.otherValue !== otherValue - || this.oldProps.selectedEnum !== selectedEnum - || this.oldProps.multiSelectedEnum !== multiSelectedEnum) { - this.oldProps = { - otherValue, - selectedEnum, - multiSelectedEnum - }; - onInputChange(); - } - } - - static getTitleByName(values, name) { - for (let key of Object.keys(values)) { - let option = values[key].find(option => option.enum === name); - if (option) { - return option.title; - } - } - return name; - } - -} - -export default InputOptions; diff --git a/openecomp-ui/src/nfvo-utils/Validator.js b/openecomp-ui/src/nfvo-utils/Validator.js index 1df82a2ada..3f6a00e289 100644 --- a/openecomp-ui/src/nfvo-utils/Validator.js +++ b/openecomp-ui/src/nfvo-utils/Validator.js @@ -46,7 +46,25 @@ class Validator { email: value => ValidatorJS.isEmail(value), ip: value => ValidatorJS.isIP(value), url: value => ValidatorJS.isURL(value), - alphanumericWithUnderscores: value => ValidatorJS.isAlphanumeric(value.replace(/_/g, '')) + alphanumericWithUnderscores: value => ValidatorJS.isAlphanumeric(value.replace(/_/g, '')), + requiredChoiceWithOther: (value, otherValue) => { + let chosen = value.choice; + // if we have an empty multiple select we have a problem since it's required + let validationFunc = this.globalValidationFunctions['required']; + if (value.choices) { + if (value.choices.length === 0) { + return false; + } else { + // continuing validation with the first chosen value in case we have the 'Other' field + chosen = value.choices[0]; + } + } + if (chosen !== otherValue) { + return validationFunc(chosen, true); + } else { // when 'Other' was chosen, validate other value + return validationFunc(value.other, true); + } + } }; } @@ -54,6 +72,7 @@ class Validator { return { required: () => i18n('Field is required'), requiredChooseOption: () => i18n('Field should have one of these options'), + requiredChoiceWithOther: () => i18n('Field is required'), maxLength: (value, maxLength) => i18n('Field value has exceeded it\'s limit, {maxLength}. current length: {length}', { length: value.length, maxLength diff --git a/openecomp-ui/src/sdc-app/common/reducers/PlainDataReducer.js b/openecomp-ui/src/sdc-app/common/reducers/PlainDataReducer.js index 2276984f7a..49f1e3d415 100644 --- a/openecomp-ui/src/sdc-app/common/reducers/PlainDataReducer.js +++ b/openecomp-ui/src/sdc-app/common/reducers/PlainDataReducer.js @@ -16,7 +16,7 @@ import {actionTypes} from './PlainDataReducerConstants.js'; import Validator from 'nfvo-utils/Validator.js'; import forOwn from 'lodash/forOwn.js'; -import {other as optionInputOther} from 'nfvo-components/input/inputOptions/InputOptions.jsx'; +import {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; function updateDataAndValidateReducer(state = {}, action) { let genericFieldInfoCopy; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js index 5be140550a..9cff2792ff 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js @@ -14,6 +14,7 @@ * permissions and limitations under the License. */ import {actionTypes, defaultState, LA_EDITOR_FORM, enums as LicenseAgreementEnums} from './LicenseAgreementConstants.js'; +import {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; export default (state = {}, action) => { switch (action.type) { @@ -38,7 +39,7 @@ export default (state = {}, action) => { 'licenseTerm' : { isValid: true, errorText: '', - validations: [{type: 'required', data: true}], + validations: [{type: 'required', data: true}, {type: 'requiredChoiceWithOther', data: optionInputOther.OTHER}], tabId: LicenseAgreementEnums.SELECTED_LICENSE_AGREEMENT_TAB.GENERAL }, 'name' : { diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx index a15e5daa4e..0b418686fd 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx @@ -21,9 +21,11 @@ import {TabsForm as Form} from 'nfvo-components/input/validation/Form.jsx'; import Tabs from 'nfvo-components/input/validation/Tabs.jsx'; import Tab from 'sdc-ui/lib/react/Tab.js'; import Input from 'nfvo-components/input/validation/Input.jsx'; +import InputOptions from 'nfvo-components/input/validation/InputOptions.jsx'; import DualListboxView from 'nfvo-components/input/dualListbox/DualListboxView.jsx'; import i18n from 'nfvo-utils/i18n/i18n.js'; import Validator from 'nfvo-utils/Validator.js'; +import {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; import {enums as LicenseAgreementEnums, optionsInputValues as LicenseAgreementOptionsInputValues, LA_EDITOR_FORM} from './LicenseAgreementConstants.js'; @@ -43,7 +45,7 @@ const LicenseAgreementPropType = React.PropTypes.shape({ }); -const GeneralTabContent = ({data, genericFieldInfo, onDataChanged, validateName, validateLTChoice}) => { +const GeneralTabContent = ({data, genericFieldInfo, onDataChanged, validateName}) => { let {name, description, requirementsAndConstrains, licenseTerm} = data; return ( <GridSection> @@ -67,24 +69,22 @@ const GeneralTabContent = ({data, genericFieldInfo, onDataChanged, validateName, data-test-id='create-la-requirements-constants' name='license-agreement-requirements-and-constraints' type='textarea'/> - <Input + <InputOptions + onInputChange={()=>{}} + isMultiSelect={false} + onEnumChange={licenseTerm => onDataChanged({licenseTerm:{choice: licenseTerm, other: ''}}, + LA_EDITOR_FORM)} + onOtherChange={licenseTerm => onDataChanged({licenseTerm:{choice: optionInputOther.OTHER, + other: licenseTerm}}, LA_EDITOR_FORM)} label={i18n('License Term')} - type='select' - value={licenseTerm && licenseTerm.choice} + data-test-id='create-la-license-term' isRequired={true} - onChange={e => { - const selectedIndex = e.target.selectedIndex; - const licenseTerm = e.target.options[selectedIndex].value; - onDataChanged({licenseTerm:{choice: licenseTerm, other: ''}}, LA_EDITOR_FORM, { licenseTerm: validateLTChoice }); - }} + type='select' + selectedEnum={licenseTerm && licenseTerm.choice} + otherValue={licenseTerm && licenseTerm.other} + values={LicenseAgreementOptionsInputValues.LICENSE_MODEL_TYPE} isValid={genericFieldInfo.licenseTerm.isValid} - errorText={genericFieldInfo.licenseTerm.errorText} - className='input-options-select' - groupClassName='bootstrap-input-options' - data-test-id='create-la-license-term' > - {LicenseAgreementOptionsInputValues.LICENSE_MODEL_TYPE.map(mtype => - <option key={mtype.enum} value={mtype.enum}>{`${mtype.title}`}</option>)} - </Input> + errorText={genericFieldInfo.licenseTerm.errorText} /> </GridItem> <GridItem colSpan={2} stretch> <Input @@ -151,7 +151,7 @@ class LicenseAgreementEditorView extends React.Component { data-test-id='general-tab' title={i18n('General')}> <fieldset disabled={isReadOnlyMode}> - <GeneralTabContent data={data} genericFieldInfo={genericFieldInfo} onDataChanged={onDataChanged} validateLTChoice={(value)=>this.validateLTChoice(value)} + <GeneralTabContent data={data} genericFieldInfo={genericFieldInfo} onDataChanged={onDataChanged} validateName={(value)=>this.validateName(value)}/> </fieldset> </Tab> @@ -181,12 +181,6 @@ class LicenseAgreementEditorView extends React.Component { this.props.onSubmit({licenseAgreement, previousLicenseAgreement}); } - validateLTChoice(value) { - if (!value.choice) { - return {isValid: false, errorText: i18n('Field is required')}; - } - return {isValid: true, errorText: ''}; - } validateName(value) { const {data: {id}, LANames} = this.props; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx index 5c4e50d673..d4b7e5c898 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx @@ -7,7 +7,7 @@ import GridItem from 'nfvo-components/grid/GridItem.jsx'; import {LIMITS_FORM_NAME, selectValues} from './LimitEditorConstants.js'; import Button from 'sdc-ui/lib/react/Button.js'; import Validator from 'nfvo-utils/Validator.js'; -import {other as optionInputOther} from 'nfvo-components/input/inputOptions/InputOptions.jsx'; +import {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; import InputOptions from 'nfvo-components/input/validation/InputOptions.jsx'; const LimitPropType = React.PropTypes.shape({ @@ -96,9 +96,9 @@ class LimitEditor extends React.Component { isMultiSelect={false} isRequired={true} onEnumChange={metric => onDataChanged({metric:{choice: metric, other: ''}}, - LIMITS_FORM_NAME, {metric: this.validateChoiceWithOther})} + LIMITS_FORM_NAME)} onOtherChange={metric => onDataChanged({metric:{choice: optionInputOther.OTHER, - other: metric}}, LIMITS_FORM_NAME, {metric: this.validateChoiceWithOther})} + other: metric}}, LIMITS_FORM_NAME)} label={i18n('Metric')} data-test-id='limit-editor-metric' type='select' @@ -196,23 +196,6 @@ class LimitEditor extends React.Component { {isValid: false, errorText: i18n('Limit by the name \'' + value + '\' already exists. Limit name must be unique')}; } - validateChoiceWithOther(value) { - let chosen = value.choice; - // if we have an empty multiple select we have a problem since it's required - if (value.choices) { - if (value.choices.length === 0) { - return Validator.validate('field', '', [{type: 'required', data: true}]); - } else { - // continuing validation with the first chosen value in case we have the 'Other' field - chosen = value.choices[0]; - } - } - if (chosen !== optionInputOther.OTHER) { - return Validator.validate('field', chosen, [{type: 'required', data: true}]); - } else { // when 'Other' was chosen, validate other value - return Validator.validate('field', value.other, [{type: 'required', data: true}]); - } - } submit() { if (!this.props.formReady) { diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorReducer.js index de9e7c8c38..99d94a09cc 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorReducer.js @@ -15,6 +15,7 @@ */ import {actionTypes, LIMITS_FORM_NAME, defaultState} from './LimitEditorConstants.js'; +import {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; export default (state = {}, action) => { switch (action.type) { @@ -38,7 +39,7 @@ export default (state = {}, action) => { 'metric' : { isValid: true, errorText: '', - validations: [] + validations: [{type: 'required', data: true}, {type: 'requiredChoiceWithOther', data: optionInputOther.OTHER}] }, 'value' : { isValid: true, @@ -398,6 +398,7 @@ <activeByDefault>false</activeByDefault> </activation> <modules> + <module>build-tools</module> <module>onboarding</module> </modules> </profile> |