aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary/src
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-intermediary/src')
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java12
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java14
2 files changed, 25 insertions, 1 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
index fd82c37ba..fefa637da 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
@@ -40,6 +40,7 @@ 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.concepts.ParticipantDeploy;
import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
import org.onap.policy.clamp.models.acm.concepts.StateChangeResult;
import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCompositionDeploy;
@@ -47,6 +48,7 @@ import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCom
import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCompositionMigration;
import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCompositionStateChange;
import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantPrimeAck;
import org.onap.policy.clamp.models.acm.messages.kafka.participant.PropertiesUpdate;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder;
@@ -428,6 +430,16 @@ public class AutomationCompositionHandler {
var acElementsDefinitions = cacheProvider.getAcElementsDefinitions().get(compositionId);
if (acElementsDefinitions == null) {
// this participant does not handle this composition
+ var participantPrimeAck = new ParticipantPrimeAck();
+ participantPrimeAck.setCompositionId(compositionId);
+ participantPrimeAck.setMessage("Already deprimed or never primed");
+ participantPrimeAck.setResult(true);
+ participantPrimeAck.setResponseTo(messageId);
+ participantPrimeAck.setCompositionState(AcTypeState.COMMISSIONED);
+ participantPrimeAck.setStateChangeResult(StateChangeResult.NO_ERROR);
+ participantPrimeAck.setParticipantId(cacheProvider.getParticipantId());
+ participantPrimeAck.setState(ParticipantState.ON_LINE);
+ publisher.sendParticipantPrimeAck(participantPrimeAck);
return;
}
var list = new ArrayList<>(acElementsDefinitions.values());
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
index 661c009f6..b8fd3b42d 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
@@ -47,6 +47,7 @@ import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCom
import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCompositionDeployAck;
import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCompositionMigration;
import org.onap.policy.clamp.models.acm.messages.kafka.participant.AutomationCompositionStateChange;
+import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantPrimeAck;
import org.onap.policy.clamp.models.acm.messages.kafka.participant.PropertiesUpdate;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder;
@@ -273,7 +274,7 @@ class AutomationCompositionHandlerTest {
}
@Test
- void handleComposiotDeprimeTest() {
+ void handleCompositionDeprimeTest() {
var acElementDefinition = new AutomationCompositionElementDefinition();
acElementDefinition.setAcElementDefinitionId(new ToscaConceptIdentifier("key", "1.0.0"));
var toscaNodeTemplate = new ToscaNodeTemplate();
@@ -292,6 +293,17 @@ class AutomationCompositionHandlerTest {
}
@Test
+ void handleCompositionAlreadyDeprimedTest() {
+ var messageId = UUID.randomUUID();
+ var compositionId = UUID.randomUUID();
+ var participantMessagePublisher = mock(ParticipantMessagePublisher.class);
+ var ach = new AutomationCompositionHandler(mock(CacheProvider.class), participantMessagePublisher,
+ mock(ThreadHandler.class));
+ ach.deprime(messageId, compositionId);
+ verify(participantMessagePublisher).sendParticipantPrimeAck(any(ParticipantPrimeAck.class));
+ }
+
+ @Test
void restartedTest() {
var acElementDefinition = new AutomationCompositionElementDefinition();
acElementDefinition.setAcElementDefinitionId(new ToscaConceptIdentifier("key", "1.0.0"));