summaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary/src
diff options
context:
space:
mode:
authorsaul.gill <saul.gill@est.tech>2023-01-23 17:44:13 +0000
committersaul.gill <saul.gill@est.tech>2023-01-26 09:27:28 +0000
commit73d0c089fe3e3019e8caa54a60a4c76de5edd72a (patch)
tree3197ed2af3da4a57abf8226c1cf21e6500a42444 /participant/participant-intermediary/src
parentdb615d9fed370c7896a638704d00807c19b6f5d3 (diff)
Remove participantType and references
Issue-ID: POLICY-4538 Change-Id: Idf3f0308254a318b3e72aa8a234fd7c78f6ffd82 Signed-off-by: saul.gill <saul.gill@est.tech>
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.java14
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java16
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java6
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java4
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java10
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java1
6 files changed, 11 insertions, 40 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 49b16d23d..422fc3e23 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
@@ -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");
@@ -58,7 +58,6 @@ import org.springframework.stereotype.Component;
public class AutomationCompositionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionHandler.class);
- private final ToscaConceptIdentifier participantType;
private final UUID participantId;
private final ParticipantMessagePublisher publisher;
@@ -78,7 +77,6 @@ public class AutomationCompositionHandler {
* @param publisher the ParticipantMessage Publisher
*/
public AutomationCompositionHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher) {
- this.participantType = parameters.getIntermediaryParameters().getParticipantType();
this.participantId = parameters.getIntermediaryParameters().getParticipantId();
this.publisher = publisher;
}
@@ -125,7 +123,6 @@ public class AutomationCompositionHandler {
var automationCompositionStateChangeAck =
new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionStateChangeAck.setParticipantId(participantId);
- automationCompositionStateChangeAck.setParticipantType(participantType);
automationCompositionStateChangeAck.setAutomationCompositionId(automationCompositionId);
acElement.setOrderedState(orderedState);
acElement.setState(newState);
@@ -160,7 +157,6 @@ public class AutomationCompositionHandler {
var automationCompositionAck =
new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionAck.setParticipantId(participantId);
- automationCompositionAck.setParticipantType(participantType);
automationCompositionAck.setMessage("Automation composition " + stateChangeMsg.getAutomationCompositionId()
+ " does not use this participant " + participantId);
automationCompositionAck.setResult(false);
@@ -212,7 +208,7 @@ public class AutomationCompositionHandler {
public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg,
List<AutomationCompositionElementDefinition> acElementDefinitions) {
- if (!updateMsg.appliesTo(participantType, participantId)) {
+ if (!updateMsg.appliesTo(participantId)) {
return;
}
@@ -234,7 +230,6 @@ public class AutomationCompositionHandler {
var automationCompositionUpdateAck =
new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK);
automationCompositionUpdateAck.setParticipantId(participantId);
- automationCompositionUpdateAck.setParticipantType(participantType);
automationCompositionUpdateAck.setMessage("Automation composition " + updateMsg.getAutomationCompositionId()
+ " already defined on participant " + participantId);
@@ -267,7 +262,7 @@ public class AutomationCompositionHandler {
var acElementList = updateMsg.getParticipantUpdatesList().stream()
.flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream())
- .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
+ .filter(element -> participantId.equals(element.getParticipantId())).collect(Collectors.toList());
handleAutomationCompositionElementUpdate(acElementList, acElementDefinitions, updateMsg.getStartPhase(),
updateMsg.getAutomationCompositionId());
@@ -311,7 +306,7 @@ public class AutomationCompositionHandler {
List<ParticipantUpdates> participantUpdates) {
var acElementList = participantUpdates.stream()
.flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream())
- .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
+ .filter(element -> participantId.equals(element.getParticipantId())).collect(Collectors.toList());
for (var element : acElementList) {
elementsOnThisParticipant.put(element.getId(), element);
@@ -393,7 +388,6 @@ public class AutomationCompositionHandler {
var automationCompositionAck =
new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionAck.setParticipantId(participantId);
- automationCompositionAck.setParticipantType(participantType);
automationCompositionAck.setMessage("Automation composition is already in state " + orderedState);
automationCompositionAck.setResult(false);
automationCompositionAck.setAutomationCompositionId(automationComposition.getInstanceId());
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
index 7e881b59d..f324cea0c 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
@@ -48,7 +48,6 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantSt
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -61,9 +60,6 @@ public class ParticipantHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantHandler.class);
@Getter
- private final ToscaConceptIdentifier participantType;
-
- @Getter
private final UUID participantId;
private final AutomationCompositionHandler automationCompositionHandler;
@@ -81,7 +77,6 @@ public class ParticipantHandler {
*/
public ParticipantHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher,
AutomationCompositionHandler automationCompositionHandler) {
- this.participantType = parameters.getIntermediaryParameters().getParticipantType();
this.participantId = parameters.getIntermediaryParameters().getParticipantId();
this.publisher = publisher;
this.automationCompositionHandler = automationCompositionHandler;
@@ -133,7 +128,7 @@ public class ParticipantHandler {
* @return true if it applies, false otherwise
*/
public boolean appliesTo(ParticipantMessage participantMsg) {
- return participantMsg.appliesTo(participantType, participantId);
+ return participantMsg.appliesTo(participantId);
}
/**
@@ -143,7 +138,7 @@ public class ParticipantHandler {
* @return true if it applies, false otherwise
*/
public boolean appliesTo(ParticipantAckMessage participantMsg) {
- return participantMsg.appliesTo(participantType, participantId);
+ return participantMsg.appliesTo(participantId);
}
/**
@@ -152,7 +147,6 @@ public class ParticipantHandler {
public void sendParticipantRegister() {
var participantRegister = new ParticipantRegister();
participantRegister.setParticipantId(participantId);
- participantRegister.setParticipantType(participantType);
participantRegister.setParticipantSupportedElementType(supportedAcElementTypes);
publisher.sendParticipantRegister(participantRegister);
@@ -176,7 +170,6 @@ public class ParticipantHandler {
public void sendParticipantDeregister() {
var participantDeregister = new ParticipantDeregister();
participantDeregister.setParticipantId(participantId);
- participantDeregister.setParticipantType(participantType);
publisher.sendParticipantDeregister(participantDeregister);
}
@@ -206,7 +199,7 @@ public class ParticipantHandler {
if (!participantUpdateMsg.getParticipantDefinitionUpdates().isEmpty()) {
// This message is to commission the automation composition
for (var participantDefinition : participantUpdateMsg.getParticipantDefinitionUpdates()) {
- if (participantDefinition.getParticipantType().equals(participantType)) {
+ if (participantDefinition.getParticipantId().equals(participantId)) {
acElementDefsMap.get(participantUpdateMsg.getCompositionId())
.addAll(participantDefinition.getAutomationCompositionElementDefinitionList());
break;
@@ -228,7 +221,6 @@ public class ParticipantHandler {
participantUpdateAck.setMessage("Participant Update Ack message");
participantUpdateAck.setResult(true);
participantUpdateAck.setParticipantId(participantId);
- participantUpdateAck.setParticipantType(participantType);
participantUpdateAck.setState(ParticipantState.ON_LINE);
publisher.sendParticipantUpdateAck(participantUpdateAck);
}
@@ -246,7 +238,6 @@ public class ParticipantHandler {
public ParticipantStatus makeHeartbeat(boolean responseToParticipantStatusReq) {
var heartbeat = new ParticipantStatus();
heartbeat.setParticipantId(participantId);
- heartbeat.setParticipantType(participantType);
heartbeat.setState(ParticipantState.ON_LINE);
heartbeat.setAutomationCompositionInfoList(getAutomationCompositionInfoList());
@@ -255,7 +246,6 @@ public class ParticipantHandler {
for (var acElementDefsOnThisParticipant : acElementDefsMap.values()) {
var participantDefinition = new ParticipantDefinition();
participantDefinition.setParticipantId(participantId);
- participantDefinition.setParticipantType(participantType);
participantDefinition.setAutomationCompositionElementDefinitionList(acElementDefsOnThisParticipant);
participantDefinitionList.add(participantDefinition);
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
index 8f32c6f9a..77a578ea8 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
@@ -31,7 +31,6 @@ import lombok.Setter;
import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType;
import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
import org.onap.policy.common.parameters.validation.ParameterGroupConstraint;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Class to hold all parameters needed for participant component.
@@ -48,11 +47,6 @@ public class ParticipantIntermediaryParameters {
@NotBlank
private String description;
- // The participant type of this participant
- @NotNull
- @Valid
- private ToscaConceptIdentifier participantType;
-
// The time interval for periodic reporting of status to the CLAMP ACM server
@Valid
@Positive
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 dc9e3d307..6698ef9a8 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
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-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.
@@ -146,7 +146,6 @@ class AutomationCompositionHandlerTest {
var participantUpdate = new ParticipantUpdates();
participantUpdate.setParticipantId(partecipantId);
var element = new AutomationCompositionElement();
- element.setParticipantType(definition);
element.setDefinition(definition);
participantUpdate.setAutomationCompositionElementList(List.of(element));
updateMsg.setParticipantUpdatesList(List.of(participantUpdate));
@@ -189,5 +188,4 @@ class AutomationCompositionHandlerTest {
stateChangePassive.setParticipantId(CommonTestData.getRndParticipantId());
assertDoesNotThrow(() -> ach.handleAutomationCompositionStateChange(stateChangePassive, List.of()));
}
-
}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
index 8e65abffb..c538a0248 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-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.
@@ -38,7 +38,6 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMe
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
class ParticipantHandlerTest {
@@ -61,12 +60,10 @@ class ParticipantHandlerTest {
var participantHandler = commonTestData.getMockParticipantHandler();
- var participantType = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
var participantId = CommonTestData.getParticipantId();
participantUpdateMsg.setAutomationCompositionId(CommonTestData.AC_ID_1);
participantUpdateMsg.setCompositionId(CommonTestData.AC_ID_1);
participantUpdateMsg.setParticipantId(participantId);
- participantUpdateMsg.setParticipantType(participantType);
participantUpdateMsg.setMessageId(UUID.randomUUID());
participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000));
@@ -90,7 +87,6 @@ class ParticipantHandlerTest {
private ParticipantUpdate setListParticipantDefinition(ParticipantUpdate participantUpdateMsg) {
var def = new ParticipantDefinition();
def.setParticipantId(CommonTestData.getParticipantId());
- def.setParticipantType(new ToscaConceptIdentifier(ID_NAME, ID_VERSION));
participantUpdateMsg.setParticipantDefinitionUpdates(List.of(def));
return participantUpdateMsg;
}
@@ -106,8 +102,8 @@ class ParticipantHandlerTest {
new ParticipantMessage(ParticipantMessageType.PARTICIPANT_STATUS);
assertTrue(participantHandler.appliesTo(participantMsg));
- var emptyid = new ToscaConceptIdentifier("", ID_VERSION);
- participantMsg.setParticipantType(emptyid);
+ var randomId = UUID.randomUUID();
+ participantMsg.setParticipantId(randomId);
assertFalse(participantHandler.appliesTo(participantMsg));
}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
index 45703848e..9641edc2e 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
@@ -113,7 +113,6 @@ public class CommonTestData {
map.put("name", name);
map.put("participantId", getParticipantId());
map.put("description", DESCRIPTION);
- map.put("participantType", getDefinition());
map.put("reportingTimeIntervalMs", TIME_INTERVAL);
map.put("clampAutomationCompositionTopics", getTopicParametersMap(false));
map.put("participantSupportedElementTypes", new ArrayList<>());