diff options
author | PATTANAYAK, SAUMYA SWARUP (sp931a) <sp931a@att.com> | 2020-08-13 12:35:01 -0400 |
---|---|---|
committer | PATTANAYAK, SAUMYA SWARUP (sp931a) <sp931a@att.com> | 2020-08-31 15:06:10 -0400 |
commit | 62c72edd91b2d5485683274298b8249670663519 (patch) | |
tree | f9534a62c76fbdc85dc7fbf86c9a9f71b7863d29 /vid-app-common/src/test/java/org/onap/vid/job/command | |
parent | bc25167f4ef0aabdcc55d1d286081808e1e47ae9 (diff) |
Pause Upon VF Module Failure
Issue-ID: VID-862
Currently in VID, once a failure is received from SO on the
instantiation of a VF Module, it is assumed that other VF Modules may
continue with the execution without stopping. However, in most of the
cases, it is a good idea to stop further requests to SO if one of the VF
Module instantiation returns an error. This user story, makes sure this
functionality is achieved.
Change-Id: I07c51b81111f805b61c8b3714a65171d7cbaa254
Signed-off-by: PATTANAYAK, SAUMYA SWARUP (sp931a) <sp931a@att.com>
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/job/command')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/job/command/WatchChildrenJobsBLTest.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/WatchChildrenJobsBLTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/WatchChildrenJobsBLTest.java index fad32bba6..a8613f7a7 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/command/WatchChildrenJobsBLTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/command/WatchChildrenJobsBLTest.java @@ -37,10 +37,12 @@ import org.mockito.MockitoAnnotations; import org.onap.portalsdk.core.service.DataAccessService; import org.onap.vid.job.Job.JobStatus; import org.onap.vid.job.impl.JobDaoImpl; +import org.onap.vid.properties.Features; import org.onap.vid.utils.DaoUtils; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import org.togglz.core.manager.FeatureManager; public class WatchChildrenJobsBLTest { @Mock @@ -49,6 +51,9 @@ public class WatchChildrenJobsBLTest { @InjectMocks private WatchChildrenJobsBL watchChildrenJobsBL; + @Mock + private static FeatureManager featureManager; + @BeforeClass public void initMocks() { MockitoAnnotations.initMocks(this); @@ -80,16 +85,16 @@ public class WatchChildrenJobsBLTest { {Arrays.asList(JobStatus.COMPLETED, JobStatus.COMPLETED), JobStatus.COMPLETED}, {Arrays.asList(JobStatus.COMPLETED, JobStatus.COMPLETED_WITH_NO_ACTION), JobStatus.COMPLETED}, {Arrays.asList(JobStatus.FAILED, JobStatus.COMPLETED_WITH_NO_ACTION), JobStatus.FAILED}, - {Arrays.asList(JobStatus.FAILED, JobStatus.COMPLETED), JobStatus.COMPLETED_WITH_ERRORS}, + {Arrays.asList(JobStatus.FAILED, JobStatus.COMPLETED), getErrorStatus()}, {Arrays.asList(JobStatus.RESOURCE_IN_PROGRESS, JobStatus.FAILED), JobStatus.IN_PROGRESS}, {Arrays.asList(JobStatus.PAUSE, JobStatus.FAILED), JobStatus.IN_PROGRESS}, {Arrays.asList(JobStatus.PENDING, JobStatus.FAILED), JobStatus.IN_PROGRESS}, {Arrays.asList(JobStatus.IN_PROGRESS, JobStatus.COMPLETED), JobStatus.IN_PROGRESS}, {Arrays.asList(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS), JobStatus.IN_PROGRESS}, - {Arrays.asList(JobStatus.COMPLETED, JobStatus.COMPLETED_WITH_ERRORS), JobStatus.COMPLETED_WITH_ERRORS}, - {Arrays.asList(JobStatus.COMPLETED_WITH_ERRORS, JobStatus.FAILED), JobStatus.COMPLETED_WITH_ERRORS}, - {Arrays.asList(JobStatus.COMPLETED_WITH_ERRORS, JobStatus.COMPLETED_WITH_ERRORS), JobStatus.COMPLETED_WITH_ERRORS}, - {Arrays.asList(JobStatus.COMPLETED_WITH_ERRORS, JobStatus.COMPLETED_WITH_NO_ACTION), JobStatus.COMPLETED_WITH_ERRORS}, + {Arrays.asList(JobStatus.COMPLETED, getErrorStatus()), getErrorStatus()}, + {Arrays.asList(getErrorStatus(), JobStatus.FAILED), getErrorStatus()}, + {Arrays.asList(getErrorStatus(), getErrorStatus()), getErrorStatus()}, + {Arrays.asList(getErrorStatus(), JobStatus.COMPLETED_WITH_NO_ACTION), getErrorStatus()}, {Arrays.asList(JobStatus.COMPLETED_WITH_NO_ACTION, JobStatus.COMPLETED_WITH_NO_ACTION), JobStatus.COMPLETED_WITH_NO_ACTION}, {Arrays.asList(JobStatus.COMPLETED_AND_PAUSED, JobStatus.RESOURCE_IN_PROGRESS), JobStatus.IN_PROGRESS}, {Arrays.asList(JobStatus.COMPLETED_AND_PAUSED, JobStatus.COMPLETED), JobStatus.COMPLETED_AND_PAUSED}, @@ -117,4 +122,8 @@ public class WatchChildrenJobsBLTest { public void whenCumulate2JobStatus_thenResultAsExpected(List<JobStatus> jobs, JobStatus expectedChildrenJobsStatus) { assertEquals(expectedChildrenJobsStatus, watchChildrenJobsBL.cumulateJobStatus(jobs.get(0), jobs.get(1))); } + private static JobStatus getErrorStatus() { + return featureManager.isActive(Features.FLAG_2008_PAUSE_VFMODULE_INSTANTIATION_FAILURE) ? + JobStatus.FAILED_AND_PAUSED : JobStatus.COMPLETED_WITH_ERRORS; + } } |