Fixed blocker, critical, major & minor SONAR issues.
Issue-ID: SDC-343
Change-Id: I72e5a3a7fa7d7407a92f98f77e4334827f70f926
Signed-off-by: dd4616 <Divesh.Mirchandani@amdocs.com>
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;
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)
HttpServletRequest servletRequest) {
ListResponseWrapper responseList = null;
Map<String, String> errorMap = validateRequestHeaders(servletRequest);
- ;
Map<String, String> queryParamErrors = validateQueryParam(componentID);
errorMap.putAll(queryParamErrors);
if (errorMap.isEmpty()) {
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);
+ }
}
}
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);
}
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> {
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;
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)
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;
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")
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;
public class ActionAuthenticationFilter implements Filter {
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
private boolean runningOnLocal = true;
@Override
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;
}
.valueOf(username.substring(username.indexOf("-") + 1).toUpperCase());
return userPrivilege.ordinal() >= requiredPrivilege.ordinal();
} catch (Exception exception) {
+ log.debug("",exception);
return false;
}
}
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
* @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) {
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;
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")
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;
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;
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;
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)
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;
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> {
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;
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")
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;
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)
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;
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;
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 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;
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 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;
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;
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 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;
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;
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;
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)
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;
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;
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)
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> {
ComponentRelationType.valueOf(source.getRelationType());
target.setRelation(source.getRelationType());
} catch (IllegalArgumentException exception) {
+ logger.debug("",exception);
ErrorCode errorCode =
ComponentDependencyModelErrorBuilder.getInvalidRelationTypeErrorBuilder();
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
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));
}
}
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;
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,
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;
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;
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")
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;
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;
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;
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;
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")
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;
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;
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")
package org.openecomp.sdcrests.vendorsoftwareproducts.types;
-import org.hibernate.validator.constraints.NotBlank;
-
public class ComponentDependencyModel {
private String sourceId;
import org.hibernate.validator.constraints.NotBlank;
-import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
public class ComputeDetailsDto implements CompositionDataEntityDto {
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 {
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")
import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.ValidateString;
import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
public class NicRequestDto {
package org.openecomp.sdcrests.vendorsoftwareproducts.types;
-import java.util.List;
import java.util.Set;
public class QuestionnaireValidationResultDto {
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("");
}
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;
}
}
}
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;
* 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 =
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(),
}
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(": "));
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;
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;
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;
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";
}
@BeforeMethod
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
}
vendorLicenseManagerImpl.updateLimit(limitEntity2,USER1);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(),
VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND);
}
return ep;
}
*/
-}
\ No newline at end of file
+}
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;
}
@BeforeMethod
- public void setUp() throws Exception{
+ public void setUp() {
MockitoAnnotations.initMocks(this);
}
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.*;
}
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(": "));
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;
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;
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;
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;
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;
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 {
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;
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,
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(),
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;
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);
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(),
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 : "
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 : "
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 : "
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 : "
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;
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");
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");
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;
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;
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");
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");
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";
try {
validateUniqueName(VALIDATION_VSP_NAME);
} catch (Exception ignored) {
+ logger.debug("",ignored);
return VALIDATION_VSP_ID;
}
VspDetails validationVsp = new VspDetails();
vsps.add(new VersionedVendorSoftwareProductInfo(vsp, versionInfo));
}
} catch (RuntimeException rte) {
+ logger.debug("",rte);
logger.error(
"Error trying to retrieve vsp[" + entry.getKey() + "] version[" + version.toString
() + "] " +
createPackage(vspId, finalVersion, user);
return finalVersion;
} catch (IOException ex) {
+ logger.debug("",ex);
throw new Exception(ex.getMessage());
}
default:
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;
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 {
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
-import java.util.List;
import java.util.Set;
public class QuestionnaireValidationResult {
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;
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;
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;
ComponentDependencyModelErrorBuilder.getNoSourceComponentErrorBuilder().id(),
ComponentDependencyModelErrorBuilder.getNoSourceComponentErrorBuilder().message());
- entities.removeAll(entities);
+ entities.clear();
entities.add(createModelEntity("", sourceComp2Id));
testCreate_negative(entities, vsp1Id, VERSION01, USER1,
ComponentDependencyModelErrorBuilder.getNoSourceComponentErrorBuilder().id(),
user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
}
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;
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";
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());
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,
componentManager.createComponent(component, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
componentManager.getComponent(vspId, version, componentId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
.updateComponent(new ComponentEntity(vspId, version, componentId), user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
componentManager.listComponents(vspId, version, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
componentManager.deleteComponents(vspId, version, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
componentManager.deleteComponent(vspId, version, componentId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
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;
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";
Assert.fail();
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.DUPLICATE_COMPUTE_NAME_NOT_ALLOWED,
ex.code().id());
}
computeManager.updateCompute(computeEntity, USER);
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.UPDATE_COMPUTE_NOT_ALLOWED);
}
computeManager.deleteCompute(vspId, version, componentId, computeId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
computeManager.getCompute(vspId, version, componentId, computeId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
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);
}
computeManager.updateCompute(new ComputeEntity(vspId, version, componentId, computeId), user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
computeManager.createCompute(computeEntity1, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
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;
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);
Assert.fail();
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED,
ex.code().id());
}
Assert.fail();
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.FEATURE_GROUP_NOT_EXIST_FOR_VSP,
ex.code().id());
}
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",
deploymentFlavorManager.createDeploymentFlavor(expected, USER);
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.INVALID_COMPUTE_FLAVOR_ID,
ex.code().id());
}
deploymentFlavorManager.createDeploymentFlavor(expected, USER);
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED,
ex.code().id());
}
deploymentFlavorManager.listDeploymentFlavors(vspId, version, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
}
deploymentFlavorManager.createDeploymentFlavor(deploymentFlavorEntity, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
deploymentFlavorManager.deleteDeploymentFlavor(vspId, version, deploymentFlavorId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
.updateDeploymentFlavor(deploymentFlavorEntity, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
deploymentFlavorManager.getDeploymentFlavor(vspId, version, deploymentFlavorId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
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;
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" +
" " +
imageManager.updateImage(imageEntity, USER);
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED);
}
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);
}
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);
}
Assert.fail();
}
catch(CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED);
}
}
Assert.fail();
}
catch(CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.VFC_IMAGE_INVALID_FORMAT);
}
}
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);
}
imageManager.createImage(image, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
imageManager.deleteImage(vspId, version, componentId, nicId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
imageManager.updateImage(new ImageEntity(vspId, version, componentId, imageId), user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
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;
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);
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);
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);
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)) {
}
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));
}
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;
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";
MonitoringUploadType.VES_EVENTS, USER1);
Assert.fail();
} catch (Exception exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.getMessage(), "Invalid zip file");
}
}
MonitoringUploadType.SNMP_TRAP, USER1);
Assert.fail();
} catch (Exception exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.getMessage(), "Zip file should not contain folders");
}
}
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)");
try {
return url.openStream();
} catch (IOException exception) {
- exception.printStackTrace();
+ log.debug("",exception);
return null;
}
}
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;
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";
networkManager.createNetwork(network, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
networkManager.getNetwork(vspId, version, networkId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
networkManager.updateNetwork(new NetworkEntity(vspId, version, networkId), user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
networkManager.listNetworks(vspId, version, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
networkManager.deleteNetwork(vspId, version, networkId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
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;
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";
try {
NicEntity created = nicManager.createNic(nicEntity,USER);
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED,
exception.code().id());
}
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());
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,
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
Assert.fail();
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED,
ex.code().id());
}
nicManager.createNic(nic, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
nicManager.getNic(vspId, version, componentId, nicId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
nicManager.updateNic(new NicEntity(vspId, version, componentId, nicId), user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
nicManager.deleteNic(vspId, version, componentId, nicId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
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;
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";
processManager.getProcess(vspId, version, componentId, processId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
.updateProcess(new ProcessEntity(vspId, version, componentId, processId), user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
processManager.getProcessArtifact(vspId, version, componentId, processId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
vspId, version, componentId, processId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.error("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
processManager.deleteProcessArtifact(vspId, VERSION, componentId, processId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
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;
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";
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());
}
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;
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;
*/
public class CompositionDataExtractorImplTest {
+
+ private static final Logger log = (Logger) LoggerFactory.getLogger
+ (CompositionDataExtractorImplTest.class.getName());
+
@InjectMocks
private static CompositionDataExtractorImpl compositionDataExtractor;
try {
yamlFile.close();
} catch (IOException ignore) {
+ log.debug("",ignore);
}
} catch (FileNotFoundException exception) {
throw exception;
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;
*/
public class TreeBaseTest {
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
String INPUT_DIR;
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;
+
}
}
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;
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;
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;
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,
zos.write(data);
zos.closeEntry();
} catch (IOException exception) {
- exception.printStackTrace();
+ log.debug("",exception);
}
}
}
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;
* @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());
try {
zos.close();
} catch (IOException exception) {
- exception.printStackTrace();
+ log.debug("",exception);
}
return new ByteArrayInputStream(baos.toByteArray());
}
public class CoreException extends RuntimeException {
- private ErrorCode errorCode;
+ private final ErrorCode errorCode;
public CoreException(ErrorCode errorCode) {
this(errorCode, null);
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;
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 {
applicationConfigDao.create(applicationConfigEntity3);
} catch (Exception e) {
+ log.debug("",e);
throw new CoreException(new ErrorCode.ErrorCodeBuilder().
withCategory(ErrorCategory.APPLICATION).
withId(SCHEMA_GENERATOR_INITIALIZATION_ERROR).
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");
}
INSTANCE = CommonMethods.newInstance(
"org.openecomp.core.factory.FactoriesConfigImpl", FactoriesConfiguration.class);
} catch (Exception exception) {
- exception.printStackTrace();
throw exception;
}
}
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;
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;
.collect(Collectors.toSet());
return versions.stream().collect(Collectors.joining(","));
} catch (Exception e){
+ log.debug("",e);
return "Failed to retrieve version";
}
}
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;
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;
}
ctx.init(null, tmf.getTrustManagers(), new SecureRandom());
} catch (Exception exception) {
- exception.printStackTrace();
+ log.debug("",exception);
} finally {
if (tsf != null) {
tsf.close();
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;
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();
try {
is = new FileInputStream(file);
} catch (FileNotFoundException exception) {
- exception.printStackTrace();
+ log.debug("",exception);
}
return is;
}
public class NoSqlDbTest {
- private static NoSqlDb noSqlDb;
+ private NoSqlDb noSqlDb;
/*
@Test
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;
*/
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.
*
try {
is.close();
} catch (IOException ignore) {
+ logger.debug("",ignore);
//do nothing
}
}
try {
return new JsonParser().parse(json).isJsonObject();
} catch (JsonSyntaxException jse) {
+ logger.debug("",jse);
return false;
}
}
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;
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;
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);
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;
private static CompositionEntityDataManager compositionEntityDataManager =
CompositionEntityDataManagerFactory.getInstance().createInterface();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
public CompositionDataHealer() {
}
serviceModelDao.storeServiceModel(vspId, version,
translatorOutput.getToscaServiceModel());
} catch (Exception e) {
+ log.debug("", e);
return Optional.empty();
}
OnboardingTypesEnum.ZIP, uploadData.getContentData().array());
return HeatToToscaUtil.loadAndTranslateTemplateData(fileContentHandler);
} catch (Exception e) {
+ log.debug("", e);
return null;
}
}
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;
CandidateServiceFactory.getInstance().createInterface();
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
public FileDataStructureHealer() {
}
healingResult = getFileDataStructureFromJson(candidateDataEntity.getFilesDataStructure());
}catch (Exception e){
+ log.debug("", e);
return Optional.empty();
}
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;
templateDao = ServiceTemplateDaoFactory.getInstance().createInterface();
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
public HeatToToscaTranslationHealer(){
}
.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;
+ }
}
}
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;
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 {
JsonUtil.json2Object(orchestrationTemplate.getValidationData(), OldValidationStructureTree
.class);
} catch (Exception e){
+ logger.debug("",e);
return Optional.empty();
}
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;
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();
}
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;
VendorSoftwareProductInfoDaoFactory.getInstance().createInterface();
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
public VspQuestionnaireHealer() {
}
questionnaireData = new JsonSchemaDataGenerator(generatedSchema).generateData();
vspInfoDao.updateQuestionnaireData(vspId, version, questionnaireData);
}catch(Exception e){
+ log.debug("", e);
return Optional.empty();
}
mdcDataDebugMessage.debugExitMessage(null, null);
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;
private static Set<Object> heatFalse;
private static Set<Object> heatTrue;
+ private final static Logger log = (Logger) LoggerFactory.getLogger(HeatBoolean.class.getName());
+
static {
Boolean answer = eval(value);
return true;
} catch (CoreException ce) {
+ log.debug("",ce);
return false;
}
}
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;
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;
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;
.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<>());
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);
+ }
}
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) {
} 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);
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;
public class HeatOrchestrationTemplateTest {
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
@Test
public void testYamlToServiceTemplateObj() {
YamlUtil yamlUtil = new YamlUtil();
yamlUtil.yamlToObject(yml, HeatOrchestrationTemplate.class);
Assert.assertNotNull(heatOrchestrationTemplate);
} catch (Exception ignored) {
+ log.debug("",ignored);
}
}
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.
*/
public class MdcDataDebugMessage extends MdcData {
- private static Logger logger;
+ private Logger logger;
private static Map<String, String> mapExitOrEntryToMessage;
static {
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.*;
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() {
}
lastUpdated.set(current); // set now to register the attempt even if failed
hostAddress = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
+ log.debug("",e);
hostAddress = null;
}
}
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";
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;
+ }
}
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;
public class EnrichmentManagerImplTest {
+ private final static Logger log = (Logger) LoggerFactory.getLogger
+ (EnrichmentManagerImplTest.class.getName());
+
private static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath,
String globalServiceTemplatesPath,
try {
yamlFile.close();
} catch (IOException ignore) {
+ log.debug("",ignore);
}
} catch (FileNotFoundException e) {
throw e;
externalArtifactEnricherInstance.enrich(this.data);
}
} catch (Exception e) {
- e.printStackTrace();
+ logger.debug("",e);
logger.error(e.getMessage());
}
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;
private ComponentArtifactDao componentArtifactDao;
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
/**
* Enrich map.
*
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()));
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;
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;
protected String outputFilesPath;
+ private final static Logger log = (Logger) LoggerFactory.getLogger
+ (BaseToscaEnrichmentTest.class.getName());
+
public static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath,
String globalServiceTemplatesPath,
String entryDefinitionServiceTemplate)
try {
yamlFile.close();
} catch (IOException ignore) {
+ log.debug("",ignore);
}
} catch (FileNotFoundException exception) {
throw exception;
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);
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;
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);
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,
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> {
return new ToscaExtensionYamlUtil().
yamlToObject(yamlContent, ServiceTemplate.class);
}catch (Exception e){
+ logger.debug("",e);
return null;
}
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
*/
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 {
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";
}
groupName = (String) groupNameProperty;
}
- if (!Strings.isNullOrEmpty(groupName)) {
+ if (groupName != null && !Strings.isNullOrEmpty(groupName)) {
groupName = groupName.replace(" ", "_");
resourceId += "_" + groupName;
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;
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();
}
} catch (Exception e) {
+ log.debug("",e);
Assert.fail(e.getMessage());
}
return serviceTemplateMap;
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.
package org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation;
-import java.util.List;
-
-
/**
* The type nested template consolidation data.
*/
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;
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;
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;
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);
}
/**
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);
+ }
}
/**
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 {
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;
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;
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);
}
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
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;
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;
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))) {
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;
}
}
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;
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;
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;
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;
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;
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;
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;
NodeTemplate computeNodeTemplate = new NodeTemplate();
computeNodeTemplate.setType(computeNodeTypeId);
- if (!computeNodeTemplateProperties.isEmpty()) {
+ if (computeNodeTemplateProperties != null && !computeNodeTemplateProperties.isEmpty()) {
computeNodeTemplate.setProperties(computeNodeTemplateProperties);
}
String computeNodeTemplateId = translateTo.getTranslatedId();
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;
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;
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;
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;
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;
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 "
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;
mdcDataDebugMessage.debugEntryMessage(null, null);
- if (propertyValue instanceof String && propertyValue != null) {
+ if (propertyValue != null && propertyValue instanceof String) {
if (propertyValue.equals(indexVarValue)) {
return getNewIndexVarValue();
}
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;
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;
private static String zipFilename = "VSP.zip";
private static String validationFilename = "validationOutput.json";
+ private static Logger logger = (Logger) LoggerFactory.getLogger(TestUtils.class);
+
private TestUtils() {
}
serviceTemplateMap.put(fileList[i], serviceTemplate);
}
} catch (Exception e) {
+ logger.debug("",e);
Assert.fail(e.getMessage());
}
return serviceTemplateMap;
try {
yamlFile.close();
} catch (IOException ignore) {
+ logger.debug("",ignore);
}
} catch (FileNotFoundException e) {
throw e;
try {
yamlFile.close();
} catch (IOException ignore) {
+ logger.debug("",ignore);
}
} catch (FileNotFoundException e) {
throw e;
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;
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;
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.
*/
}
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();
+ }
}
}
}
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 {
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");
}
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;
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;
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;
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;
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;
public class HeatTreeManagerTest {
+ private Logger logger = LoggerFactory.getLogger(HeatTreeManagerTest.class);
+
@Test
public void testHeatTreeCreation() {
try {
return FileUtils.toByteArray(new FileInputStream(file));
} catch (IOException e) {
- e.printStackTrace();
+ logger.debug("",e);
}
return new byte[0];
throw new Exception("The file '" + nestedFileName + "' has no content");
}
} catch (Exception exception) {
+ logger.debug("",exception);
mdcDataDebugMessage.debugExitMessage("file", parentFileName);
return;
}
throw new Exception("The file '" + parentFileName + "' has no content");
}
} catch (Exception exception) {
+ logger.debug("",exception);
mdcDataDebugMessage.debugExitMessage("file", parentFileName);
return;
}
}
} catch (Exception exception) {
+ logger.debug("",exception);
logger.warn("HEAT Validator will not be executed on file " + nestedFileName
+ " due to illegal HEAT format");
throw new Exception("The file '" + resourceType + "' has no content");
}
} catch (Exception exception) {
+ logger.debug("",exception);
return;
}
nestedOutputMap = nestedHeatOrchestrationTemplate.getOutputs();
throw new Exception("The file '" + envFileName + "' has no content");
}
} catch (Exception exception) {
+ logger.debug("",exception);
mdcDataDebugMessage.debugExitMessage("env file", envFileName);
return null;
}
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
try {
manifestContent = ValidationUtil.checkValidationPreCondition(globalContext);
} catch (Exception exception) {
+ logger.debug("",exception);
return;
}
Map<String, FileData.Type> fileTypeMap = ManifestUtil.getFileTypeMap(manifestContent);
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();
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;
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;
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 =
try {
manifestContent = ValidationUtil.checkValidationPreCondition(globalContext);
} catch (Exception exception) {
+ log.debug("",exception);
return;
}
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 {
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();
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,
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,
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();
try {
manifestContent = ValidationUtil.checkValidationPreCondition(globalContext);
} catch (Exception exception) {
+ logger.debug("",exception);
return;
}
String baseFileName;
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,
}
+ 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) {
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
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,
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(),
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) {
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;
* 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) {
try {
manifestContent = ValidationUtil.checkValidationPreCondition(globalContext);
} catch (Exception exception) {
+ log.debug("",exception);
return;
}
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
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);
+ }
}
}
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) {
try {
manifestContent = ValidationUtil.checkValidationPreCondition(globalContext);
} catch (Exception exception) {
+ logger.debug("",exception);
return;
}
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;
*/
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);
fileContent = FileUtils.toByteArray(fis);
contentMap.put(file.getName(), fileContent);
} catch (IOException e) {
- e.printStackTrace();
+ log.debug("",e);
}
}
return contentMap;
CommonMethods.newInstance(validatorConf.getImplementationClass(), Validator.class);
validator.init(validatorConf.getProperties());
} catch (IllegalArgumentException iae) {
+ log.debug("",iae);
return null;
}
return validator;
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;
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,
throw new Exception("The file '" + envFileName + "' has no content");
}
} catch (Exception exception) {
+ log.debug("",exception);
mdcDataDebugMessage.debugExitMessage("file", envFileName);
return null;
}
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);
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;
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;
"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;
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);
package org.openecomp.sdc.vendorlicense.dao.types;
-import java.util.ArrayList;
-import java.util.List;
-
public enum LimitType {
ServiceProvider,
Vendor;
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;
"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
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);
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;
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;
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.
return Collections.singletonList(new RequestedVersionInvalidErrorBuilder().build());
}
} catch (CoreException exception) {
+ log.debug("",exception);
return Collections.singletonList(exception.code());
}
try {
getLicenseAgreement(vlmId, licenseAgreementId, version);
} catch (CoreException exception) {
+ log.debug("",exception);
errorMessages.add(exception.code());
}
version).build());
}
} catch (CoreException exception) {
+ log.debug("",exception);
errorMessages.add(exception.code());
}
}
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;
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;
public abstract class XmlArtifact {
XmlMapper xmlMapper = new XmlMapper();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
abstract void initMapper();
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);
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;
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;
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;
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;
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.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;
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> {
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")
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;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.IOException;
-import java.nio.ByteBuffer;
/**
* @author katyr
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;
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.
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());
import java.util.Collection;
import java.util.HashSet;
-import java.util.Objects;
import java.util.Set;
/**
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";
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;
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 {
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;
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;
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;
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;
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;
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 {
if (Objects.isNull(head)) {
head = father = element;
} else {
- father.getSubElements().add(element);
- father = element;
+ if (father != null) {
+ father.getSubElements().add(element);
+ father = element;
+ }
}
}
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;
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;
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;
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;
private static final VendorLicenseFacade vendorLicenseFacade =
VendorLicenseFacadeFactory.getInstance().createInterface();
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
/**
* Gets vendor name for the vsp.
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());
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
try {
value= (String) inputEntry.getValue().get_default();
} catch (Exception e) {
+ logger.debug(e.getMessage(), e);
value = inputEntry.getValue().get_default().toString();
}
return value;
return true;
}
- result = result || isThereErrorsInSubTree(subEntity);
+ result = isThereErrorsInSubTree(subEntity) || result;
if (result) {
return true;
}
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()));
(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,
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);
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;
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;
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\"";
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}";
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);
}
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;
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;
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";
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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;
/**
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;
*/
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private static final Logger logger = LoggerFactory.getLogger(DataModelUtil.class);
/**
* Add substitution mapping.
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;
}
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;
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
try {
zos.closeEntry();
} catch (IOException ignore) {
- //do nothing
+ logger.debug(ignore.getMessage(), ignore);
}
}
}
try {
zos.closeEntry();
} catch (IOException ignore) {
- //do nothing
+ logger.debug(ignore.getMessage(), ignore);
}
}
}
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;
public class TestUtil {
+ private static final Logger logger = LoggerFactory.getLogger(TestUtil.class);
+
public static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath,
String globalServiceTemplatesPath,
String entryDefinitionServiceTemplate)
try {
yamlFile.close();
} catch (IOException ignore) {
+ logger.debug(ignore.getMessage(), ignore);
}
} catch (FileNotFoundException e) {
throw e;
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();
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;
}
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;
}
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;
}
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;
}
}
.getViewableVersions().contains(versionId));
}
-
+ public static Map<String, VersionInfoEntity> getVersionInfoMap()
+ {
+ return versionInfoMap;
+ }
}
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 {
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;
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;
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;
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;
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;
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());
}
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);
}
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());
}
}
private static boolean isActiveVersion(String itemId, Version versionId) {
VersionInfoEntity versionInfo =
- MigrationMain.versionInfoMap.get(itemId);
+ MigrationMain.getVersionInfoMap().get(itemId);
if (versionInfo == null) {
return false;
}
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;
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);
FileUtils.forceDelete(rootDir.toFile());
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
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();
}
}
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) {
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
write(itemFilePath, itemJson.getBytes());
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
write(versionFilePath, versionJson.getBytes());
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
versionCassandraLoader.insertElementToVersion(elementEntity);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
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);
System.out.println("Item Created :"+item.getInfo().getName()+" , "+item.getId());
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
- ex.printStackTrace();
}
}
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 {
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);
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);