summaryrefslogtreecommitdiffstats
path: root/asdc-controller
diff options
context:
space:
mode:
authorrob.bog <r.bogacki@samsung.com>2019-05-28 13:18:24 +0200
committerr.bogacki <r.bogacki@samsung.com>2019-06-03 12:26:59 +0200
commita2df406852f02374c81afc8231639c7cb482f10e (patch)
tree17c234a0b796217b0abb554d291364b400e9b26b /asdc-controller
parent1640ac602723737c8f15a9a84046e709f7230a1c (diff)
Cleaned up duplicated literals
Cleaned up Sonar code smells related to the duplicated literals in loggers. Issue-ID: SO-1932 Signed-off-by: Robert Bogacki <r.bogacki@samsung.com> Change-Id: I58c48cec0012c42b7b892ae76c24c6a087c60c7e
Diffstat (limited to 'asdc-controller')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java14
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java10
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java50
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java7
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java5
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java5
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java19
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java7
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java15
9 files changed, 74 insertions, 58 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
index c80e84b574..a084ce7177 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
@@ -22,6 +22,7 @@ package org.onap.so.asdc.activity;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
+import com.google.common.base.Strings;
import org.apache.http.HttpStatus;
import org.apache.http.entity.ContentType;
import org.onap.so.asdc.activity.beans.ActivitySpec;
@@ -68,7 +69,8 @@ public class ActivitySpecsActions {
int statusCode = response.getStatus();
if (statusCode != HttpStatus.SC_OK) {
- logger.warn("{} {} {}", "Error creating activity spec", activitySpec.getName(), statusCode);
+ logger.warn(Strings.repeat("{} ", 3), "Error creating activity spec", activitySpec.getName(),
+ statusCode);
} else {
if (response.getEntity() != null) {
ActivitySpecCreateResponse activitySpecCreateResponse =
@@ -76,14 +78,14 @@ public class ActivitySpecsActions {
if (activitySpecCreateResponse != null) {
activitySpecId = activitySpecCreateResponse.getId();
} else {
- logger.warn("{} {}", "Unable to read activity spec", activitySpec.getName());
+ logger.warn(Strings.repeat("{} ", 2), "Unable to read activity spec", activitySpec.getName());
}
} else {
- logger.warn("{} {}", "No activity spec response returned", activitySpec.getName());
+ logger.warn(Strings.repeat("{} ", 2), "No activity spec response returned", activitySpec.getName());
}
}
} catch (Exception e) {
- logger.warn("{} {}", "Exception creating activitySpec", e.getMessage());
+ logger.warn(Strings.repeat("{} ", 2), "Exception creating activitySpec", e.getMessage());
}
return activitySpecId;
@@ -109,13 +111,13 @@ public class ActivitySpecsActions {
int statusCode = response.getStatus();
if (statusCode != HttpStatus.SC_OK) {
- logger.warn("{} {} {}", "Error certifying activity", activitySpecId, statusCode);
+ logger.warn(Strings.repeat("{} ", 3), "Error certifying activity", activitySpecId, statusCode);
} else {
certificationResult = true;
}
} catch (Exception e) {
- logger.warn("{} {}", "Exception certifying activitySpec", e.getMessage());
+ logger.warn(Strings.repeat("{} ", 2), "Exception certifying activitySpec", e.getMessage());
}
return certificationResult;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index 43eb277d21..164d32dd66 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -22,6 +22,7 @@ package org.onap.so.asdc.activity;
import java.util.ArrayList;
import java.util.List;
+import com.google.common.base.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -63,15 +64,16 @@ public class DeployActivitySpecs {
ActivitySpec activitySpec = mapActivitySpecFromCatalogToSdc(activitySpecFromCatalog);
String activitySpecId = activitySpecsActions.createActivitySpec(hostname, activitySpec);
if (activitySpecId != null) {
- logger.info("{} {}", "Successfully created activitySpec", activitySpec.getName());
+ logger.info(Strings.repeat("{} ", 2), "Successfully created activitySpec", activitySpec.getName());
boolean certificationResult = activitySpecsActions.certifyActivitySpec(hostname, activitySpecId);
if (certificationResult) {
- logger.info("{} {}", "Successfully certified activitySpec", activitySpec.getName());
+ logger.info(Strings.repeat("{} ", 2), "Successfully certified activitySpec",
+ activitySpec.getName());
} else {
- logger.info("{} {}", "Failed to certify activitySpec", activitySpec.getName());
+ logger.info(Strings.repeat("{} ", 2), "Failed to certify activitySpec", activitySpec.getName());
}
} else {
- logger.info("{} {}", "Failed to create activitySpec", activitySpec.getName());
+ logger.info(Strings.repeat("{} ", 2), "Failed to create activitySpec", activitySpec.getName());
}
}
}
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 ea1d194c68..b1fde550b4 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
@@ -36,6 +36,7 @@ import java.io.UnsupportedEncodingException;
import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
+import com.google.common.base.Strings;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
@@ -232,7 +233,8 @@ public class ASDCController {
}
this.changeControllerStatus(ASDCControllerStatus.IDLE);
- logger.info("{} {} {}", MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC.toString(), "ASDC", "changeControllerStatus");
+ logger.info(Strings.repeat("{} ", 3), MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC.toString(), "ASDC",
+ "changeControllerStatus");
}
/**
@@ -264,7 +266,7 @@ public class ASDCController {
if (toscaInstaller.isResourceAlreadyDeployed(resource, serviceDeployed)) {
- logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST.toString(),
+ logger.info(Strings.repeat("{} ", 4), MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST.toString(),
resource.getResourceInstance().getResourceInstanceName(),
resource.getResourceInstance().getResourceUUID(), resource.getResourceInstance().getResourceName());
@@ -334,7 +336,8 @@ public class ASDCController {
try {
downloadResult = distributionClient.download(artifact);
if (null == downloadResult) {
- logger.info("{} {}", MessageEnum.ASDC_ARTIFACT_NULL.toString(), artifact.getArtifactUUID());
+ logger.info(Strings.repeat("{} ", 2), MessageEnum.ASDC_ARTIFACT_NULL.toString(),
+ artifact.getArtifactUUID());
return downloadResult;
}
} catch (RuntimeException e) {
@@ -346,11 +349,12 @@ public class ASDCController {
}
if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult())) {
- logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC.toString(), artifact.getArtifactURL(),
- artifact.getArtifactUUID(), String.valueOf(downloadResult.getArtifactPayload().length));
+ logger.info(Strings.repeat("{} ", 4), MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC.toString(),
+ artifact.getArtifactURL(), artifact.getArtifactUUID(),
+ String.valueOf(downloadResult.getArtifactPayload().length));
} else {
- logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
+ logger.error(Strings.repeat("{} ", 7), MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(),
downloadResult.getDistributionMessageResult(), ErrorCode.DataError.getValue(),
"ASDC artifact download fail");
@@ -391,12 +395,12 @@ public class ASDCController {
byte[] payloadBytes = resultArtifact.getArtifactPayload();
try (FileOutputStream outFile = new FileOutputStream(filePath)) {
- logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***WRITE FILE ARTIFACT NAME",
- "ASDC", artifact.getArtifactName());
+ logger.info(Strings.repeat("{} ", 4), MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(),
+ "***WRITE FILE ARTIFACT NAME", "ASDC", artifact.getArtifactName());
outFile.write(payloadBytes, 0, payloadBytes.length);
} catch (Exception e) {
logger.debug("Exception :", e);
- logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
+ logger.error(Strings.repeat("{} ", 7), MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(),
resultArtifact.getDistributionMessageResult(), ErrorCode.DataError.getValue(),
"ASDC write to file failed");
@@ -444,7 +448,7 @@ public class ASDCController {
protected void deployResourceStructure(ResourceStructure resourceStructure,
ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException {
- logger.info("{} {} {} {}", MessageEnum.ASDC_START_DEPLOY_ARTIFACT.toString(),
+ logger.info(Strings.repeat("{} ", 4), MessageEnum.ASDC_START_DEPLOY_ARTIFACT.toString(),
resourceStructure.getResourceInstance().getResourceInstanceName(),
resourceStructure.getResourceInstance().getResourceUUID(), "ASDC");
try {
@@ -452,7 +456,7 @@ public class ASDCController {
toscaInstaller.installTheResource(toscaResourceStructure, resourceStructure);
} catch (ArtifactInstallerException e) {
- logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
+ logger.info(Strings.repeat("{} ", 6), MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
resourceStructure.getResourceInstance().getResourceName(),
resourceStructure.getResourceInstance().getResourceUUID(),
String.valueOf(resourceStructure.getNumberOfResources()), "ASDC", "deployResourceStructure");
@@ -461,7 +465,7 @@ public class ASDCController {
}
if (resourceStructure.isDeployedSuccessfully() || toscaResourceStructure.isDeployedSuccessfully()) {
- logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(),
+ logger.info(Strings.repeat("{} ", 6), MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(),
resourceStructure.getResourceInstance().getResourceName(),
resourceStructure.getResourceInstance().getResourceUUID(),
String.valueOf(resourceStructure.getNumberOfResources()), "ASDC", "deployResourceStructure");
@@ -484,7 +488,7 @@ public class ASDCController {
if (errorReason != null) {
event = event + "(" + errorReason + ")";
}
- logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC.toString(), notificationType.name(),
+ logger.info(Strings.repeat("{} ", 6), MessageEnum.ASDC_SEND_NOTIF_ASDC.toString(), notificationType.name(),
status.name(), artifactURL, "ASDC", "sendASDCNotification");
logger.debug(event);
@@ -514,7 +518,7 @@ public class ASDCController {
break;
}
} catch (RuntimeException e) {
- logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
+ logger.warn(Strings.repeat("{} ", 5), MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
"sendASDCNotification", ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification",
e);
}
@@ -541,7 +545,7 @@ public class ASDCController {
} catch (RuntimeException e) {
logger.debug("Exception caught in sendFinalDistributionStatus {}", e.getMessage());
- logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
+ logger.warn(Strings.repeat("{} ", 5), MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
"sendASDCNotification", ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification",
e);
}
@@ -570,12 +574,12 @@ public class ASDCController {
for (IResourceInstance resource : iNotif.getResources()) {
noOfArtifacts += resource.getArtifacts().size();
}
- logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF.toString(), String.valueOf(noOfArtifacts),
- iNotif.getServiceUUID(), "ASDC");
+ logger.info(Strings.repeat("{} ", 4), MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF.toString(),
+ String.valueOf(noOfArtifacts), iNotif.getServiceUUID(), "ASDC");
try {
logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
- logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), iNotif.getServiceUUID(),
- "ASDC", "treatNotification");
+ logger.info(Strings.repeat("{} ", 4), MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(),
+ iNotif.getServiceUUID(), "ASDC", "treatNotification");
this.changeControllerStatus(ASDCControllerStatus.BUSY);
Optional<String> notificationMessage = getNotificationJson(iNotif);
@@ -665,7 +669,7 @@ public class ASDCController {
"OptimisticLockingFailure for DistributionId: {} Another process "
+ "has already altered this distribution, so not going to process it on this site.",
iNotif.getDistributionID());
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Database concurrency exception: ", "ASDC", "treatNotification",
ErrorCode.BusinessProcesssError.getValue(), "RuntimeException in treatNotification", e);
@@ -807,7 +811,7 @@ public class ASDCController {
} catch (ASDCDownloadException | UnsupportedEncodingException e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(Strings.repeat("{} ", 6), MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during Installation of artifact", "ASDC", "processResourceNotification",
ErrorCode.BusinessProcesssError.getValue(), "Exception in processResourceNotification", e);
}
@@ -853,7 +857,7 @@ public class ASDCController {
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(Strings.repeat("{} ", 6), MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during processCsarServiceArtifacts", "ASDC",
"processCsarServiceArtifacts", ErrorCode.BusinessProcesssError.getValue(),
"Exception in processCsarServiceArtifacts", e);
@@ -874,7 +878,7 @@ public class ASDCController {
} catch (Exception e) {
logger.info("Whats the error {}", e.getMessage());
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(Strings.repeat("{} ", 6), MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during processCsarServiceArtifacts", "ASDC",
"processCsarServiceArtifacts", ErrorCode.BusinessProcesssError.getValue(),
"Exception in processCsarServiceArtifacts", e);
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 6a9c1aa848..302a8cbe62 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
@@ -31,6 +31,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import com.google.common.base.Strings;
import org.onap.so.asdc.client.ASDCController;
import org.onap.so.asdc.client.exceptions.ASDCControllerException;
import org.onap.so.asdc.client.exceptions.ASDCParametersException;
@@ -104,11 +105,11 @@ public class ASDCRestInterface {
toscaInstaller.installTheComponentStatus(statusData);
controller.closeASDC();
- logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(), statusData.getDistributionID(),
- "ASDC", "ASDC Updates Are Complete");
+ logger.info(Strings.repeat("{} ", 4), MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(),
+ statusData.getDistributionID(), "ASDC", "ASDC Updates Are Complete");
} catch (Exception e) {
logger.info("Error caught " + e.getMessage());
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION.toString(),
+ logger.error(Strings.repeat("{} ", 6), MessageEnum.ASDC_GENERAL_EXCEPTION.toString(),
"Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService",
ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e);
}
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 749a397ee0..9d214972f4 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
@@ -25,6 +25,7 @@ package org.onap.so.asdc.installer;
import java.io.File;
import java.nio.file.Paths;
import java.util.List;
+import com.google.common.base.Strings;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
@@ -142,14 +143,14 @@ public class ToscaResourceStructure {
File spoolFile = new File(filePath);
logger.debug("ASDC File path is: {}", spoolFile.getAbsolutePath());
- logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***PATH", "ASDC",
+ logger.info(Strings.repeat("{} ", 4), MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***PATH", "ASDC",
spoolFile.getAbsolutePath());
sdcCsarHelper = factory.getSdcCsarHelper(spoolFile.getAbsolutePath(), false);
} catch (Exception e) {
logger.debug(e.getMessage(), e);
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(Strings.repeat("{} ", 6), MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC",
"processResourceNotification", ErrorCode.BusinessProcesssError.getValue(),
"Exception in " + "processResourceNotification", e);
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 16e9fda7c4..b29e856782 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
@@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import com.google.common.base.Strings;
import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.asdc.util.ASDCNotificationLogging;
@@ -133,8 +134,8 @@ public class VfResourceStructure extends ResourceStructure {
// for vender tosca VNF there is no VFModule in VF
if (vfModulesMetadataList == null) {
- logger.info("{} {} {} {}", MessageEnum.ASDC_GENERAL_INFO.toString(), "There is no VF mudules in the VF.",
- "ASDC", "createVfModuleStructures");
+ logger.info(Strings.repeat("{} ", 4), MessageEnum.ASDC_GENERAL_INFO.toString(),
+ "There is no VF mudules in the VF.", "ASDC", "createVfModuleStructures");
return;
}
for (IVfModuleData vfModuleMeta : vfModulesMetadataList) {
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 7945ad0174..8c2d0b81f2 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
@@ -33,6 +33,7 @@ import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
+import com.google.common.base.Strings;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@@ -83,16 +84,17 @@ public class BpmnInstaller {
logger.debug("Response entity: {}", response.getEntity().toString());
if (response.getStatusLine().getStatusCode() != 200) {
logger.debug("Failed deploying BPMN {}", name);
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(),
- name, fileName, Integer.toString(response.getStatusLine().getStatusCode()),
+ logger.error(Strings.repeat("{} ", 6),
+ MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name, fileName,
+ Integer.toString(response.getStatusLine().getStatusCode()),
ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
} else {
logger.debug("Successfully deployed to Camunda: {}", name);
}
} catch (Exception e) {
logger.debug("Exception :", e);
- logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name,
- e.getMessage(), ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(),
+ name, e.getMessage(), ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
}
}
entry = csarFile.getNextEntry();
@@ -100,8 +102,9 @@ public class BpmnInstaller {
csarFile.close();
} catch (IOException ex) {
logger.debug("Exception :", ex);
- logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath,
- ex.getMessage(), ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed");
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(),
+ csarFilePath, ex.getMessage(), ErrorCode.DataError.getValue(),
+ "ASDC reading CSAR with workflows failed");
}
return;
}
@@ -119,8 +122,8 @@ public class BpmnInstaller {
}
} catch (Exception e) {
logger.debug("Exception :", e);
- logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath, e.getMessage(),
- ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries");
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath,
+ e.getMessage(), ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries");
}
return workflowsInCsar;
}
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 daeda2f976..e69eed6ad0 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
@@ -27,6 +27,7 @@ import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import com.google.common.base.Strings;
import org.apache.http.HttpResponse;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.so.asdc.installer.VfResourceStructure;
@@ -88,8 +89,8 @@ public class WorkflowResource {
logger.debug("Response entity: {}", response.getEntity().toString());
if (response.getStatusLine().getStatusCode() != 200) {
logger.debug("Failed deploying BPMN {}", bpmnName);
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), bpmnName,
- bpmnName, Integer.toString(response.getStatusLine().getStatusCode()),
+ logger.error(Strings.repeat("{} ", 6), MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(),
+ bpmnName, bpmnName, Integer.toString(response.getStatusLine().getStatusCode()),
ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
throw (new Exception("Error from Camunda on deploying the BPMN: " + bpmnName));
} else {
@@ -97,7 +98,7 @@ public class WorkflowResource {
}
} catch (Exception e) {
logger.debug("Exception :", e);
- logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), bpmnName,
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), bpmnName,
e.getMessage(), ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
throw e;
}
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 486697b0b2..1daf81940b 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
@@ -38,6 +38,7 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
+import com.google.common.base.Strings;
import org.hibernate.StaleObjectStateException;
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.LockAcquisitionException;
@@ -323,8 +324,8 @@ public class ToscaResourceInstaller {
}
return status;
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), ErrorCode.SchemaError.getValue(),
- "Exception - isResourceAlreadyDeployed");
+ logger.error(Strings.repeat("{} ", 3), MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(),
+ ErrorCode.SchemaError.getValue(), "Exception - isResourceAlreadyDeployed");
throw new ArtifactInstallerException("Exception caught during checking existence of the VNF Resource.", e);
}
}
@@ -394,7 +395,7 @@ public class ToscaResourceInstaller {
if (dbExceptionToCapture instanceof ConstraintViolationException
|| dbExceptionToCapture instanceof LockAcquisitionException) {
- logger.warn("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
+ logger.warn(Strings.repeat("{} ", 5), MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
resourceStruct.getResourceInstance().getResourceName(),
resourceStruct.getNotification().getServiceVersion(), ErrorCode.DataError.getValue(),
"Exception - ASCDC Artifact already deployed", e);
@@ -402,7 +403,7 @@ public class ToscaResourceInstaller {
String elementToLog = (!artifactListForLogging.isEmpty()
? artifactListForLogging.get(artifactListForLogging.size() - 1).toString()
: "No element listed");
- logger.error("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
ErrorCode.DataError.getValue(), "Exception caught during installation of "
+ resourceStruct.getResourceInstance().getResourceName() + ". Transaction rollback",
e);
@@ -474,7 +475,7 @@ public class ToscaResourceInstaller {
if (dbExceptionToCapture instanceof ConstraintViolationException
|| dbExceptionToCapture instanceof LockAcquisitionException) {
- logger.warn("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
+ logger.warn(Strings.repeat("{} ", 5), MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
vfResourceStructure.getResourceInstance().getResourceName(),
vfResourceStructure.getNotification().getServiceVersion(), ErrorCode.DataError.getValue(),
"Exception - ASCDC Artifact already deployed", e);
@@ -482,7 +483,7 @@ public class ToscaResourceInstaller {
String elementToLog = (!artifactListForLogging.isEmpty()
? artifactListForLogging.get(artifactListForLogging.size() - 1).toString()
: "No element listed");
- logger.error("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
ErrorCode.DataError.getValue(),
"Exception caught during installation of "
+ vfResourceStructure.getResourceInstance().getResourceName()
@@ -1157,7 +1158,7 @@ public class ToscaResourceInstaller {
break;
case ASDCConfiguration.HEAT_NET:
case ASDCConfiguration.OTHER:
- logger.warn("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(),
+ logger.warn(Strings.repeat("{} ", 4), MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(),
vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:"
+ vfModuleArtifact.getArtifactInfo().getArtifactName() + ")",
ErrorCode.DataError.getValue(), "Artifact type not supported");