From 62c72edd91b2d5485683274298b8249670663519 Mon Sep 17 00:00:00 2001 From: "PATTANAYAK, SAUMYA SWARUP (sp931a)" Date: Thu, 13 Aug 2020 12:35:01 -0400 Subject: 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) --- .../test/java/org/onap/vid/services/JobsBrokerServiceTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.java') diff --git a/vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.java index 00b2b959b..df8f5034b 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.java @@ -103,6 +103,7 @@ import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import org.togglz.core.manager.FeatureManager; @ContextConfiguration(classes = {DataSourceConfig.class, SystemProperties.class, JobAdapterConfig.class}) public class JobsBrokerServiceTest extends AbstractTestNGSpringContextTests { @@ -124,6 +125,9 @@ public class JobsBrokerServiceTest extends AbstractTestNGSpringContextTests { private static final String DELETE_SERVICE_NOT_EXIST_EXCEPTION_MESSAGE = "Service does not exist"; private JobsBrokerService broker; + @Mock + private FeatureManager featureManager; + @Inject JobAdapter jobAdapter; @Inject @@ -144,7 +148,7 @@ public class JobsBrokerServiceTest extends AbstractTestNGSpringContextTests { public void initializeBroker() { MockitoAnnotations.initMocks(this); when(versionService.retrieveBuildNumber()).thenReturn("aBuildNumber"); - broker = new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, 200, 0, versionService); + broker = new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, 200, 0, versionService, featureManager); ((JobsBrokerServiceInDatabaseImpl) broker).deleteAll(); } @@ -607,7 +611,7 @@ public class JobsBrokerServiceTest extends AbstractTestNGSpringContextTests { @Test(dataProvider = "jobs") public void givenSomeJobs_pullNextJob_returnNextOrNothingAsExpected(List jobbers, int msoLimit, int expectedIndexSelected, Job.JobStatus topic, String assertionReason) { - JobsBrokerServiceInDatabaseImpl aBroker = new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, msoLimit, 20, versionService); + JobsBrokerServiceInDatabaseImpl aBroker = new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, msoLimit, 20, versionService, featureManager); final List jobs = addJobsWithModifiedDate(jobbers, aBroker); Optional nextJob = aBroker.pull(topic, UUID.randomUUID().toString()); boolean shouldAnyBeSelected = expectedIndexSelected >= 0; -- cgit 1.2.3-korg