aboutsummaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/test/java
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-02-13 11:08:42 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2023-02-14 10:32:14 +0000
commit204be45b2c666a9261e287275ead362b8817f22c (patch)
tree4c21b8763a6570e920fb8901a33ecd07990def15 /runtime-acm/src/test/java
parent06339bee0cf891144ca781983ba99d170b10b2b7 (diff)
Implement recording of Operational State and Usage State on ACM-R
Issue-ID: POLICY-4511 Change-Id: I3a241bf602e6625d91cee2dc5242b76165bcd381 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src/test/java')
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java55
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAspectTest.java12
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantScannerTest.java58
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java103
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java16
5 files changed, 179 insertions, 65 deletions
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java
index fb285a84c..153f7a0e0 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java
@@ -21,9 +21,12 @@
package org.onap.policy.clamp.acm.runtime.supervision;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_SERVICE_TEMPLATE_YAML;
import java.util.Map;
import java.util.Optional;
@@ -34,6 +37,7 @@ import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionD
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck;
+import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.LockState;
@@ -97,4 +101,55 @@ class SupervisionAcHandlerTest {
verify(automationCompositionProvider).updateAutomationComposition(any(AutomationComposition.class));
}
+
+ @Test
+ void testUndeploy() {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var acStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
+ var handler = new SupervisionAcHandler(automationCompositionProvider,
+ mock(AutomationCompositionDeployPublisher.class),
+ acStateChangePublisher);
+ var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
+ var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
+ var automationComposition =
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Undeploy");
+ handler.undeploy(automationComposition, acDefinition);
+
+ verify(automationCompositionProvider).updateAutomationComposition(any(AutomationComposition.class));
+ verify(acStateChangePublisher).send(any(AutomationComposition.class), anyInt(), anyBoolean());
+ }
+
+ @Test
+ void testUnlock() {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var acStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
+ var handler = new SupervisionAcHandler(automationCompositionProvider,
+ mock(AutomationCompositionDeployPublisher.class),
+ acStateChangePublisher);
+ var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
+ var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
+ var automationComposition =
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "UnLock");
+ handler.unlock(automationComposition, acDefinition);
+
+ verify(automationCompositionProvider).updateAutomationComposition(any(AutomationComposition.class));
+ verify(acStateChangePublisher).send(any(AutomationComposition.class), anyInt(), anyBoolean());
+ }
+
+ @Test
+ void testLock() {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var acStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
+ var handler = new SupervisionAcHandler(automationCompositionProvider,
+ mock(AutomationCompositionDeployPublisher.class),
+ acStateChangePublisher);
+ var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
+ var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
+ var automationComposition =
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Lock");
+ handler.lock(automationComposition, acDefinition);
+
+ verify(automationCompositionProvider).updateAutomationComposition(any(AutomationComposition.class));
+ verify(acStateChangePublisher).send(any(AutomationComposition.class), anyInt(), anyBoolean());
+ }
}
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 b913cfac9..c9985e203 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
@@ -34,16 +34,19 @@ class SupervisionAspectTest {
@Test
void testSchedule() throws Exception {
var supervisionScanner = mock(SupervisionScanner.class);
- try (var supervisionAspect = new SupervisionAspect(supervisionScanner)) {
+ var partecipantScanner = mock(SupervisionPartecipantScanner.class);
+ try (var supervisionAspect = new SupervisionAspect(supervisionScanner, partecipantScanner)) {
supervisionAspect.schedule();
verify(supervisionScanner, timeout(500)).run(true);
+ verify(partecipantScanner, timeout(500)).run();
}
}
@Test
void testDoCheck() throws Exception {
var supervisionScanner = mock(SupervisionScanner.class);
- try (var supervisionAspect = new SupervisionAspect(supervisionScanner)) {
+ var partecipantScanner = mock(SupervisionPartecipantScanner.class);
+ try (var supervisionAspect = new SupervisionAspect(supervisionScanner, partecipantScanner)) {
supervisionAspect.doCheck();
supervisionAspect.doCheck();
verify(supervisionScanner, timeout(500).times(2)).run(false);
@@ -56,9 +59,10 @@ class SupervisionAspectTest {
participantStatusMessage.setParticipantId(CommonTestData.getParticipantId());
var supervisionScanner = mock(SupervisionScanner.class);
- try (var supervisionAspect = new SupervisionAspect(supervisionScanner)) {
+ var partecipantScanner = mock(SupervisionPartecipantScanner.class);
+ try (var supervisionAspect = new SupervisionAspect(supervisionScanner, partecipantScanner)) {
supervisionAspect.handleParticipantStatus(participantStatusMessage);
- verify(supervisionScanner, timeout(500)).handleParticipantStatus(CommonTestData.getParticipantId());
+ verify(partecipantScanner, timeout(500)).handleParticipantStatus(CommonTestData.getParticipantId());
}
}
}
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
new file mode 100644
index 000000000..3ad9f813c
--- /dev/null
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantScannerTest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.runtime.supervision;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
+import org.onap.policy.models.base.PfModelException;
+
+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());
+ participant.setParticipantState(ParticipantState.OFF_LINE);
+ var participantProvider = mock(ParticipantProvider.class);
+ when(participantProvider.getParticipants()).thenReturn(List.of(participant));
+
+ var supervisionScanner = new SupervisionPartecipantScanner(participantProvider, acRuntimeParameterGroup);
+
+ supervisionScanner.handleParticipantStatus(participant.getParticipantId());
+ supervisionScanner.run();
+ verify(participantProvider, times(0)).saveParticipant(any());
+
+ supervisionScanner.run();
+ verify(participantProvider, times(1)).updateParticipant(any());
+ }
+}
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 fe34c6b04..032468a56 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
@@ -21,6 +21,7 @@
package org.onap.policy.clamp.acm.runtime.supervision;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
@@ -39,13 +40,11 @@ import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionS
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.DeployState;
+import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
-import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
-import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
class SupervisionScannerTest {
@@ -70,16 +69,15 @@ class SupervisionScannerTest {
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
- var participantProvider = mock(ParticipantProvider.class);
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
var automationComposition = InstantiationUtils.getAutomationCompositionFromResource(AC_JSON, "Crud");
when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId))
- .thenReturn(List.of(automationComposition));
+ .thenReturn(List.of(automationComposition));
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider,
- acRuntimeParameterGroup);
+ automationCompositionStateChangePublisher, automationCompositionDeployPublisher,
+ acRuntimeParameterGroup);
supervisionScanner.run(false);
verify(automationCompositionProvider, times(0)).updateAutomationComposition(any(AutomationComposition.class));
@@ -88,20 +86,19 @@ class SupervisionScannerTest {
@Test
void testScannerOrderedStateDifferentToState() {
var automationComposition = InstantiationUtils.getAutomationCompositionFromResource(AC_JSON, "Crud");
- automationComposition.setState(AutomationCompositionState.UNINITIALISED2PASSIVE);
- automationComposition.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
+ automationComposition.setDeployState(DeployState.UNDEPLOYING);
+ automationComposition.setLockState(LockState.NONE);
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId))
- .thenReturn(List.of(automationComposition));
+ .thenReturn(List.of(automationComposition));
var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
- var participantProvider = mock(ParticipantProvider.class);
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider,
- acRuntimeParameterGroup);
+ automationCompositionStateChangePublisher, automationCompositionDeployPublisher,
+ acRuntimeParameterGroup);
supervisionScanner.run(false);
verify(automationCompositionProvider, times(1)).updateAutomationComposition(any(AutomationComposition.class));
@@ -112,21 +109,16 @@ class SupervisionScannerTest {
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
var automationComposition = new AutomationComposition();
when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId))
- .thenReturn(List.of(automationComposition));
-
- var participantProvider = mock(ParticipantProvider.class);
- var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId());
- when(participantProvider.getParticipants()).thenReturn(List.of(participant));
+ .thenReturn(List.of(automationComposition));
var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider,
- acRuntimeParameterGroup);
+ automationCompositionStateChangePublisher, automationCompositionDeployPublisher,
+ acRuntimeParameterGroup);
- supervisionScanner.handleParticipantStatus(participant.getParticipantId());
supervisionScanner.run(true);
verify(automationCompositionProvider, times(0)).updateAutomationComposition(any(AutomationComposition.class));
}
@@ -134,65 +126,68 @@ class SupervisionScannerTest {
@Test
void testSendAutomationCompositionMsgUpdate() {
var automationComposition = InstantiationUtils.getAutomationCompositionFromResource(AC_JSON, "Crud");
- automationComposition.setState(AutomationCompositionState.UNINITIALISED2PASSIVE);
- automationComposition.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
+ automationComposition.setDeployState(DeployState.DEPLOYING);
+ automationComposition.setLockState(LockState.NONE);
for (var element : automationComposition.getElements().values()) {
if ("org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement"
- .equals(element.getDefinition().getName())) {
- element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
- element.setState(AutomationCompositionState.UNINITIALISED);
+ .equals(element.getDefinition().getName())) {
+ element.setDeployState(DeployState.DEPLOYING);
+ element.setLockState(LockState.NONE);
} else {
- element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
- element.setState(AutomationCompositionState.PASSIVE);
+ element.setDeployState(DeployState.DEPLOYED);
+ element.setLockState(LockState.LOCKED);
}
}
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId))
- .thenReturn(List.of(automationComposition));
+ .thenReturn(List.of(automationComposition));
- var participantProvider = mock(ParticipantProvider.class);
var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider,
- acRuntimeParameterGroup);
+ automationCompositionStateChangePublisher, automationCompositionDeployPublisher,
+ acRuntimeParameterGroup);
supervisionScanner.run(false);
- verify(automationCompositionDeployPublisher).send(any(AutomationComposition.class), anyInt());
+ verify(automationCompositionDeployPublisher).send(any(AutomationComposition.class),
+ any(ToscaServiceTemplate.class), anyInt(), anyBoolean());
}
@Test
- void testScanParticipant() throws PfModelException {
+ void testSendAutomationCompositionMsgUnlocking() {
+ var automationComposition = InstantiationUtils.getAutomationCompositionFromResource(AC_JSON, "Crud");
+ automationComposition.setDeployState(DeployState.DEPLOYED);
+ automationComposition.setLockState(LockState.UNLOCKING);
+ for (var element : automationComposition.getElements().values()) {
+ if ("org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement"
+ .equals(element.getDefinition().getName())) {
+ element.setDeployState(DeployState.DEPLOYED);
+ element.setLockState(LockState.UNLOCKING);
+ } else {
+ element.setDeployState(DeployState.DEPLOYED);
+ element.setLockState(LockState.UNLOCKED);
+ }
+ }
+
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
- var automationComposition = new AutomationComposition();
when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId))
- .thenReturn(List.of(automationComposition));
-
- var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanParticipant");
- acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().setMaxWaitMs(-1);
- acRuntimeParameterGroup.getParticipantParameters().setMaxStatusWaitMs(-1);
-
- var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId());
- participant.setParticipantState(ParticipantState.OFF_LINE);
- var participantProvider = mock(ParticipantProvider.class);
- when(participantProvider.getParticipants()).thenReturn(List.of(participant));
+ .thenReturn(List.of(automationComposition));
var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
+ var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider,
- acRuntimeParameterGroup);
+ automationCompositionStateChangePublisher, automationCompositionDeployPublisher,
+ acRuntimeParameterGroup);
- supervisionScanner.handleParticipantStatus(participant.getParticipantId());
- supervisionScanner.run(true);
- verify(participantProvider, times(0)).saveParticipant(any());
+ supervisionScanner.run(false);
- supervisionScanner.run(true);
- verify(participantProvider, times(1)).updateParticipant(any());
+ verify(automationCompositionStateChangePublisher).send(any(AutomationComposition.class), anyInt(),
+ anyBoolean());
}
}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java
index 0072a1042..e0accc4a0 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java
@@ -42,7 +42,8 @@ import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.DeployState;
+import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
@@ -117,14 +118,15 @@ class SupervisionMessagesTest {
@Test
void testSendAutomationCompositionStateChangePublisherNotActive() {
var publisher = new AutomationCompositionStateChangePublisher();
- assertThatThrownBy(() -> publisher.send(getAutomationComposition(), 0)).hasMessage(NOT_ACTIVE);
+ assertThatThrownBy(() -> publisher.send(getAutomationComposition(), 0, true)).hasMessage(NOT_ACTIVE);
}
private AutomationComposition getAutomationComposition() {
var automationComposition = new AutomationComposition();
automationComposition.setName("NAME");
automationComposition.setVersion("0.0.1");
- automationComposition.setState(AutomationCompositionState.UNINITIALISED);
+ automationComposition.setDeployState(DeployState.DEPLOYED);
+ automationComposition.setLockState(LockState.UNLOCKING);
return automationComposition;
}
@@ -133,7 +135,7 @@ class SupervisionMessagesTest {
var publisher = new AutomationCompositionStateChangePublisher();
var topicSink = mock(TopicSink.class);
publisher.active(List.of(topicSink));
- publisher.send(getAutomationComposition(), 0);
+ publisher.send(getAutomationComposition(), 0, true);
verify(topicSink).send(anyString());
publisher.stop();
}
@@ -152,12 +154,12 @@ class SupervisionMessagesTest {
var participantId = UUID.randomUUID();
Map<ToscaConceptIdentifier, UUID> supportedElementMap = new HashMap<>();
supportedElementMap.put(
- new ToscaConceptIdentifier("org.onap.policy.clamp.acm.PolicyAutomationCompositionElement", "1.0.1"),
+ new ToscaConceptIdentifier("org.onap.policy.clamp.acm.PolicyAutomationCompositionElement", "1.0.0"),
participantId);
supportedElementMap.put(new ToscaConceptIdentifier(
- "org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement", "1.0.1"), participantId);
+ "org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement", "1.0.0"), participantId);
supportedElementMap.put(
- new ToscaConceptIdentifier("org.onap.policy.clamp.acm.HttpAutomationCompositionElement", "1.0.1"),
+ new ToscaConceptIdentifier("org.onap.policy.clamp.acm.HttpAutomationCompositionElement", "1.0.0"),
participantId);
var participantProvider = mock(ParticipantProvider.class);
when(participantProvider.getSupportedElementMap()).thenReturn(supportedElementMap);