summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/backend')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java14
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java79
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java33
3 files changed, 33 insertions, 93 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java
index b8fddcd075..ae0283b568 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerFactoryImpl.java
@@ -1,9 +1,6 @@
-/*-
- * ============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
@@ -15,12 +12,10 @@
* 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.impl;
-import org.openecomp.sdc.healing.factory.HealingManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
@@ -32,8 +27,7 @@ public class OrchestrationTemplateCandidateManagerFactoryImpl extends
private static final OrchestrationTemplateCandidateManager INSTANCE =
new OrchestrationTemplateCandidateManagerImpl(
VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(),
- CandidateServiceFactory.getInstance().createInterface(),
- HealingManagerFactory.getInstance().createInterface()
+ CandidateServiceFactory.getInstance().createInterface()
);
@Override
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 f613dbb54f..c9bb956a18 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
@@ -1,9 +1,6 @@
-/*-
- * ============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
@@ -15,7 +12,6 @@
* 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.impl;
@@ -31,12 +27,10 @@ import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
-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.logging.api.annotations.Metrics;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
-import org.openecomp.sdc.logging.messages.AuditMessages;
import org.openecomp.sdc.logging.types.LoggerServiceName;
import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
@@ -63,27 +57,26 @@ import java.util.Optional;
public class OrchestrationTemplateCandidateManagerImpl
implements OrchestrationTemplateCandidateManager {
- private static final Logger logger =
+ private static final Logger LOGGER =
LoggerFactory.getLogger(OrchestrationTemplateCandidateManagerImpl.class);
- private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage();
- private VendorSoftwareProductInfoDao vspInfoDao;
- private CandidateService candidateService;
- private HealingManager healingManager;
+ private final VendorSoftwareProductInfoDao vspInfoDao;
+ private final CandidateService candidateService;
+ private static final String VSP_ID = "VSP id";
public OrchestrationTemplateCandidateManagerImpl(VendorSoftwareProductInfoDao vspInfoDao,
- CandidateService candidateService,
- HealingManager healingManager) {
+ CandidateService candidateService
+ ) {
this.vspInfoDao = vspInfoDao;
this.candidateService = candidateService;
- this.healingManager = healingManager;
}
@Override
@Metrics
public UploadFileResponse upload(String vspId, Version version, InputStream fileToUpload,
String fileSuffix, String networkPackageName) {
- mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+ MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
OrchestrationTemplateFileHandler orchestrationTemplateFileHandler =
OrchestrationUploadFactory.createOrchestrationTemplateFileHandler(fileSuffix);
@@ -99,7 +92,7 @@ public class OrchestrationTemplateCandidateManagerImpl
@Override
public OrchestrationTemplateActionResponse process(String vspId, Version version) {
- mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+ MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
OrchestrationTemplateCandidateData candidate = fetchCandidateDataEntity(vspId, version)
.orElseThrow(
@@ -112,14 +105,14 @@ public class OrchestrationTemplateCandidateManagerImpl
@Override
public Optional<FilesDataStructure> getFilesDataStructure(String vspId, Version version) {
- mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+ MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
Optional<FilesDataStructure> candidateFileDataStructure =
candidateService.getOrchestrationTemplateCandidateFileDataStructure(vspId, version);
if (candidateFileDataStructure.isPresent()) {
return candidateFileDataStructure;
} else {
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return Optional.empty();
}
}
@@ -127,7 +120,7 @@ public class OrchestrationTemplateCandidateManagerImpl
@Override
public ValidationResponse updateFilesDataStructure(String vspId, Version version,
FilesDataStructure fileDataStructure) {
- mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+ MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
ValidationResponse response = new ValidationResponse();
Optional<List<ErrorMessage>> validateErrors =
@@ -140,21 +133,21 @@ public class OrchestrationTemplateCandidateManagerImpl
response.setUploadDataErrors(errorsMap, LoggerServiceName.Update_Manifest,
LoggerTragetServiceName.VALIDATE_FILE_DATA_STRUCTURE);
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return response;
}
}
candidateService
.updateOrchestrationTemplateCandidateFileDataStructure(vspId, version, fileDataStructure);
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return response;
}
@Override
public Optional<Pair<String, byte[]>> get(String vspId, Version version) throws IOException {
- mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+ MDC_DATA_DEBUG_MESSAGE.debugEntryMessage(VSP_ID, vspId);
VspDetails vspDetails = getVspDetails(vspId, version);
@@ -164,9 +157,9 @@ public class OrchestrationTemplateCandidateManagerImpl
if (!candidateDataEntity.isPresent()) {
ErrorMessage errorMessage = new ErrorMessage(ErrorLevel.ERROR,
Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage());
- logger.error(errorMessage.getMessage());
+ LOGGER.error(errorMessage.getMessage());
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return Optional.empty();
}
OnboardingTypesEnum type =
@@ -177,7 +170,7 @@ public class OrchestrationTemplateCandidateManagerImpl
.json2Object(candidateDataEntity.get().getFilesDataStructure(), FilesDataStructure.class);
String manifest = candidateService.createManifest(vspDetails, structure);
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return Optional.of(
new ImmutablePair<>(OnboardingTypesEnum.ZIP.toString(), candidateService
.replaceManifestInZip(candidateDataEntity.get().getContentData(),
@@ -200,36 +193,10 @@ public class OrchestrationTemplateCandidateManagerImpl
.ofNullable(candidateService.getOrchestrationTemplateCandidate(vspId, version));
}
-
- // todo *************************** move to reusable place! *************************
-
- private Map<String, Object> getHealingParamsAsMap(String vspId, Version version) {
- Map<String, Object> healingParams = new HashMap<>();
-
- healingParams.put(SdcCommon.VSP_ID, vspId);
- healingParams.put(SdcCommon.VERSION, version);
-
- return healingParams;
- }
-
private VspDetails getVspDetails(String vspId, Version version) {
- VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version));
-/* OrchestrationTemplateEntity orchestrationTemplateInfo =
- orchestrationTemplateDao.getInfo(vspId, version);
- vspDetails.setValidationData(orchestrationTemplateInfo.getValidationData());
- vspDetails.setNetworkPackageName(orchestrationTemplateInfo.getFileName());
- vspDetails.setOnboardingOrigin(orchestrationTemplateInfo.getFileSuffix());*/
- return vspDetails;
- }
-
- private void printAuditForErrors(List<ErrorMessage> errorList, String vspId, String auditType) {
- errorList.forEach(errorMessage -> {
- if (errorMessage.getLevel().equals(ErrorLevel.ERROR)) {
- logger.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(),
- vspId));
- }
- });
+ return vspInfoDao.get(new VspDetails(vspId, version));
}
+
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java
index d574c9ee74..046163515f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.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.upload.csar;
@@ -24,20 +20,13 @@ package org.openecomp.sdc.vendorsoftwareproduct.upload.csar;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
-import org.openecomp.core.model.dao.ServiceModelDao;
-import org.openecomp.core.model.types.ServiceElement;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
-import org.openecomp.sdc.healing.api.HealingManager;
-import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.impl.OrchestrationTemplateCandidateManagerImpl;
-import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
-import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructuremodule.CandidateServiceImpl;
import org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructuremodule.ManifestCreatorNamingConventionImpl;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
@@ -60,19 +49,9 @@ public class UploadCSARFileTest {
public static final Version VERSION01 = new Version("0.1");
- @Mock
- private OrchestrationTemplateDao orchestrationTemplateDataDaoMock;
@Spy
private CandidateServiceImpl candidateService;
@Mock
- private HealingManager healingManagerMock;
- @Mock
- private CompositionDataExtractor compositionDataExtractorMock;
- @Mock
- private ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDaoMock;
- @Mock
- private CompositionEntityDataManager compositionEntityDataManagerMock;
- @Mock
private VendorSoftwareProductInfoDao vspInfoDaoMock;
@Mock
private OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDao;
@@ -92,7 +71,7 @@ public class UploadCSARFileTest {
MockitoAnnotations.initMocks(this);
candidateService = new CandidateServiceImpl(manifestCreator, orchestrationTemplateCandidateDao);
candidateManager = new OrchestrationTemplateCandidateManagerImpl(vspInfoDaoMock,
- candidateService, healingManagerMock);
+ candidateService);
}
@Test