diff options
56 files changed, 279 insertions, 329 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java index f717144562..35c928c3b5 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java @@ -72,9 +72,7 @@ public class KeystoneV3Authentication { OpenStackRequest<Token> v3Request = keystoneTenantClient.tokens().authenticate(v3Credentials); - KeystoneAuthHolder holder = makeRequest(v3Request, type, region); - - return holder; + return makeRequest(v3Request, type, region); } protected KeystoneAuthHolder makeRequest(OpenStackRequest<Token> v3Request, String type, String region) { diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java index 02ace5665d..072bf404e7 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java @@ -72,22 +72,22 @@ public final class DeploymentInfoBuilder { this.errorMessage = execution.getError(); // Compute the status based on the last workflow - if (lastAction.equals("install")) { - if (actionStatus.equals("terminated")) { + if (("install").equals(lastAction)) { + if (("terminated").equals(actionStatus)) { this.deploymentStatus = DeploymentStatus.INSTALLED; - } else if (actionStatus.equals("failed")) { + } else if (("failed").equals(actionStatus)) { this.deploymentStatus = DeploymentStatus.FAILED; - } else if (actionStatus.equals("started") || actionStatus.equals("pending")) { + } else if (("started").equals(actionStatus) || ("pending").equals(actionStatus)) { this.deploymentStatus = DeploymentStatus.INSTALLING; } else { this.deploymentStatus = DeploymentStatus.UNKNOWN; } - } else if (lastAction.equals("uninstall")) { - if (actionStatus.equals("terminated")) { + } else if (("uninstall").equals(lastAction)) { + if (("terminated").equals(actionStatus)) { this.deploymentStatus = DeploymentStatus.CREATED; - } else if (actionStatus.equals("failed")) { + } else if (("failed").equals(actionStatus)) { this.deploymentStatus = DeploymentStatus.FAILED; - } else if (actionStatus.equals("started") || actionStatus.equals("pending")) { + } else if (("started").equals(actionStatus) || ("pending").equals(actionStatus)) { this.deploymentStatus = DeploymentStatus.UNINSTALLING; } else { this.deploymentStatus = DeploymentStatus.UNKNOWN; diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java index 5c2348dffa..2251575671 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java @@ -38,8 +38,8 @@ public class MsoCloudifyWorkflowException extends MsoCloudifyException { super(0, "Workflow Exception", "Workflow " + workflowId + " failed on deployment " + deploymentId + ": " + message); this.workflowStatus = workflowStatus; - if (workflowStatus.equals("pending") || workflowStatus.equals("started") || workflowStatus.equals("cancelling") - || workflowStatus.equals("force_cancelling")) { + if (("pending").equals(workflowStatus) || ("started").equals(workflowStatus) + || ("cancelling").equals(workflowStatus) || ("force_cancelling").equals(workflowStatus)) { workflowStillRunning = true; } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java index e550394931..c1acc319f7 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java @@ -104,7 +104,7 @@ public class QueryAllottedResourceCustomization extends CatalogQuery { first = false; - boolean arNull = o.getAllottedResource() == null ? true : false; + boolean arNull = o.getAllottedResource() == null; put(valueMap, "MODEL_NAME", arNull ? null : o.getAllottedResource().getModelName()); put(valueMap, "MODEL_UUID", arNull ? null : o.getAllottedResource().getModelUUID()); diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java index 96ea797631..5573b23a8d 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java @@ -104,7 +104,7 @@ public class QueryServiceNetworks extends CatalogQuery { if (first) sb.append("\n"); first = false; - boolean nrNull = o.getNetworkResource() == null ? true : false; + boolean nrNull = o.getNetworkResource() == null; put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName()); put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID()); put(valueMap, "MODEL_INVARIANT_ID", nrNull ? null : o.getNetworkResource().getModelInvariantUUID()); diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java index b1bdeda445..f786f25361 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java @@ -101,7 +101,7 @@ public class QueryServiceVnfs extends CatalogQuery { sb.append("\n"); first = false; - boolean vrNull = o.getVnfResources() == null ? true : false; + boolean vrNull = o.getVnfResources() == null; put(valueMap, "MODEL_NAME", vrNull ? null : o.getVnfResources().getModelName()); put(valueMap, "MODEL_UUID", vrNull ? null : o.getVnfResources().getModelUUID()); diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java index 1dec9cecae..1604e99a72 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java @@ -97,7 +97,7 @@ public class QueryVfModule extends CatalogQuery { sb.append("\n"); first = false; - boolean vfNull = o.getVfModule() == null ? true : false; + boolean vfNull = o.getVfModule() == null; boolean hasVolumeGroup = false; HeatEnvironment envt = o.getVolumeHeatEnv(); if (envt != null) { @@ -109,10 +109,10 @@ public class QueryVfModule extends CatalogQuery { put(valueMap, "MODEL_INVARIANT_ID", vfNull ? null : o.getVfModule().getModelInvariantUUID()); put(valueMap, "MODEL_VERSION", vfNull ? null : o.getVfModule().getModelVersion()); put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID()); - put(valueMap, "IS_BASE", vfNull ? false : o.getVfModule().getIsBase() ? true : false); + put(valueMap, "IS_BASE", !vfNull && (o.getVfModule().getIsBase())); put(valueMap, "VF_MODULE_LABEL", o.getLabel()); put(valueMap, "INITIAL_COUNT", o.getInitialCount()); - put(valueMap, "HAS_VOLUME_GROUP", new Boolean(hasVolumeGroup)); + put(valueMap, "HAS_VOLUME_GROUP", hasVolumeGroup); sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap)); sep = ",\n"; 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 b59a1fa79a..bac41a1f8b 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 @@ -6,6 +6,7 @@ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Modifications Copyright (c) 2019 Samsung + * Modifications Copyright (c) 2019 IBM * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +67,6 @@ import org.onap.so.entity.MsoRequest; import org.onap.so.logger.ErrorCode; import org.onap.so.heatbridge.HeatBridgeApi; import org.onap.so.heatbridge.HeatBridgeImpl; -import org.onap.so.heatbridge.openstack.api.OpenstackClient; import org.onap.so.logger.MessageEnum; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; @@ -189,7 +189,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String vfModuleId = ""; // Create a hook here to catch shortcut createVf requests: if (requestType != null && requestType.startsWith("VFMOD")) { - logger.debug("Calling createVfModule from createVnf -- requestType=" + requestType); + logger.debug("Calling createVfModule from createVnf -- requestType={}", requestType); String newRequestType = requestType.substring(5); String vfVolGroupHeatStackId = ""; String vfBaseHeatStackId = ""; @@ -251,13 +251,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { Holder<Boolean> vnfExists, Holder<String> vnfId, Holder<VnfStatus> status, Holder<Map<String, String>> outputs) throws VnfException { - logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); + logger.debug("Querying VNF {} in {}/{}", vnfName, cloudSiteId, tenantId); // Will capture execution time for metrics - long startTime = System.currentTimeMillis(); - StackInfo heatStack = null; - long subStartTime = System.currentTimeMillis(); + StackInfo heatStack; try { heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vnfName); } catch (MsoException me) { @@ -310,14 +308,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { throws VnfException { logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); - // Will capture execution time for metrics - long startTime = System.currentTimeMillis(); - // Use the MsoHeatUtils to delete the stack. Set the polling flag to true. - // The possible outcomes of deleteStack are a StackInfo object with status - // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException - // could be thrown. - long subStartTime = System.currentTimeMillis(); try { heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true); } catch (MsoException me) { @@ -344,7 +335,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { */ @Override public void rollbackVnf(VnfRollback rollback) throws VnfException { - 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"); @@ -437,13 +427,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { logger.debug(" HeatBridgeMain.py returned {} with code {}", wait, p.exitValue()); return wait && p.exitValue() == 0; } catch (IOException e) { - logger.debug(" HeatBridgeMain.py failed with IO Exception! " + e); + logger.debug(" HeatBridgeMain.py failed with IO Exception! {}", e); return false; } catch (RuntimeException e) { - logger.debug(" HeatBridgeMain.py failed during runtime!" + e); + logger.debug(" HeatBridgeMain.py failed during runtime! {}", e); return false; } catch (Exception e) { - logger.debug(" HeatBridgeMain.py failed for unknown reasons! " + e); + logger.debug(" HeatBridgeMain.py failed for unknown reasons! {}", e); return false; } } @@ -461,7 +451,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudOwner, cloudSiteId, tenantId); - OpenstackClient openstackClient = heatBridgeClient.authenticate(); List<Resource> stackResources = heatBridgeClient.queryNestedHeatStackResources(heatStackId); List<Server> osServers = heatBridgeClient.getAllOpenstackServers(stackResources); @@ -590,7 +579,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { useMCUuid = false; mcu = ""; } else { - logger.debug("Found modelCustomizationUuid! Will use that: " + mcu); + logger.debug("Found modelCustomizationUuid! Will use that: {}", mcu); useMCUuid = true; } } @@ -1277,7 +1266,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { logger.debug("VF Module {} successfully created", vfModuleName); // call heatbridge heatbridge(heatStack, cloudOwner, cloudSiteId, tenantId, genericVnfName, vfModuleId); - return; } catch (Exception e) { logger.debug("unhandled exception in create VF", e); throw new VnfException("Exception during create VF " + e.getMessage()); @@ -1290,7 +1278,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { logger.debug("Deleting VF {} in ", vnfName, cloudOwner + "/" + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics - long startTime = System.currentTimeMillis(); // 1702 capture the output parameters on a delete // so we'll need to query first @@ -1323,11 +1310,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { msoRequest, failRequestOnValetFailure); } - // Use the MsoHeatUtils to delete the stack. Set the polling flag to true. - // The possible outcomes of deleteStack are a StackInfo object with status - // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException - // could be thrown. - long subStartTime = System.currentTimeMillis(); try { heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true); } catch (MsoException me) { @@ -2033,7 +2015,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { outputs.value = copyStringOutputs(heatStack.getOutputs()); rollback.value = vfRollback; - return; } private String getVfModuleNameFromModuleStackId(String vfModuleStackId) { @@ -2199,13 +2180,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { Map<String, Object> newInputs = vur.getParameters(); if (newInputs != null) { Map<String, Object> oldGold = goldenInputs; - logger.debug("parameters before being modified by valet:{}", oldGold.toString()); - goldenInputs = new HashMap<String, Object>(); + logger.debug("parameters before being modified by valet:{}", oldGold); + goldenInputs = new HashMap<>(); for (String key : newInputs.keySet()) { goldenInputs.put(key, newInputs.get(key)); } valetModifiedParamsHolder.value = goldenInputs; - logger.debug("parameters after being modified by valet:{}", goldenInputs.toString()); + logger.debug("parameters after being modified by valet:{}", goldenInputs); valetSucceeded = true; } } else { 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 21ce06eaf1..7d412b77ad 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 @@ -5,7 +5,7 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ - * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (C) 2019 IBM. * Modifications Copyright (c) 2019 Samsung * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -77,13 +77,12 @@ public class SDNCRestClient { private static Logger logger = LoggerFactory.getLogger(SDNCRestClient.class); private static final String EXCEPTION_MSG = "Exception while evaluate xpath"; - private static final String MSO_INTERNAL_ERROR = "MsoInternalError"; private static final String CAMUNDA = "Camunda"; @Async public void executeRequest(SDNCAdapterRequest bpelRequest) { - logger.debug("BPEL Request:" + bpelRequest.toString()); + logger.debug("BPEL Request: {}", bpelRequest); // Added delay to allow completion of create request to SDNC // before executing activate of create request. @@ -96,8 +95,6 @@ public class SDNCRestClient { Thread.currentThread().interrupt(); } - String action = bpelRequest.getRequestHeader().getSvcAction(); - String operation = bpelRequest.getRequestHeader().getSvcOperation(); String bpelReqId = bpelRequest.getRequestHeader().getRequestId(); String callbackUrl = bpelRequest.getRequestHeader().getCallbackUrl(); @@ -118,12 +115,9 @@ public class SDNCRestClient { Document reqDoc = node.getOwnerDocument(); sdncReqBody = Utils.genSdncPutReq(reqDoc, rt); } - long sdncStartTime = System.currentTimeMillis(); SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt); logger.debug("Got the SDNC Response: {}", sdncResp.getSdncRespXml()); - long bpelStartTime = System.currentTimeMillis(); sendRespToBpel(callbackUrl, sdncResp); - return; } public SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt) { @@ -288,7 +282,6 @@ public class SDNCRestClient { try { wsdlUrl = new URL(bpelUrl); } catch (MalformedURLException e1) { - error = "Caught exception initializing Callback wsdl " + e1.getMessage(); logger.error("{} {} {} {}", MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA, ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1); @@ -317,7 +310,6 @@ public class SDNCRestClient { reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers); headers.put("Authorization", Collections.singletonList(basicAuth)); } catch (Exception e2) { - error = "Unable to set authorization in callback request " + e2.getMessage(); logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA, ErrorCode.BusinessProcesssError.getValue(), "Exception - Unable to set authorization in callback request", e2); @@ -333,6 +325,5 @@ public class SDNCRestClient { MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), error, e); } logger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA); - return; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java index 4332a6cf4e..86bbead9a4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java @@ -47,7 +47,7 @@ public class ExtractPojosForBB { return extractByKey(execution, key, execution.getLookupMap().get(key)); } - public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) + protected <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) throws BBObjectNotFoundException { Optional<T> result = Optional.empty(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java index 513ff74180..4e74e5d414 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java @@ -55,7 +55,7 @@ public class HomingV2 { private boolean isOof(BuildingBlockExecution execution) { for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters() .getUserParams()) { - if (params.containsKey(HOMINGSOLUTION) && params.get(HOMINGSOLUTION).equals("oof")) { + if (params.containsKey(HOMINGSOLUTION) && ("oof").equals(params.get(HOMINGSOLUTION))) { return true; } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java index 2696313daf..d5a085aba7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java @@ -81,6 +81,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; @Component("OofHoming") public class OofHomingV2 { + public static final String ERROR_WHILE_PREPARING_OOF_REQUEST = " Error - while preparing oof request: "; private static final Logger logger = LoggerFactory.getLogger(OofHomingV2.class); private JsonUtils jsonUtils = new JsonUtils(); @Autowired @@ -91,13 +92,9 @@ public class OofHomingV2 { private OofValidator oofValidator; @Autowired private ExceptionBuilder exceptionUtil; - private static final String MODEL_NAME = "modelName"; private static final String MODEL_INVARIANT_ID = "modelInvariantId"; private static final String MODEL_VERSION_ID = "modelVersionId"; - private static final String MODEL_VERSION = "modelVersion"; private static final String SERVICE_RESOURCE_ID = "serviceResourceId"; - private static final String RESOURCE_MODULE_NAME = "resourceModuleName"; - private static final String RESOURCE_MODEL_INFO = "resourceModelInfo"; private static final String IDENTIFIER_TYPE = "identifierType"; private static final String SOLUTIONS = "solutions"; private static final String RESOURCE_MISSING_DATA = "Resource does not contain: "; @@ -128,7 +125,7 @@ public class OofHomingV2 { OofRequest oofRequest = new OofRequest(); - RequestInfo requestInfo = (RequestInfo) buildRequestInfo(requestId, timeout); + RequestInfo requestInfo = buildRequestInfo(requestId, timeout); oofRequest.setRequestInformation(requestInfo); ServiceInfo serviceInfo = buildServiceInfo(serviceInstance); @@ -157,13 +154,13 @@ public class OofHomingV2 { logger.trace("Completed Oof Homing Call Oof"); } catch (BpmnError e) { - logger.debug(" Error - while preparing oof request: " + e.getStackTrace()); + logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace()); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage()); } catch (BadResponseException e) { - logger.debug(" Error - while preparing oof request: " + e.getStackTrace()); + logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace()); exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage()); } catch (Exception e) { - logger.debug(" Error - while preparing oof request: " + e.getStackTrace()); + logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace()); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while " + "preparing oof request: " + e + " Stack:" + ExceptionUtils.getFullStackTrace(e)); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 3304d1b113..01bdc09419 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -481,6 +481,16 @@ public class AAIUpdateTasks { } } + public void updateOrchestrationStatusAssignFabricConfiguration(BuildingBlockExecution execution) { + try { + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); + aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, + OrchestrationStatus.ASSIGNED); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) { try { Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); 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 05d4f56fdc..a37f43727e 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 @@ -85,7 +85,7 @@ public class ExecuteActivity implements JavaDelegate { Map<String, Object> variables = new HashMap<>(); variables.put("buildingBlock", executeBuildingBlock); - variables.put("mso-request-id", requestId); + variables.put(G_REQUEST_ID, requestId); variables.put("retryCount", 1); variables.put("aLaCarte", true); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java index 77898dd5cc..428f5e703d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java @@ -32,7 +32,6 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.exception.ExceptionBuilder; -import org.onap.so.client.orchestration.NetworkAdapterResources; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -40,7 +39,6 @@ import org.springframework.stereotype.Component; @Component public class NetworkAdapterUpdateTasks { - private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterUpdateTasks.class); @Autowired private ExtractPojosForBB extractPojosForBB; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java index 849465e787..b257e91165 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java @@ -47,7 +47,7 @@ import static org.apache.commons.lang3.StringUtils.*; @Component public class VnfAdapterCreateTasks { - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateTasks.class); + public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_"; private static final String VNFREST_REQUEST = "VNFREST_Request"; @Autowired @@ -73,7 +73,7 @@ public class VnfAdapterCreateTasks { try { vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { - sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); + sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId()); } else { throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); @@ -109,8 +109,8 @@ public class VnfAdapterCreateTasks { CloudRegion cloudRegion = gBBInput.getCloudRegion(); RequestContext requestContext = gBBInput.getRequestContext(); OrchestrationContext orchestrationContext = gBBInput.getOrchContext(); - String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); - String sdncVnfQueryResponse = execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId()); + String sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId()); + String sdncVnfQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId()); CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest( requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java index 116dc30d63..5fe80b79f9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java @@ -42,7 +42,7 @@ import org.springframework.stereotype.Component; @Component public class VnfAdapterDeleteTasks { - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteTasks.class); + private static final String VNFREST_REQUEST = "VNFREST_Request"; @Autowired 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 bfa76c5053..48426fa725 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 @@ -63,6 +63,7 @@ public class VnfAdapterImpl { private static final String OAM_MANAGEMENT_V4_ADDRESS = "oamManagementV4Address"; private static final String OAM_MANAGEMENT_V6_ADDRESS = "oamManagementV6Address"; private static final String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList"; + public static final String HEAT_STACK_ID = "heatStackId"; @Autowired private ExtractPojosForBB extractPojosForBB; @@ -77,7 +78,7 @@ public class VnfAdapterImpl { extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId()); execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId()); - execution.setVariable("heatStackId", null); + execution.setVariable(HEAT_STACK_ID, null); execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, null); execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, null); execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, null); @@ -97,7 +98,7 @@ public class VnfAdapterImpl { String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId(); if (!StringUtils.isEmpty(heatStackId)) { vfModule.setHeatStackId(heatStackId); - execution.setVariable("heatStackId", heatStackId); + execution.setVariable(HEAT_STACK_ID, heatStackId); } Map<String, String> vfModuleOutputs = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleOutputs(); @@ -110,7 +111,7 @@ public class VnfAdapterImpl { Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted(); if (null != vfModuleDelete && vfModuleDelete) { vfModule.setHeatStackId(null); - execution.setVariable("heatStackId", null); + execution.setVariable(HEAT_STACK_ID, null); Map<String, String> vfModuleOutputs = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleOutputs(); if (vfModuleOutputs != null) { @@ -134,7 +135,7 @@ public class VnfAdapterImpl { String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId(); if (!StringUtils.isEmpty(heatStackId)) { volumeGroup.setHeatStackId(heatStackId); - execution.setVariable("heatStackId", heatStackId); + execution.setVariable(HEAT_STACK_ID, heatStackId); } else { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response."); @@ -144,7 +145,7 @@ public class VnfAdapterImpl { Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted(); if (null != volumeGroupDelete && volumeGroupDelete) { volumeGroup.setHeatStackId(null); - execution.setVariable("heatStackId", null); + execution.setVariable(HEAT_STACK_ID, null); } } } @@ -184,7 +185,7 @@ public class VnfAdapterImpl { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>(); + List<String> contrailNetworkPolicyFqdnList = new ArrayList<>(); Iterator<String> keys = vfModuleOutputs.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java index f193967a32..e0176eb802 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java @@ -42,6 +42,7 @@ import com.google.common.base.Optional; public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvider { private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class); + public static final String RECEIVED_RESPONSE_WITHOUT_BODY = "Received response without body: {}"; private final VnfmAdapterUrlProvider urlProvider; private final HttpRestServiceProvider httpServiceProvider; @@ -69,7 +70,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide } if (!response.hasBody()) { - LOGGER.error("Received response without body: {}", response); + LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response); return Optional.absent(); } @@ -107,7 +108,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide } if (!response.hasBody()) { - LOGGER.error("Received response without body: {}", response); + LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response); return Optional.absent(); } final DeleteVnfResponse deleteVnfResponse = response.getBody(); @@ -139,7 +140,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide } if (!response.hasBody()) { - LOGGER.error("Received response without body: {}", response); + LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response); return Optional.absent(); } return Optional.of(response.getBody()); 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 ef882b4694..f9bd8c546f 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 @@ -47,6 +47,9 @@ import org.springframework.stereotype.Component; @Component public class AppcRunTasks { private static final Logger logger = LoggerFactory.getLogger(AppcRunTasks.class); + public static final String ROLLBACK_VNF_STOP = "rollbackVnfStop"; + public static final String ROLLBACK_VNF_LOCK = "rollbackVnfLock"; + public static final String ROLLBACK_QUIESCE_TRAFFIC = "rollbackQuiesceTraffic"; @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -71,9 +74,9 @@ public class AppcRunTasks { execution.setVariable("actionHealthCheck", Action.HealthCheck); execution.setVariable("actionDistributeTraffic", Action.DistributeTraffic); execution.setVariable("actionDistributeTrafficCheck", Action.DistributeTrafficCheck); - execution.setVariable("rollbackVnfStop", false); - execution.setVariable("rollbackVnfLock", false); - execution.setVariable("rollbackQuiesceTraffic", false); + execution.setVariable(ROLLBACK_VNF_STOP, false); + execution.setVariable(ROLLBACK_VNF_LOCK, false); + execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false); } public void runAppcCommand(BuildingBlockExecution execution, Action action) { @@ -153,17 +156,17 @@ public class AppcRunTasks { protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) { if (appcCode.equals("0") && action != null) { if (action.equals(Action.Lock)) { - execution.setVariable("rollbackVnfLock", true); + execution.setVariable(ROLLBACK_VNF_LOCK, true); } else if (action.equals(Action.Unlock)) { - execution.setVariable("rollbackVnfLock", false); + execution.setVariable(ROLLBACK_VNF_LOCK, false); } else if (action.equals(Action.Start)) { - execution.setVariable("rollbackVnfStop", false); + execution.setVariable(ROLLBACK_VNF_STOP, false); } else if (action.equals(Action.Stop)) { - execution.setVariable("rollbackVnfStop", true); + execution.setVariable(ROLLBACK_VNF_STOP, true); } else if (action.equals(Action.QuiesceTraffic)) { - execution.setVariable("rollbackQuiesceTraffic", true); + execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, true); } else if (action.equals(Action.ResumeTraffic)) { - execution.setVariable("rollbackQuiesceTraffic", false); + execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false); } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java index ab8818f682..4b88f741de 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java @@ -54,9 +54,9 @@ public class AssignNetworkBBUtils { * @return */ public boolean networkFoundByName(BuildingBlockExecution execution) throws Exception { - boolean found = false; + // TODO - populate logic after iTrack MSO-2143 implemented - return found; + return false; } /** @@ -71,7 +71,7 @@ public class AssignNetworkBBUtils { CloudRegion cloudRegion = gBBInput.getCloudRegion(); String cloudRegionSdnc; String cloudRegionPo = cloudRegion.getLcpCloudRegionId(); - if (cloudRegion.getCloudRegionVersion().equalsIgnoreCase("2.5")) { + if ("2.5".equalsIgnoreCase(cloudRegion.getCloudRegionVersion())) { cloudRegionSdnc = "AAIAIC25"; } else { cloudRegionSdnc = cloudRegionPo; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java index 359f19285f..4ec8b932c0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java @@ -40,9 +40,9 @@ import org.springframework.stereotype.Component; @Component public class ConfigDeployVnf { private static final Logger logger = LoggerFactory.getLogger(ConfigDeployVnf.class); - private final static String ORIGINATOR_ID = "SO"; - private final static String ACTION_NAME = "config-deploy"; - private final static String MODE = "async"; + private static final String ORIGINATOR_ID = "SO"; + private static final String ACTION_NAME = "config-deploy"; + private static final String MODE = "async"; @Autowired private ExceptionBuilder exceptionUtil; 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 1925d8b69f..0ad88d0676 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 @@ -160,7 +160,7 @@ public class ConfigurationScaleOut { logger.error("Error Message: " + appcMessage); logger.error("ERROR CODE: " + appcCode); logger.trace("End of runAppCommand "); - if (appcCode != null && !appcCode.equals("0")) { + if (appcCode != null && !("0").equals(appcCode)) { exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java index c2d9c6e7bb..b7ddc11f35 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java @@ -39,7 +39,7 @@ import org.springframework.stereotype.Component; @Component public class CreateNetwork { - private static final Logger logger = LoggerFactory.getLogger(CreateNetwork.class); + @Autowired private ExceptionBuilder exceptionUtil; @Autowired diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java index 4eaec381e9..36eab8f981 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java @@ -36,7 +36,7 @@ import org.springframework.stereotype.Component; @Component public class CreateNetworkCollection { - private static final Logger logger = LoggerFactory.getLogger(CreateNetworkCollection.class); + @Autowired private ExceptionBuilder exceptionUtil; @Autowired 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 98b602eca1..8f0c809e1f 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 @@ -45,6 +45,9 @@ import org.springframework.stereotype.Component; public class GenericVnfHealthCheck { private static final Logger logger = LoggerFactory.getLogger(GenericVnfHealthCheck.class); + public static final String VNF_NAME = "vnfName"; + public static final String OAM_IP_ADDRESS = "oamIpAddress"; + public static final String VNF_HOST_IP_ADDRESS = "vnfHostIpAddress"; @Autowired private ExceptionBuilder exceptionUtil; @Autowired @@ -71,9 +74,9 @@ public class GenericVnfHealthCheck { String controllerName = controllerSelectionReference.getControllerName(); execution.setVariable("vnfId", vnfId); - execution.setVariable("vnfName", vnfName); - execution.setVariable("oamIpAddress", oamIpAddress); - execution.setVariable("vnfHostIpAddress", oamIpAddress); + execution.setVariable(VNF_NAME, vnfName); + execution.setVariable(OAM_IP_ADDRESS, oamIpAddress); + execution.setVariable(VNF_HOST_IP_ADDRESS, oamIpAddress); execution.setVariable("msoRequestId", gBBInput.getRequestContext().getMsoRequestId()); execution.setVariable("action", actionCategory); execution.setVariable("controllerType", controllerName); @@ -98,11 +101,11 @@ public class GenericVnfHealthCheck { payload = Optional.of(pay); } String controllerType = execution.getVariable("controllerType"); - HashMap<String, String> payloadInfo = new HashMap<String, String>(); - payloadInfo.put("vnfName", execution.getVariable("vnfName")); + HashMap<String, String> payloadInfo = new HashMap<>(); + payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME)); payloadInfo.put("vfModuleId", execution.getVariable("vfModuleId")); - payloadInfo.put("oamIpAddress", execution.getVariable("oamIpAddress")); - payloadInfo.put("vnfHostIpAddress", execution.getVariable("vnfHostIpAddress")); + payloadInfo.put(OAM_IP_ADDRESS, execution.getVariable(OAM_IP_ADDRESS)); + payloadInfo.put(VNF_HOST_IP_ADDRESS, execution.getVariable(VNF_HOST_IP_ADDRESS)); logger.debug("Running APP-C action: {}", action.toString()); logger.debug("VNFID: {}", vnfId); @@ -133,7 +136,7 @@ public class GenericVnfHealthCheck { logger.error("Error Message: " + appcMessage); logger.error("ERROR CODE: " + appcCode); logger.trace("End of runAppCommand "); - if (appcCode != null && !appcCode.equals("0")) { + if (appcCode != null && !("0").equals(appcCode)) { exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java index 27415190cc..7466df53b2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java @@ -38,11 +38,10 @@ import org.springframework.stereotype.Component; @Component public class UnassignNetworkBB { - private static final Logger logger = LoggerFactory.getLogger(UnassignNetworkBB.class); - private static String MESSAGE_CANNOT_PERFORM_UNASSIGN = + private static String messageCannotPerformUnassign = "Cannot perform Unassign Network. Network is still related to "; - private static String MESSAGE_ERROR_ROLLBACK = " Rollback is not possible. Please restore data manually."; + private static String messageErrorRollback = " Rollback is not possible. Please restore data manually."; @Autowired private ExceptionBuilder exceptionUtil; @@ -72,7 +71,7 @@ public class UnassignNetworkBB { Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) { - String msg = MESSAGE_CANNOT_PERFORM_UNASSIGN + relatedToValue; + String msg = messageCannotPerformUnassign + relatedToValue; execution.setVariable("ErrorUnassignNetworkBB", msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); } @@ -109,7 +108,7 @@ public class UnassignNetworkBB { boolean isRollbackNeeded = execution.getVariable("isRollbackNeeded") != null ? execution.getVariable("isRollbackNeeded") : false; if (isRollbackNeeded == true) { - msg = execution.getVariable("ErrorUnassignNetworkBB") + MESSAGE_ERROR_ROLLBACK; + msg = execution.getVariable("ErrorUnassignNetworkBB") + messageErrorRollback; } else { msg = execution.getVariable("ErrorUnassignNetworkBB"); } 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 b906b8a662..61fc8ffc48 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 @@ -23,6 +23,14 @@ public class ManualHandlingTasks { private static final String TASK_TYPE_PAUSE = "pause"; private static final String TASK_TYPE_FALLOUT = "fallout"; + public static final String VNF_TYPE = "vnfType"; + public static final String SERVICE_TYPE = "serviceType"; + public static final String MSO_REQUEST_ID = "msoRequestId"; + public static final String REQUESTOR_ID = "requestorId"; + public static final String ERROR_CODE = "errorCode"; + public static final String VALID_RESPONSES = "validResponses"; + public static final String DESCRIPTION = "description"; + public static final String BPMN_EXCEPTION = "BPMN exception: "; @Autowired private ExceptionBuilder exceptionUtil; @@ -37,39 +45,39 @@ public class ManualHandlingTasks { String taskId = task.getId(); logger.debug("taskId is: " + taskId); String type = TASK_TYPE_FALLOUT; - String nfRole = (String) execution.getVariable("vnfType"); - String subscriptionServiceType = (String) execution.getVariable("serviceType"); - String originalRequestId = (String) execution.getVariable("msoRequestId"); - String originalRequestorId = (String) execution.getVariable("requestorId"); + String nfRole = (String) execution.getVariable(VNF_TYPE); + String subscriptionServiceType = (String) execution.getVariable(SERVICE_TYPE); + String originalRequestId = (String) execution.getVariable(MSO_REQUEST_ID); + String originalRequestorId = (String) execution.getVariable(REQUESTOR_ID); String description = ""; String timeout = ""; String errorSource = (String) execution.getVariable("failedActivity"); - String errorCode = (String) execution.getVariable("errorCode"); + String errorCode = (String) execution.getVariable(ERROR_CODE); String errorMessage = (String) execution.getVariable("errorText"); String buildingBlockName = (String) execution.getVariable("currentActivity"); String buildingBlockStep = (String) execution.getVariable("workStep"); - String validResponses = (String) execution.getVariable("validResponses"); + String validResponses = (String) execution.getVariable(VALID_RESPONSES); - Map<String, String> taskVariables = new HashMap<String, String>(); + Map<String, String> taskVariables = new HashMap<>(); taskVariables.put("type", type); taskVariables.put("nfRole", nfRole); taskVariables.put("subscriptionServiceType", subscriptionServiceType); taskVariables.put("originalRequestId", originalRequestId); taskVariables.put("originalRequestorId", originalRequestorId); taskVariables.put("errorSource", errorSource); - taskVariables.put("errorCode", errorCode); + taskVariables.put(ERROR_CODE, errorCode); taskVariables.put("errorMessage", errorMessage); taskVariables.put("buildingBlockName", buildingBlockName); taskVariables.put("buildingBlockStep", buildingBlockStep); - taskVariables.put("validResponses", validResponses); + taskVariables.put(VALID_RESPONSES, validResponses); taskVariables.put("tmeout", timeout); - taskVariables.put("description", description); + taskVariables.put(DESCRIPTION, description); TaskService taskService = execution.getProcessEngineServices().getTaskService(); taskService.setVariables(taskId, taskVariables); logger.debug("successfully created fallout task: " + taskId); } catch (BpmnError e) { - logger.debug("BPMN exception: " + e.getMessage()); + logger.debug(BPMN_EXCEPTION + e.getMessage()); throw e; } catch (Exception ex) { String msg = "Exception in setFalloutTaskVariables " + ex.getMessage(); @@ -86,39 +94,39 @@ public class ManualHandlingTasks { String taskId = task.getId(); logger.debug("taskId is: " + taskId); String type = TASK_TYPE_PAUSE; - String nfRole = (String) execution.getVariable("vnfType"); - String subscriptionServiceType = (String) execution.getVariable("serviceType"); - String originalRequestId = (String) execution.getVariable("msoRequestId"); - String originalRequestorId = (String) execution.getVariable("requestorId"); - String description = (String) execution.getVariable("description"); + String nfRole = (String) execution.getVariable(VNF_TYPE); + String subscriptionServiceType = (String) execution.getVariable(SERVICE_TYPE); + String originalRequestId = (String) execution.getVariable(MSO_REQUEST_ID); + String originalRequestorId = (String) execution.getVariable(REQUESTOR_ID); + String description = (String) execution.getVariable(DESCRIPTION); String timeout = (String) execution.getVariable("taskTimeout"); String errorSource = ""; String errorCode = ""; String errorMessage = ""; String buildingBlockName = ""; String buildingBlockStep = ""; - String validResponses = (String) execution.getVariable("validResponses"); + String validResponses = (String) execution.getVariable(VALID_RESPONSES); - Map<String, String> taskVariables = new HashMap<String, String>(); + Map<String, String> taskVariables = new HashMap<>(); taskVariables.put("type", type); taskVariables.put("nfRole", nfRole); - taskVariables.put("description", description); + taskVariables.put(DESCRIPTION, description); taskVariables.put("timeout", timeout); taskVariables.put("subscriptionServiceType", subscriptionServiceType); taskVariables.put("originalRequestId", originalRequestId); taskVariables.put("originalRequestorId", originalRequestorId); taskVariables.put("errorSource", errorSource); - taskVariables.put("errorCode", errorCode); + taskVariables.put(ERROR_CODE, errorCode); taskVariables.put("errorMessage", errorMessage); taskVariables.put("buildingBlockName", buildingBlockName); taskVariables.put("buildingBlockStep", buildingBlockStep); - taskVariables.put("validResponses", validResponses); + taskVariables.put(VALID_RESPONSES, validResponses); TaskService taskService = execution.getProcessEngineServices().getTaskService(); taskService.setVariables(taskId, taskVariables); logger.debug("successfully created pause task: " + taskId); } catch (BpmnError e) { - logger.debug("BPMN exception: " + e.getMessage()); + logger.debug(BPMN_EXCEPTION + e.getMessage()); throw e; } catch (Exception ex) { String msg = "Exception in setPauseTaskVariables " + ex.getMessage(); @@ -149,7 +157,7 @@ public class ManualHandlingTasks { execution.setVariable("responseValueTask", responseValueUppercaseStart); } catch (BpmnError e) { - logger.debug("BPMN exception: " + e.getMessage()); + logger.debug(BPMN_EXCEPTION + e.getMessage()); throw e; } catch (Exception ex) { String msg = "Exception in completeManualTask " + ex.getMessage(); @@ -164,15 +172,15 @@ public class ManualHandlingTasks { try { ExternalTicket ticket = new ExternalTicket(); - ticket.setRequestId((String) execution.getVariable("msoRequestId")); + ticket.setRequestId((String) execution.getVariable(MSO_REQUEST_ID)); ticket.setCurrentActivity((String) execution.getVariable("currentActivity")); - ticket.setNfRole((String) execution.getVariable("vnfType")); - ticket.setDescription((String) execution.getVariable("description")); - ticket.setSubscriptionServiceType((String) execution.getVariable("serviceType")); - ticket.setRequestorId((String) execution.getVariable("requestorId")); + ticket.setNfRole((String) execution.getVariable(VNF_TYPE)); + ticket.setDescription((String) execution.getVariable(DESCRIPTION)); + ticket.setSubscriptionServiceType((String) execution.getVariable(SERVICE_TYPE)); + ticket.setRequestorId((String) execution.getVariable(REQUESTOR_ID)); ticket.setTimeout((String) execution.getVariable("taskTimeout")); ticket.setErrorSource((String) execution.getVariable("failedActivity")); - ticket.setErrorCode((String) execution.getVariable("errorCode")); + ticket.setErrorCode((String) execution.getVariable(ERROR_CODE)); ticket.setErrorMessage((String) execution.getVariable("errorText")); ticket.setWorkStep((String) execution.getVariable("workStep")); @@ -191,7 +199,7 @@ public class ManualHandlingTasks { public void updateRequestDbStatus(DelegateExecution execution, String status) { try { - String requestId = (String) execution.getVariable("msoRequestId"); + String requestId = (String) execution.getVariable(MSO_REQUEST_ID); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); request.setRequestStatus(status); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java index 7a0008d5a2..32276891c7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java @@ -50,7 +50,8 @@ import org.springframework.stereotype.Component; @Component public class SDNCActivateTasks { - private static final Logger logger = LoggerFactory.getLogger(SDNCActivateTasks.class); + + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCVnfResources sdncVnfResources; @Autowired @@ -77,7 +78,7 @@ public class SDNCActivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -103,7 +104,7 @@ public class SDNCActivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -126,7 +127,7 @@ public class SDNCActivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java index d3878f06b7..111f008159 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java @@ -54,6 +54,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCAssignTasks { private static final Logger logger = LoggerFactory.getLogger(SDNCAssignTasks.class); + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCServiceInstanceResources sdncSIResources; @Autowired @@ -79,7 +80,7 @@ public class SDNCAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.SERVICE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -99,7 +100,7 @@ public class SDNCAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -126,7 +127,7 @@ public class SDNCAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -152,7 +153,7 @@ public class SDNCAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java index 50cf0fb074..4ffb397707 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java @@ -47,6 +47,7 @@ import org.springframework.stereotype.Component; @Component public class SDNCChangeAssignTasks { + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCNetworkResources sdncNetworkResources; @Autowired @@ -70,7 +71,7 @@ public class SDNCChangeAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.SERVICE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -87,7 +88,7 @@ public class SDNCChangeAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -104,7 +105,7 @@ public class SDNCChangeAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -125,7 +126,7 @@ public class SDNCChangeAssignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java index 3a1528946d..e587830c74 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java @@ -51,7 +51,8 @@ import org.springframework.stereotype.Component; @Component public class SDNCDeactivateTasks { - private static final Logger logger = LoggerFactory.getLogger(SDNCDeactivateTasks.class); + + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCNetworkResources sdncNetworkResources; @Autowired @@ -80,7 +81,7 @@ public class SDNCDeactivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -107,7 +108,7 @@ public class SDNCDeactivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -132,7 +133,7 @@ public class SDNCDeactivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.SERVICE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -157,7 +158,7 @@ public class SDNCDeactivateTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java index 7ae6117c61..fcc67d0ef7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java @@ -39,7 +39,8 @@ import org.springframework.stereotype.Component; @Component public class SDNCQueryTasks { - private static final Logger logger = LoggerFactory.getLogger(SDNCQueryTasks.class); + + public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_"; @Autowired private SDNCVnfResources sdncVnfResources; @Autowired @@ -61,7 +62,7 @@ public class SDNCQueryTasks { genericVnf.setSelflink(selfLink); } String response = sdncVnfResources.queryVnf(genericVnf); - execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), response); + execution.setVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId(), response); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -82,7 +83,7 @@ public class SDNCQueryTasks { } if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { String response = sdncVfModuleResources.queryVfModule(vfModule); - execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response); + execution.setVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId(), response); } else { throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); @@ -97,7 +98,7 @@ public class SDNCQueryTasks { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { String response = sdncVfModuleResources.queryVfModule(vfModule); - execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response); + execution.setVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId(), response); } else { throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java index e9848d1646..fba189fcfc 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java @@ -51,7 +51,8 @@ import org.springframework.stereotype.Component; @Component public class SDNCUnassignTasks { - private static final Logger logger = LoggerFactory.getLogger(SDNCUnassignTasks.class); + + public static final String SDNC_REQUEST = "SDNCRequest"; @Autowired private SDNCServiceInstanceResources sdncSIResources; @Autowired @@ -77,7 +78,7 @@ public class SDNCUnassignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.SERVICE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -94,7 +95,7 @@ public class SDNCUnassignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -114,7 +115,7 @@ public class SDNCUnassignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VNF); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } @@ -136,7 +137,7 @@ public class SDNCUnassignTasks { SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.NETWORK); - execution.setVariable("SDNCRequest", sdncRequest); + execution.setVariable(SDNC_REQUEST, sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java index 746f136e96..1453e40653 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -49,7 +49,7 @@ public class AAIConfigurationResources { public void createConfiguration(Configuration configuration) { AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); - configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index 7109ac8826..905f244278 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -666,6 +666,18 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test + public void updateOrchestrationStatusAssignedFabricConfigurationTest() throws Exception { + gBBInput = execution.getGeneralBuildingBlock(); + doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, + OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignFabricConfiguration(execution); + + verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, + OrchestrationStatus.ASSIGNED); + } + + @Test public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception { execution.setVariable("contrailServiceInstanceFqdn", "newContrailServiceInstanceFqdn"); doNothing().when(aaiVfModuleResources).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java index 2e1a40dd22..be58ccb046 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java @@ -98,7 +98,7 @@ public class AAIConfigurationResourcesTest extends TestDataSetup { aaiConfigurationResources.createConfiguration(configuration); - assertEquals(OrchestrationStatus.ASSIGNED, configuration.getOrchestrationStatus()); + assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus()); verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class)); } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java index 0f9ad2da39..df63bd18d3 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,20 +31,6 @@ public class CloudifyRequest<R> { private CloudifyClient client; - public CloudifyRequest() { - - } - - public CloudifyRequest(CloudifyClient client, HttpMethod method, CharSequence path, Entity<?> entity, - Class<R> returnType) { - this.client = client; - this.method = method; - this.path = new StringBuilder(path); - this.entity = entity; - this.returnType = returnType; - header("Accept", "application/json"); - } - private String endpoint; private HttpMethod method; @@ -61,6 +47,20 @@ public class CloudifyRequest<R> { private String user = null; private String password = null; + public CloudifyRequest() { + + } + + public CloudifyRequest(CloudifyClient client, HttpMethod method, CharSequence path, Entity<?> entity, + Class<R> returnType) { + this.client = client; + this.method = method; + this.path = new StringBuilder(path); + this.entity = entity; + this.returnType = returnType; + header("Accept", "application/json"); + } + public CloudifyRequest<R> endpoint(String endpoint) { this.endpoint = endpoint; return this; @@ -151,7 +151,7 @@ public class CloudifyRequest<R> { /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java index 3eae02bcee..9877eb9f43 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java @@ -31,6 +31,7 @@ import org.onap.so.cloudify.base.client.CloudifyRequest; public class BlueprintsResource { private final CloudifyClient client; + private static final String BLUEPRINTS_PATH = "/api/v3/blueprints/"; public BlueprintsResource(CloudifyClient client) { this.client = client; @@ -72,7 +73,7 @@ public class BlueprintsResource { // If a URL is provided, add it to the query string // If a Stream is provided, set it as the Entity body super(client, HttpMethod.PUT, - "/api/v3/blueprints/" + blueprintId + "?application_file_name=" + mainFileName + BLUEPRINTS_PATH + blueprintId + "?application_file_name=" + mainFileName + ((blueprintUrl != null) ? "&blueprint_archive=" + blueprintUrl : ""), ((blueprint != null) ? Entity.stream(blueprint) : null), Blueprint.class); } @@ -80,13 +81,13 @@ public class BlueprintsResource { public class DeleteBlueprint extends CloudifyRequest<Blueprint> { public DeleteBlueprint(String blueprintId) { - super(client, HttpMethod.DELETE, "/api/v3/blueprints/" + blueprintId, null, Blueprint.class); + super(client, HttpMethod.DELETE, BLUEPRINTS_PATH + blueprintId, null, Blueprint.class); } } public class GetBlueprint extends CloudifyRequest<Blueprint> { public GetBlueprint(String id, String queryArgs) { - super(client, HttpMethod.GET, "/api/v3/blueprints/" + id + queryArgs, null, Blueprint.class); + super(client, HttpMethod.GET, BLUEPRINTS_PATH + id + queryArgs, null, Blueprint.class); } } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java index 262045a367..335f6b1697 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java @@ -32,6 +32,7 @@ import org.onap.so.cloudify.base.client.CloudifyRequest; public class DeploymentsResource { private final CloudifyClient client; + private static final String DEPLOYMENT_PATH = "/api/v3/deployments/"; public DeploymentsResource(CloudifyClient client) { this.client = client; @@ -59,25 +60,25 @@ public class DeploymentsResource { public class CreateDeployment extends CloudifyRequest<Deployment> { public CreateDeployment(String deploymentId, CreateDeploymentParams body) { - super(client, HttpMethod.PUT, "/api/v3/deployments/" + deploymentId, Entity.json(body), Deployment.class); + super(client, HttpMethod.PUT, DEPLOYMENT_PATH + deploymentId, Entity.json(body), Deployment.class); } } public class DeleteDeployment extends CloudifyRequest<Deployment> { public DeleteDeployment(String deploymentId) { - super(client, HttpMethod.DELETE, "/api/v3/deployments/" + deploymentId, null, Deployment.class); + super(client, HttpMethod.DELETE, DEPLOYMENT_PATH + deploymentId, null, Deployment.class); } } public class GetDeployment extends CloudifyRequest<Deployment> { public GetDeployment(String id) { - super(client, HttpMethod.GET, "/api/v3/deployments/" + id, null, Deployment.class); + super(client, HttpMethod.GET, DEPLOYMENT_PATH + id, null, Deployment.class); } } public class GetDeploymentOutputs extends CloudifyRequest<DeploymentOutputs> { public GetDeploymentOutputs(String id) { - super(client, HttpMethod.GET, "/api/v3/deployments/" + id + "/outputs", null, DeploymentOutputs.class); + super(client, HttpMethod.GET, DEPLOYMENT_PATH + id + "/outputs", null, DeploymentOutputs.class); } } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java index 51aaea94bb..34251bfe52 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java @@ -33,6 +33,7 @@ import org.onap.so.cloudify.base.client.CloudifyRequest; public class ExecutionsResource { private final CloudifyClient client; + private static final String EXECUTIONS_PATH = "/api/v3/executions/"; public ExecutionsResource(CloudifyClient client) { this.client = client; @@ -76,7 +77,7 @@ public class ExecutionsResource { public class GetExecution extends CloudifyRequest<Execution> { public GetExecution(String id) { - super(client, HttpMethod.GET, "/api/v3/executions/" + id, null, Execution.class); + super(client, HttpMethod.GET, EXECUTIONS_PATH + id, null, Execution.class); } } @@ -95,13 +96,13 @@ public class ExecutionsResource { public class UpdateExecution extends CloudifyRequest<Execution> { public UpdateExecution(String executionId, UpdateExecutionParams body) { - super(client, HttpMethod.PATCH, "/api/v3/executions/" + executionId, Entity.json(body), Execution.class); + super(client, HttpMethod.PATCH, EXECUTIONS_PATH + executionId, Entity.json(body), Execution.class); } } public class CancelExecution extends CloudifyRequest<Execution> { public CancelExecution(String executionId, CancelExecutionParams body) { - super(client, HttpMethod.POST, "/api/v3/executions/" + executionId, Entity.json(body), Execution.class); + super(client, HttpMethod.POST, EXECUTIONS_PATH + executionId, Entity.json(body), Execution.class); } } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java index 0fbe1fc33d..7f96b8f7c6 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java @@ -30,8 +30,8 @@ public class CancelExecutionParams implements Serializable { @JsonProperty("action") private String action; - public final static String CANCEL_ACTION = "cancel"; - public final static String FORCE_CANCEL_ACTION = "force-cancel"; + public static final String CANCEL_ACTION = "cancel"; + public static final String FORCE_CANCEL_ACTION = "force-cancel"; public String getAction() { return action; 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 d11f1706e9..e6e81671cf 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 @@ -49,6 +49,9 @@ import com.fasterxml.jackson.databind.SerializationFeature; public class CamundaClient extends RequestClient { private static Logger logger = LoggerFactory.getLogger(CamundaClient.class); private static final String CAMUNDA_URL_MESAGE = "Camunda url is: "; + private static final String CAMUNDA_RESPONSE = "Response is: {}"; + private static final String AUTHORIZATION = "Authorization"; + private static final String BASIC = "Basic "; public CamundaClient() { super(CommonConstants.CAMUNDA); @@ -71,7 +74,7 @@ public class CamundaClient extends RequestClient { setupHeaders(post); HttpResponse response = client.execute(post); - logger.debug("Response is: {}", response); + logger.debug(CAMUNDA_RESPONSE, response); return response; } @@ -88,8 +91,8 @@ public class CamundaClient extends RequestClient { String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP)); if (userCredentials != null) { - post.addHeader("Authorization", - "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); + post.addHeader(AUTHORIZATION, + BASIC + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); } } } @@ -111,8 +114,8 @@ public class CamundaClient extends RequestClient { String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP)); if (userCredentials != null) { - post.addHeader("Authorization", - "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); + post.addHeader(AUTHORIZATION, + BASIC + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); } } } @@ -120,7 +123,7 @@ public class CamundaClient extends RequestClient { post.setEntity(input); HttpResponse response = client.execute(post); - logger.debug("Response is: {}", response); + logger.debug(CAMUNDA_RESPONSE, response); return response; } @@ -151,15 +154,15 @@ public class CamundaClient extends RequestClient { String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP)); if (userCredentials != null) { - post.addHeader("Authorization", - "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); + post.addHeader(AUTHORIZATION, + BASIC + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); } } } post.setEntity(input); HttpResponse response = client.execute(post); - logger.debug("Response is: {}", response); + logger.debug(CAMUNDA_RESPONSE, response); return response; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java index 0aac35d5a9..9b7801711f 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java @@ -79,8 +79,7 @@ public abstract class RequestClient { protected String decryptPropValue(String prop, String defaultValue, String encryptionKey) { try { - String result = CryptoUtils.decrypt(prop, encryptionKey); - return result; + return CryptoUtils.decrypt(prop, encryptionKey); } catch (GeneralSecurityException e) { logger.debug("Security exception", e); } @@ -89,14 +88,10 @@ public abstract class RequestClient { protected String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) { try { - String result = CryptoUtils.decrypt(prop, encryptionKey); - return result; + return CryptoUtils.decrypt(prop, encryptionKey); } catch (GeneralSecurityException e) { logger.debug("Security exception", e); } return defaultValue; } - - - } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java index fff4c1d508..095182fe98 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java @@ -80,12 +80,8 @@ public class ResponseHandler { new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError) .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); - - ValidateException validateException = - new ValidateException.Builder("IOException getting Camunda response body", - HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) - .errorInfo(errorLoggerInfo).build(); - throw validateException; + throw new ValidateException.Builder("IOException getting Camunda response body", HttpStatus.SC_BAD_REQUEST, + ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); } ObjectMapper mapper = new ObjectMapper(); @@ -96,11 +92,8 @@ public class ResponseHandler { new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError) .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); - - ValidateException validateException = - new ValidateException.Builder("Cannot parse Camunda Response", HttpStatus.SC_BAD_REQUEST, - ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); - throw validateException; + throw new ValidateException.Builder("Cannot parse Camunda Response", HttpStatus.SC_BAD_REQUEST, + ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); } if (response != null) { responseBody = response.getResponse(); @@ -125,22 +118,16 @@ public class ResponseHandler { } catch (IOException e) { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build(); - ValidateException validateException = - new ValidateException.Builder("Could not convert BPEL response to string", - HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) - .errorInfo(errorLoggerInfo).build(); - throw validateException; + + throw new ValidateException.Builder("Could not convert BPEL response to string", HttpStatus.SC_BAD_REQUEST, + ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); } if (status != HttpStatus.SC_ACCEPTED) { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError).targetEntity("BPEL").targetServiceName("parseBpel").build(); - - BPMNFailureException bpmnFailureException = - new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL) - .errorInfo(errorLoggerInfo).build(); - - throw bpmnFailureException; + throw new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL) + .errorInfo(errorLoggerInfo).build(); } } @@ -157,24 +144,17 @@ public class ResponseHandler { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build(); - - ValidateException validateException = - new ValidateException.Builder("Could not convert CamundaTask response to string", - HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) - .errorInfo(errorLoggerInfo).build(); - throw validateException; + throw new ValidateException.Builder("Could not convert CamundaTask response to string", + HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo) + .build(); } if (status != HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED) { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError).targetEntity("CAMUNDATASK").targetServiceName("parseCamundaTask") .build(); - - BPMNFailureException bpmnFailureException = - new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL) - .errorInfo(errorLoggerInfo).build(); - - throw bpmnFailureException; + throw new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL) + .errorInfo(errorLoggerInfo).build(); } } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java index 7cf2046646..ec583645ae 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java @@ -41,12 +41,12 @@ public class Constants { public static final String A_LA_CARTE = "aLaCarte"; - public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; + public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; - public final static String VNF_REQUEST_SCOPE = "vnf"; - public final static String SERVICE_INSTANCE_PATH = "/serviceInstances"; - public final static String SERVICE_INSTANTIATION_PATH = "/serviceInstantiation"; - public final static String ORCHESTRATION_REQUESTS_PATH = "/orchestrationRequests"; + public static final String VNF_REQUEST_SCOPE = "vnf"; + public static final String SERVICE_INSTANCE_PATH = "/serviceInstances"; + public static final String SERVICE_INSTANTIATION_PATH = "/serviceInstantiation"; + public static final String ORCHESTRATION_REQUESTS_PATH = "/orchestrationRequests"; private Constants() {} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java index 8b3b91ae1a..d9db5713a7 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java @@ -42,7 +42,7 @@ import org.springframework.stereotype.Component; @Component public class AAIClientHelper { - private static Logger logger = LoggerFactory.getLogger(AAIClientHelper.class); + /** * Get managing ECOMP Environment Info from A&AI diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpec.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpec.java index 00eff8f0c9..9a9564023d 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpec.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpec.java @@ -1,7 +1,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.persistence.Column; @@ -10,9 +9,6 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.PrePersist; import javax.persistence.Table; @@ -22,8 +18,6 @@ import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategories.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategories.java index 3518805b0d..f1ee006b60 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategories.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategories.java @@ -21,7 +21,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,15 +31,11 @@ import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.PrePersist; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; -import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity @IdClass(ActivitySpecActivitySpecCategoriesId.class) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParameters.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParameters.java index f0c9bd99ce..49c5d98943 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParameters.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParameters.java @@ -21,7 +21,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,15 +31,11 @@ import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.PrePersist; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; -import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity @IdClass(ActivitySpecActivitySpecParametersId.class) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java index a42a73aac9..56aecc4a98 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java @@ -1,8 +1,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; @@ -10,20 +8,12 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.ManyToOne; import javax.persistence.OneToMany; -import javax.persistence.PrePersist; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParameters.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParameters.java index be32da379e..6a7b5ba0be 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParameters.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParameters.java @@ -21,7 +21,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,15 +31,11 @@ import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.PrePersist; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; -import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity @IdClass(ActivitySpecUserParametersId.class) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java index 54e2144c81..f94b8155f8 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java @@ -21,22 +21,17 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.List; -import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.OneToMany; import javax.persistence.Table; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; -import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import com.openpojo.business.annotation.BusinessKey; @Entity diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java index 1117648a7f..4599c978ec 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java @@ -22,7 +22,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; import java.util.Date; -import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,8 +31,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.MapsId; -import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.PrePersist; import javax.persistence.Table; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java index 9287fbcf84..21b1550cb5 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java @@ -44,33 +44,6 @@ import uk.co.blackpepper.bowman.annotation.LinkedResource; public class NetworkResourceCustomization implements Serializable { public static final long serialVersionUID = -1322322139926390329L; - @Override - public String toString() { - return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) - .append("modelInstanceName", modelInstanceName).append("created", created) - .append("networkTechnology", networkTechnology).append("networkType", networkType) - .append("networkScope", networkScope).append("networkRole", networkRole) - .append("networkResource", networkResource).toString(); - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof NetworkResourceCustomization)) { - return false; - } - NetworkResourceCustomization castOther = (NetworkResourceCustomization) other; - return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); - } - - public NetworkResourceCustomization() { - super(); - } - @BusinessKey @Id @Column(name = "MODEL_CUSTOMIZATION_UUID") @@ -102,6 +75,10 @@ public class NetworkResourceCustomization implements Serializable { @JoinColumn(name = "NETWORK_RESOURCE_MODEL_UUID") private NetworkResource networkResource = null; + public NetworkResourceCustomization() { + super(); + } + @PrePersist protected void onCreate() { this.created = new Date(); @@ -175,4 +152,27 @@ public class NetworkResourceCustomization implements Serializable { public void setResourceInput(String resourceInput) { this.resourceInput = resourceInput; } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("created", created) + .append("networkTechnology", networkTechnology).append("networkType", networkType) + .append("networkScope", networkScope).append("networkRole", networkRole) + .append("networkResource", networkResource).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof NetworkResourceCustomization)) { + return false; + } + NetworkResourceCustomization castOther = (NetworkResourceCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java index a7610fec92..98db12c288 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java @@ -90,8 +90,8 @@ public class MavenLikeVersioning implements Serializable { public boolean isTheSameVersion(String versionToCompare) { if (versionToCompare == null && this.version == null) { return true; - } else if (versionToCompare == null || versionToCompare.trim().equals("") || this.version == null - || this.version.trim().equals("")) { + } else if (versionToCompare == null || "".equals(versionToCompare.trim()) || this.version == null + || "".equals(this.version.trim())) { return false; } String[] currentVersionArray = this.version.split("\\."); |