diff options
4 files changed, 28 insertions, 67 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java index 093192e858..d9af918a28 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java @@ -31,7 +31,6 @@ import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.api.annotations.Metrics; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; -import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; @@ -132,8 +131,8 @@ public class OrchestrationTemplateCandidateManagerImpl if (CollectionUtils.isNotEmpty(errorMessages)) { Map<String, List<ErrorMessage>> errorsMap = new HashMap<>(); errorsMap.put(SdcCommon.UPLOAD_FILE, errorMessages); - response.setUploadDataErrors(errorsMap, LoggerServiceName.Update_Manifest, - LoggerTragetServiceName.VALIDATE_FILE_DATA_STRUCTURE); + response.setUploadDataErrors(errorsMap, + LoggerTragetServiceName.VALIDATE_FILE_DATA_STRUCTURE); MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId); return response; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java index 9156eebb84..e38c1b3b37 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java @@ -43,7 +43,6 @@ import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; import org.openecomp.sdc.logging.messages.AuditMessages; import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; -import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; @@ -220,10 +219,10 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa vspDetails.getVersion())); } validationResponse.setUploadDataErrors(validateOrchestrationTemplate(orchestrationTemplate), - LoggerServiceName.Submit_VSP, LoggerTragetServiceName.SUBMIT_VSP); + LoggerTragetServiceName.SUBMIT_VSP); } validationResponse - .setVspErrors(vspErrors, LoggerServiceName.Submit_VSP, LoggerTragetServiceName.SUBMIT_VSP); + .setVspErrors(vspErrors, LoggerTragetServiceName.SUBMIT_VSP); validationResponse.setLicensingDataErrors(validateLicensingData(vspDetails)); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java index 316b1a4049..769d55a320 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java @@ -1,21 +1,17 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2017 European Support Limited + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= */ package org.openecomp.sdc.vendorsoftwareproduct.types; @@ -24,9 +20,6 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.datatypes.error.ErrorMessage; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils; import java.util.Collection; @@ -34,12 +27,10 @@ import java.util.List; import java.util.Map; public class ValidationResponse { - protected static Logger logger = (Logger) LoggerFactory.getLogger(ValidationResponse.class); private boolean valid = true; private Collection<ErrorCode> vspErrors; private Collection<ErrorCode> licensingDataErrors; private Map<String, List<ErrorMessage>> uploadDataErrors; - private Map<String, List<ErrorMessage>> compilationErrors; private QuestionnaireValidationResult questionnaireValidationResult; public boolean isValid() { @@ -52,12 +43,10 @@ public class ValidationResponse { /** * Sets vsp errors. - * - * @param vspErrors the vsp errors - * @param serviceName the service name + * @param vspErrors the vsp errors * @param targetServiceName the target service name */ - public void setVspErrors(Collection<ErrorCode> vspErrors, LoggerServiceName serviceName, + public void setVspErrors(Collection<ErrorCode> vspErrors, String targetServiceName) { this.vspErrors = vspErrors; if (CollectionUtils.isNotEmpty(vspErrors)) { @@ -90,13 +79,11 @@ public class ValidationResponse { /** * Sets upload data errors. - * - * @param uploadDataErrors the upload data errors - * @param serviceName the service name + * @param uploadDataErrors the upload data errors * @param targetServiceName the target service name */ public void setUploadDataErrors(Map<String, List<ErrorMessage>> uploadDataErrors, - LoggerServiceName serviceName, String targetServiceName) { + String targetServiceName) { this.uploadDataErrors = uploadDataErrors; if (MapUtils.isNotEmpty(uploadDataErrors)) { valid = false; @@ -106,28 +93,6 @@ public class ValidationResponse { .setErrorsIntoLogger(uploadDataErrors, targetServiceName); } - public Map<String, List<ErrorMessage>> getCompilationErrors() { - return compilationErrors; - } - - /** - * Sets compilation errors. - * - * @param compilationErrors the compilation errors - * @param serviceName the service name - * @param targetServiceName the target service name - */ - public void setCompilationErrors(Map<String, List<ErrorMessage>> compilationErrors, - LoggerServiceName serviceName, String targetServiceName) { - this.compilationErrors = compilationErrors; - if (MapUtils.isNotEmpty(compilationErrors)) { - valid = false; - } - - VendorSoftwareProductUtils - .setErrorsIntoLogger(uploadDataErrors, targetServiceName); - } - public QuestionnaireValidationResult getQuestionnaireValidationResult() { return questionnaireValidationResult; } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java index 369efe38bc..d5c6ab4c64 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java @@ -1,21 +1,17 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2017 European Support Limited + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= */ package org.openecomp.sdc.vendorsoftwareproduct.utils; @@ -41,14 +37,17 @@ import org.slf4j.MDC; import java.io.File; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; +import java.util.EnumMap; import java.util.List; import java.util.Map; public class VendorSoftwareProductUtils { - protected static Logger logger = - LoggerFactory.getLogger(VendorSoftwareProductUtils.class); + private static final Logger LOGGER = LoggerFactory.getLogger(VendorSoftwareProductUtils.class); + + private VendorSoftwareProductUtils(){ + + } /** * Add file names to upload file response. @@ -66,8 +65,6 @@ public class VendorSoftwareProductUtils { } uploadFileResponse.removeFileFromList(SdcCommon.MANIFEST_NAME); } - - /** * Validate content zip data. * @@ -92,7 +89,8 @@ public class VendorSoftwareProductUtils { */ public static Map<MonitoringUploadType, String> mapArtifactsByType( Collection<ComponentMonitoringUploadEntity> artifacts) { - Map<MonitoringUploadType, String> artifactTypeToFilename = new HashMap<>(); + Map<MonitoringUploadType, String> artifactTypeToFilename + = new EnumMap<>(MonitoringUploadType.class); for (ComponentMonitoringUploadEntity entity : artifacts) { artifactTypeToFilename.put(entity.getType(), entity.getArtifactName()); @@ -121,7 +119,7 @@ public class VendorSoftwareProductUtils { for (Map.Entry<String, List<ErrorMessage>> listEntry : errors.entrySet()) { List<ErrorMessage> errorList = listEntry.getValue(); for (ErrorMessage message : errorList) { - logger.error(message.getMessage()); + LOGGER.error(message.getMessage()); } } } @@ -143,7 +141,7 @@ public class VendorSoftwareProductUtils { } for (ErrorCode error : errors) { - logger.error(error.message()); + LOGGER.error(error.message()); } } } |