diff options
author | Liam Fallon <liam.fallon@est.tech> | 2021-09-23 14:45:12 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-09-23 14:45:12 +0000 |
commit | 4143155d835d2fcb291143e6863147dedfe367f4 (patch) | |
tree | a7ff6b912c4363cd25be1a318d50fdae92dbbeec /runtime-controlloop/src/test/java/org | |
parent | 60141eb41cd7f7a6ea0ee2a382081985ea8a24e4 (diff) | |
parent | 3b9768ebb116a49aed649927d162dbdcdfa7fffe (diff) |
Merge "Fix startPhase in runtime and participants"
Diffstat (limited to 'runtime-controlloop/src/test/java/org')
-rw-r--r-- | runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java index 2ba321d36..bc1a3b70a 100644 --- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java +++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScannerTest.java @@ -46,13 +46,16 @@ import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantSta import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantUpdatePublisher; import org.onap.policy.clamp.controlloop.runtime.util.CommonTestData; import org.onap.policy.models.base.PfModelException; +import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; class SupervisionScannerTest { @Test void testScannerOrderedStateEqualsToState() throws PfModelException { var controlLoopProvider = mock(ControlLoopProvider.class); + var modelsProvider = mock(PolicyModelsProvider.class); var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class); var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class); var participantProvider = mock(ParticipantProvider.class); @@ -63,9 +66,9 @@ class SupervisionScannerTest { var controlLoop = new ControlLoop(); when(controlLoopProvider.getControlLoops(null, null)).thenReturn(List.of(controlLoop)); - var supervisionScanner = new SupervisionScanner(controlLoopProvider, controlLoopStateChangePublisher, - controlLoopUpdatePublisher, participantProvider, participantStatusReqPublisher, - participantUpdatePublisher, clRuntimeParameterGroup); + var supervisionScanner = new SupervisionScanner(controlLoopProvider, modelsProvider, + controlLoopStateChangePublisher, controlLoopUpdatePublisher, participantProvider, + participantStatusReqPublisher, participantUpdatePublisher, clRuntimeParameterGroup); supervisionScanner.run(false); verify(controlLoopProvider, times(0)).updateControlLoop(any(ControlLoop.class)); @@ -87,9 +90,12 @@ class SupervisionScannerTest { var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class); var clRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner"); - var supervisionScanner = new SupervisionScanner(controlLoopProvider, controlLoopStateChangePublisher, - controlLoopUpdatePublisher, participantProvider, participantStatusReqPublisher, - participantUpdatePublisher, clRuntimeParameterGroup); + var modelsProvider = mock(PolicyModelsProvider.class); + when(modelsProvider.getServiceTemplateList(null, null)).thenReturn(List.of(new ToscaServiceTemplate())); + + var supervisionScanner = new SupervisionScanner(controlLoopProvider, modelsProvider, + controlLoopStateChangePublisher, controlLoopUpdatePublisher, participantProvider, + participantStatusReqPublisher, participantUpdatePublisher, clRuntimeParameterGroup); supervisionScanner.run(false); verify(controlLoopProvider, times(1)).updateControlLoop(any(ControlLoop.class)); @@ -107,15 +113,16 @@ class SupervisionScannerTest { participant.setVersion("1.0.0"); when(participantProvider.getParticipants(null, null)).thenReturn(List.of(participant)); + var modelsProvider = mock(PolicyModelsProvider.class); var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class); var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class); var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class); var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class); var clRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner"); - var supervisionScanner = new SupervisionScanner(controlLoopProvider, controlLoopStateChangePublisher, - controlLoopUpdatePublisher, participantProvider, participantStatusReqPublisher, - participantUpdatePublisher, clRuntimeParameterGroup); + var supervisionScanner = new SupervisionScanner(controlLoopProvider, modelsProvider, + controlLoopStateChangePublisher, controlLoopUpdatePublisher, participantProvider, + participantStatusReqPublisher, participantUpdatePublisher, clRuntimeParameterGroup); supervisionScanner.handleParticipantStatus(participant.getKey().asIdentifier()); supervisionScanner.run(true); @@ -142,14 +149,15 @@ class SupervisionScannerTest { var participantProvider = new ParticipantProvider(clRuntimeParameterGroup.getDatabaseProviderParameters()); participantProvider.updateParticipants(List.of(participant)); + var modelsProvider = mock(PolicyModelsProvider.class); var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class); var participantStatusReqPublisher = mock(ParticipantStatusReqPublisher.class); var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class); var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class); - var supervisionScanner = new SupervisionScanner(controlLoopProvider, controlLoopStateChangePublisher, - controlLoopUpdatePublisher, participantProvider, participantStatusReqPublisher, - participantUpdatePublisher, clRuntimeParameterGroup); + var supervisionScanner = new SupervisionScanner(controlLoopProvider, modelsProvider, + controlLoopStateChangePublisher, controlLoopUpdatePublisher, participantProvider, + participantStatusReqPublisher, participantUpdatePublisher, clRuntimeParameterGroup); supervisionScanner.handleParticipantStatus(participant.getKey().asIdentifier()); supervisionScanner.run(true); |