diff options
author | Einat Vinouze <einat.vinouze@intl.att.com> | 2020-05-18 12:59:57 +0300 |
---|---|---|
committer | Einat Vinouze <einat.vinouze@intl.att.com> | 2020-05-19 08:53:30 +0300 |
commit | 19016e3c0951ff994956e93b1c24e412a7ed542e (patch) | |
tree | 9459b6a941617cf9c7c90261d3305391f26dab50 /vid-app-common | |
parent | aaec5296d2fa63828c320e4a3fb1e5ed0e168de2 (diff) |
Introduce FeatureManager to ResourceCommand
Issue-ID: VID-821
Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Change-Id: Id6c663d4612d69a48b4a9425db082fb6c33e08b1
Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Diffstat (limited to 'vid-app-common')
16 files changed, 123 insertions, 67 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/ALaCarteServiceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/ALaCarteServiceCommand.kt index 9bef3c11b..df39f7387 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/ALaCarteServiceCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/ALaCarteServiceCommand.kt @@ -36,6 +36,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.http.HttpMethod import org.springframework.stereotype.Component +import org.togglz.core.manager.FeatureManager import java.time.ZonedDateTime import java.time.temporal.ChronoUnit import java.util.* @@ -63,9 +64,10 @@ class ALaCarteServiceCommand @Autowired constructor( msoResultHandlerService: MsoResultHandlerService, jobAdapter: JobAdapter, restMso: RestMsoImplementation, - auditService: AuditService + auditService: AuditService, + featureManager: FeatureManager ) : RootServiceCommand(restMso, inProgressStatusService, msoResultHandlerService, - watchChildrenJobsBL, jobsBrokerService, jobAdapter, asyncInstantiationBL, auditService, msoRequestBuilder), JobCommand { + watchChildrenJobsBL, jobsBrokerService, jobAdapter, asyncInstantiationBL, auditService, msoRequestBuilder, featureManager), JobCommand { companion object { private val LOGGER = EELFLoggerDelegate.getLogger(ALaCarteServiceCommand::class.java) diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/InstanceGroupCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/InstanceGroupCommand.kt index 886251a0c..60d051943 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/InstanceGroupCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/InstanceGroupCommand.kt @@ -34,6 +34,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.http.HttpMethod import org.springframework.stereotype.Component +import org.togglz.core.manager.FeatureManager import java.util.* @Component @@ -46,9 +47,10 @@ class InstanceGroupCommand @Autowired constructor( inProgressStatusService:InProgressStatusService, watchChildrenJobsBL: WatchChildrenJobsBL, jobsBrokerService: JobsBrokerService, - jobAdapter: JobAdapter - ) : ResourceCommand(restMso, inProgressStatusService, msoResultHandlerService, - watchChildrenJobsBL, jobsBrokerService, jobAdapter), JobCommand { + jobAdapter: JobAdapter, + featureManager: FeatureManager +) : ResourceCommand(restMso, inProgressStatusService, msoResultHandlerService, + watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager), JobCommand { companion object { private val LOGGER = EELFLoggerDelegate.getLogger(InstanceGroupCommand::class.java) diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/InstanceGroupMemberCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/InstanceGroupMemberCommand.kt index d8e9297a3..b70c4495b 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/InstanceGroupMemberCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/InstanceGroupMemberCommand.kt @@ -13,6 +13,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.http.HttpMethod import org.springframework.stereotype.Component +import org.togglz.core.manager.FeatureManager import java.util.* @Component @@ -25,9 +26,10 @@ class InstanceGroupMemberCommand @Autowired constructor( inProgressStatusService:InProgressStatusService, watchChildrenJobsBL: WatchChildrenJobsBL, jobsBrokerService: JobsBrokerService, - jobAdapter: JobAdapter + jobAdapter: JobAdapter, + featureManager: FeatureManager ) : ResourceCommand(restMso, inProgressStatusService, msoResultHandlerService, - watchChildrenJobsBL, jobsBrokerService, jobAdapter), JobCommand { + watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager), JobCommand { companion object { private val LOGGER = EELFLoggerDelegate.getLogger(InstanceGroupMemberCommand::class.java) diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/MacroServiceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/MacroServiceCommand.kt index 8ce73d713..c3744b5cd 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/MacroServiceCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/MacroServiceCommand.kt @@ -21,6 +21,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.http.HttpMethod import org.springframework.stereotype.Component +import org.togglz.core.manager.FeatureManager import java.util.* @Component @@ -34,9 +35,10 @@ class MacroServiceCommand @Autowired constructor( msoResultHandlerService: MsoResultHandlerService, jobAdapter: JobAdapter, restMso: RestMsoImplementation, - auditService: AuditService + auditService: AuditService, + featureManager: FeatureManager ) : RootServiceCommand(restMso, inProgressStatusService, msoResultHandlerService, - watchChildrenJobsBL, jobsBrokerService, jobAdapter, asyncInstantiationBL, auditService, msoRequestBuilder), JobCommand { + watchChildrenJobsBL, jobsBrokerService, jobAdapter, asyncInstantiationBL, auditService, msoRequestBuilder, featureManager), JobCommand { companion object { diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/NetworkCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/NetworkCommand.kt index 6c9af14ea..3cf2b2845 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/NetworkCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/NetworkCommand.kt @@ -13,6 +13,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.http.HttpMethod import org.springframework.stereotype.Component +import org.togglz.core.manager.FeatureManager import java.util.* @@ -26,9 +27,10 @@ class NetworkCommand @Autowired constructor( inProgressStatusService:InProgressStatusService, watchChildrenJobsBL: WatchChildrenJobsBL, jobsBrokerService: JobsBrokerService, - jobAdapter: JobAdapter - ) : ResourceCommand(restMso, inProgressStatusService, msoResultHandlerService, - watchChildrenJobsBL, jobsBrokerService, jobAdapter), JobCommand { + jobAdapter: JobAdapter, + featureManager: FeatureManager +) : ResourceCommand(restMso, inProgressStatusService, msoResultHandlerService, + watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager), JobCommand { override fun createChildren(): Job.JobStatus { return Job.JobStatus.COMPLETED_WITH_NO_ACTION } diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt index 2b5ec0127..9b4f8b985 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt @@ -33,11 +33,14 @@ import org.onap.vid.job.impl.JobSharedData import org.onap.vid.model.Action import org.onap.vid.model.RequestReferencesContainer import org.onap.vid.model.serviceInstantiation.BaseResource +import org.onap.vid.model.serviceInstantiation.BaseResource.PauseInstantiation.afterCompletion import org.onap.vid.mso.RestMsoImplementation import org.onap.vid.mso.model.ModelInfo +import org.onap.vid.properties.Features import org.onap.vid.utils.JACKSON_OBJECT_MAPPER import org.onap.vid.utils.getEnumFromMapOfStrings import org.springframework.http.HttpMethod +import org.togglz.core.manager.FeatureManager import java.util.* @@ -76,7 +79,8 @@ abstract class ResourceCommand( protected val msoResultHandlerService: MsoResultHandlerService, protected val watchChildrenJobsBL: WatchChildrenJobsBL, private val jobsBrokerService: JobsBrokerService, - private val jobAdapter: JobAdapter + private val jobAdapter: JobAdapter, + private val featureManager: FeatureManager ) : CommandBase(), JobCommand { companion object { diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/RootServiceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/RootServiceCommand.kt index c4680b2bd..d13ecd7a0 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/RootServiceCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/RootServiceCommand.kt @@ -13,6 +13,7 @@ import org.onap.vid.services.AsyncInstantiationBusinessLogic import org.onap.vid.services.AuditService import org.springframework.beans.factory.annotation.Autowired import org.springframework.http.HttpMethod +import org.togglz.core.manager.FeatureManager import java.util.* abstract class RootServiceCommand @Autowired constructor( @@ -24,9 +25,10 @@ abstract class RootServiceCommand @Autowired constructor( jobAdapter: JobAdapter, private val asyncInstantiationBL: AsyncInstantiationBusinessLogic, private val auditService: AuditService, - private val msoRequestBuilder: MsoRequestBuilder + private val msoRequestBuilder: MsoRequestBuilder, + featureManager: FeatureManager ) : ResourceCommand(restMso, inProgressStatusService, msoResultHandlerService, - watchChildrenJobsBL, jobsBrokerService, jobAdapter), JobCommand { + watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager), JobCommand { lateinit var optimisticUniqueServiceInstanceName: String diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt index 29d7001e2..a92f610da 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/VfmoduleCommand.kt @@ -16,6 +16,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.http.HttpMethod import org.springframework.stereotype.Component +import org.togglz.core.manager.FeatureManager import java.util.* typealias ToscaVfm = org.onap.vid.model.VfModule @@ -30,9 +31,10 @@ class VfmoduleCommand @Autowired constructor( inProgressStatusService:InProgressStatusService, watchChildrenJobsBL: WatchChildrenJobsBL, jobsBrokerService: JobsBrokerService, - jobAdapter: JobAdapter + jobAdapter: JobAdapter, + featureManager: FeatureManager ) : ResourceCommand(restMso, inProgressStatusService, msoResultHandlerService, - watchChildrenJobsBL, jobsBrokerService, jobAdapter), JobCommand { + watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager), JobCommand { companion object { private val LOGGER = EELFLoggerDelegate.getLogger(VfmoduleCommand::class.java) diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt index 1eb9799a0..e2bc6dcef 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt @@ -39,7 +39,7 @@ class VnfCommand @Autowired constructor( jobAdapter: JobAdapter, private val featureManager: FeatureManager ) : ResourceCommand(restMso, inProgressStatusService, msoResultHandlerService, - watchChildrenJobsBL, jobsBrokerService, jobAdapter), JobCommand { + watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager), JobCommand { private var needToCreateBaseModule:Boolean by Delegates.notNull<Boolean>() diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/VolumeGroupCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/VolumeGroupCommand.kt index 9794933ce..906ff2674 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/VolumeGroupCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/VolumeGroupCommand.kt @@ -13,6 +13,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.http.HttpMethod import org.springframework.stereotype.Component +import org.togglz.core.manager.FeatureManager import java.util.* @Component @@ -25,9 +26,10 @@ class VolumeGroupCommand @Autowired constructor( inProgressStatusService:InProgressStatusService, watchChildrenJobsBL: WatchChildrenJobsBL, jobsBrokerService: JobsBrokerService, - jobAdapter: JobAdapter + jobAdapter: JobAdapter, + featureManager: FeatureManager ) : ResourceCommand(restMso, inProgressStatusService, msoResultHandlerService, - watchChildrenJobsBL, jobsBrokerService, jobAdapter), JobCommand { + watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager), JobCommand { companion object { private val LOGGER = EELFLoggerDelegate.getLogger(VolumeGroupCommand::class.java) diff --git a/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java b/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java index 3f2bf7318..468fb41c3 100644 --- a/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java +++ b/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java @@ -174,8 +174,9 @@ public class JobCommandsConfigWithMockedMso { InProgressStatusService inProgressStatusService, WatchChildrenJobsBL watchChildrenJobsBL, RestMsoImplementation restMso, - AuditService auditService) { - return new ALaCarteServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoRequestBuilder, msoResultHandlerService, jobAdapter, restMso, auditService); + AuditService auditService, + FeatureManager featureManager) { + return new ALaCarteServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoRequestBuilder, msoResultHandlerService, jobAdapter, restMso, auditService, featureManager); } @Bean @@ -189,8 +190,9 @@ public class JobCommandsConfigWithMockedMso { InProgressStatusService inProgressStatusService, WatchChildrenJobsBL watchChildrenJobsBL, RestMsoImplementation restMso, - AuditService auditService) { - return new MacroServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoRequestBuilder, msoResultHandlerService, jobAdapter, restMso, auditService); + AuditService auditService, + FeatureManager featureManager) { + return new MacroServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoRequestBuilder, msoResultHandlerService, jobAdapter, restMso, auditService, featureManager); } @@ -204,9 +206,10 @@ public class JobCommandsConfigWithMockedMso { InProgressStatusService inProgressStatusService, WatchChildrenJobsBL watchChildrenJobsBL, JobsBrokerService jobsBrokerService, - JobAdapter jobAdapter) { + JobAdapter jobAdapter, + FeatureManager featureManager) { return new NetworkCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, - inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter); + inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager); } @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @@ -218,8 +221,10 @@ public class JobCommandsConfigWithMockedMso { WatchChildrenJobsBL watchChildrenJobsBL, RestMsoImplementation restMso, JobsBrokerService jobsBrokerService, - JobAdapter jobAdapter) { - return new InstanceGroupCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter); + JobAdapter jobAdapter, + FeatureManager featureManager) { + return new InstanceGroupCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, inProgressStatusService, + watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager); } @Bean @@ -232,9 +237,10 @@ public class JobCommandsConfigWithMockedMso { WatchChildrenJobsBL watchChildrenJobsBL, RestMsoImplementation restMso, JobsBrokerService jobsBrokerService, - JobAdapter jobAdapter) { + JobAdapter jobAdapter, + FeatureManager featureManager) { return new InstanceGroupMemberCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, inProgressStatusService, - watchChildrenJobsBL, jobsBrokerService, jobAdapter); + watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager); } @@ -265,9 +271,10 @@ public class JobCommandsConfigWithMockedMso { InProgressStatusService inProgressStatusService, WatchChildrenJobsBL watchChildrenJobsBL, JobsBrokerService jobsBrokerService, - JobAdapter jobAdapter) { + JobAdapter jobAdapter, + FeatureManager featureManager) { return new VolumeGroupCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, - inProgressStatusService, watchChildrenJobsBL, jobsBrokerService ,jobAdapter); + inProgressStatusService, watchChildrenJobsBL, jobsBrokerService ,jobAdapter, featureManager); } @Bean @@ -280,9 +287,10 @@ public class JobCommandsConfigWithMockedMso { InProgressStatusService inProgressStatusService, WatchChildrenJobsBL watchChildrenJobsBL, JobsBrokerService jobsBrokerService, - JobAdapter jobAdapter) { + JobAdapter jobAdapter, + FeatureManager featureManager) { return new VfmoduleCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, - inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter); + inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager); } @Bean public AuditService auditService(RestMsoImplementation msoClient, AsyncInstantiationRepository asyncInstantiationRepository) { diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java index c68c5f754..3817ac27a 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java @@ -20,7 +20,19 @@ package org.onap.vid.job.command; +import static java.util.function.Function.identity; +import static java.util.stream.Collectors.toMap; +import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.only; +import static org.mockito.Mockito.same; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.google.common.collect.ImmutableMap; +import java.util.Optional; +import java.util.Set; import org.apache.commons.beanutils.BeanUtils; import org.mockito.Answers; import org.mockito.InjectMocks; @@ -39,15 +51,7 @@ import org.springframework.http.HttpMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; - -import java.util.Optional; -import java.util.Set; - -import static java.util.function.Function.identity; -import static java.util.stream.Collectors.toMap; -import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; +import org.togglz.core.manager.FeatureManager; public class InstanceGroupCommandTest { @@ -75,6 +79,8 @@ public class InstanceGroupCommandTest { @Mock InProgressStatusService inProgressStatusService; + @Mock FeatureManager featureManager; + @InjectMocks private InstanceGroupCommand command; diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/MacroServiceCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/MacroServiceCommandTest.java index e4771611c..cf1322e21 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/command/MacroServiceCommandTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/command/MacroServiceCommandTest.java @@ -54,6 +54,7 @@ import org.onap.vid.services.AuditService; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import org.togglz.core.manager.FeatureManager; public class MacroServiceCommandTest { @@ -84,6 +85,9 @@ public class MacroServiceCommandTest { @Mock private AuditService auditService; + @Mock + FeatureManager featureManager; + @InjectMocks private MacroServiceCommand macroServiceCommand; diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java index 8d60b8477..9d466f4b3 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java @@ -81,6 +81,7 @@ import org.onap.vid.mso.model.ModelInfo; import org.springframework.http.HttpMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import org.togglz.core.manager.FeatureManager; public class ResourceCommandTest { @@ -97,7 +98,8 @@ public class ResourceCommandTest { mock(MsoResultHandlerService.class, RETURNS_MOCKS), mock(WatchChildrenJobsBL.class), mock(JobsBrokerService.class, RETURNS_MOCKS), - mock(JobAdapter.class, RETURNS_MOCKS)); + mock(JobAdapter.class, RETURNS_MOCKS), + mock(FeatureManager.class)); this.mockedJobStatus = mockedJobStatus; this.mockState = mockState; this.mockPhase = mockPhase; diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java index 992325049..463d720d2 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java @@ -20,12 +20,45 @@ package org.onap.vid.job.command; +import static java.util.Collections.emptyList; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.core.Is.is; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.onap.vid.job.Job.JobStatus.COMPLETED; +import static org.onap.vid.job.Job.JobStatus.COMPLETED_WITH_NO_ACTION; +import static org.onap.vid.job.Job.JobStatus.IN_PROGRESS; +import static org.onap.vid.job.command.ResourceCommandKt.ACTION_PHASE; +import static org.onap.vid.job.command.ResourceCommandKt.CHILD_JOBS; +import static org.onap.vid.job.command.ResourceCommandKt.INTERNAL_STATE; +import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.createNetwork; +import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.createService; +import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.createVnf; +import static org.onap.vid.model.Action.Create; +import static org.onap.vid.testUtils.TestUtils.testWithSystemProperty; +import static org.testng.AssertJUnit.assertEquals; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import java.time.Instant; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.temporal.ChronoUnit; +import java.util.Arrays; +import java.util.UUID; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.onap.vid.job.*; +import org.onap.vid.job.Job; +import org.onap.vid.job.JobAdapter; +import org.onap.vid.job.JobType; +import org.onap.vid.job.JobsBrokerService; +import org.onap.vid.job.NextCommand; import org.onap.vid.job.impl.JobSharedData; import org.onap.vid.model.Action; import org.onap.vid.model.serviceInstantiation.Network; @@ -42,27 +75,6 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import org.togglz.core.manager.FeatureManager; -import java.time.Instant; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.time.temporal.ChronoUnit; -import java.util.Arrays; -import java.util.UUID; - -import static java.util.Collections.emptyList; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.core.Is.is; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.*; -import static org.onap.vid.job.Job.JobStatus.*; -import static org.onap.vid.job.command.ResourceCommandKt.*; -import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.*; -import static org.onap.vid.model.Action.Create; -import static org.onap.vid.testUtils.TestUtils.testWithSystemProperty; -import static org.testng.AssertJUnit.assertEquals; - public class ServiceInProgressStatusCommandTest { @@ -134,7 +146,8 @@ public class ServiceInProgressStatusCommandTest { msoResultHandlerService, jobAdapter, restMsoImplementation, - auditService + auditService, + featureManager ); } diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/VfmoduleCommandTest.kt b/vid-app-common/src/test/java/org/onap/vid/job/command/VfmoduleCommandTest.kt index ea67f2372..3d8ec94f7 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/command/VfmoduleCommandTest.kt +++ b/vid-app-common/src/test/java/org/onap/vid/job/command/VfmoduleCommandTest.kt @@ -14,6 +14,7 @@ import org.onap.vid.services.AsyncInstantiationBusinessLogic import org.onap.vid.testUtils.TestUtils.initMockitoMocks import org.testng.annotations.BeforeMethod import org.testng.annotations.Test +import org.togglz.core.manager.FeatureManager class VfmoduleCommandTest { @@ -25,6 +26,8 @@ class VfmoduleCommandTest { @Mock lateinit var watchChildrenJobsBL: WatchChildrenJobsBL; @Mock lateinit var jobsBrokerService: JobsBrokerService; @Mock lateinit var jobAdapter: JobAdapter; + @Mock lateinit var featureManager: FeatureManager; + @InjectMocks lateinit var vfModuleCommand: VfmoduleCommand; |