summaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary/src/test/java
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-06-09 10:27:53 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2023-06-09 09:42:08 +0000
commit5ccedbf315e6879005e1748baaccbfda9e81097e (patch)
tree7fccb4275be9b6405511a76e7b2127612c74f7a3 /participant/participant-intermediary/src/test/java
parentd58c0ca04ae993702b2c399afd52b01e503ec0fe (diff)
Add Minor Refactor for Intermediary to support failure handler
First part related to refactor Intermediary to support failure handler. Rest of refactor will be implemented in POLICY-4707. Issue-ID: POLICY-4732 Change-Id: I12fbec84c154937f3c197070862b18ad5675cc3e Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-intermediary/src/test/java')
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java66
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java142
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/CacheProviderTest.java128
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java11
4 files changed, 323 insertions, 24 deletions
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
index 1540d6e4c..1dbf0b13c 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
@@ -20,19 +20,23 @@
package org.onap.policy.clamp.acm.participant.intermediary.comm;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.Mockito.mock;
import java.util.Collections;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
+import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
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.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrimeAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
@@ -40,11 +44,9 @@ import org.onap.policy.common.utils.coder.CoderException;
class ParticipantCommTest {
- private final CommonTestData commonTestData = new CommonTestData();
-
@Test
void participantReqTest() throws CoderException {
- var participantHandler = commonTestData.getParticipantHandlerAutomationCompositions();
+ var participantHandler = mock(ParticipantHandler.class);
var participantRegisterAckListener = new ParticipantRegisterAckListener(participantHandler);
assertEquals(ParticipantMessageType.PARTICIPANT_REGISTER_ACK.name(), participantRegisterAckListener.getType());
@@ -54,51 +56,75 @@ class ParticipantCommTest {
var participantDeregisterAckListener = new ParticipantDeregisterAckListener(participantHandler);
assertEquals(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK.name(),
- participantDeregisterAckListener.getType());
+ participantDeregisterAckListener.getType());
var participantPrimeListener = new ParticipantPrimeListener(participantHandler);
assertEquals(ParticipantMessageType.PARTICIPANT_PRIME.name(), participantPrimeListener.getType());
+ var acPropertyUpdateListener = new AcPropertyUpdateListener(participantHandler);
+ assertEquals(ParticipantMessageType.PROPERTIES_UPDATE.name(), acPropertyUpdateListener.getType());
+
var automationCompositionUpdateListener = new AutomationCompositionDeployListener(participantHandler);
assertEquals(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY.name(),
- automationCompositionUpdateListener.getType());
+ automationCompositionUpdateListener.getType());
var automationCompositionStateChangeListener = new AutomationCompositionStateChangeListener(participantHandler);
assertEquals(ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE.name(),
- automationCompositionStateChangeListener.getType());
+ automationCompositionStateChangeListener.getType());
+ }
+
+ @Test
+ void participantMessagePublisherTest() {
+ var publisher = new ParticipantMessagePublisher();
+ publisher.active(Collections.singletonList(Mockito.mock(TopicSink.class)));
+ var participantStatus = new ParticipantStatus();
+ assertDoesNotThrow(() -> publisher.sendParticipantStatus(participantStatus));
+
+ assertDoesNotThrow(() -> publisher.sendHeartbeat(participantStatus));
+
+ var participantRegister = new ParticipantRegister();
+ assertDoesNotThrow(() -> publisher.sendParticipantRegister(participantRegister));
+
+ var participantDeregister = new ParticipantDeregister();
+ assertDoesNotThrow(() -> publisher.sendParticipantDeregister(participantDeregister));
+
+ var participantPrimeAck = new ParticipantPrimeAck();
+ assertDoesNotThrow(() -> publisher.sendParticipantPrimeAck(participantPrimeAck));
+
+ var automationCompositionAck = mock(AutomationCompositionDeployAck.class);
+ assertDoesNotThrow(() -> publisher.sendAutomationCompositionAck(automationCompositionAck));
}
@Test
void participantMessagePublisherExceptionsTest() {
- var participantMessagePublisher = new ParticipantMessagePublisher();
+ var publisher = new ParticipantMessagePublisher();
- var participantStatus = Mockito.mock(ParticipantStatus.class);
- assertThrows(AutomationCompositionRuntimeException.class,
- () -> participantMessagePublisher.sendParticipantStatus(participantStatus));
+ var participantStatus = new ParticipantStatus();
assertThrows(AutomationCompositionRuntimeException.class,
- () -> participantMessagePublisher.sendHeartbeat(participantStatus));
+ () -> publisher.sendParticipantStatus(participantStatus));
+ assertThrows(AutomationCompositionRuntimeException.class, () -> publisher.sendHeartbeat(participantStatus));
- var participantRegister = Mockito.mock(ParticipantRegister.class);
+ var participantRegister = new ParticipantRegister();
assertThrows(AutomationCompositionRuntimeException.class,
- () -> participantMessagePublisher.sendParticipantRegister(participantRegister));
+ () -> publisher.sendParticipantRegister(participantRegister));
- var participantDeregister = Mockito.mock(ParticipantDeregister.class);
+ var participantDeregister = new ParticipantDeregister();
assertThrows(AutomationCompositionRuntimeException.class,
- () -> participantMessagePublisher.sendParticipantDeregister(participantDeregister));
+ () -> publisher.sendParticipantDeregister(participantDeregister));
- var automationCompositionAck = Mockito.mock(AutomationCompositionDeployAck.class);
+ var automationCompositionAck = mock(AutomationCompositionDeployAck.class);
assertThrows(AutomationCompositionRuntimeException.class,
- () -> participantMessagePublisher.sendAutomationCompositionAck(automationCompositionAck));
+ () -> publisher.sendAutomationCompositionAck(automationCompositionAck));
List<TopicSink> emptyList = Collections.emptyList();
- assertThrows(IllegalArgumentException.class, () -> participantMessagePublisher.active(emptyList));
+ assertThrows(IllegalArgumentException.class, () -> publisher.active(emptyList));
- participantMessagePublisher.stop();
+ publisher.stop();
}
@Test
void messageSenderTest() throws CoderException {
- var participantHandler = commonTestData.getParticipantHandlerAutomationCompositions();
+ var participantHandler = mock(ParticipantHandler.class);
var participantParameters = CommonTestData.getParticipantParameters();
var messageSender = new MessageSender(participantHandler, participantParameters);
messageSender.run();
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java
new file mode 100644
index 000000000..3f022dcf2
--- /dev/null
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java
@@ -0,0 +1,142 @@
+/*-
+ * ============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.participant.intermediary.handler;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+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.Map;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
+import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
+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.StateChangeResult;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
+
+class AutomationCompositionOutHandlerTest {
+
+ @Test
+ void updateAutomationCompositionElementStateNullTest() {
+ var cacheProvider = mock(CacheProvider.class);
+ var acOutHandler = new AutomationCompositionOutHandler(mock(ParticipantMessagePublisher.class), cacheProvider);
+
+ assertDoesNotThrow(
+ () -> acOutHandler.updateAutomationCompositionElementState(null, null, null, null, null, null));
+ assertDoesNotThrow(() -> acOutHandler.updateAutomationCompositionElementState(UUID.randomUUID(),
+ UUID.randomUUID(), null, null, null, null));
+ assertDoesNotThrow(() -> acOutHandler.updateAutomationCompositionElementState(UUID.randomUUID(),
+ UUID.randomUUID(), DeployState.DEPLOYED, null, null, null));
+
+ var automationComposition = CommonTestData.getTestAutomationCompositionMap().values().iterator().next();
+ when(cacheProvider.getAutomationComposition(automationComposition.getInstanceId()))
+ .thenReturn(automationComposition);
+ assertDoesNotThrow(() -> acOutHandler.updateAutomationCompositionElementState(
+ automationComposition.getInstanceId(), UUID.randomUUID(), DeployState.DEPLOYED, null, null, null));
+ }
+
+ @Test
+ void updateAutomationCompositionElementStateDeployedTest() {
+ var publisher = mock(ParticipantMessagePublisher.class);
+ var cacheProvider = mock(CacheProvider.class);
+ var acOutHandler = new AutomationCompositionOutHandler(publisher, cacheProvider);
+
+ var automationComposition = CommonTestData.getTestAutomationCompositionMap().values().iterator().next();
+ when(cacheProvider.getAutomationComposition(automationComposition.getInstanceId()))
+ .thenReturn(automationComposition);
+ var elementId = automationComposition.getElements().values().iterator().next().getId();
+ acOutHandler.updateAutomationCompositionElementState(automationComposition.getInstanceId(), elementId,
+ DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Deployed");
+ verify(publisher).sendAutomationCompositionAck(any(AutomationCompositionDeployAck.class));
+ }
+
+ @Test
+ void updateAutomationCompositionElementStateLockTest() {
+ var publisher = mock(ParticipantMessagePublisher.class);
+ var cacheProvider = mock(CacheProvider.class);
+ var acOutHandler = new AutomationCompositionOutHandler(publisher, cacheProvider);
+
+ var automationComposition = CommonTestData.getTestAutomationCompositionMap().values().iterator().next();
+ when(cacheProvider.getAutomationComposition(automationComposition.getInstanceId()))
+ .thenReturn(automationComposition);
+ var elementId = automationComposition.getElements().values().iterator().next().getId();
+ acOutHandler.updateAutomationCompositionElementState(automationComposition.getInstanceId(), elementId, null,
+ LockState.LOCKED, StateChangeResult.NO_ERROR, "Locked");
+ verify(publisher).sendAutomationCompositionAck(any(AutomationCompositionDeployAck.class));
+ }
+
+ @Test
+ void updateAutomationCompositionElementStateDeleteTest() {
+ var publisher = mock(ParticipantMessagePublisher.class);
+ var cacheProvider = mock(CacheProvider.class);
+ var acOutHandler = new AutomationCompositionOutHandler(publisher, cacheProvider);
+
+ var automationComposition = CommonTestData.getTestAutomationCompositionMap().values().iterator().next();
+ when(cacheProvider.getAutomationComposition(automationComposition.getInstanceId()))
+ .thenReturn(automationComposition);
+ for (var element : automationComposition.getElements().values()) {
+ acOutHandler.updateAutomationCompositionElementState(automationComposition.getInstanceId(), element.getId(),
+ DeployState.DELETED, null, StateChangeResult.NO_ERROR, "Deleted");
+ }
+ verify(publisher, times(automationComposition.getElements().size()))
+ .sendAutomationCompositionAck(any(AutomationCompositionDeployAck.class));
+ verify(cacheProvider).removeAutomationComposition(automationComposition.getInstanceId());
+ }
+
+ @Test
+ void sendAcElementInfoTestNull() {
+ var publisher = mock(ParticipantMessagePublisher.class);
+ var cacheProvider = mock(CacheProvider.class);
+ var acOutHandler = new AutomationCompositionOutHandler(publisher, cacheProvider);
+
+ assertDoesNotThrow(() -> acOutHandler.sendAcElementInfo(null, null, null, null, null));
+ assertDoesNotThrow(() -> acOutHandler.sendAcElementInfo(UUID.randomUUID(), null, null, null, null));
+ assertDoesNotThrow(
+ () -> acOutHandler.sendAcElementInfo(UUID.randomUUID(), UUID.randomUUID(), null, null, null));
+
+ var automationComposition = CommonTestData.getTestAutomationCompositionMap().values().iterator().next();
+ when(cacheProvider.getAutomationComposition(automationComposition.getInstanceId()))
+ .thenReturn(automationComposition);
+ assertDoesNotThrow(() -> acOutHandler.sendAcElementInfo(automationComposition.getInstanceId(),
+ UUID.randomUUID(), null, null, null));
+ }
+
+ @Test
+ void sendAcElementInfoTest() {
+ var publisher = mock(ParticipantMessagePublisher.class);
+ var cacheProvider = mock(CacheProvider.class);
+ var acOutHandler = new AutomationCompositionOutHandler(publisher, cacheProvider);
+
+ var automationComposition = CommonTestData.getTestAutomationCompositionMap().values().iterator().next();
+ when(cacheProvider.getAutomationComposition(automationComposition.getInstanceId()))
+ .thenReturn(automationComposition);
+ var elementId = automationComposition.getElements().values().iterator().next().getId();
+ acOutHandler.sendAcElementInfo(automationComposition.getInstanceId(),
+ elementId, "", "", Map.of());
+ verify(publisher).sendParticipantStatus(any(ParticipantStatus.class));
+ }
+}
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/CacheProviderTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/CacheProviderTest.java
new file mode 100644
index 000000000..bbce42351
--- /dev/null
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/CacheProviderTest.java
@@ -0,0 +1,128 @@
+/*-
+ * ============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.participant.intermediary.handler;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
+import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
+import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+
+class CacheProviderTest {
+
+ @Test
+ void testgetSupportedAcElementTypes() {
+ var parameter = CommonTestData.getParticipantParameters();
+ var cacheProvider = new CacheProvider(parameter);
+ assertEquals(parameter.getIntermediaryParameters().getParticipantId(), cacheProvider.getParticipantId());
+ assertEquals(parameter.getIntermediaryParameters().getParticipantSupportedElementTypes().get(0),
+ cacheProvider.getSupportedAcElementTypes().get(0));
+ }
+
+ @Test
+ void testNotNull() {
+ var parameter = CommonTestData.getParticipantParameters();
+ var cacheProvider = new CacheProvider(parameter);
+ var instanceId = UUID.randomUUID();
+ assertThatThrownBy(() -> cacheProvider.initializeAutomationComposition(null, null, null))
+ .isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> cacheProvider.initializeAutomationComposition(instanceId, null, null))
+ .isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> cacheProvider.initializeAutomationComposition(instanceId, instanceId, null))
+ .isInstanceOf(NullPointerException.class);
+
+ assertThatThrownBy(() -> cacheProvider.addElementDefinition(null, null))
+ .isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> cacheProvider.addElementDefinition(instanceId, null))
+ .isInstanceOf(NullPointerException.class);
+
+ assertThatThrownBy(() -> cacheProvider.getAutomationComposition(null)).isInstanceOf(NullPointerException.class);
+
+ assertThatThrownBy(() -> cacheProvider.getCommonProperties(null, null))
+ .isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> cacheProvider.getCommonProperties(instanceId, null))
+ .isInstanceOf(NullPointerException.class);
+
+ assertThatThrownBy(() -> cacheProvider.removeAutomationComposition(null))
+ .isInstanceOf(NullPointerException.class);
+
+ assertThatThrownBy(() -> cacheProvider.removeElementDefinition(null)).isInstanceOf(NullPointerException.class);
+ }
+
+ @Test
+ void testinitCommonProperties() throws AutomationCompositionException {
+ var parameter = CommonTestData.getParticipantParameters();
+ var cacheProvider = new CacheProvider(parameter);
+ var participantDeploy = new ParticipantDeploy();
+ participantDeploy.setParticipantId(cacheProvider.getParticipantId());
+
+ var compositionId = UUID.randomUUID();
+
+ List<AutomationCompositionElementDefinition> definitions = new ArrayList<>();
+ var automationComposition =
+ CommonTestData.getTestAutomationCompositions().getAutomationCompositionList().get(0);
+ automationComposition.setInstanceId(UUID.randomUUID());
+ automationComposition.setCompositionId(compositionId);
+ for (var element : automationComposition.getElements().values()) {
+ var acElementDefinition = new AutomationCompositionElementDefinition();
+ acElementDefinition.setAcElementDefinitionId(element.getDefinition());
+ var nodeTemplate = new ToscaNodeTemplate();
+ nodeTemplate.setProperties(Map.of("key", "value"));
+ acElementDefinition.setAutomationCompositionElementToscaNodeTemplate(nodeTemplate);
+ definitions.add(acElementDefinition);
+
+ var acElement = new AcElementDeploy();
+ acElement.setId(element.getId());
+ acElement.setDefinition(element.getDefinition());
+ participantDeploy.getAcElementList().add(acElement);
+ }
+ cacheProvider.addElementDefinition(compositionId, definitions);
+
+ cacheProvider.initializeAutomationComposition(compositionId, automationComposition.getInstanceId(),
+ participantDeploy);
+
+ for (var element : automationComposition.getElements().values()) {
+ var commonProperties =
+ cacheProvider.getCommonProperties(automationComposition.getInstanceId(), element.getId());
+ assertEquals("value", commonProperties.get("key"));
+ }
+
+ assertEquals(automationComposition.getInstanceId(),
+ cacheProvider.getAutomationComposition(automationComposition.getInstanceId()).getInstanceId());
+
+ assertThat(cacheProvider.getAutomationCompositions()).hasSize(1);
+ cacheProvider.removeAutomationComposition(automationComposition.getInstanceId());
+ assertThat(cacheProvider.getAutomationCompositions()).isEmpty();
+
+ cacheProvider.removeElementDefinition(compositionId);
+ assertThat(cacheProvider.getAcElementsDefinitions()).isEmpty();
+ }
+}
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 e627da611..60812c27a 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
@@ -22,7 +22,6 @@ package org.onap.policy.clamp.acm.participant.intermediary.main.parameters;
import java.io.File;
import java.time.Instant;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
@@ -39,6 +38,7 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
import org.onap.policy.clamp.models.acm.concepts.DeployState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
@@ -116,7 +116,10 @@ public class CommonTestData {
map.put("description", DESCRIPTION);
map.put("reportingTimeIntervalMs", TIME_INTERVAL);
map.put("clampAutomationCompositionTopics", getTopicParametersMap(false));
- map.put("participantSupportedElementTypes", new ArrayList<>());
+ var supportedElementType = new ParticipantSupportedElementType();
+ supportedElementType.setTypeName("org.onap.policy.clamp.acm.HttpAutomationCompositionElement");
+ supportedElementType.setTypeVersion("1.0.0");
+ map.put("participantSupportedElementTypes", List.of(supportedElementType));
return map;
}
@@ -237,7 +240,7 @@ public class CommonTestData {
*
* @throws CoderException if there is an error with .json file.
*/
- public Map<UUID, AutomationComposition> getTestAutomationCompositionMap() {
+ public static Map<UUID, AutomationComposition> getTestAutomationCompositionMap() {
var automationCompositions = getTestAutomationCompositions();
var automationComposition = automationCompositions.getAutomationCompositionList().get(1);
Map<UUID, AutomationComposition> automationCompositionMap = new LinkedHashMap<>();
@@ -252,7 +255,7 @@ public class CommonTestData {
*
* @throws CoderException if there is an error with .json file.
*/
- public AutomationCompositions getTestAutomationCompositions() {
+ public static AutomationCompositions getTestAutomationCompositions() {
try {
var automationCompositions =
new StandardCoder().decode(new File("src/test/resources/providers/TestAutomationCompositions.json"),