From 388ece287dc341d2b1a34a86b3469476eff3cd29 Mon Sep 17 00:00:00 2001 From: mharazin Date: Wed, 5 Feb 2020 12:39:16 +0100 Subject: AssignPnfBB - set orchestration status to Assigned after successful assignment Issue-ID: SO-2642 Signed-off-by: Mateusz Harazin Change-Id: I4247e464b1533025638880763ea9e2fe629b10c3 --- .../subprocess/BuildingBlock/AssignPnfBB.bpmn | 41 ++++++++++++++-------- .../infrastructure/aai/tasks/AAIUpdateTasks.java | 9 +++++ .../aai/tasks/AAIUpdateTasksTest.java | 19 ++++++++++ 3 files changed, 54 insertions(+), 15 deletions(-) diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn index c8600586ce..1b4470b545 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn @@ -1,34 +1,38 @@ - + - - - SequenceFlow_0l6rtzy - SequenceFlow_1fu9o4x - SequenceFlow_0l6rtzy + SequenceFlow_0yrabnf SequenceFlow_1fu9o4x + + + + SequenceFlow_0yrabnf + SequenceFlow_1yb16sd + + + SequenceFlow_1yb16sd + Inputs: - - pnfName - String - + - pnfName - String - + @@ -51,19 +55,26 @@ - + - + - - - - + + + + + + + + + + + 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 dab35931f2..4d5494d18c 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 @@ -118,6 +118,15 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of Pnf to Assigned in AAI + * + * @param execution + */ + public void updateOrchestrationStatusAssignedPnf(BuildingBlockExecution execution) { + updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ASSIGNED); + } + /** * BPMN access method to update status of Pnf to Active in AAI * 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 19877aae16..e26009a1de 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 @@ -139,6 +139,25 @@ public class AAIUpdateTasksTest extends BaseTaskTest { aaiUpdateTasks.updateOrchestrationStatusActiveService(execution); } + @Test + public void updateOrchestrationStatusAssignedPnfTest() throws Exception { + Pnf pnf = preparePnfAndExtractForPnf(); + doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignedPnf(execution); + + verify(aaiPnfResources, times(1)).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.ASSIGNED); + } + + @Test + public void updateOrchestrationStatusAssignedPnfExceptionTest() throws Exception { + Pnf pnf = preparePnfAndExtractForPnf(); + doThrow(RuntimeException.class).when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, + OrchestrationStatus.ASSIGNED); + + expectedException.expect(BpmnError.class); + aaiUpdateTasks.updateOrchestrationStatusAssignedPnf(execution); + } @Test public void updateOrchestrationStatusActivePnfTest() throws Exception { -- cgit 1.2.3-korg