diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-01-03 22:50:11 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-01-04 09:15:22 -0500 |
commit | f49313bb87e0dc2ee20f5621c6858d119e5f8f83 (patch) | |
tree | ba1902c3f1ee2f5aa54f75ebe533d58d07755ba5 /bpmn/so-bpmn-tasks/src/test | |
parent | a5bb70becba912f172615b873c4921a2a88dcf3e (diff) |
Bugfixes for December 2018
Changed the way that the cidr is constructed in network utils.
added in the if statement to check if selflink already exists
removed execution line that was not needed in pull
added service instance id to workflowResourceIds for virtualLinkKey
network flows
wrote test for updating request to complete in db
workflow action directly updates db instead of using mso complete
process
Increase max timeout for SDNO Health Checks dmaap.
Added execution variable and corrected type and way data is retrieved
to fix defect
fixed retry status message in request db for #/5
updated workflowActionBBTasks for flow status message
updated flow status to failed on a workflowaction fail
Removed slashes and fixed rollbackStatusMessage
Updated requestStatus logic for adding status messages
Added junit test to validate casue of a defect and cleaned up code and
logging
added end timestamp to request db on complete request
fixed l3Network update of orchestation status in
DoUpdateNetworkInstance groovy as well
fixed update of l3network orchestration status
Add explicit resetting of heatStackId in A&AI to DeleteVfModule and
DeleteVolumeGroup BBs.
Preserve heatStackId setting in the copiedVfModule when updating the VF
Module in A&AI.
added functionality to skip rollback based on flag
Update snapshot version for logging, add headers
fixed optional of error in retrieveErrorMessage method
Set heatStackId to null if we want to remove it in A&AI.
added in a warn logger statement to keep track of field
map network technology from l3network instead of model info for network
adapter object mapper
Force heatStackId value to empty on an attempt to set it to null on
update
updated common pom to use aai schema version 1.4.1
removed handle sync error from SDNCHandler bpmn flow
Change-Id: I1bd7aa55b06d4e439000b216165c9daafeacc9a4
Issue-ID: SO-1361
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test')
4 files changed, 51 insertions, 17 deletions
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 6c20938780..f97b137fb3 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 @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; @@ -292,6 +293,17 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ } @Test + public void updateHeatStackIdVfModuleToNullTest() throws Exception { + execution.setVariable("heatStackId", null); + doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); + + aaiUpdateTasks.updateHeatStackIdVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf); + assertEquals(vfModule.getHeatStackId(), ""); + } + + @Test public void updateHeatStackIdVfModuleExceptionTest() throws Exception { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); @@ -358,6 +370,16 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); assertEquals("newHeatStackId", volumeGroup.getHeatStackId()); } + @Test + public void updateHeatStackIdVolumeGroupToNullTest() throws Exception { + execution.setVariable("heatStackId", null); + doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); + + aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); + assertEquals(volumeGroup.getHeatStackId(), ""); + } @Test public void updateHeatStackIdVolumeGroupExceptionTest() throws Exception { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java index a6efbd5989..f1779cf119 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java @@ -129,15 +129,6 @@ public class SDNCRequestTasksTest extends SDNCRequestTasks{ sndcRequestTasks.handleTimeOutException(delegateExecution); } - - @Test - public void HandleSyncError_Test() throws MapperException, BadResponseException{ - delegateExecution.setVariable("SDNCSyncError", "Error in SDNC Request"); - doReturn("processKey").when(exceptionBuilder).getProcessKey(delegateExecution); - expectedException.expect(BpmnError.class); - sndcRequestTasks.handleSyncError(delegateExecution); - } - @Test public void processCallBack_Final_Test() throws MapperException, BadResponseException, IOException{ final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_ASYNC_Request.json"))); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java index 189ecb96c7..5c1485979e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java @@ -114,16 +114,37 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { } @Test - public void msoCompleteProcessTest() throws Exception{ - execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + public void updateRequestStatusToCompleteTest() throws Exception{ + String reqId = "reqId123"; + execution.setVariable("mso-request-id", reqId); execution.setVariable("requestAction", "createInstance"); - execution.setVariable("resourceId", "123"); - execution.setVariable("source","MSO"); execution.setVariable("resourceName", "Service"); execution.setVariable("aLaCarte", true); - workflowActionBBTasks.setupCompleteMsoProcess(execution); - String response = (String) execution.getVariable("CompleteMsoProcessRequest"); - assertEquals(response,"<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns=\"http://org.onap/so/request/types/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>00f704ca-c5e5-4f95-a72c-6889db7b0688</request-id><action>createInstance</action><source>MSO</source></request-info><status-message>ALaCarte-Service-createInstance request was executed correctly.</status-message><serviceInstanceId>123</serviceInstanceId><mso-bpel-name>WorkflowActionBB</mso-bpel-name></aetgt:MsoCompletionRequest>"); + InfraActiveRequests req = new InfraActiveRequests(); + doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId); + doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class)); + workflowActionBBTasks.updateRequestStatusToComplete(execution); + assertEquals("ALaCarte-Service-createInstance request was executed correctly.",execution.getVariable("finalStatusMessage")); + } + + @Test + public void updateRequestStatusToFailedFlowStatusTest() { + String reqId = "reqId123"; + execution.setVariable("mso-request-id", reqId); + execution.setVariable("isRollbackComplete", false); + execution.setVariable("isRollback", false); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + BuildingBlock buildingBlock = new BuildingBlock(); + buildingBlock.setBpmnFlowName("CreateNetworkBB"); + ebb.setBuildingBlock(buildingBlock); + execution.setVariable("buildingBlock", ebb); + WorkflowException wfe = new WorkflowException("failure", 1, "failure"); + execution.setVariable("WorkflowException", wfe); + InfraActiveRequests req = new InfraActiveRequests(); + doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId); + doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class)); + workflowActionBBTasks.updateRequestStatusToFailed(execution); + assertEquals("CreateNetworkBB has failed.",execution.getVariable("flowStatus")); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java index 8f0d00ff86..6f353fa622 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -144,7 +144,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ List<Subnet> subnetList = new ArrayList<Subnet>(); subnetList.add(openstackSubnet); l3Network.getSubnets().add(openstackSubnet); - l3Network.getModelInfoNetwork().setNetworkTechnology("Contrail"); + l3Network.setNetworkTechnology("Contrail"); CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer); |