diff options
7 files changed, 137 insertions, 114 deletions
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java index 09fea0644e..33805f9faa 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java @@ -26,6 +26,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.sql.Timestamp; import java.time.Instant; import java.time.temporal.ChronoUnit; @@ -331,4 +332,14 @@ public class RequestsDbClientTest extends RequestsAdapterBase { List<InfraActiveRequests> infraActiveRequests = requestsDbClient.getInProgressVolumeGroupsAndVfModules(); assertThat(request, sameBeanAs(infraActiveRequests.get(0)).ignoring("modifyTime")); } + + @Test + public void getRequestProcessingDataBySoRequestIdAndNameAndTag() { + List<RequestProcessingData> requestProcessingData = + requestsDbClient.getRequestProcessingDataBySoRequestIdAndNameAndTagOrderByCreateTimeDesc( + "00032ab7-na18-42e5-965d-8ea592502018", "requestAction", "pincFabricConfigRequest"); + assertNotNull(requestProcessingData); + assertTrue(requestProcessingData.size() == 1); + assertEquals("assign", requestProcessingData.get(0).getValue()); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupParameter.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupParameter.java index 1290f2aeef..df726fed22 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupParameter.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupParameter.java @@ -79,266 +79,266 @@ public class BBInputSetupParameter { } - protected CloudConfiguration getCloudConfiguration() { + public CloudConfiguration getCloudConfiguration() { return cloudConfiguration; } - protected void setCloudConfiguration(CloudConfiguration cloudConfiguration) { + public void setCloudConfiguration(CloudConfiguration cloudConfiguration) { this.cloudConfiguration = cloudConfiguration; } - protected ConfigurationResourceKeys getConfigurationResourceKeys() { + public ConfigurationResourceKeys getConfigurationResourceKeys() { return configurationResourceKeys; } - protected void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) { + public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) { this.configurationResourceKeys = configurationResourceKeys; } - protected List<Map<String, String>> getInstanceParams() { + public List<Map<String, String>> getInstanceParams() { return instanceParams; } - protected void setInstanceParams(List<Map<String, String>> instanceParams) { + public void setInstanceParams(List<Map<String, String>> instanceParams) { this.instanceParams = instanceParams; } - protected Map<ResourceKey, String> getLookupKeyMap() { + public Map<ResourceKey, String> getLookupKeyMap() { return lookupKeyMap; } - protected void setLookupKeyMap(Map<ResourceKey, String> lookupKeyMap) { + public void setLookupKeyMap(Map<ResourceKey, String> lookupKeyMap) { this.lookupKeyMap = lookupKeyMap; } - protected ModelInfo getModelInfo() { + public ModelInfo getModelInfo() { return modelInfo; } - protected void setModelInfo(ModelInfo modelInfo) { + public void setModelInfo(ModelInfo modelInfo) { this.modelInfo = modelInfo; } - protected LineOfBusiness getLineOfBusiness() { + public LineOfBusiness getLineOfBusiness() { return lineOfBusiness; } - protected void setLineOfBusiness(LineOfBusiness lineOfBusiness) { + public void setLineOfBusiness(LineOfBusiness lineOfBusiness) { this.lineOfBusiness = lineOfBusiness; } - protected Platform getPlatform() { + public Platform getPlatform() { return platform; } - protected void setPlatform(Platform platform) { + public void setPlatform(Platform platform) { this.platform = platform; } - protected RelatedInstanceList[] getRelatedInstanceList() { + public RelatedInstanceList[] getRelatedInstanceList() { return relatedInstanceList; } - protected void setRelatedInstanceList(RelatedInstanceList[] relatedInstanceList) { + public void setRelatedInstanceList(RelatedInstanceList[] relatedInstanceList) { this.relatedInstanceList = relatedInstanceList; } - protected RequestDetails getRequestDetails() { + public RequestDetails getRequestDetails() { return requestDetails; } - protected void setRequestDetails(RequestDetails requestDetails) { + public void setRequestDetails(RequestDetails requestDetails) { this.requestDetails = requestDetails; } - protected Service getService() { + public Service getService() { return service; } - protected void setService(Service service) { + public void setService(Service service) { this.service = service; } - protected ServiceInstance getServiceInstance() { + public ServiceInstance getServiceInstance() { return serviceInstance; } - protected void setServiceInstance(ServiceInstance serviceInstance) { + public void setServiceInstance(ServiceInstance serviceInstance) { this.serviceInstance = serviceInstance; } - protected String getBbName() { + public String getBbName() { return bbName; } - protected void setBbName(String bbName) { + public void setBbName(String bbName) { this.bbName = bbName; } - protected String getInstanceGroupId() { + public String getInstanceGroupId() { return instanceGroupId; } - protected void setInstanceGroupId(String instanceGroupId) { + public void setInstanceGroupId(String instanceGroupId) { this.instanceGroupId = instanceGroupId; } - protected String getInstanceName() { + public String getInstanceName() { return instanceName; } - protected void setInstanceName(String instanceName) { + public void setInstanceName(String instanceName) { this.instanceName = instanceName; } - protected String getProductFamilyId() { + public String getProductFamilyId() { return productFamilyId; } - protected void setProductFamilyId(String productFamilyId) { + public void setProductFamilyId(String productFamilyId) { this.productFamilyId = productFamilyId; } - protected String getResourceId() { + public String getResourceId() { return resourceId; } - protected void setResourceId(String resourceId) { + public void setResourceId(String resourceId) { this.resourceId = resourceId; } - protected String getVnfType() { + public String getVnfType() { return vnfType; } - protected void setVnfType(String vnfType) { + public void setVnfType(String vnfType) { this.vnfType = vnfType; } - protected ExecuteBuildingBlock getExecuteBB() { + public ExecuteBuildingBlock getExecuteBB() { return executeBB; } - protected void setExecuteBB(ExecuteBuildingBlock executeBB) { + public void setExecuteBB(ExecuteBuildingBlock executeBB) { this.executeBB = executeBB; } - protected String getRequestAction() { + public String getRequestAction() { return requestAction; } - protected void setRequestAction(String requestAction) { + public void setRequestAction(String requestAction) { this.requestAction = requestAction; } - protected boolean getaLaCarte() { + public boolean getaLaCarte() { return aLaCarte; } - protected void setaLaCarte(boolean aLaCarte) { + public void setaLaCarte(boolean aLaCarte) { this.aLaCarte = aLaCarte; } - protected Customer getCustomer() { + public Customer getCustomer() { return customer; } - protected void setCustomer(Customer customer) { + public void setCustomer(Customer customer) { this.customer = customer; } - protected void setRequestId(String requestId) { + public void setRequestId(String requestId) { this.requestId = requestId; } - protected String getRequestId() { + public String getRequestId() { return requestId; } - protected void setConfigurationKey(String configurationKey) { + public void setConfigurationKey(String configurationKey) { this.configurationKey = configurationKey; } - protected String getConfigurationKey() { + public String getConfigurationKey() { return configurationKey; } - protected String getKey() { + public String getKey() { return key; } - protected void setKey(String key) { + public void setKey(String key) { this.key = key; } - protected String getApplicationId() { + public String getApplicationId() { return applicationId; } - protected void setApplicationId(String applicationId) { + public void setApplicationId(String applicationId) { this.applicationId = applicationId; } - protected boolean getIsReplace() { + public boolean getIsReplace() { return isReplace; } - protected void setIsReplace(boolean isReplace) { + public void setIsReplace(boolean isReplace) { this.isReplace = isReplace; } - protected ServiceModel getServiceModel() { + public ServiceModel getServiceModel() { return this.serviceModel; } - protected void setServiceModel(ServiceModel serviceModel) { + public void setServiceModel(ServiceModel serviceModel) { this.serviceModel = serviceModel; } - protected boolean getIsHelm() { + public boolean getIsHelm() { return isHelm; } - protected void setIsHelm(boolean isHelm) { + public void setIsHelm(boolean isHelm) { this.isHelm = isHelm; } @@ -492,27 +492,27 @@ public class BBInputSetupParameter { return this; } - protected Builder setApplicationId(String applicationId) { + public Builder setApplicationId(String applicationId) { this.applicationId = applicationId; return this; } - protected Builder setIsReplace(boolean isReplace) { + public Builder setIsReplace(boolean isReplace) { this.isReplace = isReplace; return this; } - protected Builder setServiceModel(ServiceModel serviceModel) { + public Builder setServiceModel(ServiceModel serviceModel) { this.serviceModel = serviceModel; return this; } - protected boolean getIsHelm() { + public boolean getIsHelm() { return isHelm; } - protected void setIsHelm(boolean isHelm) { + public void setIsHelm(boolean isHelm) { this.isHelm = isHelm; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index ee4e56bc18..bc8f8cc822 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -26,9 +26,27 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGNINSTANCE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CONTROLLER; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.FABRIC_CONFIGURATION; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.NETWORKCOLLECTION; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCERETAINASSIGNMENTS; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.SERVICE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.USER_PARAM_SERVICE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE; import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; import org.apache.commons.lang3.SerializationUtils; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.javatuples.Pair; @@ -79,26 +97,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGNINSTANCE; -import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CONTROLLER; -import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE; -import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.FABRIC_CONFIGURATION; -import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.NETWORKCOLLECTION; -import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCE; -import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCERETAINASSIGNMENTS; -import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.SERVICE; -import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.USER_PARAM_SERVICE; -import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; @Component public class WorkflowAction { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index ec2ca74fa7..cd151bafea 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -37,6 +37,7 @@ import org.onap.aai.domain.yang.Vnfc; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aaiclient.client.aai.entities.Configuration; import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.common.listener.db.RequestsDbListenerRunner; import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner; @@ -68,10 +69,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Component public class WorkflowActionBBTasks { - private static final String G_CURRENT_SEQUENCE = "gCurrentSequence"; - private static final String G_REQUEST_ID = "mso-request-id"; - private static final String G_ALACARTE = "aLaCarte"; - private static final String G_ACTION = "requestAction"; private static final String RETRY_COUNT = "retryCount"; private static final String FABRIC_CONFIGURATION = "FabricConfiguration"; private static final String ADD_FABRIC_CONFIGURATION_BB = "AddFabricConfigurationBB"; @@ -112,14 +109,15 @@ public class WorkflowActionBBTasks { } catch (NullPointerException ex) { workflowAction.buildAndThrowException(execution, "Error in FlowManipulator Modify Flows", ex); } - int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); + int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE); ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence); execution.setVariable("buildingBlock", ebb); currentSequence++; execution.setVariable(COMPLETED, currentSequence >= flowsToExecute.size()); - execution.setVariable(G_CURRENT_SEQUENCE, currentSequence); + execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currentSequence); + } catch (Exception e) { workflowAction.buildAndThrowException(execution, "Internal Error occured during selectBB", e); } @@ -127,7 +125,7 @@ public class WorkflowActionBBTasks { public void updateFlowStatistics(DelegateExecution execution) { try { - int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); + int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE); if (currentSequence > 1) { InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence); requestDbclient.updateInfraActiveRequests(request); @@ -142,7 +140,7 @@ public class WorkflowActionBBTasks { protected InfraActiveRequests getUpdatedRequest(DelegateExecution execution, int currentSequence) { List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); - String requestId = (String) execution.getVariable(G_REQUEST_ID); + String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); ExecuteBuildingBlock completedBB = flowsToExecute.get(currentSequence - 2); ExecuteBuildingBlock nextBB = flowsToExecute.get(currentSequence - 1); @@ -171,7 +169,7 @@ public class WorkflowActionBBTasks { } public void sendSyncAck(DelegateExecution execution) { - final String requestId = (String) execution.getVariable(G_REQUEST_ID); + final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID); final String resourceId = (String) execution.getVariable("resourceId"); ServiceInstancesResponse serviceInstancesResponse = new ServiceInstancesResponse(); RequestReferences requestRef = new RequestReferences(); @@ -199,7 +197,7 @@ public class WorkflowActionBBTasks { } public void sendErrorSyncAck(DelegateExecution execution) { - final String requestId = (String) execution.getVariable(G_REQUEST_ID); + final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID); try { ExceptionBuilder exceptionBuilder = new ExceptionBuilder(); String errorMsg = (String) execution.getVariable("WorkflowActionErrorMessage"); @@ -225,10 +223,10 @@ public class WorkflowActionBBTasks { public void updateRequestStatusToComplete(DelegateExecution execution) { try { - final String requestId = (String) execution.getVariable(G_REQUEST_ID); + final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); - final String action = (String) execution.getVariable(G_ACTION); - final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); + final String action = (String) execution.getVariable(BBConstants.G_ACTION); + final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE); final String resourceName = (String) execution.getVariable("resourceName"); String statusMessage = (String) execution.getVariable("StatusMessage"); String macroAction; @@ -258,7 +256,7 @@ public class WorkflowActionBBTasks { public void checkRetryStatus(DelegateExecution execution) { String handlingCode = (String) execution.getVariable(HANDLINGCODE); - String requestId = (String) execution.getVariable(G_REQUEST_ID); + String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID); String retryDuration = (String) execution.getVariable("RetryDuration"); int retryCount = (int) execution.getVariable(RETRY_COUNT); int envMaxRetries; @@ -280,8 +278,8 @@ public class WorkflowActionBBTasks { logger.warn("Failed to update Request Db Infra Active Requests with Retry Status", ex); } if (retryCount < envMaxRetries) { - int currSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); - execution.setVariable(G_CURRENT_SEQUENCE, currSequence - 1); + int currSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE); + execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currSequence - 1); execution.setVariable(RETRY_COUNT, nextCount); } else { workflowAction.buildAndThrowException(execution, @@ -297,7 +295,7 @@ public class WorkflowActionBBTasks { * working on. */ public void rollbackExecutionPath(DelegateExecution execution) { - final String action = (String) execution.getVariable(G_ACTION); + final String action = (String) execution.getVariable(BBConstants.G_ACTION); final String resourceName = (String) execution.getVariable("resourceName"); if (!(boolean) execution.getVariable("isRollback")) { List<ExecuteBuildingBlock> flowsToExecute = @@ -308,7 +306,7 @@ public class WorkflowActionBBTasks { .collect(Collectors.toList()); List<ExecuteBuildingBlock> rollbackFlows = new ArrayList<>(); - int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); + int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE); int listSize = flowsToExecute.size(); for (int i = listSize - 1; i >= 0; i--) { @@ -381,7 +379,7 @@ public class WorkflowActionBBTasks { execution.setVariable("flowsToExecute", rollbackFlowsFiltered); execution.setVariable(HANDLINGCODE, "PreformingRollback"); execution.setVariable("isRollback", true); - execution.setVariable(G_CURRENT_SEQUENCE, 0); + execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, 0); execution.setVariable(RETRY_COUNT, 0); } else { workflowAction.buildAndThrowException(execution, @@ -391,7 +389,7 @@ public class WorkflowActionBBTasks { protected void updateInstanceId(DelegateExecution execution) { try { - String requestId = (String) execution.getVariable(G_REQUEST_ID); + String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID); String resourceId = (String) execution.getVariable("resourceId"); WorkflowType resourceType = (WorkflowType) execution.getVariable("resourceType"); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); @@ -424,8 +422,8 @@ public class WorkflowActionBBTasks { List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); String handlingCode = (String) execution.getVariable(HANDLINGCODE); - final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); - int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); + final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE); + int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE); logger.debug("Current Sequence: {}", currentSequence); ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1); String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName(); @@ -444,7 +442,7 @@ public class WorkflowActionBBTasks { protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution, ExecuteBuildingBlock ebb, List<ExecuteBuildingBlock> flowsToExecute) { try { - String requestAction = (String) execution.getVariable(G_ACTION); + String requestAction = (String) execution.getVariable(BBConstants.G_ACTION); String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId(); String vnfId = ebb.getWorkflowResourceIds().getVnfId(); String vfModuleId = ebb.getResourceId(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 26e0d2f8c9..55529b5bf0 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -232,7 +232,6 @@ public class WorkflowActionTest extends BaseTaskTest { when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, true, "my-custom-cloud-owner")).thenReturn(northBoundRequest); - workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "ActivateServiceInstanceBB"); @@ -1044,7 +1043,7 @@ public class WorkflowActionTest extends BaseTaskTest { NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", - "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB"); + "AddFabricConfigurationBB"); northBoundRequest.setOrchestrationFlowList(orchFlows); List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<CvnfcCustomization>(); @@ -1078,15 +1077,14 @@ public class WorkflowActionTest extends BaseTaskTest { when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, true, "my-custom-cloud-owner")).thenReturn(northBoundRequest); - // when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("fc25201d-36d6-43a3-8d39-fdae88e526ae", - // "9a6d01fd-19a7-490a-9800-460830a12e0b")).thenReturn(cvnfcCustomizations); + workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); - assertEqualsBulkFlowName(ebbs, "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", - "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "AssignFabricConfigurationBB", - "ActivateFabricConfigurationBB"); + assertEqualsBulkFlowName(ebbs, "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB"); } + + @Test public void selectExecutionListALaCarteVfModuleNoVolumeGroupReplaceTest() throws Exception { String gAction = "replaceInstance"; @@ -1450,7 +1448,6 @@ public class WorkflowActionTest extends BaseTaskTest { "ChangeModelVnfBB", "ChangeModelServiceInstanceBB"); } - @Test public void selectExecutionListALaCarteVfModuleFabricDeleteTest() throws Exception { String gAction = "deleteInstance"; @@ -2249,6 +2246,7 @@ public class WorkflowActionTest extends BaseTaskTest { for (int i = 0; i < ebbs.size(); i++) { assertEquals(ebbs.get(i).getBuildingBlock().getBpmnFlowName(), flowNames[i]); } + assertEquals(ebbs.size(), flowNames.length); } private void initExecution(String gAction, String bpmnRequest, boolean isAlaCarte) { diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java index 21bc2a697a..9ec214fc6d 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java @@ -23,6 +23,7 @@ package org.onap.so.db.request.data.repository; import java.util.List; import org.onap.so.db.request.beans.RequestProcessingData; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @@ -44,4 +45,7 @@ public interface RequestProcessingDataRepository extends JpaRepository<RequestPr RequestProcessingData[] findByGroupingIdAndNameAndTag(@Param("GROUPING_ID") String groupingId, @Param("NAME") String name, @Param("TAG") String tag); + + RequestProcessingData[] findBySoRequestIdAndNameAndTagOrderByCreatedDesc(@Param("SO_REQUEST_ID") String soRequestId, + @Param("NAME") String name, @Param("TAG") String tag); } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java index 9b42eacfc2..806d347582 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java @@ -127,6 +127,9 @@ public class RequestsDbClient { private static final String findByGroupingIdAndNameAndTag = "/requestProcessingData/search/findByGroupingIdAndNameAndTag"; + private static final String findBySoRequestIdAndNameAndTagOrderByCreateTimeDesc = + "/requestProcessingData/search/findBySoRequestIdAndNameAndTagOrderByCreatedDesc"; + @Autowired protected RestTemplate restTemplate; @@ -403,6 +406,15 @@ public class RequestsDbClient { RequestProcessingData.class); } + public List<RequestProcessingData> getRequestProcessingDataBySoRequestIdAndNameAndTagOrderByCreateTimeDesc( + String soRequestId, String name, String tag) { + + return getMultipleResponse(getUri(UriBuilder + .fromUri(endpoint + findBySoRequestIdAndNameAndTagOrderByCreateTimeDesc) + .queryParam(SO_REQUEST_ID, soRequestId).queryParam(NAME, name).queryParam(TAG, tag).build().toString()), + new ParameterizedTypeReference<List<RequestProcessingData>>() {}); + } + public void persistProcessingData(String flowExecutionPath, String requestId) { |