aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-policy
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl/participant-impl-policy')
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java12
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java16
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java2
3 files changed, 10 insertions, 20 deletions
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
index 0e19ea33e..b17ae4311 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java
@@ -32,6 +32,7 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementSt
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyApiHttpClient;
@@ -89,10 +90,12 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
}
break;
case PASSIVE:
- intermediaryApi.updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.PASSIVE);
+ intermediaryApi.updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.PASSIVE,
+ ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
break;
case RUNNING:
- intermediaryApi.updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.RUNNING);
+ intermediaryApi.updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.RUNNING,
+ ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
break;
default:
LOGGER.debug("Unknown orderedstate {}", newState);
@@ -111,7 +114,8 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
apiHttpClient.deletePolicyType(policyType.getKey(), policyType.getValue());
}
policyTypeMap.clear();
- intermediaryApi.updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.UNINITIALISED);
+ intermediaryApi.updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.UNINITIALISED,
+ ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
}
/**
@@ -125,7 +129,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
public void controlLoopElementUpdate(ControlLoopElement element, ToscaNodeTemplate clElementDefinition)
throws PfModelException {
intermediaryApi.updateControlLoopElementState(element.getId(), element.getOrderedState(),
- ControlLoopState.PASSIVE);
+ ControlLoopState.PASSIVE, ParticipantMessageType.CONTROL_LOOP_UPDATE);
ToscaServiceTemplate controlLoopDefinition = intermediaryApi.getToscaServiceTemplate();
if (controlLoopDefinition.getToscaTopologyTemplate() != null) {
if (controlLoopDefinition.getPolicyTypes() != null) {
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java
index df9a4b259..699df25e8 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java
@@ -161,21 +161,7 @@ class ParticipantMessagesTest {
@Test
void testParticipantStatusHeartbeat() throws Exception {
- final ParticipantStatus heartbeat = new ParticipantStatus();
- heartbeat.setParticipantId(getParticipantId());
- ControlLoopInfo clInfo = getControlLoopInfo(getControlLoopId());
- clInfo.setControlLoopId(getControlLoopId());
- heartbeat.setControlLoopInfoList(List.of(clInfo));
-
- ControlLoopElementDefinition clDefinition = getClElementDefinition();
- List<ControlLoopElementDefinition> controlLoopElementDefinitionList =
- List.of(clDefinition);
- ParticipantDefinition participantDefinition = new ParticipantDefinition();
- participantDefinition.setParticipantId(getParticipantId());
- participantDefinition.setControlLoopElementDefinitionList(controlLoopElementDefinitionList);
- List<ParticipantDefinition> participantDefinitionUpdates = List.of(participantDefinition);
- heartbeat.setParticipantDefinitionUpdates(participantDefinitionUpdates);
-
+ final ParticipantStatus heartbeat = participantHandler.makeHeartbeat(true);
synchronized (lockit) {
ParticipantMessagePublisher publisher =
new ParticipantMessagePublisher(Collections.singletonList(Mockito.mock(TopicSink.class)));
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java
index 5984cf149..4c87e0875 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java
@@ -59,7 +59,7 @@ public class TestListenerUtils {
private static final Coder CODER = new StandardCoder();
static CommonTestData commonTestData = new CommonTestData();
private static final Logger LOGGER = LoggerFactory.getLogger(TestListenerUtils.class);
- private static final String CONTROL_LOOP_ELEMENT = "ControlLoopElement";
+ private static final String CONTROL_LOOP_ELEMENT = "org.onap.policy.clamp.controlloop.ControlLoopElement";
private TestListenerUtils() {}