diff options
Diffstat (limited to 'asdc-controller/src')
12 files changed, 75 insertions, 110 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java index ecffb683ca..fe166f7942 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java @@ -24,15 +24,13 @@ package org.onap.so.asdc; import java.security.SecureRandom; import javax.annotation.PreDestroy; -import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.asdc.client.ASDCController; import org.onap.so.asdc.client.exceptions.ASDCControllerException; -import org.onap.so.logger.ErrorCode; -import org.onap.so.logger.ScheduledTasksMDCSetup; -import org.onap.so.utils.Components; +import org.onap.logging.filter.base.ErrorCode; +import org.onap.logging.filter.base.ScheduledLogging; +import org.onap.logging.filter.base.ScheduledTaskException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.Scheduled; @@ -47,16 +45,13 @@ public class ASDCControllerSingleton { private final ASDCController asdcController; @Autowired - private ScheduledTasksMDCSetup scheduledMDCSetup; - - @Autowired public ASDCControllerSingleton(final ASDCController asdcController) { this.asdcController = asdcController; } + @ScheduledLogging @Scheduled(fixedRate = 50000) - public void periodicControllerTask() { - scheduledMDCSetup.mdcSetup(Components.ASDC_CONTROLLER, "periodicControllerTask"); + public void periodicControllerTask() throws ScheduledTaskException { try { final int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE); asdcController.setControllerName("mso-controller" + randomNumber); @@ -66,11 +61,9 @@ public class ASDCControllerSingleton { asdcController.initASDC(); } } catch (final ASDCControllerException controllerException) { - scheduledMDCSetup.errorMDCSetup(ErrorCode.UnknownError, controllerException.getMessage()); - MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString()); - logger.error("Exception occurred", controllerException); + throw new ScheduledTaskException(ErrorCode.UnknownError, controllerException.getMessage(), + controllerException); } - scheduledMDCSetup.exitAndClearMDC(); } @PreDestroy diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index e084cfec18..ad96e1be4b 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -74,7 +74,7 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.beans.WatchdogDistributionStatus; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java index d0f86c722e..d59984bb52 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java @@ -6,12 +6,14 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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. @@ -52,21 +54,25 @@ public final class ASDCStatusCallBack implements IStatusCallback { try { - if (iStatus.getStatus() != null) { - if (iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_OK) - || iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_ERROR)) { - WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository - .findById(iStatus.getDistributionID()).orElseGet(() -> null); - if (watchdogDistributionStatus == null) { - watchdogDistributionStatus = new WatchdogDistributionStatus(); - watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID()); - watchdogDistributionStatusRepository.save(watchdogDistributionStatus); - } - logger.debug(event); - toscaInstaller.installTheComponentStatus(iStatus); - - } + if (iStatus.getStatus() == null) { + logger.info("Missing status on Status Object. "); + return; + } + if (!iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_OK) + && !iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_ERROR)) { + logger.info("Status is not 'Component Done OK' or 'Component Done Error'"); + return; } + WatchdogDistributionStatus watchdogDistributionStatus = + watchdogDistributionStatusRepository.findById(iStatus.getDistributionID()).orElseGet(() -> null); + if (watchdogDistributionStatus == null) { + watchdogDistributionStatus = new WatchdogDistributionStatus(); + watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID()); + watchdogDistributionStatusRepository.save(watchdogDistributionStatus); + } + logger.debug(event); + toscaInstaller.installTheComponentStatus(iStatus); + } catch (ArtifactInstallerException e) { logger.error("Error in ASDCStatusCallback {}", e.getMessage(), e); logger.debug("Error in ASDCStatusCallback {}", e.getMessage()); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java index 13cace404e..0a1b1c531e 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java @@ -4,12 +4,14 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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. @@ -37,7 +39,6 @@ public class FinalDistributionStatusMessage implements IFinalDistrStatusMessage public FinalDistributionStatusMessage(String distributionId, final DistributionStatusEnum distributionStatusEnum, final long timestampL, String consumerId) { - // componentName = componentname; consumerID = consumerId; distributionID = distributionId; status = distributionStatusEnum; @@ -68,6 +69,7 @@ public class FinalDistributionStatusMessage implements IFinalDistrStatusMessage this.timestamp = timestamp; } + @Override public String getComponentName() { return componentName; } @@ -76,6 +78,7 @@ public class FinalDistributionStatusMessage implements IFinalDistrStatusMessage this.componentName = componentName; } + @Override public String getConsumerID() { return consumerID; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java index 7bd9c752a4..34f21ab813 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java @@ -4,12 +4,14 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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. @@ -50,43 +52,37 @@ public class JsonStatusData implements IStatusData { @Override public String getDistributionID() { - // return (String)this.attributesMap.get("distributionID"); return "35120a87-1f82-4276-9735-f6de5a244d65"; } @Override public String getConsumerID() { - // return (String)this.attributesMap.get("consumerID"); return "mso.123456"; } @Override public String getComponentName() { - // return (String)this.attributesMap.get("componentName"); return "SDN-C"; } @Override public Long getTimestamp() { - // return (String)this.attributesMap.get("timestamp"); return null; } @Override public String getArtifactURL() { - // return (String)this.attributesMap.get("artifactURL"); return "/sdc/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml"; } @Override public DistributionStatusEnum getStatus() { - // return (DistributionStatusEnum)this.attributesMap.get(DistributionStatusEnum.DEPLOY_OK); return DistributionStatusEnum.COMPONENT_DONE_OK; } /** * Method instantiate a INotificationData implementation from a JSON file. - * + * * @param notifFilePath The file path in String * @return A JsonNotificationData instance * @throws IOException in case of the file is not readable or not accessible @@ -96,19 +92,6 @@ public class JsonStatusData implements IStatusData { InputStream is = Thread.currentThread().getContextClassLoader() .getResourceAsStream(notifFilePath + "status-structure.json"); - // String fileLocation = System.getProperty("mso.config.path") + "notif-structure.json"; - - // String source = fileLocation; - // InputStream is = IOUtils.toInputStream(source, "UTF-8"); - - // String myString = IOUtils.toString(is, "UTF-8"); - - - // System.out.println(myString); - - if (is == null) { - // throw new FileExistsException("Resource Path does not exist: "+notifFilePath); - } return mapper.readValue(is, JsonStatusData.class); } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java index a9d06d8e82..42778507f0 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java @@ -36,7 +36,7 @@ import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator; import org.onap.so.asdc.client.test.emulators.JsonStatusData; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java index dcb49478f4..04d4b0c2dc 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java @@ -50,7 +50,7 @@ import org.onap.so.db.catalog.beans.ToscaCsar; import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java index 36d6ab96c0..11c1cc33cf 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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 @@ -25,8 +27,6 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; -import org.onap.sdc.api.notification.IVfModuleMetadata; -import org.onap.so.asdc.client.ASDCConfiguration; import org.onap.so.asdc.client.exceptions.ArtifactInstallerException; import org.onap.so.db.catalog.beans.VfModule; @@ -73,23 +73,6 @@ public final class VfModuleStructure { } } - public List<VfModuleArtifact> getOrderedArtifactList() { - - List<VfModuleArtifact> artifactsList = new LinkedList<>(); - - artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT)); - artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_ENV)); - artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_VOL)); - - artifactsList.addAll((artifactsMap.get(ASDCConfiguration.HEAT_NESTED))); - - artifactsList.addAll((artifactsMap.get(ASDCConfiguration.HEAT_ARTIFACT))); - - artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_VOL)); - - return null; - } - public IVfModuleData getVfModuleMetadata() { return vfModuleMetadata; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java index f954fe0c5a..f5b0e17cf5 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java @@ -7,6 +7,8 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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 @@ -77,39 +79,38 @@ public class VfResourceStructure extends ResourceStructure { private Service catalogService; - public VfResourceStructure(INotificationData notificationdata, IResourceInstance resourceinstance) { - super(notificationdata, resourceinstance); + public VfResourceStructure(INotificationData notificationData, IResourceInstance resourceInstance) { + super(notificationData, resourceInstance); this.resourceType = ResourceType.VF_RESOURCE; vfModulesStructureList = new LinkedList<>(); vfModulesMetadataList = new ArrayList<>(); } - public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo, + public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactInfo, IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException { - this.addArtifactToStructure(distributionClient, artifactinfo, clientResult, null); + this.addArtifactToStructure(artifactInfo, clientResult, null); } - public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo, - IDistributionClientDownloadResult clientResult, String modifiedHeatTemplate) - throws UnsupportedEncodingException { - VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo, clientResult, modifiedHeatTemplate); - addArtifactByType(artifactinfo, clientResult, vfModuleArtifact); - if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifactinfo.getArtifactType())) { + public void addArtifactToStructure(IArtifactInfo artifactInfo, IDistributionClientDownloadResult clientResult, + String modifiedHeatTemplate) throws UnsupportedEncodingException { + VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactInfo, clientResult, modifiedHeatTemplate); + addArtifactByType(artifactInfo, clientResult, vfModuleArtifact); + if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifactInfo.getArtifactType())) { logger.debug("VF_MODULE_ARTIFACT: " + new String(clientResult.getArtifactPayload(), "UTF-8")); logger.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(vfModulesMetadataList)); } } - public void addWorkflowArtifactToStructure(IArtifactInfo artifactinfo, + public void addWorkflowArtifactToStructure(IArtifactInfo artifactInfo, IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException { - WorkflowArtifact workflowArtifact = new WorkflowArtifact(artifactinfo, clientResult); - workflowArtifactsMapByUUID.put(artifactinfo.getArtifactUUID(), workflowArtifact); + WorkflowArtifact workflowArtifact = new WorkflowArtifact(artifactInfo, clientResult); + workflowArtifactsMapByUUID.put(artifactInfo.getArtifactUUID(), workflowArtifact); } - protected void addArtifactByType(IArtifactInfo artifactinfo, IDistributionClientDownloadResult clientResult, + protected void addArtifactByType(IArtifactInfo artifactInfo, IDistributionClientDownloadResult clientResult, VfModuleArtifact vfModuleArtifact) { - switch (artifactinfo.getArtifactType()) { + switch (artifactInfo.getArtifactType()) { case ASDCConfiguration.HEAT: case ASDCConfiguration.HEAT_ENV: case ASDCConfiguration.HEAT_VOL: @@ -118,7 +119,7 @@ public class VfResourceStructure extends ResourceStructure { case ASDCConfiguration.HEAT_NET: case ASDCConfiguration.OTHER: case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT: - artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact); + artifactsMapByUUID.put(artifactInfo.getArtifactUUID(), vfModuleArtifact); break; case ASDCConfiguration.VF_MODULES_METADATA: vfModulesMetadataList = this.decodeVfModuleArtifact(clientResult.getArtifactPayload()); @@ -196,9 +197,7 @@ public class VfResourceStructure extends ResourceStructure { public List<IVfModuleData> decodeVfModuleArtifact(byte[] arg0) { try { - List<IVfModuleData> listVFModuleMetaData = - new ObjectMapper().readValue(arg0, new TypeReference<List<VfModuleMetaData>>() {}); - return listVFModuleMetaData; + return new ObjectMapper().readValue(arg0, new TypeReference<List<VfModuleMetaData>>() {}); } catch (JsonParseException e) { logger.debug("JsonParseException : ", e); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java index 195aa7e302..4253521dff 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java @@ -6,6 +6,8 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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 @@ -27,6 +29,7 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.net.URI; +import java.net.URISyntaxException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Enumeration; @@ -47,7 +50,7 @@ import org.apache.http.entity.mime.content.ByteArrayBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.HttpClientBuilder; import org.onap.so.asdc.client.ASDCConfiguration; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -107,18 +110,15 @@ public class BpmnInstaller { logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath, ex.getMessage(), ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed"); } - return; } public boolean containsWorkflows(String csarFilePath) { - boolean workflowsInCsar = false; try (ZipFile zipFile = new ZipFile(csarFilePath)) { Enumeration<? extends ZipEntry> zipEntries = zipFile.entries(); while (zipEntries.hasMoreElements()) { String fileName = zipEntries.nextElement().getName(); if (fileName.endsWith(BPMN_SUFFIX)) { - workflowsInCsar = true; - break; + return true; } } } catch (Exception e) { @@ -126,10 +126,11 @@ public class BpmnInstaller { logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath, e.getMessage(), ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries"); } - return workflowsInCsar; + return false; } - protected HttpResponse sendDeploymentRequest(String bpmnFileName, String version) throws Exception { + protected HttpResponse sendDeploymentRequest(String bpmnFileName, String version) + throws IOException, URISyntaxException { HttpClient client = HttpClientBuilder.create().build(); URI deploymentUri = new URI(this.env.getProperty(CAMUNDA_URL) + CREATE_DEPLOYMENT_PATH); HttpPost post = new HttpPost(deploymentUri); @@ -141,7 +142,7 @@ public class BpmnInstaller { return client.execute(post); } - protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws Exception { + protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws IOException { FileInputStream bpmnFileStream = new FileInputStream( Paths.get(getMsoConfigPath(), "ASDC", version, bpmnFileName).normalize().toString()); @@ -182,17 +183,14 @@ public class BpmnInstaller { return requestEntity; } - /* protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) throws IOException */ protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) { String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", fileName).normalize().toString(); - /* BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath)); */ try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath))) { byte[] bytesIn = new byte[4096]; - int read = 0; + int read; while ((read = zipIn.read(bytesIn)) != -1) { outputStream.write(bytesIn, 0, read); } - /* outputStream.close(); */ } catch (IOException e) { logger.error("Unable to open file.", e); } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java index ef4dfa24aa..1f111ba7a0 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java @@ -40,7 +40,7 @@ import org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence; import org.onap.so.db.catalog.data.repository.ActivitySpecRepository; import org.onap.so.db.catalog.data.repository.VnfResourceRepository; import org.onap.so.db.catalog.data.repository.WorkflowRepository; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 1c7ebb7d9a..423c1a7ed6 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -83,7 +83,7 @@ import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository; import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository; -import org.onap.so.logger.ErrorCode; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; |