diff options
126 files changed, 781 insertions, 625 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index 029da43f48..dd2d9f95f7 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Optional; import javax.jws.WebService; import javax.xml.ws.Holder; +import com.google.common.base.Strings; import org.onap.so.adapters.network.beans.ContrailPolicyRef; import org.onap.so.adapters.network.beans.ContrailPolicyRefSeq; import org.onap.so.adapters.network.beans.ContrailSubnet; @@ -205,7 +206,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String.format( "Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration", networkName, cloudSiteId, tenantId); - logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); // Set the detailed error as the Exception 'message' throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -240,8 +241,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (failIfExists != null && failIfExists) { String error = String.format("Create Nework: Network %s already exists in %s/%s with ID %s", networkName, cloudSiteId, tenantId, netInfo.getId()); - logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(), - error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NETWORK_ALREADY_EXIST, + ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } else { // Populate the outputs from the existing network. @@ -285,7 +286,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { HeatTemplate heatTemplate = networkResource.getHeatTemplate(); if (heatTemplate == null) { String error = String.format("Network error - undefined Heat Template. Network Type = %s", networkType); - logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), + error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -322,8 +324,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (failIfExists != null && failIfExists) { String error = String.format("CreateNetwork: Stack %s already exists in %s/%s as %s", networkName, cloudSiteId, tenantId, heatStack.getCanonicalName()); - logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(), - error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NETWORK_ALREADY_EXIST, + ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } else { // Populate the outputs from the existing stack. @@ -371,7 +373,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { stackParams = heat.validateStackParams(stackParams, heatTemplate); } catch (IllegalArgumentException e) { String error = "Create Network: Configuration Error: " + e.getMessage(); - logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error, e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error, + e); // Input parameters were not valid throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -537,7 +540,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String.format( "UpdateNetwork: Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration", networkName, cloudSiteId, tenantId); - logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); // Set the detailed error as the Exception 'message' throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -569,8 +572,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (netInfo == null) { String error = String.format("Update Nework: Network %s does not exist in %s/%s", networkId, cloudSiteId, tenantId); - logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.BusinessProcesssError.getValue(), - error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NETWORK_NOT_FOUND, + ErrorCode.BusinessProcesssError.getValue(), error); // Does not exist. Throw an exception (can't update a non-existent network) throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -613,7 +616,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (heatStack == null || (heatStack.getStatus() == HeatStatus.NOTFOUND)) { String error = String.format("UpdateNetwork: Stack %s does not exist in %s/%s", networkName, cloudSiteId, tenantId); - logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.DataError.getValue(), + error); // Network stack does not exist. Return an error throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -644,7 +648,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { HeatTemplate heatTemplate = networkResource.getHeatTemplate(); if (heatTemplate == null) { String error = "Network error - undefined Heat Template. Network Type=" + networkType; - logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), + error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -672,7 +677,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { stackParams = heat.validateStackParams(stackParams, heatTemplate); } catch (IllegalArgumentException e) { String error = "UpdateNetwork: Configuration Error: Network Type=" + networkType; - logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), + error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e); } @@ -802,7 +808,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String.format( "Create/UpdateNetwork: Unable to get network resource with NetworkType: %s or ModelCustomizationUUID:%s", networkType, modelCustomizationUuid); - logger.error("{} {} {} ", MessageEnum.RA_UNKOWN_PARAM, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_UNKOWN_PARAM, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -814,8 +820,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // All Networks are orchestrated via HEAT or Neutron if (!("HEAT".equals(mode) || NEUTRON_MODE.equals(mode))) { String error = "CreateNetwork: Configuration Error: Network Type = " + networkType; - logger.error("{} {} {}", MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, ErrorCode.DataError.getValue(), - error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, + ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -836,7 +842,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { "Network Type:%s Version_Min:%s Version_Max:%s not supported on Cloud:%s with AIC_Version:%s", networkType, networkType, networkResource.getAicVersionMin(), networkResource.getAicVersionMax(), cloudSiteId, cloudSite.getCloudVersion()); - logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -845,7 +851,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { validateNetworkParams(neutronNetworkType, networkName, physicalNetworkName, vlans, routeTargets); if (!missing.isEmpty()) { String error = "Create Network: Missing parameters: " + missing; - logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -890,7 +896,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { || commonUtils.isNullOrEmpty(networkNameOrId)) { String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId"; - logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -899,7 +905,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String.format( "Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration", networkNameOrId, cloudSiteId, tenantId); - logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error); // Set the detailed error as the Exception 'message' throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -1017,7 +1023,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (commonUtils.isNullOrEmpty(cloudSiteId) || commonUtils.isNullOrEmpty(tenantId) || commonUtils.isNullOrEmpty(networkId)) { String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId"; - logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -1309,8 +1315,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { logger.debug("Json PolicyRefs Data:{}", jsonString); } catch (Exception e) { String error = "Error creating JsonNode for policyRefs Data"; - logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(), error, - e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MARSHING_ERROR, + ErrorCode.BusinessProcesssError.getValue(), error, e); throw new MsoAdapterException(error); } // update parameters @@ -1386,7 +1392,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { logger.debug("Json Subnet List:{}", jsonString); } catch (Exception e) { String error = "Error creating JsonNode from input subnets"; - logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, ErrorCode.DataError.getValue(), error, e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MARSHING_ERROR, ErrorCode.DataError.getValue(), error, + e); throw new MsoAdapterException(error); } // update parameters @@ -1432,7 +1439,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { curR = curR.replace("%subnetId%", subnet.getSubnetId()); } else { String error = "Missing Required AAI SubnetId for subnet in HEAT Template"; - logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), + error); throw new MsoAdapterException(error); } @@ -1446,7 +1454,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { curR = curR.replace("%cidr%", subnet.getCidr()); } else { String error = "Missing Required cidr for subnet in HEAT Template"; - logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), + error); throw new MsoAdapterException(error); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java index dea84abbf9..d523fedb28 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java @@ -36,6 +36,7 @@ import java.util.Optional; import java.util.concurrent.TimeUnit; import javax.jws.WebService; import javax.xml.ws.Holder; +import com.google.common.base.Strings; import org.apache.commons.collections.CollectionUtils; import org.onap.so.adapters.valet.GenericValetResponse; import org.onap.so.adapters.valet.ValetClient; @@ -267,7 +268,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Query VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, + logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId, OPENSTACK, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryStack", me); logger.debug(error); throw new VnfException(me); @@ -320,7 +321,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "DeleteVNF", ErrorCode.DataError.getValue(), "Exception - DeleteVNF", me); logger.debug(error); @@ -364,7 +365,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("RollbackVNF"); String error = "Rollback VNF: " + vnfId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudOwner, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - DeleteStack", me); logger.debug(error); @@ -642,8 +643,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } catch (MsoException me) { String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Exception - queryStack", me); logger.debug(error); // Failed to query the Stack due to an openstack exception. @@ -661,7 +662,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists"); logger.debug(error); @@ -672,7 +673,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // fail - it exists and is in a FAILED state String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists and is " + "in FAILED state"); logger.debug(error); @@ -684,7 +685,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state"); logger.debug(error); @@ -696,9 +697,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (failIfExists != null && failIfExists) { String error = "Create VF: Stack " + vfModuleName + " already exists in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), - vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", - ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists"); + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.DataError.getValue(), + "Stack " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId, heatStack.getCanonicalName()); @@ -728,7 +729,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("CreateVFModule"); String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "queryStack", ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested stack", me); logger.debug("ERROR trying to query nested stack= {}", error); @@ -737,7 +738,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) { String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 10), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "queryStack", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached heatStack ID " + "DOES NOT EXIST"); @@ -762,7 +763,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("CreateVFModule"); String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested base stack", me); @@ -772,7 +773,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) { String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 10), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached base heatStack ID DOES NOT EXIST"); @@ -801,7 +802,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { logger.debug("Unable to find vfModuleCust with modelCustomizationUuid={}", mcu); String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + mcu; - logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module ModelCustomizationUuid", modelCustomizationUuid, OPENSTACK, ErrorCode.DataError.getValue(), "Create VF Module: Unable to find vfModule with " + "modelCustomizationUuid=" + mcu); @@ -830,8 +831,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } if (vnfResource == null) { String error = "Create VNF: Unknown VNF Type: " + vnfType; - logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VNF Type", vnfType, - OPENSTACK, ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type"); + logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VNF Type", + vnfType, OPENSTACK, ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -904,8 +905,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion(); - logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, - ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_CONFIG_EXC.toString(), error, + OPENSTACK, ErrorCode.BusinessProcesssError.getValue(), + "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -940,8 +942,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", vnfResourceModelUuid=" + vnfResource.getModelUUID() + ", reqType=" + requestTypeString; - logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", - vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + "Heat Template " + "ID", vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -956,8 +958,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", vnfResourceModelUuid=" + vnfResource.getModelUUID() + ", reqType=" + requestTypeString; - logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", - OPENSTACK, ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + "Heat " + "Environment ID", OPENSTACK, ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -1133,8 +1135,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (checkRequiredParameters) { // Problem - missing one or more required parameters String error = "Create VFModule: Missing Required inputs: " + missingParams; - logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK, - ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_MISSING_PARAM.toString(), missingParams, + OPENSTACK, ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { @@ -1257,7 +1259,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("DeleteVFModule"); String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), "Exception - QueryStack", me); logger.debug(error); @@ -1285,7 +1287,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - deleteStack", me); logger.debug(error); @@ -1421,8 +1423,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("UpdateVFModule"); String error = "Update VFModule: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), "Exception - QueryStack", me); logger.debug(error); throw new VnfException(me); @@ -1433,8 +1435,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Not Found String error = "Update VF: Stack " + vfModuleName + " does not exist in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), error); throw new VnfNotFound(cloudSiteId, cloudOwner, tenantId, vfModuleName); } else { logger.debug("Found Existing stack, status={}", heatStack.getStatus()); @@ -1457,7 +1459,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("UpdateVFModule"); String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), "Exception - " + error, me); logger.debug("ERROR trying to query nested stack= {}", error); @@ -1466,9 +1468,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) { String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, - cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack", - ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 10), MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, + cloudSiteId, tenantId, error, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { @@ -1491,7 +1492,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("UpdateVfModule"); String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), "Exception - " + error, me); logger.debug("ERROR trying to query nested base stack= {}", error); @@ -1500,7 +1501,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) { String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 10), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, error, OPENSTACK, "QueryStack", ErrorCode.DataError.getValue(), error); logger.debug(error); @@ -1531,7 +1532,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } if (vf == null) { String error = "Update VfModule: unable to find vfModule with modelCustomizationUuid=" + mcu; - logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type", + logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type", vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -1612,8 +1613,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "VNF Resource type: " + vnfResource.getModelName() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + aicV; - logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, - ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_CONFIG_EXC.toString(), error, + OPENSTACK, ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -1644,7 +1645,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestTypeString; - logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", + logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -1654,7 +1655,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestTypeString; - logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -1862,8 +1863,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Problem - missing one or more required parameters if (checkRequiredParameters) { String error = "Update VNF: Missing Required inputs: " + missingParams; - logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK, - ErrorCode.DataError.getValue(), error); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_MISSING_PARAM.toString(), missingParams, + OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { logger.debug("found missing parameters - but checkRequiredParameters is false - will not block"); @@ -1882,7 +1883,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // This is not a valid parameter for this template extraParams.removeAll(paramList); if (!extraParams.isEmpty()) { - logger.warn("{} {} {} {} {} {}", MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType, + logger.warn(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType, extraParams.toString(), OPENSTACK, ErrorCode.DataError.getValue(), "Extra params"); inputs.keySet().removeAll(extraParams); } @@ -1946,7 +1947,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { me.addContext("UpdateVFModule"); String error = "Update VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudOwner, + logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, OPENSTACK, ErrorCode.DataError.getValue(), "Exception - " + error, me); if (isValetEnabled && sendResponseToValet) { logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet"); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index b21a1a0755..b4bf44643c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java @@ -32,6 +32,8 @@ import java.util.Optional; import java.util.Set; import javax.jws.WebService; import javax.xml.ws.Holder; +import com.google.common.base.Strings; +import com.woorea.openstack.heat.Heat; import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.cloud.CloudConfig; @@ -83,7 +85,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { private static final String CLOUDIFY = "Cloudify"; private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); - private static final String BRACKETS = "{} {} {} {} {} {} {} {} {}"; + private static final String BRACKETS = Strings.repeat("{} ", 9); private static final String OPENSTACK = "OpenStack"; @Autowired @@ -242,7 +244,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { long startTime = System.currentTimeMillis(); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { - logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf"); + logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf"); return; } @@ -509,7 +511,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { logger.debug("Missing required input: modelCustomizationUuid"); String error = "Create vfModule error: Missing required input: modelCustomizationUuid"; - logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module ModelCustomizationUuid", CLOUDIFY, ErrorCode.DataError.getValue(), "Create VF Module: Missing required input: modelCustomizationUuid"); logger.debug(error); @@ -572,7 +574,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + modelCustomizationUuid; logger.debug(error); - logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module " + "ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -608,7 +610,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion(); - logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -627,7 +629,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Failed to query the Deployment due to a cloudify exception. String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, + logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Exception - queryDeployment", me); logger.debug(error); @@ -820,7 +822,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestType; - logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", + logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -830,7 +832,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestType; - logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", OPENSTACK, ErrorCode.DataError.getValue(), error); // Alarm on this error, configuration must be fixed throw new VnfException(error, MsoExceptionCategory.INTERNAL); @@ -966,8 +968,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (checkRequiredParameters) { // Problem - missing one or more required parameters String error = "Create VFModule: Missing Required inputs: " + missingParams; - logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, CLOUDIFY, - ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_MISSING_PARAM.toString(), missingParams, + CLOUDIFY, ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { @@ -1029,7 +1031,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { catch (MsoException me) { me.addContext("CreateVFModule"); String error = "Create VF Module: Upload blueprint failed. Blueprint=" + blueprintName + ": " + me; - logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, + logger.error(Strings.repeat("{} ", 7), MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - uploadBlueprint", me); logger.debug(error); @@ -1056,7 +1058,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { me.addContext("CreateVFModule"); String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, + logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - createDeployment", me); logger.debug(error); @@ -1064,7 +1066,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } catch (NullPointerException npe) { String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + npe; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, + logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "NullPointerException - createDeployment", npe); logger.debug(error); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index 00b7e59404..b9053aaa23 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -42,6 +42,7 @@ import java.util.Optional; import java.util.Set; import javax.jws.WebService; import javax.xml.ws.Holder; +import com.google.common.base.Strings; import org.onap.so.adapters.vdu.CloudInfo; import org.onap.so.adapters.vdu.VduException; import org.onap.so.adapters.vdu.VduInstance; @@ -203,7 +204,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { e.addContext("QueryVNF"); String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + e; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner, cloudSiteId, tenantId, "VDU", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryVDU", e); logger.debug(error); @@ -254,7 +255,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { long startTime = System.currentTimeMillis(); // rollback may be null (e.g. if stack already existed when Create was called) if (rollback == null) { - logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf"); + logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf"); return; } @@ -291,7 +292,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { ve.addContext("RollbackVFModule"); String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + ve; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu", ve); logger.debug(error); @@ -546,7 +547,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) { logger.debug("Missing required input: modelCustomizationUuid"); String error = "Create vfModule error: Missing required input: modelCustomizationUuid"; - logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module ModelCustomizationUuid", "VDU", ErrorCode.DataError, "Create VF Module: " + "Missing required input: modelCustomizationUuid"); logger.debug(error); @@ -610,7 +611,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + modelCustomizationUuid; logger.debug(error); - logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), + logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", ErrorCode.DataError, error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -649,7 +650,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion(); - logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -671,9 +672,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Failed to query the VDU due to a plugin exception. String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), - "Exception - queryVdu", me); + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, + cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "Exception - queryVdu", + me); logger.debug(error); // Convert to a generic VnfException me.addContext("CreateVFModule"); @@ -690,9 +691,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // fail - it exists String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), - vfModuleName, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", - ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists"); + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), + "VF Module " + vfModuleName + " already exists"); logger.debug(error); throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, vduInstance.getVduInstanceId()); @@ -712,7 +713,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists"); logger.debug(error); @@ -722,7 +723,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // fail - it exists and is in a FAILED state String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists and is in FAILED state"); logger.debug(error); @@ -733,7 +734,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state"); logger.debug(error); @@ -744,7 +745,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists and is in an unknown state"); logger.debug(error); @@ -768,7 +769,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Failed to query the Volume Group VDU due to a plugin exception. String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(), "Exception - queryVdu(volume)", me); logger.debug(error); @@ -780,7 +781,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (volumeVdu == null || volumeVdu.getStatus().getState() == VduStateType.NOTFOUND) { String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, + logger.error(Strings.repeat("{} ", 10), MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached Volume Group " + "DOES NOT EXIST"); @@ -818,7 +819,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Failed to query the Base VF Module due to a Vdu Plugin exception. String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(Base)", ErrorCode.DataError.getValue(), "Exception - queryVdu(Base)", me); logger.debug(error); @@ -830,8 +831,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) { String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), - baseVfModuleId, cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)", + logger.error(Strings.repeat("{} ", 10), MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, + cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Base Module DOES NOT EXIST"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -864,7 +865,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID() + ", reqType=" + requestType; - logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", + logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType, "VNF", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); @@ -875,7 +876,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID() + ", reqType=" + requestType; - logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID", "OpenStack", ErrorCode.DataError.getValue(), error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { @@ -1009,8 +1010,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (checkRequiredParameters) { // Problem - missing one or more required parameters String error = "Create VFModule: Missing Required inputs: " + missingParams; - logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU", - ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_MISSING_PARAM.toString(), missingParams, + "VDU", ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { @@ -1046,7 +1047,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { me.addContext("CreateVFModule"); String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, + logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me); logger.debug(error); // Convert to a generic VnfException @@ -1054,7 +1055,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } catch (NullPointerException npe) { String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + npe; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, + logger.error(Strings.repeat("{} ", 8), MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(), "NullPointerException - instantiateVdu", npe); logger.debug(error); @@ -1105,7 +1106,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { e.addContext("QueryVFModule"); String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + e; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId, tenantId, "VDU", "QueryVFModule", ErrorCode.DataError.getValue(), "Exception - queryVDU", e); logger.debug(error); @@ -1131,7 +1132,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException String error = "Delete VF: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, + logger.error(Strings.repeat("{} ", 9), MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu: " + me.getMessage()); logger.debug(error); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java index 686410f14c..2254a149fe 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java @@ -40,6 +40,7 @@ import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.xml.ws.Holder; +import com.google.common.base.Strings; import org.apache.http.HttpStatus; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.vnf.exceptions.VnfException; @@ -183,7 +184,7 @@ public class VnfAdapterRest { response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value); } catch (VnfException e) { - logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_DELETE_VNF_ERR.toString(), ErrorCode.BusinessProcesssError.getValue(), "VnfException - Delete VNF Module", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId()); @@ -241,8 +242,8 @@ public class VnfAdapterRest { logger.debug("Query vfModule exit"); return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build(); } catch (VnfException e) { - logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule", - ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, + "queryVfModule", ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR) @@ -288,7 +289,7 @@ public class VnfAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR, "createVfModule", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_CREATE_VNF_ERR, "createVfModule", ErrorCode.BusinessProcesssError, "Exception - createVfModule", e); return Response.serverError().build(); } @@ -403,7 +404,7 @@ public class VnfAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule", ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e); return Response.serverError().build(); } @@ -507,7 +508,7 @@ public class VnfAdapterRest { t1.start(); } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller - logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule", ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); return Response.serverError().build(); } @@ -559,7 +560,7 @@ public class VnfAdapterRest { vnfAdapter.rollbackVnf(vrb); response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId()); } catch (VnfException e) { - logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcesssError, + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcesssError, "Exception" + " - " + "rollbackVfModule", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId()); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java index 5b831047ad..972305b033 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java @@ -39,6 +39,7 @@ import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.xml.ws.Holder; +import com.google.common.base.Strings; import org.apache.http.HttpStatus; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.vnf.exceptions.VnfException; @@ -84,7 +85,7 @@ public class VnfAdapterRestV2 { private static Logger logger = LoggerFactory.getLogger(VnfAdapterRestV2.class); private static final String TESTING_KEYWORD = "___TESTING___"; private static final String RESP = ", resp="; - private static final String BRACKETS = "{} {} {} {}"; + private static final String BRACKETS = Strings.repeat("{} ", 4); @Autowired private VnfAdapterRestUtils vnfAdapterRestUtils; @@ -199,7 +200,7 @@ public class VnfAdapterRestV2 { response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value); } catch (VnfException e) { - logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_DELETE_VNF_ERR.toString(), ErrorCode.BusinessProcesssError.getValue(), "VnfException - " + "Delete VNF Module", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId()); @@ -269,8 +270,8 @@ public class VnfAdapterRestV2 { logger.debug("Query vfModule exit"); return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build(); } catch (VnfException e) { - logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule", - ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, + "queryVfModule", ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR) @@ -610,7 +611,7 @@ public class VnfAdapterRestV2 { response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId()); } catch (VnfException e) { - logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId()); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java index a5e6a4558f..761116b4ab 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java @@ -323,7 +323,7 @@ public class HeatBridgeImpl implements HeatBridgeApi { } } catch (WebApplicationException e) { // Silently log that we failed to update the Pserver p-interface with PCI-ID - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION, pserverHostName, + logger.error(Strings.repeat("{} ", 9), MessageEnum.GENERAL_EXCEPTION, pserverHostName, matchingPifName.get(), cloudOwner, tenantId, "OpenStack", "Heatbridge", ErrorCode.DataError.getValue(), "Exception - Failed to add sriov-pf object to pserver", e); } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java index 02b44efe1c..8d97d85e43 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; +import com.google.common.base.Strings; import org.onap.so.db.request.beans.ArchivedInfraRequests; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.data.repository.ArchivedInfraRequestsRepository; @@ -145,8 +146,8 @@ public class ArchiveInfraRequestsScheduler { newArchivedReqs.add(archivedInfra); oldInfraReqs.add(iar); } catch (Exception e) { - logger.error("{} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), ErrorCode.UnknownError.getValue(), - e); + logger.error(Strings.repeat("{} ", 2), MessageEnum.RA_GENERAL_EXCEPTION.toString(), + ErrorCode.UnknownError.getValue(), e); } } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java index d48013b80d..b657e7ab26 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java @@ -30,6 +30,7 @@ import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceFeature; +import com.google.common.base.Strings; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -59,19 +60,19 @@ public class SDNCAdapterService extends Service { try { wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCAdapter.wsdl"); } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL, + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL, ErrorCode.DataError.getValue(), "Exception - WSDL not found", e); } if (wsdlUrl == null) { - logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL, + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL, ErrorCode.DataError.getValue(), "WSDL not found"); } else { try { - logger.info("{} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL, + logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL, wsdlUrl.toURI().toString()); } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_ADAPTER_WSDL, - ErrorCode.DataError.getValue(), "Exception - print URL", e); + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), + SDNC_ADAPTER_WSDL, ErrorCode.DataError.getValue(), "Exception - print URL", e); } } WSDL_LOCATION = wsdlUrl; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java index 97a6860dfe..c9976686b6 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java @@ -31,6 +31,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; +import com.google.common.base.Strings; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -122,8 +123,8 @@ public class SDNCAdapterCallbackRequest { m.marshal(this, w); return w.toString(); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.RA_MARSHING_ERROR.toString(), ErrorCode.DataError.getValue(), - "Exception - MARSHING_ERROR", e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MARSHING_ERROR.toString(), + ErrorCode.DataError.getValue(), "Exception - MARSHING_ERROR", e); } return ""; } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java index 72d18bd1ce..f19c403861 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java @@ -29,6 +29,7 @@ import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceFeature; +import com.google.common.base.Strings; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -57,18 +58,18 @@ public class SDNCCallbackAdapterService extends Service { wsdlUrl = Thread.currentThread().getContextClassLoader() .getResource("main/resources/SDNCCallbackAdapter.wsdl"); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", - ErrorCode.DataError.getValue(), "Exception - WSDL not found", e); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, + "SDNC", ErrorCode.DataError.getValue(), "Exception - WSDL not found", e); } if (wsdlUrl == null) { - logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", - ErrorCode.DataError.getValue(), "WSDL not found"); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, + "SDNC", ErrorCode.DataError.getValue(), "WSDL not found"); } else { try { - logger.info("{} {} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL, + logger.info(Strings.repeat("{} ", 4), MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL, wsdlUrl.toURI().toString(), "SDNC"); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", ErrorCode.DataError.getValue(), "Exception - URL convention problem", e); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java index 2d43385700..d958f8cc7f 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java @@ -23,6 +23,7 @@ package org.onap.so.adapters.sdnc.impl; +import com.google.common.base.Strings; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -69,7 +70,7 @@ public class MapRequestTunables { String[] parts = value.split("\\|"); // escape pipe if (parts.length < 3) { - logger.warn("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC", + logger.warn(Strings.repeat("{} ", 6), MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC", ErrorCode.DataError.getValue(), "Invalid config"); } @@ -105,7 +106,7 @@ public class MapRequestTunables { error = "Missing configuration for:" + key; } if (error != null) { - logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC", + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC", ErrorCode.DataError.getValue(), "Missing config param"); } logger.debug("RequestTunables Key:{} Value:{} Tunables:{}", key, value, this.toString()); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java index 3e3ec6f9bb..6daaab5abd 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java @@ -25,6 +25,7 @@ package org.onap.so.adapters.sdnc.impl; import javax.annotation.PostConstruct; import javax.jws.WebService; import javax.servlet.http.HttpServletResponse; +import com.google.common.base.Strings; import org.onap.so.adapters.sdnc.SDNCAdapterPortType; import org.onap.so.adapters.sdnc.SDNCAdapterRequest; import org.onap.so.adapters.sdnc.SDNCAdapterResponse; @@ -51,7 +52,8 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { @PostConstruct public void init() { - logger.info("{} {} {}", MessageEnum.RA_INIT_SDNC_ADAPTER.toString(), "SDNC", "SDNCAdapterPortType"); + logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_INIT_SDNC_ADAPTER.toString(), "SDNC", + "SDNCAdapterPortType"); } /** @@ -71,7 +73,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { sdncClient.executeRequest(bpelRequest); } catch (Exception e) { String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage(); - logger.error("{} {} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC", ErrorCode.DataError.getValue(), respMsg, e); SDNCResponse sdncResp = new SDNCResponse(bpelReqId); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java index 7d412b77ad..9c77a38b0b 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java @@ -45,6 +45,7 @@ import javax.xml.ws.handler.MessageContext; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; +import com.google.common.base.Strings; import org.onap.so.logger.ErrorCode; import org.onap.so.utils.CryptoUtils; import org.onap.so.adapters.sdnc.SDNCAdapterRequest; @@ -89,7 +90,7 @@ public class SDNCRestClient { try { Thread.sleep(5000); } catch (InterruptedException e) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC", ErrorCode.UnknownError.getValue(), "Exception processing request to SDNC", e); Thread.currentThread().interrupt(); @@ -176,7 +177,7 @@ public class SDNCRestClient { logger.info("{} :\n {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.name(), sdncResp.toString(), "SDNC"); return (sdncResp); } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", ErrorCode.BusinessProcesssError.getValue(), "Exception processing request to SDNC", e); // default sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR); @@ -213,9 +214,10 @@ public class SDNCRestClient { eType = xpath.evaluate("error-type", error); sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType); } catch (Exception e3) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), - "error-type", error.toString(), "SDNC", ErrorCode.DataError.getValue(), - EXCEPTION_MSG, e3); + logger.error(Strings.repeat("{} ", 6), + MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type", + error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG, + e3); } String eTag = null; @@ -223,9 +225,10 @@ public class SDNCRestClient { eTag = xpath.evaluate("error-tag", error); sdncErrMsg.append(", error-tag:").append(eTag); } catch (Exception e3) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), - "error-tag", error.toString(), "SDNC", ErrorCode.DataError.getValue(), - EXCEPTION_MSG, e3); + logger.error(Strings.repeat("{} ", 6), + MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag", + error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG, + e3); } String eMsg = null; @@ -233,18 +236,19 @@ public class SDNCRestClient { eMsg = xpath.evaluate("error-message", error); sdncErrMsg.append(", error-message:").append(eMsg).append("]"); } catch (Exception e3) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), - "error-message", error.toString(), "SDNC", ErrorCode.DataError.getValue(), - EXCEPTION_MSG, e3); + logger.error(Strings.repeat("{} ", 6), + MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message", + error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG, + e3); } } } catch (Exception e2) { - logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC", ErrorCode.DataError.getValue(), "Exception while analyse error", e2); } } // is != null } catch (Exception e1) { - logger.error("{} {} {} {}", MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC", ErrorCode.BusinessProcesssError.getValue(), "Exception while get SDNC response", e1); } } // con != null @@ -256,7 +260,7 @@ public class SDNCRestClient { sdncResp.setRespMsg(respMsg); - logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", ErrorCode.AvailabilityError.getValue(), "Exception while communicate with SDNC", e); return sdncResp; @@ -282,7 +286,7 @@ public class SDNCRestClient { try { wsdlUrl = new URL(bpelUrl); } catch (MalformedURLException e1) { - logger.error("{} {} {} {}", MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA, + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA, ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1); } @@ -310,7 +314,7 @@ public class SDNCRestClient { reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers); headers.put("Authorization", Collections.singletonList(basicAuth)); } catch (Exception e2) { - logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA, + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA, ErrorCode.BusinessProcesssError.getValue(), "Exception - Unable to set authorization in callback request", e2); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java index 52164bdac7..f83f0bfede 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java @@ -31,6 +31,7 @@ import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import com.google.common.base.Strings; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -97,7 +98,7 @@ public class Utils { return s; } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e); } return null; @@ -131,7 +132,7 @@ public class Utils { return s; } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", ErrorCode.DataError.getValue(), "Exception in genSdncPutReq", e); } return null; @@ -166,7 +167,7 @@ public class Utils { return s; } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC", ErrorCode.DataError.getValue(), "Exception in genMsoFailResp", e); } return null; @@ -191,7 +192,7 @@ public class Utils { s = s.replaceAll("xmlns=\"\"", ""); return s; } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), ErrorCode.DataError.getValue(), "Exception - domToStr", e); } } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java index 6808230474..1d96e7ae85 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java @@ -25,6 +25,7 @@ package org.onap.so.adapters.sdnc.sdncrest; import javax.xml.bind.DatatypeConverter; +import com.google.common.base.Strings; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; @@ -92,8 +93,8 @@ public class BPRestCallback { public boolean send(String url, String message) { logger.debug(getClass().getSimpleName() + ".send(" + "url=" + url + " message=" + message + ")"); - logger.info("{} {} {}", MessageEnum.RA_CALLBACK_BPEL.toString(), message == null ? "[no content]" : message, - CAMUNDA); + logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_CALLBACK_BPEL.toString(), + message == null ? "[no content]" : message, CAMUNDA); HttpPost method = null; HttpResponse httpResponse = null; @@ -123,7 +124,7 @@ public class BPRestCallback { method.setHeader(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); method.setHeader(ONAPLogConstants.Headers.PARTNER_NAME, "SO-SDNCAdapter"); } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA, + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA, ErrorCode.BusinessProcesssError.getValue(), "Unable to set authorization in callback request", e); error = true; @@ -141,14 +142,14 @@ public class BPRestCallback { if (httpResponse.getStatusLine().getStatusCode() >= 300) { String msg = "Received error response to callback request: " + httpResponse.getStatusLine(); - logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, ErrorCode.BusinessProcesssError.getValue(), msg); } } return true; } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, ErrorCode.BusinessProcesssError.getValue(), "Error sending callback request", e); return false; } finally { @@ -168,7 +169,7 @@ public class BPRestCallback { logger.debug("Exception:", e); } } - logger.info("{} {}", MessageEnum.RA_CALLBACK_BPEL_COMPLETE.toString(), CAMUNDA); + logger.info(Strings.repeat("{} ", 2), MessageEnum.RA_CALLBACK_BPEL_COMPLETE.toString(), CAMUNDA); } } } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java index 70943c206f..1eabedb185 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java @@ -23,6 +23,7 @@ package org.onap.so.adapters.sdnc.sdncrest; +import com.google.common.base.Strings; import org.onap.so.adapters.sdnc.exception.SDNCAdapterException; import org.onap.so.adapters.sdnc.impl.Constants; import org.onap.so.logger.ErrorCode; @@ -54,8 +55,8 @@ public class MapTypedRequestTunablesData { if ("".equals(value)) { error = MISSING_CONFIGURATION_ERROR_MSG + reqTunable.getKey(); - logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), reqTunable.getKey(), - "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), + reqTunable.getKey(), "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); throw new SDNCAdapterException(error); } @@ -64,8 +65,8 @@ public class MapTypedRequestTunablesData { if (parts.length != 5) { error = "Invalid configuration for: " + reqTunable.getKey(); - logger.error("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(), value, - "SDNC", ErrorCode.DataError.getValue(), "Invalid config"); + logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(), + value, "SDNC", ErrorCode.DataError.getValue(), "Invalid config"); throw new SDNCAdapterException(error); } @@ -80,7 +81,7 @@ public class MapTypedRequestTunablesData { if ("".equals(reqTunable.getSdncUrl())) { error = MISSING_CONFIGURATION_ERROR_MSG + urlPropKey; - logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC", + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); throw new SDNCAdapterException(error); @@ -98,8 +99,8 @@ public class MapTypedRequestTunablesData { if ("".equals(reqTunable.getMyUrl())) { error = MISSING_CONFIGURATION_ERROR_MSG + Constants.MY_URL_PROP; - logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.MY_URL_PROP, - "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), + Constants.MY_URL_PROP, "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG); throw new SDNCAdapterException(error); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java index a7c65d87a4..c258b72007 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java @@ -34,6 +34,7 @@ import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; +import com.google.common.base.Strings; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; @@ -159,7 +160,8 @@ public abstract class SDNCConnector { method = null; - logger.info("{} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), responseContent, "SDNC"); + logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), responseContent, + "SDNC"); return createResponseFromContent(statusCode, statusMessage, responseContent, rt); } catch (SocketTimeoutException | ConnectTimeoutException e) { @@ -192,12 +194,12 @@ public abstract class SDNCConnector { } protected void logError(String errMsg) { - logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", ErrorCode.AvailabilityError.getValue(), errMsg); } protected void logError(String errMsg, Throwable t) { - logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC", ErrorCode.AvailabilityError.getValue(), errMsg, t); } @@ -283,7 +285,7 @@ public abstract class SDNCConnector { String errorType = xpath.evaluate("error-type", error); info += "error-type:" + errorType; } catch (XPathExpressionException e) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type", + logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type", error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e); } @@ -294,7 +296,7 @@ public abstract class SDNCConnector { } info += "error-tag:" + errorTag; } catch (XPathExpressionException e) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag", + logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag", error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e); } @@ -305,8 +307,9 @@ public abstract class SDNCConnector { } info += "error-message:" + errorMessage; } catch (Exception e) { - logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message", - error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e); + logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), + "error-message", error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, + e); } if (!info.isEmpty()) { @@ -318,7 +321,7 @@ public abstract class SDNCConnector { } } } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC", ErrorCode.DataError.getValue(), "Exception while analyzing errors", e); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java index 7e82adf064..022fb7bf89 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java @@ -31,6 +31,7 @@ import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import com.google.common.base.Strings; import org.apache.http.HttpStatus; import org.onap.so.adapters.sdnc.exception.SDNCAdapterException; import org.onap.so.adapters.sdncrest.RequestInformation; @@ -185,7 +186,7 @@ public class SDNCServiceRequestTask { addTextChild(agnosticServiceInformation, "content-type", contentType); addTextChild(agnosticServiceInformation, "anydata", anydata); } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC", ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e); return null; } @@ -204,8 +205,8 @@ public class SDNCServiceRequestTask { transformer.transform(new DOMSource(doc), new StreamResult(writer)); xml = writer.toString(); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), ErrorCode.DataError.getValue(), - "Exception - domToStr", e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), + ErrorCode.DataError.getValue(), "Exception - domToStr", e); return null; } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java index 3921891ced..31187c568f 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java @@ -31,6 +31,7 @@ import javax.ws.rs.PathParam; 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.adapters.sdnc.impl.Constants; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; @@ -61,14 +62,14 @@ public class SNIROResponse { @Consumes("*/*") @Produces({MediaType.TEXT_PLAIN}) public Response serviceNotification(@PathParam("correlator") String correlator, String content) { - logger.info("{} {} {} {}", MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC", + logger.info(Strings.repeat("{} ", 4), MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC", "SDNCNotify/SNIROResponse"); String bpUrl = env.getProperty(Constants.BPEL_REST_URL_PROP, ""); if (bpUrl == null || ("").equals(bpUrl)) { String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; - logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.BPEL_REST_URL_PROP, "SDNC", ErrorCode.DataError.getValue(), "Missing config param"); return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build(); diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java index cefaadbb63..efc0a303c0 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java @@ -24,6 +24,7 @@ package org.onap.so.adapters.vfc.util; import java.io.IOException; +import com.google.common.base.Strings; import org.onap.so.adapters.vfc.constant.HttpCode; import org.onap.so.adapters.vfc.exceptions.ApplicationException; import org.onap.so.logger.ErrorCode; @@ -83,8 +84,8 @@ public class JsonUtil { try { return MAPPER.readValue(jsonstr, type); } catch (IOException e) { - logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(), - UNMARSHAL_FAIL_MSG, e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NS_EXC.toString(), + ErrorCode.BusinessProcesssError.getValue(), UNMARSHAL_FAIL_MSG, e); throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG); } } @@ -101,8 +102,8 @@ public class JsonUtil { try { return MAPPER.readValue(jsonstr, type); } catch (IOException e) { - logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(), - UNMARSHAL_FAIL_MSG, e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NS_EXC.toString(), + ErrorCode.BusinessProcesssError.getValue(), UNMARSHAL_FAIL_MSG, e); throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG); } } @@ -118,8 +119,8 @@ public class JsonUtil { try { return MAPPER.writeValueAsString(srcObj); } catch (IOException e) { - logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(), - "fail to marshal json", e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_NS_EXC.toString(), + ErrorCode.BusinessProcesssError.getValue(), "fail to marshal json", e); throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!"); } } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java index 1e61d4deb2..a84785bcad 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java @@ -27,6 +27,7 @@ package org.onap.so.adapters.vfc.util; import java.net.HttpURLConnection; import java.net.SocketTimeoutException; import javax.ws.rs.core.UriBuilder; +import com.google.common.base.Strings; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; @@ -194,12 +195,12 @@ public class RestfulUtil { } private static void logError(String errMsg, Throwable t) { - logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, ErrorCode.AvailabilityError.getValue(), errMsg, t); } private static void logError(String errMsg) { - logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, + logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER, ErrorCode.AvailabilityError.toString(), errMsg); } 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"); diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index b98e395228..81d0e678ac 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -134,13 +135,13 @@ class AaiUtil { } logger.debug("Cloud Region value for code='404' of " + backend + " is: " + regionId) }else{ - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Call AAI Cloud Region is NOT Successful.", "BPMN", ErrorCode.UnknownError.getValue()); throw new BpmnError("MSOWorkflowException") } }catch(Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured while getting the Cloud Reqion.", "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage()); (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage()) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy index e0e85e9629..37b7aa6d60 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.logger.ErrorCode @@ -195,7 +196,7 @@ class AllottedResourceUtils { AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build()) getAAIClient().update(uri,allottedResource) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in updateAR.", "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage()); exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage()) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy index 4a59b9789a..03598060d7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.json.JsonUtils @@ -120,7 +121,7 @@ public class AppCClient extends AbstractServiceTaskProcessor{ appcMessage = client.getErrorMessage() } catch (BpmnError e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); appcMessage = e.getMessage() diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index d5b0b31a39..d7bf357dbb 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.apache.commons.lang3.StringUtils import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray @@ -80,7 +81,7 @@ class CatalogDbUtils { } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", ErrorCode.UnknownError.getValue(), e.message); throw e @@ -118,7 +119,7 @@ class CatalogDbUtils { return getResponseFromCatalogDb(execution, endPoint) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", ErrorCode.UnknownError.getValue(), e.message); throw e @@ -142,7 +143,7 @@ class CatalogDbUtils { } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", ErrorCode.UnknownError.getValue(), e.message); throw e @@ -168,7 +169,7 @@ class CatalogDbUtils { } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in Querying Catalog DB", "BPMN", ErrorCode.UnknownError.getValue(), e.message); throw e @@ -218,7 +219,7 @@ class CatalogDbUtils { logger.debug("Returning networks JSON: " + modelInfosString) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } @@ -297,7 +298,7 @@ class CatalogDbUtils { logger.debug("Returning vnfs JSON: " + modelInfosString) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } @@ -351,7 +352,7 @@ class CatalogDbUtils { logger.debug("Returning allottedResources JSON: " + modelInfosString) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } @@ -380,7 +381,7 @@ class CatalogDbUtils { logger.debug("Returning serviceResources JSON: " + serviceResourcesObject.toString()) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception in parsing Catalog DB Response", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } @@ -428,7 +429,7 @@ class CatalogDbUtils { modelJson.put("modelInfo", modelInfo) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception while parsing model information", "BPMN", ErrorCode.UnknownError.getValue(), e.message); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy index a9e01c7191..c7de756789 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.logger.ErrorCode @@ -74,7 +75,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } @@ -236,7 +237,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -269,7 +270,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { logger.debug("Rethrowing MSOWorkflowException") throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -307,7 +308,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index 6a82512d88..da952ce6d7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -130,7 +130,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ // generates a WorkflowException if the A&AI query returns a response code other than 200/404 public void handleAAIQueryFailure(DelegateExecution execution) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(com.google.common.base.Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"), "BPMN", ErrorCode.UnknownError.getValue(), "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse")); @@ -140,7 +140,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ public void handleVolumeGroupNameNoMatch(DelegateExecution execution) { def errorNotAssociated = "Error occurred - volume group id ${execution.getVariable('CVGN_volumeGroupId')} " + "is not associated with ${execution.getVariable('CVGN_volumeGroupName')}" - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorNotAssociated, "BPMN", + logger.error(com.google.common.base.Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorNotAssociated, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy index 7c1c0a0490..011fcb68e6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.VolumeGroup @@ -105,7 +106,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ }catch(BpmnError b){ throw b }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing queryAAIForVolumeGroup.", "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage()); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.") @@ -127,7 +128,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ logger.debug("Volume Heat Stack Id is: " + heatStackId) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing assignVolumeHeatId.", "BPMN", ErrorCode.UnknownError.getValue(), e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.") @@ -147,7 +148,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing assignWorkflowException.", "BPMN", ErrorCode.UnknownError.getValue(), e); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy index e9e7d1ed7c..c496adfe83 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.apache.commons.lang.StringUtils import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf @@ -423,7 +424,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ // generates a WorkflowException when the A&AI query returns a response code other than 200 or 404 public void handleAAIQueryFailure(DelegateExecution execution) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), "BPMN", ErrorCode.UnknownError.getValue()); int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") @@ -475,7 +476,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ errorCode = 2000 } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred during CreateAAIVfModule flow", "BPMN", ErrorCode.UnknownError.getValue(), errorResponse); exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy index 4bce23eff7..93307867a0 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy @@ -21,6 +21,8 @@ */ package org.onap.so.bpmn.common.scripts + +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.so.client.aai.AAIObjectType @@ -204,7 +206,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ // generates a WorkflowException if the A&AI query returns a response code other than 200 public void handleAAIQueryFailure(DelegateExecution execution) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred attempting to query AAI, Response Code " + execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("DAAIVfMod_queryGenericVnfResponse"), "BPMN", ErrorCode.UnknownError.getValue()); def errorCode = 5000 @@ -251,7 +253,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ } } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error occurred during DeleteAAIVfModule flow", "BPMN", ErrorCode.UnknownError.getValue(), errorResponse); exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse) @@ -261,7 +263,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ // generates a WorkflowException if // - the A&AI Generic Vnf DELETE returns a response code other than 200 public void handleDeleteGenericVnfFailure(DelegateExecution execution) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf", "BPMN", ErrorCode.UnknownError.getValue(), execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")); diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy index 30dbeb09d5..b4f6f36876 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.* @@ -91,7 +92,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { buildWorkflowException(execution, 5000, modifiedErrorMessage) wfex = execution.getVariable("WorkflowException") - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", ErrorCode.UnknownError.getValue(), wfex.errorMessage); return wfex } else { @@ -104,7 +105,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { logger.debug("mappedErrorMessage " + mappedErrorMessage) wfex = execution.getVariable("WorkflowException") - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", ErrorCode.UnknownError.getValue(), wfex.errorMessage); return wfex } catch(Exception ex) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy index 2ceec3cb44..a979ceab31 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.ErrorCode @@ -97,7 +98,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { execution.setVariable("FH_ResponseCode", "") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -210,7 +211,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { execution.setVariable("FH_content_type", "text/xml") } } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -244,7 +245,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { execution.setVariable("FH_updateRequestPayload", payload) return execution.getVariable("FH_updateRequestPayload") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -275,7 +276,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { logger.debug("updateRequestInfraPayload: " + payload) return execution.getVariable("FH_updateRequestInfraPayload") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -306,7 +307,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { logger.debug("updateRequestGammaPayload: " + payload) return execution.getVariable("FH_updateRequestGammaPayload") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -335,7 +336,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { logger.debug("updateResponseStatusPayload: " + payload) return execution.getVariable("FH_updateResponseStatusPayload") } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -355,7 +356,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { def errorCode = responseCode == null ? 7000 : 7020 // exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) @@ -390,7 +391,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { logger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse) } catch (Exception e) { // Do NOT throw WorkflowException! - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index f008130c32..cee1e2ab0c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -158,7 +159,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage()) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy index 27fe33f5ea..78fa1de861 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.*; @@ -289,7 +290,7 @@ public class ManualHandling extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -341,11 +342,11 @@ public class ManualHandling extends AbstractServiceTaskProcessor { } catch (BpmnError e) { msg = "BPMN error in createAOTSTicket " + ex.getMessage() - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); } catch (Exception ex){ msg = "Exception in createAOTSTicket " + ex.getMessage() - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); } logger.trace("Exit createAOTSTicket of ManualHandling ") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy index f371ccef4d..5a328a5c72 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import java.text.SimpleDateFormat @@ -294,10 +295,10 @@ class MsoUtils { if ("INFO"==logmode) { logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN"); } else if ("WARN"==logmode) { - logger.warn ("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN", + logger.warn (Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN", ErrorCode.UnknownError.getValue(), logtxt); } else if ("ERROR"==logmode) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN", ErrorCode.UnknownError.getValue(), logtxt); } else { logger.debug(logtxt); diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy index a0da6870ae..84ab8fbb5d 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy @@ -20,8 +20,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.common.scripts; +package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings; import groovy.json.* import org.apache.commons.lang3.* @@ -66,7 +67,7 @@ public void preProcessRequest (DelegateExecution execution) { if ((timeout == null) || (timeout.isEmpty())) { String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\'' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -77,7 +78,7 @@ public void preProcessRequest (DelegateExecution execution) { if ((messageType == null) || (messageType.isEmpty())) { String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\'' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -88,7 +89,7 @@ public void preProcessRequest (DelegateExecution execution) { if ((correlator == null) || (correlator.isEmpty())) { String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\'' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -100,7 +101,7 @@ public void preProcessRequest (DelegateExecution execution) { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy index a7bb707dff..abd43289ad 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy @@ -20,7 +20,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.common.scripts; +package org.onap.so.bpmn.common.scripts + +import com.google.common.base.Strings; import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.ErrorCode; @@ -73,7 +75,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable("BasicAuthHeaderValue",encodedString) } catch (IOException ex) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Unable to encode username password string", "BPMN", ErrorCode.UnknownError.getValue()); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index fdd53b2f05..9bda572d58 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -86,7 +87,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) { String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -107,7 +108,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (sdncRequestId == null || sdncRequestId.isEmpty()) { String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -122,7 +123,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) { String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -139,7 +140,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } else { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -154,7 +155,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { if (basicAuthValue == null || basicAuthValue.isEmpty()) { logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", ErrorCode.UnknownError.getValue()); } else { @@ -163,7 +164,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) } catch (IOException ex) { logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", ErrorCode.UnknownError.getValue(), ex); } @@ -195,7 +196,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -243,7 +244,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } else { String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -257,7 +258,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg, e) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -368,7 +369,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -394,7 +395,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy index e56091ad65..1c1c1f82b9 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import java.text.SimpleDateFormat @@ -85,7 +86,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) { String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined' logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -106,7 +107,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (sdncRequestId == null || sdncRequestId.isEmpty()) { String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -121,7 +122,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) { String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -132,7 +133,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { } else { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -150,7 +151,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { if (basicAuthValue == null || basicAuthValue.isEmpty()) { logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", ErrorCode.UnknownError.getValue()); } else { @@ -159,7 +160,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) } catch (IOException ex) { logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", ErrorCode.UnknownError.getValue(), ex); } @@ -191,7 +192,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e logger.debug(msg) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy index eb832224db..bcf53344e1 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy @@ -20,8 +20,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.common.scripts; +package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings; import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.L3Network @@ -257,7 +258,7 @@ class SDNCAdapterUtils { def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) if (callbackUrl == null || callbackUrl.trim() == "") { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", ErrorCode.UnknownError.getValue()); workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code? @@ -395,7 +396,7 @@ class SDNCAdapterUtils { def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution) if (callbackUrl == null || callbackUrl.trim() == "") { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") @@ -468,7 +469,7 @@ class SDNCAdapterUtils { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error") @@ -973,7 +974,7 @@ class SDNCAdapterUtils { } }else { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING, + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ', "BPMN", ErrorCode.UnknownError, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ') @@ -983,7 +984,7 @@ class SDNCAdapterUtils { } if (response == null || response.trim().equals("")) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING, + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter workflow response is empty', "BPMN", ErrorCode.UnknownError, 'sdncAdapter workflow response is empty') execution.setVariable("L3HLAB_rollback", true) @@ -996,7 +997,7 @@ class SDNCAdapterUtils { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught ' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught ' + 'exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable(prefix+"ResponseCode",400) execution.setVariable("L3HLAB_rollback", true) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy index 615c977a1e..ed222d9ac6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.onap.so.logger.ErrorCode @@ -215,7 +216,7 @@ class TrinityExceptionUtil { if(message != null) { execution.setVariable(prefix+"ErrorResponse",message) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", ErrorCode.UnknownError.getValue(), execution.getVariable(prefix+"ErrorResponse")); return message @@ -311,7 +312,7 @@ class TrinityExceptionUtil { execution.setVariable(prefix+"err", myErr) execution.setVariable(prefix+"errTxt", messageTxt) execution.setVariable(prefix+"errVariables", msgVars) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN", ErrorCode.UnknownError.getValue(), execution.getVariable(prefix+"ErrorResponse")); return message diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index a40bf59097..82c1e4fa6e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf @@ -182,7 +183,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { if (newPersonaModelId != null || newPersonaModelVersion != null) { if (newPersonaModelId != genericVnf.getModelInvariantId()) { def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values' - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()) throw new Exception(msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy index c4ef165f63..0e8631e7b4 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode; import javax.xml.parsers.DocumentBuilder @@ -110,7 +111,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { } } } catch (Exception e) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(), 'Exception transforming network params to vnfNetworks', "BPMN", ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e); } @@ -149,7 +150,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { entries = entries + entry } } catch (Exception e) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(), 'Exception transforming params to entries', "BPMN", ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); } @@ -190,7 +191,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { } } } catch (Exception e) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), + logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(), 'Exception transforming params to entries', "BPMN", ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index 9215eabc57..6cdd3f39db 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -78,7 +79,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (messageId == null || messageId.isEmpty()) { String msg = getProcessKey(execution) + ': no messageId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -92,7 +93,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (notificationUrl == null || notificationUrl.isEmpty()) { String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -106,7 +107,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) { String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -124,7 +125,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -137,7 +138,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -146,7 +147,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleId == null || vfModuleId.isEmpty()) { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -160,7 +161,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -169,7 +170,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleId == null || vfModuleId.isEmpty()) { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -183,7 +184,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleRollbackNode == null) { String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -192,7 +193,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vnfId == null || vnfId.isEmpty()) { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -201,7 +202,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (vfModuleId == null || vfModuleId.isEmpty()) { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -222,7 +223,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (volumeGroupId == null || volumeGroupId.isEmpty()) { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -238,7 +239,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (volumeGroupId == null || volumeGroupId.isEmpty()) { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -254,7 +255,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { if (volumeGroupId == null || volumeGroupId.isEmpty()) { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -267,7 +268,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { } else { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -284,7 +285,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) if (basicAuthValue == null || basicAuthValue.isEmpty()) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", ErrorCode.UnknownError.getValue()); } else { @@ -292,7 +293,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) } catch (IOException ex) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", "BPMN", ErrorCode.UnknownError.getValue(), ex); } @@ -303,7 +304,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { throw e } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) @@ -355,7 +356,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { response = httpClient.delete(vnfAdapterRequest) } else { String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -368,7 +369,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { throw e } catch (Exception e) { String msg = 'Caught exception in ' + method + ": " + e - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy index c947bf2e65..42f1b6f1ba 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.core.WorkflowException @@ -86,7 +87,7 @@ class VnfAdapterUtils { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage()) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java index b9200e0640..b9ee3608c5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -25,6 +25,7 @@ package org.onap.so.bpmn.common.recipe; import java.io.IOException; import java.security.GeneralSecurityException; import javax.xml.bind.DatatypeConverter; +import com.google.common.base.Strings; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; @@ -181,8 +182,8 @@ public class BpmnRestClient { jsonReq = recipeRequest.toString(); logger.trace("request body is {}", jsonReq); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest", - ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); + logger.error(Strings.repeat("{} ", 5), MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", + "wrapVIDRequest", ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java index 33fb78b306..f4df010b08 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java @@ -25,6 +25,7 @@ package org.onap.so.bpmn.common.workflow.context; import java.util.concurrent.DelayQueue; import java.util.concurrent.TimeUnit; +import com.google.common.base.Strings; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -130,7 +131,7 @@ public class WorkflowContextHolder { Thread.currentThread().interrupt(); } catch (Exception e) { logger.debug("WorkflowContextHolder timeout thread caught exception: ", e); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread"); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 870b936f5c..52bec2e14f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; +import com.google.common.base.Strings; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.aai.domain.yang.LInterface; @@ -75,7 +76,7 @@ public class ExceptionBuilder { } } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { @@ -106,7 +107,7 @@ public class ExceptionBuilder { break; } } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java index 7c0c2f20b3..c3349dd9e2 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.common.base.Strings; import org.camunda.bpm.engine.MismatchingMessageCorrelationException; import org.camunda.bpm.engine.OptimisticLockingException; import org.camunda.bpm.engine.RuntimeService; @@ -207,7 +208,7 @@ public class CallbackHandlerService { + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "'; last exception was:" + queryException; logger.debug(msg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), msg, queryException); } @@ -245,8 +246,8 @@ public class CallbackHandlerService { String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + ole; logger.debug(msg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", - ErrorCode.UnknownError.getValue(), msg, ole); + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + "BPMN CORRELATION ERROR -", ErrorCode.UnknownError.getValue(), msg, ole); // Retry for OptimisticLocking Exceptions int retryCount = 0; @@ -279,7 +280,7 @@ public class CallbackHandlerService { String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex; logger.debug(strMsg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), strMsg, olex); } catch (Exception excep) { retryCount = 0; @@ -287,7 +288,7 @@ public class CallbackHandlerService { String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep; logger.debug(strMsg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), strMsg, excep); } @@ -300,7 +301,7 @@ public class CallbackHandlerService { + " after receiving " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + e; logger.debug(msg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), msg, e); } } catch (Exception e) { @@ -309,8 +310,8 @@ public class CallbackHandlerService { String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + e; logger.debug(msg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", - ErrorCode.UnknownError.getValue(), msg, e); + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + "BPMN CORRELATION ERROR -", ErrorCode.UnknownError.getValue(), msg, e); } return true; @@ -345,10 +346,10 @@ public class CallbackHandlerService { */ protected void logCallbackError(String method, long startTime, String msg, Exception e) { if (e == null) { - logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), msg); } else { - logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", ErrorCode.UnknownError.getValue(), msg, e); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java index 1e9ebdf0b2..da18ac2f40 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java @@ -32,6 +32,7 @@ import javax.ws.rs.PathParam; 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.bpmn.common.workflow.service.CallbackHandlerService.CallbackError; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; import org.onap.so.logger.ErrorCode; @@ -78,7 +79,7 @@ public class WorkflowMessageResource { if (messageType == null || messageType.isEmpty()) { String msg = "Missing message type"; logger.debug(LOGMARKER + " " + msg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } @@ -86,7 +87,7 @@ public class WorkflowMessageResource { if (correlator == null || correlator.isEmpty()) { String msg = "Missing correlator"; logger.debug(LOGMARKER + " " + msg); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java index 9d63e8eaf1..ef6a27b0fc 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java @@ -36,6 +36,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; +import com.google.common.base.Strings; import org.camunda.bpm.engine.HistoryService; import org.camunda.bpm.engine.ProcessEngineException; import org.camunda.bpm.engine.ProcessEngineServices; @@ -195,7 +196,7 @@ public class WorkflowResource extends ProcessEngineAwareService { if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId()); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey), ErrorCode.UnknownError.getValue(), LOGMARKER + workflowResponse.getMessage() + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse()); @@ -581,7 +582,7 @@ public class WorkflowResource extends ProcessEngineAwareService { response.setResponse("Failed to retrieve the variables," + ex.getMessage()); response.setProcessInstanceID(processInstanceId); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey), ErrorCode.UnknownError.getValue(), LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response.getResponse()); logger.debug("Exception :", ex); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index c61808ebb1..599dce5339 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure; import java.util.List; import java.util.concurrent.Executor; +import com.google.common.base.Strings; import org.camunda.bpm.application.PostDeploy; import org.camunda.bpm.application.PreUndeploy; import org.camunda.bpm.application.ProcessApplicationInfo; @@ -129,7 +130,7 @@ public class MSOInfrastructureApplication { workflowName += BPMN_SUFFIX; } if (workflowBody != null) { - logger.info("{} {}", "Deploying custom workflow", workflowName); + logger.info(Strings.repeat("{} ", 2), "Deploying custom workflow", workflowName); deploymentBuilder.addString(workflowName, workflowBody); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index bd465eb9a8..9380943238 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.* @@ -325,7 +326,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor logger.debug("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy index fa9fe62df4..3084fe5717 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.v12.GenericVnf; @@ -251,7 +252,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { String restFaultMessage = e.getMessage() //execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage) //execution.setVariable("CVFMODVOL2_isDataOk", false) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest") @@ -301,7 +302,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) @@ -402,7 +403,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { logger.debug("Outgoing MsoCompletionRequest: \n" + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing PostProcessResponse - " + "\n", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage()) @@ -479,7 +480,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method , "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") @@ -528,7 +529,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { logger.debug("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage()) @@ -584,7 +585,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method , "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy index 5ba90eb989..1dfb87b42d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; @@ -306,7 +307,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { String xmlHandlerRequest = utils.formatXml(falloutHandlerRequest) execution.setVariable(prefix+'FalloutHandlerRequest', xmlHandlerRequest) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response " + "going to FalloutHandler", "BPMN", ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy index e941d50155..aa524f1e28 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.logger.ErrorCode @@ -168,7 +169,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) @@ -194,7 +195,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { logger.debug("Rethrowing MSOWorkflowException") throw b }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in " + "CreateVnfInfra PreProcessRequest method", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra PreProcessRequest") @@ -220,7 +221,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { execution.setVariable("CREVI_sentSyncResponse", true) } catch (Exception ex) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process") @@ -246,7 +247,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) } @@ -270,7 +271,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { logger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + "Processing preProcessSDNCActivateRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) } @@ -461,7 +462,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { logger.debug("obtained VNF list: " + vnfs) if (vnfs == null) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching " + "VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", ErrorCode.UnknownError.getValue(), ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid) } @@ -470,7 +471,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { JSONObject vnf = vnfs.get(0) if (vnf == null) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF" + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF" + " in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", ErrorCode.UnknownError.getValue(), ""); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid) } @@ -543,7 +544,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId) }catch(Exception ex){ String msg = "Exception in LineOfBusiness. " + ex.getMessage(); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy index 1e2f50148c..e98cb1c119 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -354,7 +355,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { logger.debug(falloutHandlerRequest) execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, "BPMN", ErrorCode.UnknownError.getValue()) @@ -377,7 +378,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { </aetgt:WorkflowException> </aetgt:FalloutHandlerRequest>""" execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy index 3a1815cfe6..ba8027cb1b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; @@ -126,7 +127,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch(Exception e) { String restFaultMessage = e.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request") @@ -159,7 +160,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) @@ -202,7 +203,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) @@ -229,7 +230,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoDeleteVfModule(): ' + e.getMessage()) } @@ -277,7 +278,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepInfraRequest(): ' + e.getMessage()) @@ -322,7 +323,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') @@ -375,7 +376,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy index cf53aff878..b0f4dd6dab 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.VolumeGroup @@ -463,7 +464,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { logger.debug(xmlHandlerRequest) execution.setVariable("DELVfModVol_FalloutHandlerRequest", xmlHandlerRequest) - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response going to FalloutHandler", "BPMN", ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest); } @@ -484,7 +485,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { def String errorMessage = 'TenantId ' + tenantId + ' in incoming request does not match Tenant Id ' + volumeGroupTenantId + ' retrieved from AAI for Volume Group Id ' + volumeGroupId - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Error in DeleteVfModuleVolume: " + "\n" + errorMessage, "BPMN", ErrorCode.UnknownError.getValue()); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 125c3e4504..67dbdac38d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -22,6 +22,7 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.*; @@ -443,7 +444,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index 468f603ef6..68554ec376 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri @@ -234,7 +235,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces getAAIClient().connect(nsUri,relatedServiceUri) logger.info("NS relationship to Service added successfully") }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured while executing AAI Put Call", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); throw new BpmnError("MSOWorkflowException") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 6b4fc840f7..8e39636ab0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -568,7 +569,7 @@ public class DoCreateVfModule extends VfModuleBase { String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) @@ -620,7 +621,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); @@ -747,7 +748,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) @@ -827,7 +828,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 6), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e, e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) @@ -863,7 +864,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) @@ -957,7 +958,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) @@ -1165,7 +1166,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message") @@ -1556,7 +1557,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestOrch Method:\n" + e.getMessage()) @@ -1586,7 +1587,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessUpdateAAIVfModuleStatus", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleStatus Method:\n" + e.getMessage()) @@ -1616,7 +1617,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestGroup Method:\n" + e.getMessage()) @@ -1696,7 +1697,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCGetRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) @@ -1818,14 +1819,14 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug(" is Cloud Region Good: " + execution.getVariable("DCVFM_isCloudRegionGood")) } catch(BpmnError b){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + b.getMessage()); throw b }catch (Exception ex) { // try error String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + ex.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI Query Cloud Region Failed " + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during queryCloudRegion method") @@ -1888,7 +1889,7 @@ public class DoCreateVfModule extends VfModuleBase { logger.debug("Outgoing CreateAAIVfModuleVolumeGroupRequest is: \n" + createAAIVfModuleVolumeGroupRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest', "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareCreateAAIVfModuleVolumeGroupRequest Method:\n" + e.getMessage()) @@ -2021,7 +2022,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered in " + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); @@ -2066,7 +2067,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage()) @@ -2119,7 +2120,7 @@ public class DoCreateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in queryCatalogDB', "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryCatalogDB(): ' + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy index 65f6f76a21..1de18c9507 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy @@ -21,6 +21,8 @@ */ package org.onap.so.bpmn.infrastructure.scripts + +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.NetworkPolicies @@ -263,7 +265,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) @@ -448,7 +450,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ // - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), "BPMN", ErrorCode.UnknownError.getValue()); String processKey = getProcessKey(execution); @@ -609,7 +611,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage()) @@ -627,7 +629,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ execution.setVariable("rollbackError", null) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) @@ -647,7 +649,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ execution.setVariable("rollbackData", null) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing setFailedRollbackStatus.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index fb5c0fa0aa..84931aa6d4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.logger.ErrorCode @@ -215,7 +216,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -406,7 +407,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCAssignRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCAssignRequest Method:\n" + e.getMessage()) @@ -624,7 +625,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest. ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage()) @@ -663,7 +664,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in " + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy index 725a139b59..c9328c10e1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.json.JSONObject; import org.json.JSONArray; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -308,7 +309,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) @@ -326,7 +327,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("addOnModulesDeployed", addOnModulesDeployed + 1) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing postProcessAddOnModule ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessAddOnModule Method:\n" + e.getMessage()) @@ -356,7 +357,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { } }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing validateBaseModule ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during validateBaseModule Method:\n" + e.getMessage()) @@ -387,7 +388,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "${numOfCreatedAddOnModules}") execution.setVariable("rollbackData", rollbackData) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy index 7ea32d2a60..819c428aa9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -163,7 +164,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { execution.setVariable("DCVAMR_RollbackData", vfModuleRollbackData) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessCreateVfModuleRollback ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessCreateVfModuleRollback Method:\n" + e.getMessage()) @@ -183,14 +184,14 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { def numOfModulesToDelete = execution.getVariable("DCVAMR_numOfModulesToDelete") execution.setVariable("DCVAMR_numOfModulesToDelete", numOfModulesToDelete - 1) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing postProcessCreateVfModuleRollback ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessCreateVfModuleRollback Method:\n" + e.getMessage()) } if (rolledBack == false) { logger.debug("Failure on DoCreateVfModuleRollback") - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Unsuccessful rollback of DoCreateVfModule ", "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during rollback of DoCreateVfModule") @@ -216,7 +217,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) @@ -339,7 +340,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { execution.setVariable("rollbackError", null) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + "Processing setSuccessfulRollbackStatus ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage()) } @@ -361,7 +362,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { execution.setVariable("rollbackData", null) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " + "Processing setFailedRollbackStatus. ", "BPMN",ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage()) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index f1b7328bcc..c4b706c7b3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -22,6 +22,7 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.*; @@ -532,7 +533,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index 1912d65ce3..3a98bf8a26 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -22,6 +22,7 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.aai.domain.yang.AllottedResource import org.onap.so.logger.ErrorCode @@ -944,7 +945,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN", ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index 2558f7eff5..3a212d9cea 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.L3Network @@ -465,7 +466,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, sendRequestToVnfAdapter() - " + ex.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); logger.debug(exceptionMessage) @@ -517,7 +518,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); logger.debug(exceptionMessage) @@ -558,7 +559,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); logger.debug(exceptionMessage) @@ -998,7 +999,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } catch (Exception ex) { // caught exception String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRollback() - " + ex.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); logger.debug(exceptionMessage) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy index b21dcf3433..992a257809 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.aai.domain.yang.NetworkPolicies import org.onap.aai.domain.yang.NetworkPolicy import org.onap.so.logger.ErrorCode @@ -359,7 +360,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ // generates a WorkflowException if // - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); String processKey = getProcessKey(execution); @@ -580,7 +581,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) @@ -628,7 +629,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy index e5306c40de..7dfa408fa7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.NetworkPolicies import org.onap.aai.domain.yang.NetworkPolicy @@ -114,7 +115,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -160,7 +161,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage()) @@ -213,7 +214,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage()) @@ -239,7 +240,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) @@ -403,7 +404,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { // generates a WorkflowException if // - public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"), "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); String processKey = getProcessKey(execution); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy index 9bd3388b79..22be22baa4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.VfModule import org.camunda.bpm.engine.delegate.BpmnError @@ -110,7 +111,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback", execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), "Exception"); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -238,7 +239,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) @@ -338,7 +339,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) @@ -366,7 +367,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("DDVAM_vfModuleModelInfo", vfModuleModelInfo) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToDelete Method:\n" + e.getMessage()) @@ -392,7 +393,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCDeactivateRequest." + e, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy index ce3b243533..a9b2278fbe 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy @@ -21,6 +21,7 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.*; @@ -138,7 +139,7 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor { logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy index 1b089d2a2b..a728ed72e8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray import org.json.JSONObject; @@ -182,7 +183,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess try { Thread.sleep(5000) } catch (InterruptedException e) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Time Delay exception" + e, "BPMN", ErrorCode.UnknownError.getValue()); } @@ -216,7 +217,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess logger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class)) logger.trace("Completed Execute VF-C adapter Post Process ") }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured " + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured " + "while executing VFC Post Call.", "BPMN", ErrorCode.UnknownError.getValue(), e); throw new BpmnError("MSOWorkflowException") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index abbcf66323..e6fdc53d8d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf @@ -333,7 +334,7 @@ public class DoUpdateVfModule extends VfModuleBase { def sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing' - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } @@ -342,7 +343,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) @@ -383,7 +384,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preparePrepareUpdateAAIVfModule(): ' + e.getMessage()) @@ -434,14 +435,14 @@ public class DoUpdateVfModule extends VfModuleBase { logger.debug(" is Cloud Region Good: " + execution.getVariable(prefix + "isCloudRegionGood")) } catch(BpmnError b){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + b); throw b }catch (Exception e) { // try error String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + e.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "AAI Query Cloud Region Failed. Exception - " + "\n" + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during prepConfirmVolumeGroupTenant(): " + e.getMessage()) @@ -548,7 +549,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyChg(): ' + e.getMessage()) @@ -612,7 +613,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyQuery(): ' + e.getMessage()) @@ -716,7 +717,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage()) @@ -764,7 +765,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) @@ -838,7 +839,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIVfModule(): ' + e.getMessage()) @@ -941,7 +942,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyAct(): ' + e.getMessage()) @@ -962,7 +963,7 @@ public class DoUpdateVfModule extends VfModuleBase { try { def WorkflowException workflowException = (WorkflowException) execution.getVariable('WorkflowException') - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), method + ' caught WorkflowException: ' + workflowException.getErrorMessage(), "BPMN", ErrorCode.UnknownError.getValue()); @@ -970,7 +971,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 1002, 'Error in handleWorkflowException(): ' + e.getMessage()) @@ -1048,7 +1049,7 @@ public class DoUpdateVfModule extends VfModuleBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e, e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index eb788a85b7..1e36ccbf49 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.client.HttpClientFactory import org.onap.so.logger.ErrorCode @@ -272,7 +273,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) @@ -328,7 +329,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToUpdate Method:\n" + e.getMessage()) @@ -404,7 +405,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy index 4321dbadd5..99c9454021 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.appc.client.lcm.model.Action; @@ -233,7 +234,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch(Exception e) { String restFaultMessage = e.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered - " + "\n" + restFaultMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) @@ -276,7 +277,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) @@ -327,7 +328,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) @@ -369,7 +370,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") @@ -413,7 +414,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") @@ -461,7 +462,7 @@ public class ReplaceVnfInfra extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") @@ -531,19 +532,19 @@ public class ReplaceVnfInfra extends VnfCmBase { logger.trace('Exited ' + method) } catch (BpmnError e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (java.lang.NoSuchMethodError e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy index ef4a78ffde..bf7f26a731 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.camunda.bpm.engine.delegate.DelegateExecution @@ -87,7 +88,7 @@ public class RollbackVnf extends VnfCmBase { } catch(Exception e) { String restFaultMessage = e.getMessage() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Encountered - " + "\n" + restFaultMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("rollbackErrorCode", "1") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy index 0afa34bdec..49eeb2247c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode import static org.apache.commons.lang3.StringUtils.* @@ -294,7 +295,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor logger.debug("Scale network service updateServiceOperStatusRequest Request: " + payload) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", ErrorCode.UnknownError.getValue(), e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy index 9db5b7366a..596c0454e5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -96,7 +97,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) @@ -151,7 +152,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage()) @@ -181,7 +182,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) @@ -237,7 +238,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage()) @@ -278,7 +279,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') @@ -333,7 +334,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index 0344206145..dd356e8a13 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import groovy.json.JsonException import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError @@ -482,7 +483,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { " retrieved from AAI for Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion ExceptionUtil exceptionUtil = new ExceptionUtil() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' + 'UpdateVfModuleVol: ' + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) } @@ -501,7 +502,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { " retrieved from AAI for Volume Group Id " ExceptionUtil exceptionUtil = new ExceptionUtil() - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' + 'UpdateVfModuleVol: ' + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception") exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy index 05aff713bc..8ead316a29 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.common.base.Strings import groovy.json.JsonOutput import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError @@ -351,7 +352,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) @@ -396,7 +397,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) @@ -441,7 +442,7 @@ public class VnfInPlaceUpdate extends VnfCmBase { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) @@ -520,17 +521,17 @@ public class VnfInPlaceUpdate extends VnfCmBase { logger.trace('Exited ' + method) } catch (BpmnError e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (java.lang.NoSuchMethodError e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' + ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); execution.setVariable("errorCode", "1002") execution.setVariable("errorText", e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 9829419128..e3cac9d4e9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -21,6 +21,7 @@ */ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.* @@ -420,7 +421,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) @@ -847,7 +848,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") } catch (BpmnError b) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", ErrorCode.UnknownError.getValue()); throw b diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index a1cdacaf08..efdc61475f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -21,6 +21,7 @@ */ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -419,7 +420,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(BpmnError b){ - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Rethrowing MSOWorkflowException", "BPMN", ErrorCode.UnknownError.getValue()); throw b diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index 2c5b6430e6..8e3238fdd0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource @@ -585,7 +586,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ execution.setVariable("sdncGetRequest", SDNCGetRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy index 58c0ef2dcf..1ded058dfa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource @@ -205,7 +206,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc } catch (BpmnError e) { throw e; }catch(Exception ex){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index 61dd13b4e2..6177812083 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource @@ -520,7 +521,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ execution.setVariable("sdncGetRequest", SDNCGetRequest) }catch(Exception e){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy index 44e27d99cf..e79758f3a4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.onap.aai.domain.yang.AllottedResource; import org.onap.so.bpmn.common.scripts.*; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -206,7 +207,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc } catch (BpmnError e) { throw e; }catch(Exception ex){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy index 9dcee3dfb2..b8ae461ce7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AllottedResourceUtils @@ -351,7 +352,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; }catch(Exception ex){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy index 43e095859e..31f8eb42dd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.vcpe.scripts +import com.google.common.base.Strings import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AllottedResourceUtils @@ -355,7 +356,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; }catch(Exception ex){ - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index 5451f9ff57..1b32029fd6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -27,6 +27,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import com.google.common.base.Strings; import org.apache.commons.lang3.StringUtils; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; @@ -282,7 +283,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { } catch (Exception exception) { logger.info("exception: AbstractSdncOperationTask.updateProgress fail!"); logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception); - logger.error("{} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.GENERAL_EXCEPTION.toString(), " updateProgress catch exception: ", this.getTaskName(), ErrorCode.UnknownError.getValue(), exception.getClass().toString()); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java index 4d58439fda..4703dddf54 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask; import java.util.Map; +import com.google.common.base.Strings; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -78,7 +79,7 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); String postBody = getPostbody(inputEntity); - logger.info("{} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC"); + logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC"); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!"); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java index 4fb6817a39..bdc0e2952b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java @@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask; import java.util.Map; +import com.google.common.base.Strings; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -77,7 +78,7 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); String postBody = getPostbody(inputEntity); - logger.info("{} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC"); + logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC"); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!"); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index 4d4b7c9ad2..71bcd58fee 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -29,6 +29,7 @@ import java.util.TreeSet; import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.Stream; +import com.google.common.base.Strings; import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -122,8 +123,8 @@ public class AAICreateTasks { String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: " + serviceInstance.getServiceInstanceId(); - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN", - ErrorCode.UnknownError.getValue(), errorMessage); + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, + "BPMN", ErrorCode.UnknownError.getValue(), errorMessage); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage); } aaiSIResources.createServiceSubscription(customer); @@ -169,15 +170,15 @@ public class AAICreateTasks { if (owningEntityName == null || "".equals(owningEntityName)) { String msg = "Exception in AAICreateOwningEntity. Can't create an owningEntity with no owningEntityName."; - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), msg); + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, + "BPMN", ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } else { if (aaiSIResources.existsOwningEntityName(owningEntityName)) { String msg = "Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)"; - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, - "BPMN", ErrorCode.UnknownError.getValue(), msg); + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + msg, "BPMN", ErrorCode.UnknownError.getValue(), msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } else { aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java index a37f43727e..d39e58b778 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -25,6 +25,7 @@ package org.onap.so.bpmn.infrastructure.activity; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import com.google.common.base.Strings; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; @@ -135,7 +136,7 @@ public class ExecuteActivity implements JavaDelegate { } protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue(), msg, ex); execution.setVariable("ExecuteActivityErrorMessage", msg); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java index 48426fa725..f009404f7a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.adapter.vnf.tasks; +import com.google.common.base.Strings; import org.apache.commons.lang3.StringUtils; import org.onap.so.adapters.vnfrest.CreateVfModuleResponse; import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; @@ -171,8 +172,8 @@ public class VnfAdapterImpl { SAXSource source = new SAXSource(xmlReader, inputSource); return jaxbUnmarshaller.unmarshal(source); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(), - e.getMessage(), e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.GENERAL_EXCEPTION.toString(), + ErrorCode.SchemaError.getValue(), e.getMessage(), e); throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), ErrorCode.SchemaError.getValue(), e); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index f9bd8c546f..a7cb729c46 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.appc.tasks; import java.util.HashMap; import java.util.Optional; +import com.google.common.base.Strings; import org.onap.appc.client.lcm.model.Action; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -140,7 +141,7 @@ public class AppcRunTasks { appcMessage = appCClient.getErrorMessage(); mapRollbackVariables(execution, action, appcCode); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java index 0ad88d0676..e8687f25dc 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java @@ -25,6 +25,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import com.google.common.base.Strings; import org.onap.appc.client.lcm.model.Action; import org.onap.so.bpmn.appc.payload.beans.ConfigScaleOutPayload; import org.onap.so.bpmn.appc.payload.beans.RequestParametersConfigScaleOut; @@ -152,7 +153,7 @@ public class ConfigurationScaleOut { appcMessage = appCClient.getErrorMessage(); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java index 8f0c809e1f..8aeba490d1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import java.util.HashMap; import java.util.Optional; +import com.google.common.base.Strings; import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.appc.client.lcm.model.Action; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -114,19 +115,19 @@ public class GenericVnfHealthCheck { appcCode = appCClient.getErrorCode(); appcMessage = appCClient.getErrorMessage(); } catch (BpmnError ex) { - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), ex); appcMessage = ex.getMessage(); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } catch (Exception e) { if (e instanceof java.util.concurrent.TimeoutException) { appcMessage = "Request to APPC timed out. "; - logger.error("{} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_CONNECTION_EXCEPTION.toString(), "Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e); throw e; } else { - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e); appcMessage = e.getMessage(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java index 61fc8ffc48..75acf10d97 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java @@ -2,6 +2,7 @@ package org.onap.so.bpmn.infrastructure.manualhandling.tasks; import java.util.Map; import java.util.HashMap; +import com.google.common.base.Strings; import org.camunda.bpm.engine.TaskService; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateTask; @@ -187,11 +188,11 @@ public class ManualHandlingTasks { ticket.createTicket(); } catch (BpmnError e) { String msg = "BPMN error in createAOTSTicket " + e.getMessage(); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", ErrorCode.UnknownError.getValue()); } catch (Exception ex) { String msg = "Exception in createExternalTicket " + ex.getMessage(); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", + logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", ErrorCode.UnknownError.getValue()); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java index 717bb04099..5bf531753e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java @@ -24,6 +24,7 @@ package org.onap.so.client.namingservice; import java.io.IOException; import java.util.List; +import com.google.common.base.Strings; import org.apache.http.HttpStatus; import org.onap.namingservice.model.NameGenDeleteResponse; import org.onap.namingservice.model.NameGenResponse; @@ -51,8 +52,9 @@ public class NamingClientResponseValidator { public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException { if (response == null) { - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE, - "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), + NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(), + NO_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE); } @@ -60,7 +62,7 @@ public class NamingClientResponseValidator { String generatedName = ""; NameGenResponse responseBody = response.getBody(); if (responseBody == null) { - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(), NULL_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE); @@ -90,7 +92,7 @@ public class NamingClientResponseValidator { errorMessageString = error.getMessage(); } String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } @@ -99,8 +101,9 @@ public class NamingClientResponseValidator { public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response) throws BadResponseException { if (response == null) { - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE, - "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), + NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(), + NO_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE); } @@ -108,7 +111,7 @@ public class NamingClientResponseValidator { String responseMessage = ""; NameGenDeleteResponse responseBody = response.getBody(); if (responseBody == null) { - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(), NULL_RESPONSE_FROM_NAMING_SERVICE); throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE); @@ -121,7 +124,7 @@ public class NamingClientResponseValidator { String errorMessageString = NAMING_SERVICE_ERROR; String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", ErrorCode.DataError.getValue(), errorMessage); throw new BadResponseException(errorMessage); } @@ -141,7 +144,7 @@ public class NamingClientResponseValidator { errorMessageString = error.getMessage(); } String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString); - logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", ErrorCode.DataError.getValue(), errorMessage); return errorMessage; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java index fe1f3f4308..9170d8bdf0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java @@ -25,6 +25,7 @@ package org.onap.so.client.sdnc; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; +import com.google.common.base.Strings; import org.apache.commons.lang.StringUtils; import org.apache.http.HttpStatus; import org.onap.so.client.exception.BadResponseException; @@ -52,7 +53,7 @@ public class SdnCommonTasks { private static final String SDNC_CODE_NOT_0_OR_IN_200_299 = "Error from SDNC: %s"; private static final String COULD_NOT_CONVERT_SDNC_POJO_TO_JSON = "ERROR: Could not convert SDNC pojo to json string."; - private static final String BRACKETS = "{} {} {} {} {}"; + private static final String BRACKETS = Strings.repeat("{} ", 5); /*** * diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java index 6627625d62..da44f2f8cb 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java @@ -24,6 +24,7 @@ package org.onap.so.client.sdnc.mapper; import java.util.Map; import java.util.UUID; +import com.google.common.base.Strings; import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; @@ -188,8 +189,8 @@ public class VfModuleTopologyOperationRequestMapper { mapper.readValue(sdncAssignResponse, GenericResourceApiVfModuleResponseInformation.class); objectPath = assignResponseInfo.getVfModuleResponseInformation().getObjectPath(); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN", - ErrorCode.UnknownError.getValue(), e.getMessage()); + logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), + "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage()); } } return objectPath; diff --git a/common/src/main/java/org/onap/so/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java index 09b48d266f..f42fc0111f 100644 --- a/common/src/main/java/org/onap/so/utils/CryptoUtils.java +++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java @@ -23,6 +23,7 @@ package org.onap.so.utils; +import com.google.common.base.Strings; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -89,7 +90,7 @@ public final class CryptoUtils { try { return CryptoUtils.encrypt(message, CLOUD_KEY); } catch (GeneralSecurityException e) { - logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_GENERAL_EXCEPTION.toString(), ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e); return null; } @@ -99,7 +100,7 @@ public final class CryptoUtils { try { return CryptoUtils.decrypt(message, CLOUD_KEY); } catch (GeneralSecurityException e) { - logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_GENERAL_EXCEPTION.toString(), ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e); return null; } diff --git a/common/src/main/java/org/onap/so/utils/UUIDChecker.java b/common/src/main/java/org/onap/so/utils/UUIDChecker.java index 585ffcc7c4..6a95334696 100644 --- a/common/src/main/java/org/onap/so/utils/UUIDChecker.java +++ b/common/src/main/java/org/onap/so/utils/UUIDChecker.java @@ -24,6 +24,7 @@ package org.onap.so.utils; import java.util.UUID; +import com.google.common.base.Strings; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,7 +52,7 @@ public class UUIDChecker { public static String getUUID() { String result = UUID.randomUUID().toString(); - logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID, result); + logger.info(Strings.repeat("{} ", 2), MessageEnum.APIH_GENERATED_REQUEST_ID, result); return result; } } diff --git a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java index 0022ecbb96..e6acb87eaa 100644 --- a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java +++ b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java @@ -32,6 +32,7 @@ import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.sax.SAXSource; +import com.google.common.base.Strings; import org.onap.so.exceptions.MarshallerException; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; @@ -52,8 +53,8 @@ public class XmlMarshaller { Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.marshal(object, stringWriter); } catch (JAXBException e) { - logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(), - e.getMessage(), e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.GENERAL_EXCEPTION.toString(), + ErrorCode.SchemaError.getValue(), e.getMessage(), e); throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e); } @@ -77,8 +78,8 @@ public class XmlMarshaller { SAXSource source = new SAXSource(xmlReader, inputSource); object = jaxbUnmarshaller.unmarshal(source, object.getClass()).getValue(); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(), - e.getMessage(), e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.GENERAL_EXCEPTION.toString(), + ErrorCode.SchemaError.getValue(), e.getMessage(), e); throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e); } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java index 75fb00c7a6..eb4ba76530 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java @@ -27,6 +27,7 @@ package org.onap.so.apihandler.common; import java.io.IOException; import java.util.UUID; import javax.xml.bind.DatatypeConverter; +import com.google.common.base.Strings; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; @@ -161,7 +162,7 @@ public class CamundaClient extends RequestClient { jsonReq = mapper.writeValueAsString(camundaRequest); logger.trace("request body is {}", jsonReq); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapRequest", + logger.error(Strings.repeat("{} ", 5), MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapRequest", ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; @@ -252,8 +253,8 @@ public class CamundaClient extends RequestClient { jsonReq = mapper.writeValueAsString(camundaRequest); logger.trace("request body is {}", jsonReq); } catch (Exception e) { - logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest", - ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); + logger.error(Strings.repeat("{} ", 5), MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", + "wrapVIDRequest", ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java index b972f7e1db..b9a06ac1d9 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java @@ -31,6 +31,7 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; +import com.google.common.base.Strings; import org.apache.commons.io.IOUtils; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; @@ -94,8 +95,8 @@ public class XMLValidator { return "ErrorDetails: " + e.getMessage(); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.APIH_CANNOT_READ_SCHEMA.toString(), ErrorCode.SchemaError.getValue(), - "APIH cannot read schema file", e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.APIH_CANNOT_READ_SCHEMA.toString(), + ErrorCode.SchemaError.getValue(), "APIH cannot read schema file", e); return "ErrorDetails: " + "Unable to read the schema file"; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java index 3b977639fc..12379f9c1a 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java @@ -36,6 +36,7 @@ import javax.ws.rs.ext.Provider; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; +import com.google.common.base.Strings; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; @@ -134,8 +135,8 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { } catch (JsonProcessingException | JAXBException e) { String errorMsg = "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage(); - logger.error("{} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), "BuildServiceErrorResponse", - ErrorCode.DataError.getValue(), errorMsg, e); + logger.error(Strings.repeat("{} ", 4), MessageEnum.GENERAL_EXCEPTION.toString(), + "BuildServiceErrorResponse", ErrorCode.DataError.getValue(), errorMsg, e); return errorMsg; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index 3996d511a7..7ed1f9d5d0 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -38,6 +38,7 @@ import javax.ws.rs.PathParam; 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.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.json.JSONObject; @@ -228,8 +229,8 @@ public class E2EServiceInstances { Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity().toString()); return response; @@ -280,8 +281,8 @@ public class E2EServiceInstances { Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString()); return resp; } @@ -306,7 +307,7 @@ public class E2EServiceInstances { try { operationStatus = requestsDbClient.getOneByServiceIdAndOperationId(serviceId, operationId); } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Request DB - Infra Request Lookup", e); Response response = @@ -321,8 +322,8 @@ public class E2EServiceInstances { Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT, MsoException.ServiceException, "E2E serviceId " + serviceId + " is not found in DB", ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.BusinessProcesssError.getValue(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from RequestDB when searching by serviceId"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; @@ -350,8 +351,8 @@ public class E2EServiceInstances { Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -375,8 +376,8 @@ public class E2EServiceInstances { return response; } if (recipeLookupResult == null) { - logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.DataError.getValue(), "No recipe found in DB"); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB"); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "Recipe does not exist in catalog DB", ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version); @@ -414,8 +415,9 @@ public class E2EServiceInstances { Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine"); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(), + "Exception while communicate with BPMN engine"); logger.debug("End of the transaction, the final response is: " + resp.getEntity()); return resp; } @@ -424,8 +426,8 @@ public class E2EServiceInstances { Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -455,8 +457,8 @@ public class E2EServiceInstances { Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -473,8 +475,8 @@ public class E2EServiceInstances { if (requestId != null) { logger.debug("Logging failed message to the database"); } - logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -483,7 +485,7 @@ public class E2EServiceInstances { try { recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action); } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(), @@ -495,8 +497,8 @@ public class E2EServiceInstances { } if (recipeLookupResult == null) { - logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.DataError.getValue(), "No recipe found in DB"); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB"); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "Recipe does not exist in catalog DB", ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version); @@ -530,8 +532,9 @@ public class E2EServiceInstances { MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine"); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(), + "Exception while communicate with BPMN engine"); logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity()); return getBPMNResp; @@ -541,8 +544,8 @@ public class E2EServiceInstances { Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity()); return getBPMNResp; } @@ -572,8 +575,8 @@ public class E2EServiceInstances { Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -590,8 +593,8 @@ public class E2EServiceInstances { if (requestId != null) { logger.debug("Logging failed message to the database"); } - logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -600,7 +603,7 @@ public class E2EServiceInstances { try { recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action); } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(), @@ -610,8 +613,8 @@ public class E2EServiceInstances { } if (recipeLookupResult == null) { - logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.DataError.getValue(), "No recipe found in DB"); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB"); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "Recipe does not exist in catalog DB", ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version); @@ -644,8 +647,9 @@ public class E2EServiceInstances { MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine"); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(), + "Exception while communicate with BPMN engine"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -654,8 +658,8 @@ public class E2EServiceInstances { Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -684,8 +688,8 @@ public class E2EServiceInstances { Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e); logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -695,7 +699,7 @@ public class E2EServiceInstances { // TODO Get the service template model version uuid from AAI. recipeLookupResult = getServiceInstanceOrchestrationURI(null, action); } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, @@ -708,8 +712,8 @@ public class E2EServiceInstances { return response; } if (recipeLookupResult == null) { - logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.DataError.getValue(), "No recipe found in DB"); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB"); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "Recipe does not exist in catalog DB", @@ -747,8 +751,9 @@ public class E2EServiceInstances { MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine", e); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(), + "Exception while communicate with BPMN engine", e); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -757,8 +762,8 @@ public class E2EServiceInstances { Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, - ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -790,8 +795,8 @@ public class E2EServiceInstances { Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, MsoException.ServiceException, "Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version); - logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(), - ErrorCode.BusinessProcesssError.getValue(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), + requestClient.getUrl(), ErrorCode.BusinessProcesssError.getValue(), "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java index 4d283f26b1..e3b297b5db 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java @@ -25,6 +25,7 @@ package org.onap.so.apihandlerinfra; import java.net.URI; import java.util.Collections; +import com.google.common.base.Strings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; @@ -112,7 +113,7 @@ public class GlobalHealthcheckHandler { try { // Generated RequestId String requestId = requestContext.getProperty("requestId").toString(); - logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); + logger.info(Strings.repeat("{} ", 2), MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); // set APIH status, this is the main entry point rsp.setApih(HealthcheckStatus.UP.toString()); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java index 3c06804594..169ec50a74 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java @@ -34,6 +34,7 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import com.google.common.base.Strings; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.onap.so.apihandler.common.ErrorNumbers; @@ -91,7 +92,7 @@ public class ManualTasks { @PathParam("taskId") String taskId, @Context ContainerRequestContext requestContext) throws ApiException { String requestId = requestContext.getProperty("requestId").toString(); - logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); + logger.info(Strings.repeat("{} ", 2), MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); long startTime = System.currentTimeMillis(); logger.debug("requestId is: {}", requestId); TasksRequest taskRequest = null; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java index 401a6a9db6..49572630ed 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java @@ -42,6 +42,7 @@ import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import com.google.common.base.Strings; import org.onap.so.apihandler.common.ResponseBuilder; import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest; import org.onap.so.apihandlerinfra.validation.MembersValidation; @@ -151,7 +152,8 @@ public class MsoRequest { mapper.setSerializationInclusion(Include.NON_DEFAULT); requestErrorStr = mapper.writeValueAsString(re); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.APIH_VALIDATION_ERROR.toString(), ErrorCode.DataError.getValue(), + logger.error(Strings.repeat("{} ", 3), MessageEnum.APIH_VALIDATION_ERROR.toString(), + ErrorCode.DataError.getValue(), "Exception in buildServiceErrorResponse writing exceptionType to string ", e); } @@ -396,8 +398,8 @@ public class MsoRequest { aq.setRequestStatus(status.toString()); aq.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), ErrorCode.DataError.getValue(), - "Exception when creation record request", e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.APIH_DB_INSERT_EXC.toString(), + ErrorCode.DataError.getValue(), "Exception when creation record request", e); if (!status.equals(Status.FAILED)) { throw e; @@ -437,8 +439,8 @@ public class MsoRequest { aq.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), ErrorCode.DataError.getValue(), - "Exception when creation record request", e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.APIH_DB_INSERT_EXC.toString(), + ErrorCode.DataError.getValue(), "Exception when creation record request", e); if (!status.equals(Status.FAILED)) { throw e; @@ -465,7 +467,7 @@ public class MsoRequest { request.setRequestUrl(MDC.get(LogConstants.HTTP_URL)); requestsDbClient.save(request); } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(), ErrorCode.DataError.getValue(), "Exception when updating record in DB"); logger.debug("Exception: ", e); } @@ -547,8 +549,8 @@ public class MsoRequest { return null; } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.APIH_DOM2STR_ERROR.toString(), ErrorCode.DataError.getValue(), - "Exception in domToStr", e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.APIH_DOM2STR_ERROR.toString(), + ErrorCode.DataError.getValue(), "Exception in domToStr", e); } return null; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java index 9810895ad9..07a0161e8f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java @@ -30,6 +30,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; +import com.google.common.base.Strings; import org.apache.http.HttpStatus; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -57,7 +58,7 @@ public class NodeHealthcheckHandler { public Response nodeHealthcheck(@Context ContainerRequestContext requestContext) throws UnknownHostException { // Generated RequestId String requestId = requestContext.getProperty("requestId").toString(); - logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); + logger.info(Strings.repeat("{} ", 2), MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); return HEALTH_CHECK_RESPONSE; } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java index d79d73c036..6f24bd4c4d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java @@ -38,6 +38,7 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import com.google.common.base.Strings; import org.apache.http.HttpStatus; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.Constants; @@ -125,7 +126,7 @@ public class CloudOrchestration { private Response cloudOrchestration(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version, String requestId) throws ApiException { - logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); + logger.info(Strings.repeat("{} ", 2), MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); long startTime = System.currentTimeMillis(); CloudOrchestrationRequest cor = null; tenantIsolationRequest.setRequestId(requestId); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java index 696616099f..98c3f1f37f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import javax.ws.rs.core.MultivaluedMap; +import com.google.common.base.Strings; import org.apache.commons.lang3.StringUtils; import org.onap.so.apihandlerinfra.Constants; import org.onap.so.apihandlerinfra.Status; @@ -356,7 +357,7 @@ public class TenantIsolationRequest { request.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER); requestsDbClient.save(request); } catch (Exception e) { - logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(), + logger.error(Strings.repeat("{} ", 4), MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(), ErrorCode.DataError.getValue(), "Exception when updating record in DB"); logger.debug("Exception: ", e); } |