aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java21
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java22
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java2
5 files changed, 21 insertions, 27 deletions
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
index f9fd9c395d..27a21ecced 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
@@ -87,8 +87,6 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
private MsoLogger logger;
- private Service catalogService;
-
private static final Pattern lastDigit = Pattern.compile("(\\d+)$");
public ToscaResourceInstaller() {
@@ -98,7 +96,6 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
//@Override
public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStruct)
throws ArtifactInstallerException {
- CatalogDatabase db = CatalogDatabase.getInstance();
boolean status = false;
VfResourceStructure vfResourceStructure = (VfResourceStructure)vfResourceStruct;
@@ -178,8 +175,6 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
try {
- String vfModuleModelUUID = null;
-
createToscaCsar(toscaResourceStruct);
catalogDB.saveToscaCsar(toscaResourceStruct.getCatalogToscaCsar());
@@ -225,10 +220,10 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
// get the Main IArtifactInfo
HeatTemplate heatMainTemplate = null;
- HeatEnvironment heatEnv = null;
+ HeatEnvironment heatEnv;
HeatTemplate heatVolumeTemplate = null;
- HeatEnvironment heatVolumeEnv = null;
+ HeatEnvironment heatVolumeEnv;
IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
@@ -571,8 +566,7 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
logger.warn(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED, vfResourceStructure.getResourceInstance().getResourceName(),
vfResourceStructure.getNotification().getServiceVersion(), "", "", MsoLogger.ErrorCode.DataError, "Exception - ASCDC Artifact already deployed", e);
} else {
- String endEvent = "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.";
- String elementToLog = (artifactListForLogging.size() > 0 ? artifactListForLogging.get(artifactListForLogging.size()-1).toString() : "No element listed");
+ String elementToLog = (artifactListForLogging.size() > 0 ? artifactListForLogging.get(artifactListForLogging.size()-1).toString() : "No element listed");
logger.error(MessageEnum.ASDC_ARTIFACT_INSTALL_EXC, elementToLog, "", "", MsoLogger.ErrorCode.DataError, "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback", e);
catalogDB.rollback();
throw new ArtifactInstallerException(
@@ -642,7 +636,7 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
// heatTemplate.setAsdcResourceName(vfResourceStructure.getResourceInstance().getResourceName());
heatTemplate.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
- List<String> typeList = new ArrayList<String>();
+ List<String> typeList = new ArrayList<>();
typeList.add(ASDCConfiguration.HEAT_NESTED);
typeList.add(ASDCConfiguration.HEAT_ARTIFACT);
@@ -684,7 +678,7 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
// TODO Set the label
// heatEnvironment.setAsdcLabel("Label");
- List<String> typeList = new ArrayList<String>();
+ List<String> typeList = new ArrayList<>();
typeList.add(ASDCConfiguration.HEAT);
typeList.add(ASDCConfiguration.HEAT_VOL);
@@ -835,7 +829,6 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
private static void createVFModule(Group group, NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure, IVfModuleData vfModuleData) {
VfModule vfModule = new VfModule();
- boolean isBase = false;
Metadata vfMetadata = group.getMetadata();
@@ -895,7 +888,7 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
vfModule.setVnfResourceModelUUId(toscaResourceStructure.getCatalogVnfResource().getModelUuid());
String vfModuleType = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE);
- if(vfModuleType != null && vfModuleType.equalsIgnoreCase("Base")){
+ if(vfModuleType != null && "Base".equalsIgnoreCase(vfModuleType)){
vfModule.setIsBase(1);
}else {
vfModule.setIsBase(0);
@@ -1100,7 +1093,7 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
private static String testNull(Object object) {
if (object == null) {
return "";
- } else if (object.equals("null")) {
+ } else if ("null".equals(object)) {
return null;
}else if (object instanceof Integer) {
return object.toString();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java
index f3273cf144..f6abcc35b1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java
@@ -143,6 +143,7 @@ public class ManualTasks {
msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", requestUrl, null);
} catch (Exception e) {
+ msoLogger.debug ("Exception:", e);
msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", requestUrl, null);
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
index eab232d4d5..5328780b21 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
@@ -149,7 +149,7 @@ public class MsoRequest {
RequestError re = new RequestError();
- if(exceptionType.name().equals("PolicyException")){
+ if("PolicyException".equals(exceptionType.name())){
PolicyException pe = new PolicyException();
pe.setMessageId(messageId);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
index e32f1535d4..66a14db610 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
@@ -73,10 +73,10 @@ import com.wordnik.swagger.annotations.ApiOperation;
@Api(value="/serviceInstances",description="API Requests for Service Instances")
public class ServiceInstances {
- private HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ private HashMap<String, String> instanceIdMap = new HashMap<>();
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+ public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
@POST
@Path("/{version:[vV][3-5]}")
@@ -404,7 +404,7 @@ public class ServiceInstances {
String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
try {
- if(!(instanceName==null && requestScope.equals("service") && (action == Action.createInstance || action == Action.activateInstance))){
+ if(!(instanceName==null && "service".equals(requestScope) && (action == Action.createInstance || action == Action.activateInstance))){
dup = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
}
} catch (Exception e) {
@@ -423,7 +423,7 @@ public class ServiceInstances {
if (dup != null) {
// Found the duplicate record. Return the appropriate error.
- String instance = null;
+ String instance;
if(instanceName != null){
instance = instanceName;
}else{
@@ -533,7 +533,7 @@ public class ServiceInstances {
String asdcServiceModelVersion = msoRequest.getAsdcServiceModelVersion ();
// Get VF Module-specific base module indicator
- VfModule vfm = null;
+ VfModule vfm;
String modelVersionId = msoRequest.getModelInfo().getModelVersionId();
@@ -627,7 +627,7 @@ public class ServiceInstances {
// Capture audit event
msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
- System.out.println("URL : " + requestClient.getUrl ());
+ msoLogger.debug ("URL : " + requestClient.getUrl ());
response = requestClient.post(requestId, isBaseVfModule, recipeLookupResult.getRecipeTimeout (), action.name (),
serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId,
@@ -684,7 +684,7 @@ public class ServiceInstances {
msoLogger.debug ("End of the transaction, the final response is: " + (String) camundaJSONResponseBody);
return Response.status (HttpStatus.SC_ACCEPTED).entity (camundaJSONResponseBody).build ();
} else {
- List<String> variables = new ArrayList<String>();
+ List<String> variables = new ArrayList<>();
variables.add(bpelStatus + "");
String camundaJSONResponseBody = respHandler.getResponseBody ();
if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) {
@@ -754,7 +754,7 @@ public class ServiceInstances {
// TODO need to make this a configurable property
String defaultServiceModelName = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
- Service serviceRecord = null;
+ Service serviceRecord;
ModelInfo modelInfo = msoRequest.getModelInfo();
if(msoRequest.getALaCarteFlag()){
serviceRecord = db.getServiceByModelName(defaultServiceModelName);
@@ -840,7 +840,7 @@ public class ServiceInstances {
// 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use modelCustomizationId to look it up in our catalog to construct vnf-type value to pass to BPMN.
VnfResource vnfResource = null;
- VnfResourceCustomization vrc = null;
+ VnfResourceCustomization vrc;
// Validation for vnfResource
if(modelCustomizationId!=null) {
@@ -893,7 +893,7 @@ public class ServiceInstances {
if(!msoRequest.getALaCarteFlag()) {
VfModuleCustomization vfmc = null;
- VnfResourceCustomization vnfrc = null;
+ VnfResourceCustomization vnfrc;
VfModule vfModule = null;
if( modelInfo.getModelCustomizationId() != null) {
@@ -971,7 +971,7 @@ public class ServiceInstances {
ModelInfo modelInfo = msoRequest.getModelInfo();
String modelName = modelInfo.getModelName();
- Recipe recipe = null;
+ Recipe recipe;
if(msoRequest.getALaCarteFlag()){
recipe = db.getNetworkRecipe(defaultNetworkType, action.name());
}else{
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
index 8db4548bad..254ae3bf39 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
@@ -332,7 +332,7 @@ public class RequestsDatabase {
}
}
catch (Exception e){
- msoLogger.debug("Exception in getOrchestrationFiltersFromInfraActive(): + " + e.getMessage());
+ msoLogger.debug("Exception in getOrchestrationFiltersFromInfraActive(): + " + e.getMessage(), e);
return null;
}
}