diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-06-19 11:14:12 +0100 |
---|---|---|
committer | Liam Fallon <liam.fallon@est.tech> | 2023-06-23 08:35:30 +0000 |
commit | 012d85236d4450e47a3ce854e43bdc8fe33d80ed (patch) | |
tree | a1ee8919ce6a18c677cc2b8e533db268bfd0cb1f /runtime-acm/src/test/java | |
parent | bd74cd0db2289695fa9514d9d4a4079ed87f3fa1 (diff) |
Remove retry count support in ACM
Due the new timeout implementation, the Retry Count support
could be removed.
Issue-ID: POLICY-4735
Change-Id: I3b9c50a761696e00bcd1ca73dafa382c481e921d
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
(cherry picked from commit a111b9631ec8a1eb3d108e21ebdac8a667cd4362)
Diffstat (limited to 'runtime-acm/src/test/java')
-rw-r--r-- | runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspectTest.java | 6 | ||||
-rw-r--r-- | runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantScannerTest.java | 1 | ||||
-rw-r--r-- | runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java | 25 | ||||
-rw-r--r-- | runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/TimeoutHandlerTest.java (renamed from runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/HandleCounterTest.java) | 50 |
4 files changed, 28 insertions, 54 deletions
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspectTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspectTest.java index c9985e203..0cee08ac5 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspectTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspectTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. + * Copyright (C) 2021-2023 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,7 +37,7 @@ class SupervisionAspectTest { var partecipantScanner = mock(SupervisionPartecipantScanner.class); try (var supervisionAspect = new SupervisionAspect(supervisionScanner, partecipantScanner)) { supervisionAspect.schedule(); - verify(supervisionScanner, timeout(500)).run(true); + verify(supervisionScanner, timeout(500)).run(); verify(partecipantScanner, timeout(500)).run(); } } @@ -49,7 +49,7 @@ class SupervisionAspectTest { try (var supervisionAspect = new SupervisionAspect(supervisionScanner, partecipantScanner)) { supervisionAspect.doCheck(); supervisionAspect.doCheck(); - verify(supervisionScanner, timeout(500).times(2)).run(false); + verify(supervisionScanner, timeout(500).times(2)).run(); } } diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantScannerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantScannerTest.java index 3ad9f813c..4bab85bf5 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantScannerTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantScannerTest.java @@ -38,7 +38,6 @@ class SupervisionParticipantScannerTest { @Test void testScanParticipant() throws PfModelException { var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanParticipant"); - acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().setMaxWaitMs(-1); acRuntimeParameterGroup.getParticipantParameters().setMaxStatusWaitMs(-1); var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId()); diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java index 7aaa6d22c..99af72801 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java @@ -80,7 +80,7 @@ class SupervisionScannerTest { var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider, automationCompositionStateChangePublisher, automationCompositionDeployPublisher, acRuntimeParameterGroup); - supervisionScanner.run(false); + supervisionScanner.run(); verify(automationCompositionProvider, times(0)).updateAutomationComposition(any(AutomationComposition.class)); } @@ -101,7 +101,7 @@ class SupervisionScannerTest { var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider, automationCompositionStateChangePublisher, automationCompositionDeployPublisher, acRuntimeParameterGroup); - supervisionScanner.run(false); + supervisionScanner.run(); verify(automationCompositionProvider).updateAutomationComposition(any(AutomationComposition.class)); } @@ -123,7 +123,7 @@ class SupervisionScannerTest { var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider, automationCompositionStateChangePublisher, automationCompositionDeployPublisher, acRuntimeParameterGroup); - supervisionScanner.run(false); + supervisionScanner.run(); verify(automationCompositionProvider).deleteAutomationComposition(automationComposition.getInstanceId()); } @@ -143,12 +143,12 @@ class SupervisionScannerTest { automationCompositionStateChangePublisher, automationCompositionDeployPublisher, acRuntimeParameterGroup); - supervisionScanner.run(true); + supervisionScanner.run(); verify(automationCompositionProvider, times(0)).updateAutomationComposition(any(AutomationComposition.class)); } @Test - void testScannerForCounterHandling() { + void testScannerForTimeout() { var automationComposition = InstantiationUtils.getAutomationCompositionFromResource(AC_JSON, "Crud"); automationComposition.setDeployState(DeployState.DEPLOYING); automationComposition.setLockState(LockState.NONE); @@ -164,21 +164,12 @@ class SupervisionScannerTest { var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner"); acRuntimeParameterGroup.getParticipantParameters().setMaxStatusWaitMs(-1); - //verify retry scenario - var scannerObj1 = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider, - automationCompositionStateChangePublisher, automationCompositionDeployPublisher, - acRuntimeParameterGroup); - - scannerObj1.run(true); - verify(automationCompositionProvider, times(0)).updateAutomationComposition(any(AutomationComposition.class)); - //verify timeout scenario - acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().setMaxRetryCount(0); var scannerObj2 = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider, automationCompositionStateChangePublisher, automationCompositionDeployPublisher, acRuntimeParameterGroup); - scannerObj2.run(true); + scannerObj2.run(); verify(automationCompositionProvider, times(1)).updateAutomationComposition(any(AutomationComposition.class)); } @@ -211,7 +202,7 @@ class SupervisionScannerTest { automationCompositionStateChangePublisher, automationCompositionDeployPublisher, acRuntimeParameterGroup); - supervisionScanner.run(false); + supervisionScanner.run(); verify(automationCompositionDeployPublisher).send(any(AutomationComposition.class), any(ToscaServiceTemplate.class), anyInt(), anyBoolean()); @@ -245,7 +236,7 @@ class SupervisionScannerTest { automationCompositionStateChangePublisher, automationCompositionDeployPublisher, acRuntimeParameterGroup); - supervisionScanner.run(false); + supervisionScanner.run(); verify(automationCompositionStateChangePublisher).send(any(AutomationComposition.class), anyInt(), anyBoolean()); diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/HandleCounterTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/TimeoutHandlerTest.java index e50126d27..21c5b3d2c 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/HandleCounterTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/TimeoutHandlerTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. + * Copyright (C) 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,38 +24,22 @@ import static org.assertj.core.api.Assertions.assertThat; import org.junit.jupiter.api.Test; -class HandleCounterTest { +class TimeoutHandlerTest { private static final int ID = 1; @Test - void testCount() { - var handleCounter = new HandleCounter<Integer>(); - handleCounter.setMaxRetryCount(2); - assertThat(handleCounter.count(ID)).isTrue(); - assertThat(handleCounter.getCounter(ID)).isEqualTo(1); - assertThat(handleCounter.count(ID)).isTrue(); - assertThat(handleCounter.getCounter(ID)).isEqualTo(2); - assertThat(handleCounter.count(ID)).isFalse(); - assertThat(handleCounter.getCounter(ID)).isEqualTo(2); - - handleCounter.clear(ID); - assertThat(handleCounter.count(ID)).isTrue(); - assertThat(handleCounter.getCounter(ID)).isEqualTo(1); - } - - @Test void testFault() { - var handleCounter = new HandleCounter<Integer>(); - handleCounter.setFault(ID); - assertThat(handleCounter.isFault(ID)).isTrue(); - handleCounter.clear(ID); - assertThat(handleCounter.isFault(ID)).isFalse(); + var timeoutHandler = new TimeoutHandler<Integer>(); + timeoutHandler.setTimeout(ID); + assertThat(timeoutHandler.isTimeout(ID)).isTrue(); + timeoutHandler.clear(ID); + assertThat(timeoutHandler.isTimeout(ID)).isFalse(); } @Test void testDuration() { - var handleCounter = new HandleCounter<Integer>() { + var timeoutHandler = new TimeoutHandler<Integer>() { long epochMilli = 0; @Override @@ -63,21 +47,21 @@ class HandleCounterTest { return epochMilli; } }; - handleCounter.epochMilli = 100; - var result = handleCounter.getDuration(ID); + timeoutHandler.epochMilli = 100; + var result = timeoutHandler.getDuration(ID); assertThat(result).isZero(); - handleCounter.epochMilli += 100; - result = handleCounter.getDuration(ID); + timeoutHandler.epochMilli += 100; + result = timeoutHandler.getDuration(ID); assertThat(result).isEqualTo(100); - handleCounter.epochMilli += 100; - result = handleCounter.getDuration(ID); + timeoutHandler.epochMilli += 100; + result = timeoutHandler.getDuration(ID); assertThat(result).isEqualTo(200); - handleCounter.epochMilli += 100; - handleCounter.clear(ID); - result = handleCounter.getDuration(ID); + timeoutHandler.epochMilli += 100; + timeoutHandler.clear(ID); + result = timeoutHandler.getDuration(ID); assertThat(result).isZero(); } } |