AssignPnfBB - set orchestration status to Assigned after successful assignment
[so.git] / bpmn / so-bpmn-tasks / src / test / java / org / onap / so / bpmn / infrastructure / aai / tasks / AAIUpdateTasksTest.java
index ae6dde6..e26009a 100644 (file)
@@ -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 {
@@ -160,6 +179,26 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
         aaiUpdateTasks.updateOrchestrationStatusActivePnf(execution);
     }
 
+    @Test
+    public void updateOrchestrationStatusRegisterPnfTest() throws Exception {
+        Pnf pnf = preparePnfAndExtractForPnf();
+        doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.REGISTER);
+
+        aaiUpdateTasks.updateOrchestrationStatusRegisterPnf(execution);
+
+        verify(aaiPnfResources, times(1)).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.REGISTER);
+    }
+
+    @Test
+    public void updateOrchestrationStatusRegisteredPnfTest() throws Exception {
+        Pnf pnf = preparePnfAndExtractForPnf();
+        doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.REGISTERED);
+
+        aaiUpdateTasks.updateOrchestrationStatusRegisteredPnf(execution);
+
+        verify(aaiPnfResources, times(1)).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.REGISTERED);
+    }
+
     @Test
     public void updateOrchestrationStatusAssignedVnfTest() throws Exception {
         doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED);