diff options
34 files changed, 199 insertions, 194 deletions
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/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/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-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("\\."); |