summaryrefslogtreecommitdiffstats
path: root/participant/participant-impl
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl')
-rwxr-xr-xparticipant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java20
-rwxr-xr-xparticipant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AcElementHandlerTest.java60
-rwxr-xr-xparticipant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonTestData.java28
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java22
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java13
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java9
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java23
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java22
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java9
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java35
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java63
11 files changed, 136 insertions, 168 deletions
diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java
index 9b942b961..bcc3fd498 100755
--- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java
@@ -23,9 +23,7 @@ package org.onap.policy.clamp.acm.participant.a1pms.handler;
import java.lang.invoke.MethodHandles;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import java.util.UUID;
-import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.ValidationException;
import lombok.AccessLevel;
@@ -46,8 +44,6 @@ import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -75,18 +71,19 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
/**
* Handle a automation composition element state change.
*
+ * @param automationCompositionId the ID of the automation composition
* @param automationCompositionElementId the ID of the automation composition element
* @param currentState the current state of the automation composition element
* @param newState the state to which the automation composition element is changing to
* @throws PfModelException in case of a model exception
*/
@Override
- public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ public void automationCompositionElementStateChange(UUID automationCompositionId,
UUID automationCompositionElementId, AutomationCompositionState currentState,
AutomationCompositionOrderedState newState) throws A1PolicyServiceException {
switch (newState) {
case UNINITIALISED:
- ConfigurationEntity configurationEntity = configRequestMap.get(automationCompositionElementId);
+ var configurationEntity = configRequestMap.get(automationCompositionElementId);
if (configurationEntity != null && acA1PmsClient.isPmsHealthy()) {
acA1PmsClient.deleteService(configurationEntity.getPolicyServiceEntities());
configRequestMap.remove(automationCompositionElementId);
@@ -118,15 +115,16 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
/**
* Callback method to handle an update on an automation composition element.
*
+ * @param automationCompositionId the ID of the automation composition
* @param element the information on the automation composition element
- * @param nodeTemplate toscaNodeTemplate
+ * @param properties properties Map
*/
@Override
- public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
- AutomationCompositionElement element, ToscaNodeTemplate nodeTemplate) throws A1PolicyServiceException {
+ public void automationCompositionElementUpdate(UUID automationCompositionId,
+ AutomationCompositionElement element, Map<String, Object> properties) throws A1PolicyServiceException {
try {
- var configurationEntity = CODER.convert(nodeTemplate.getProperties(), ConfigurationEntity.class);
- Set<ConstraintViolation<ConfigurationEntity>> violations =
+ var configurationEntity = CODER.convert(properties, ConfigurationEntity.class);
+ var violations =
Validation.buildDefaultValidatorFactory().getValidator().validate(configurationEntity);
if (violations.isEmpty()) {
if (acA1PmsClient.isPmsHealthy()) {
diff --git a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AcElementHandlerTest.java b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AcElementHandlerTest.java
index 635b77486..ce775b616 100755
--- a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AcElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AcElementHandlerTest.java
@@ -39,10 +39,8 @@ import org.onap.policy.clamp.acm.participant.a1pms.utils.CommonTestData;
import org.onap.policy.clamp.acm.participant.a1pms.utils.ToscaUtils;
import org.onap.policy.clamp.acm.participant.a1pms.webclient.AcA1PmsClient;
import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -54,14 +52,13 @@ class AcElementHandlerTest {
@InjectMocks
@Spy
private AutomationCompositionElementHandler automationCompositionElementHandler =
- new AutomationCompositionElementHandler(acA1PmsClient);
-
+ new AutomationCompositionElementHandler(acA1PmsClient);
private final CommonTestData commonTestData = new CommonTestData();
private static ToscaServiceTemplate serviceTemplate;
private static final String A1_AUTOMATION_COMPOSITION_ELEMENT =
- "org.onap.domain.database.A1PMSAutomationCompositionElement";
+ "org.onap.domain.database.A1PMSAutomationCompositionElement";
@BeforeAll
static void init() {
@@ -81,22 +78,22 @@ class AcElementHandlerTest {
var element = commonTestData.getAutomationCompositionElement();
var automationCompositionElementId = element.getId();
- Map<String, ToscaNodeTemplate> nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- automationCompositionElementHandler.automationCompositionElementUpdate(
- commonTestData.getAutomationCompositionId(), element,
- nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT));
+ var nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ automationCompositionElementHandler
+ .automationCompositionElementUpdate(commonTestData.getAutomationCompositionId(), element,
+ nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT).getProperties());
assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
- automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
- AutomationCompositionOrderedState.PASSIVE));
+ automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.PASSIVE));
assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
- automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
- AutomationCompositionOrderedState.UNINITIALISED));
+ automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.UNINITIALISED));
assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
- automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
- AutomationCompositionOrderedState.RUNNING));
+ automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.RUNNING));
when(acA1PmsClient.isPmsHealthy()).thenReturn(Boolean.FALSE);
assertThrows(A1PolicyServiceException.class,
@@ -107,35 +104,30 @@ class AcElementHandlerTest {
@Test
void test_AutomationCompositionElementUpdate() {
- AutomationCompositionElement element = commonTestData.getAutomationCompositionElement();
+ var element = commonTestData.getAutomationCompositionElement();
- Map<String, ToscaNodeTemplate> nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementUpdate(
- commonTestData.getAutomationCompositionId(), element,
- nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT)));
+ var nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ assertDoesNotThrow(() -> automationCompositionElementHandler
+ .automationCompositionElementUpdate(commonTestData.getAutomationCompositionId(), element,
+ nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT).getProperties()));
}
@Test
void test_AutomationCompositionElementUpdateWithUnhealthyA1pms() {
- AutomationCompositionElement element = commonTestData.getAutomationCompositionElement();
+ var element = commonTestData.getAutomationCompositionElement();
when(acA1PmsClient.isPmsHealthy()).thenReturn(Boolean.FALSE);
- Map<String, ToscaNodeTemplate> nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- assertThrows(A1PolicyServiceException.class,
- () -> automationCompositionElementHandler.automationCompositionElementUpdate(
- commonTestData.getAutomationCompositionId(), element,
- nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT)));
+ var nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ assertThrows(A1PolicyServiceException.class, () -> automationCompositionElementHandler
+ .automationCompositionElementUpdate(commonTestData.getAutomationCompositionId(), element,
+ nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT).getProperties()));
}
@Test
void test_AutomationCompositionElementUpdateWithInvalidConfiguration() {
- AutomationCompositionElement element = commonTestData.getAutomationCompositionElement();
-
- Map<String, ToscaNodeTemplate> nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- ToscaNodeTemplate toscaNodeTemplate = nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT);
- toscaNodeTemplate.setProperties(Map.of());
- assertThrows(A1PolicyServiceException.class,
- () -> automationCompositionElementHandler.automationCompositionElementUpdate(
- commonTestData.getAutomationCompositionId(), element, toscaNodeTemplate));
+ var element = commonTestData.getAutomationCompositionElement();
+ assertThrows(A1PolicyServiceException.class, () -> automationCompositionElementHandler
+ .automationCompositionElementUpdate(commonTestData.getAutomationCompositionId(), element,
+ Map.of()));
}
}
diff --git a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonTestData.java b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonTestData.java
index be573cb37..b68faa692 100755
--- a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonTestData.java
@@ -31,6 +31,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
public class CommonTestData {
private static final String TEST_KEY_NAME = "org.onap.domain.database.A1PMSAutomationCompositionElement";
+ private static final List<UUID> AC_ID_LIST = List.of(UUID.randomUUID(), UUID.randomUUID());
/**
* Get a automationComposition Element.
@@ -38,7 +39,7 @@ public class CommonTestData {
* @return automationCompositionElement object
*/
public AutomationCompositionElement getAutomationCompositionElement() {
- AutomationCompositionElement element = new AutomationCompositionElement();
+ var element = new AutomationCompositionElement();
element.setId(UUID.randomUUID());
element.setDefinition(new ToscaConceptIdentifier(TEST_KEY_NAME, "1.0.1"));
element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
@@ -48,30 +49,41 @@ public class CommonTestData {
/**
* Get automation composition id.
*
+ * @param instanceNo Identifier instance no
* @return ToscaConceptIdentifier automationCompositionId
*/
- public ToscaConceptIdentifier getAutomationCompositionId() {
+ public ToscaConceptIdentifier getA1PolicyServiceId(int instanceNo) {
+ return new ToscaConceptIdentifier("A1PMSInstance" + instanceNo, "1.0.0");
+ }
+
+ /**
+ * Get automation composition id.
+ *
+ * @return UUID automationCompositionId
+ */
+ public UUID getAutomationCompositionId() {
return getAutomationCompositionId(0);
}
/**
* Get automation composition id.
+ *
* @param instanceNo Identifier instance no
- * @return ToscaConceptIdentifier automationCompositionId
+ * @return UUID automationCompositionId
*/
- public ToscaConceptIdentifier getAutomationCompositionId(int instanceNo) {
- return new ToscaConceptIdentifier("A1PMSInstance" + instanceNo, "1.0.0");
+ public UUID getAutomationCompositionId(int instanceNo) {
+ return AC_ID_LIST.get(instanceNo);
}
-
/**
* Get valid policy entities.
+ *
* @return List of policy entities
*/
public List<A1PolicyServiceEntity> getValidPolicyEntities() {
- A1PolicyServiceEntity a1PolicyServiceEntity1 = new A1PolicyServiceEntity(getAutomationCompositionId(0),
+ var a1PolicyServiceEntity1 = new A1PolicyServiceEntity(getA1PolicyServiceId(0),
"testService1", "http://localhost", 0);
- A1PolicyServiceEntity a1PolicyServiceEntity2 = new A1PolicyServiceEntity(getAutomationCompositionId(1),
+ var a1PolicyServiceEntity2 = new A1PolicyServiceEntity(getA1PolicyServiceId(1),
"testService2", "http://127.0.0.1", 0);
return List.of(a1PolicyServiceEntity1, a1PolicyServiceEntity2);
}
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
index 6b723750a..42b26c6a4 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
@@ -23,17 +23,13 @@ package org.onap.policy.clamp.acm.participant.http.main.handler;
import java.io.Closeable;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
-import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
import java.util.stream.Collectors;
-import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.ValidationException;
import lombok.Setter;
@@ -51,7 +47,6 @@ import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
@@ -83,7 +78,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
* @throws PfModelException in case of a model exception
*/
@Override
- public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ public void automationCompositionElementStateChange(UUID automationCompositionId,
UUID automationCompositionElementId, AutomationCompositionState currentState,
AutomationCompositionOrderedState newState) {
switch (newState) {
@@ -111,19 +106,20 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
/**
* Callback method to handle an update on a automation composition element.
*
+ * @param automationCompositionId the automationComposition Id
* @param element the information on the automation composition element
- * @param nodeTemplate toscaNodeTemplate
+ * @param properties properties Map
*/
@Override
- public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
- AutomationCompositionElement element, ToscaNodeTemplate nodeTemplate) {
+ public void automationCompositionElementUpdate(UUID automationCompositionId,
+ AutomationCompositionElement element, Map<String, Object> properties) {
try {
- var configRequest = CODER.convert(nodeTemplate.getProperties(), ConfigRequest.class);
- Set<ConstraintViolation<ConfigRequest>> violations =
+ var configRequest = CODER.convert(properties, ConfigRequest.class);
+ var violations =
Validation.buildDefaultValidatorFactory().getValidator().validate(configRequest);
if (violations.isEmpty()) {
invokeHttpClient(configRequest);
- List<Pair<Integer, String>> failedResponseStatus = restResponseMap.values().stream()
+ var failedResponseStatus = restResponseMap.values().stream()
.filter(response -> !HttpStatus.valueOf(response.getKey())
.is2xxSuccessful()).collect(Collectors.toList());
if (failedResponseStatus.isEmpty()) {
@@ -149,7 +145,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
*/
public void invokeHttpClient(ConfigRequest configRequest) throws ExecutionException, InterruptedException {
// Invoke runnable thread to execute https requests of all config entities
- Future<Map> result = executor.submit(new AcHttpClient(configRequest, restResponseMap), restResponseMap);
+ var result = executor.submit(new AcHttpClient(configRequest, restResponseMap), restResponseMap);
if (!result.get().isEmpty()) {
LOGGER.debug("Http Request Completed: {}", result.isDone());
}
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java
index 04cb34269..8e77b2acc 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java
@@ -25,7 +25,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import java.io.IOException;
-import java.util.Map;
+import java.util.HashMap;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -38,10 +38,8 @@ import org.onap.policy.clamp.acm.participant.http.main.models.ConfigRequest;
import org.onap.policy.clamp.acm.participant.http.utils.CommonTestData;
import org.onap.policy.clamp.acm.participant.http.utils.ToscaUtils;
import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -96,12 +94,13 @@ class AcElementHandlerTest {
@Test
void test_AutomationCompositionElementUpdate() throws Exception {
doNothing().when(automationCompositionElementHandler).invokeHttpClient(any());
- AutomationCompositionElement element = commonTestData.getAutomationCompositionElement();
+ var element = commonTestData.getAutomationCompositionElement();
- Map<String, ToscaNodeTemplate> nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ var nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ var map = new HashMap<>(nodeTemplatesMap.get(HTTP_AUTOMATION_COMPOSITION_ELEMENT).getProperties());
+ map.putAll(element.getProperties());
assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementUpdate(
- commonTestData.getAutomationCompositionId(), element,
- nodeTemplatesMap.get(HTTP_AUTOMATION_COMPOSITION_ELEMENT)));
+ commonTestData.getAutomationCompositionId(), element, map));
}
}
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java
index 010d29a66..48b7bdcd7 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,6 +34,7 @@ public class CommonTestData {
private static final String TEST_KEY_NAME =
"org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement";
+ public static final UUID AC_ID = UUID.randomUUID();
/**
* Get a automationComposition Element.
@@ -119,10 +120,10 @@ public class CommonTestData {
/**
* Get automation composition id.
*
- * @return ToscaConceptIdentifier automationCompositionId
+ * @return UUID automationCompositionId
*/
- public ToscaConceptIdentifier getAutomationCompositionId() {
- return new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
+ public UUID getAutomationCompositionId() {
+ return AC_ID;
}
/**
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java
index ba49ff1f9..c64bc4906 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java
@@ -29,7 +29,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
@@ -47,8 +46,6 @@ import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -92,12 +89,12 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
* @param newState the state to which the automation composition element is changing to
*/
@Override
- public synchronized void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ public synchronized void automationCompositionElementStateChange(UUID automationCompositionId,
UUID automationCompositionElementId, AutomationCompositionState currentState,
AutomationCompositionOrderedState newState) {
switch (newState) {
case UNINITIALISED:
- ChartInfo chart = chartMap.get(automationCompositionElementId);
+ var chart = chartMap.get(automationCompositionElementId);
if (chart != null) {
LOGGER.info("Helm deployment to be deleted {} ", chart.getReleaseName());
try {
@@ -131,15 +128,16 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
/**
* Callback method to handle an update on a automation composition element.
*
+ * @param automationCompositionId the automationComposition Id
* @param element the information on the automation composition element
- * @param nodeTemplate toscaNodeTemplate
+ * @param properties properties Map
* @throws PfModelException in case of an exception
*/
@Override
- public synchronized void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
- AutomationCompositionElement element, ToscaNodeTemplate nodeTemplate) throws PfModelException {
+ public synchronized void automationCompositionElementUpdate(UUID automationCompositionId,
+ AutomationCompositionElement element, Map<String, Object> properties) throws PfModelException {
@SuppressWarnings("unchecked")
- Map<String, Object> chartData = (Map<String, Object>) nodeTemplate.getProperties().get("chart");
+ var chartData = (Map<String, Object>) properties.get("chart");
LOGGER.info("Installation request received for the Helm Chart {} ", chartData);
try {
@@ -147,8 +145,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
if (chartService.installChart(chartInfo)) {
chartMap.put(element.getId(), chartInfo);
- var config = CODER.convert(nodeTemplate.getProperties(),
- ThreadConfig.class);
+ var config = CODER.convert(properties, ThreadConfig.class);
checkPodStatus(automationCompositionId, element.getId(), chartInfo,
config.uninitializedToPassiveTimeout, config.podStatusCheckInterval);
}
@@ -163,10 +160,10 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
*
* @param chart ChartInfo
*/
- public void checkPodStatus(ToscaConceptIdentifier automationCompositionId, UUID elementId,
+ public void checkPodStatus(UUID automationCompositionId, UUID elementId,
ChartInfo chart, int timeout, int podStatusCheckInterval) throws ExecutionException, InterruptedException {
// Invoke runnable thread to check pod status
- Future<String> result = executor.submit(new PodStatusValidator(chart, timeout,
+ var result = executor.submit(new PodStatusValidator(chart, timeout,
podStatusCheckInterval), "Done");
if (!result.get().isEmpty()) {
LOGGER.info("Pod Status Validator Completed: {}", result.isDone());
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java
index fbd18ef67..f1357e435 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java
@@ -32,7 +32,6 @@ import static org.mockito.Mockito.doThrow;
import java.io.File;
import java.io.IOException;
import java.util.List;
-import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
@@ -59,7 +58,6 @@ import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -100,8 +98,8 @@ class AutomationCompositionElementHandlerTest {
@Test
void test_AutomationCompositionElementStateChange() throws ServiceException {
- UUID automationCompositionElementId1 = UUID.randomUUID();
- UUID automationCompositionElementId2 = UUID.randomUUID();
+ var automationCompositionElementId1 = UUID.randomUUID();
+ var automationCompositionElementId2 = UUID.randomUUID();
automationCompositionElementHandler.getChartMap().put(automationCompositionElementId1, charts.get(0));
automationCompositionElementHandler.getChartMap().put(automationCompositionElementId2, charts.get(1));
@@ -133,27 +131,27 @@ class AutomationCompositionElementHandlerTest {
ExecutionException, InterruptedException {
doReturn(true).when(chartService).installChart(any());
doNothing().when(automationCompositionElementHandler).checkPodStatus(any(), any(), any(), anyInt(), anyInt());
- UUID elementId1 = UUID.randomUUID();
- AutomationCompositionElement element = new AutomationCompositionElement();
+ var elementId1 = UUID.randomUUID();
+ var element = new AutomationCompositionElement();
element.setId(elementId1);
element.setDefinition(new ToscaConceptIdentifier(KEY_NAME, "1.0.1"));
element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
- Map<String, ToscaNodeTemplate> nodeTemplatesMap =
+ var nodeTemplatesMap =
toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
automationCompositionElementHandler.automationCompositionElementUpdate(
commonTestData.getAutomationCompositionId(), element,
- nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT));
+ nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT).getProperties());
assertThat(automationCompositionElementHandler.getChartMap()).hasSize(1).containsKey(elementId1);
doThrow(new ServiceException("Error installing the chart")).when(chartService).installChart(Mockito.any());
- UUID elementId2 = UUID.randomUUID();
+ var elementId2 = UUID.randomUUID();
element.setId(elementId2);
automationCompositionElementHandler.automationCompositionElementUpdate(
commonTestData.getAutomationCompositionId(), element,
- nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT));
+ nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT).getProperties());
assertThat(automationCompositionElementHandler.getChartMap().containsKey(elementId2)).isFalse();
}
@@ -164,8 +162,8 @@ class AutomationCompositionElementHandlerTest {
doReturn("Done").when(result).get();
doReturn(true).when(result).isDone();
var chartInfo = charts.get(0);
- ToscaConceptIdentifier automationCompositionId = new ToscaConceptIdentifier();
- AutomationCompositionElement element = new AutomationCompositionElement();
+ var automationCompositionId = UUID.randomUUID();
+ var element = new AutomationCompositionElement();
assertDoesNotThrow(
() -> automationCompositionElementHandler.checkPodStatus(automationCompositionId,
element.getId(), chartInfo, 1, 1));
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
index 7ffd68812..97d2fbbd2 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
@@ -24,6 +24,7 @@ package org.onap.policy.clamp.acm.participant.kubernetes.parameters;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import java.util.UUID;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
@@ -37,7 +38,7 @@ public class CommonTestData {
public static final long TIME_INTERVAL = 2000;
public static final List<TopicParameters> TOPIC_PARAMS = List.of(getTopicParams());
public static final Coder CODER = new StandardCoder();
-
+ private static final UUID AC_ID = UUID.randomUUID();
/**
* Get ParticipantK8sParameters.
@@ -152,9 +153,9 @@ public class CommonTestData {
/**
* Get automation composition id.
- * @return ToscaConceptIdentifier automationCompositionId
+ * @return UUID automationCompositionId
*/
- public ToscaConceptIdentifier getAutomationCompositionId() {
- return new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
+ public UUID getAutomationCompositionId() {
+ return AC_ID;
}
}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
index bdf4f8fcf..ca27c8214 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
@@ -24,7 +24,6 @@ package org.onap.policy.clamp.acm.participant.policy.main.handler;
import java.util.LinkedHashMap;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.UUID;
import lombok.Setter;
import org.apache.http.HttpStatus;
@@ -39,11 +38,7 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMe
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.pdp.concepts.DeploymentSubGroup;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -84,7 +79,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
* @param orderedState the state to which the automation composition element is changing to
*/
@Override
- public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ public void automationCompositionElementStateChange(UUID automationCompositionId,
UUID automationCompositionElementId,
AutomationCompositionState currentState,
AutomationCompositionOrderedState orderedState) {
@@ -120,26 +115,26 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
}
}
- private void deletePolicyData(ToscaConceptIdentifier automationCompositionId,
+ private void deletePolicyData(UUID automationCompositionId,
UUID automationCompositionElementId, AutomationCompositionOrderedState newState) {
// Delete all policies of this automationComposition from policy framework
- for (Entry<String, String> policy : policyMap.entrySet()) {
+ for (var policy : policyMap.entrySet()) {
apiHttpClient.deletePolicy(policy.getKey(), policy.getValue());
}
policyMap.clear();
// Delete all policy types of this automation composition from policy framework
- for (Entry<String, String> policyType : policyTypeMap.entrySet()) {
+ for (var policyType : policyTypeMap.entrySet()) {
apiHttpClient.deletePolicyType(policyType.getKey(), policyType.getValue());
}
policyTypeMap.clear();
}
- private void deployPolicies(ToscaConceptIdentifier automationCompositionId, UUID automationCompositionElementId,
+ private void deployPolicies(UUID automationCompositionId, UUID automationCompositionElementId,
AutomationCompositionOrderedState newState) {
var deployFailure = false;
// Deploy all policies of this automationComposition from Policy Framework
if (!policyMap.entrySet().isEmpty()) {
- for (Entry<String, String> policy : policyMap.entrySet()) {
+ for (var policy : policyMap.entrySet()) {
var deployPolicyResp = papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(),
DeploymentSubGroup.Action.POST).getStatus();
if (deployPolicyResp != HttpStatus.SC_ACCEPTED) {
@@ -161,7 +156,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
private void undeployPolicies(UUID automationCompositionElementId) {
// Undeploy all policies of this automation composition from Policy Framework
if (!policyMap.entrySet().isEmpty()) {
- for (Entry<String, String> policy : policyMap.entrySet()) {
+ for (var policy : policyMap.entrySet()) {
papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(),
DeploymentSubGroup.Action.DELETE);
}
@@ -174,22 +169,21 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
/**
* Callback method to handle an update on automation composition element.
*
+ * @param automationCompositionId the automationComposition Id
* @param element the information on the automation composition element
- * @param acElementDefinition toscaNodeTemplate
+ * @param properties properties Map
* @throws PfModelException in case of an exception
*/
@Override
- public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
- AutomationCompositionElement element,
- ToscaNodeTemplate acElementDefinition)
- throws PfModelException {
+ public void automationCompositionElementUpdate(UUID automationCompositionId,
+ AutomationCompositionElement element, Map<String, Object> properties) throws PfModelException {
var createPolicyTypeResp = HttpStatus.SC_OK;
var createPolicyResp = HttpStatus.SC_OK;
- ToscaServiceTemplate automationCompositionDefinition = element.getToscaServiceTemplateFragment();
+ var automationCompositionDefinition = element.getToscaServiceTemplateFragment();
if (automationCompositionDefinition.getToscaTopologyTemplate() != null) {
if (automationCompositionDefinition.getPolicyTypes() != null) {
- for (ToscaPolicyType policyType : automationCompositionDefinition.getPolicyTypes().values()) {
+ for (var policyType : automationCompositionDefinition.getPolicyTypes().values()) {
policyTypeMap.put(policyType.getName(), policyType.getVersion());
}
LOGGER.info("Found Policy Types in automation composition definition: {} , Creating Policy Types",
@@ -197,8 +191,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
createPolicyTypeResp = apiHttpClient.createPolicyType(automationCompositionDefinition).getStatus();
}
if (automationCompositionDefinition.getToscaTopologyTemplate().getPolicies() != null) {
- for (Map<String, ToscaPolicy> gotPolicyMap : automationCompositionDefinition.getToscaTopologyTemplate()
- .getPolicies()) {
+ for (var gotPolicyMap : automationCompositionDefinition.getToscaTopologyTemplate().getPolicies()) {
for (ToscaPolicy policy : gotPolicyMap.values()) {
policyMap.put(policy.getName(), policy.getVersion());
}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java
index 34162a29b..0836dbb3c 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java
@@ -39,45 +39,34 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedSta
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
-
class AutomationCompositionElementHandlerTest {
private static final String ID_NAME = "org.onap.PM_CDS_Blueprint";
private static final String ID_VERSION = "1.0.1";
private static final UUID automationCompositionElementId = UUID.randomUUID();
- private static final ToscaConceptIdentifier automationCompositionId =
- new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
+ public static final UUID AC_ID = UUID.randomUUID();
+ private static final ToscaConceptIdentifier PARTICIPANT_ID = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
private PolicyApiHttpClient api = Mockito.mock(PolicyApiHttpClient.class);
- private PolicyPapHttpClient pap = Mockito.mock(PolicyPapHttpClient.class);
+ private PolicyPapHttpClient pap = Mockito.mock(PolicyPapHttpClient.class);
@Test
void testHandlerDoesNotThrowExceptions() {
- AutomationCompositionElementHandler handler = getTestingHandler();
-
- assertDoesNotThrow(() -> handler
- .automationCompositionElementStateChange(automationCompositionId,
- automationCompositionElementId,
- AutomationCompositionState.UNINITIALISED,
- AutomationCompositionOrderedState.PASSIVE));
-
- assertDoesNotThrow(() -> handler
- .automationCompositionElementStateChange(automationCompositionId,
- automationCompositionElementId,
- AutomationCompositionState.RUNNING,
- AutomationCompositionOrderedState.UNINITIALISED));
-
- assertDoesNotThrow(() -> handler
- .automationCompositionElementStateChange(automationCompositionId,
- automationCompositionElementId,
- AutomationCompositionState.PASSIVE,
- AutomationCompositionOrderedState.RUNNING));
+ var handler = getTestingHandler();
+
+ assertDoesNotThrow(() -> handler.automationCompositionElementStateChange(AC_ID, automationCompositionElementId,
+ AutomationCompositionState.UNINITIALISED, AutomationCompositionOrderedState.PASSIVE));
+
+ assertDoesNotThrow(() -> handler.automationCompositionElementStateChange(AC_ID, automationCompositionElementId,
+ AutomationCompositionState.RUNNING, AutomationCompositionOrderedState.UNINITIALISED));
+
+ assertDoesNotThrow(() -> handler.automationCompositionElementStateChange(AC_ID, automationCompositionElementId,
+ AutomationCompositionState.PASSIVE, AutomationCompositionOrderedState.RUNNING));
}
private AutomationCompositionElementHandler getTestingHandler() {
@@ -91,11 +80,11 @@ class AutomationCompositionElementHandlerTest {
private AutomationCompositionElement getTestingAcElement() {
var element = new AutomationCompositionElement();
- element.setDefinition(automationCompositionId);
+ element.setDefinition(PARTICIPANT_ID);
element.setDescription("Description");
element.setId(automationCompositionElementId);
element.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
- element.setParticipantId(automationCompositionId);
+ element.setParticipantId(PARTICIPANT_ID);
element.setState(AutomationCompositionState.UNINITIALISED);
var template = new ToscaServiceTemplate();
template.setToscaTopologyTemplate(new ToscaTopologyTemplate());
@@ -112,28 +101,20 @@ class AutomationCompositionElementHandlerTest {
doReturn(Response.ok().build()).when(api).createPolicy(any());
doReturn(Response.accepted().build()).when(pap).handlePolicyDeployOrUndeploy(any(), any(), any());
- AutomationCompositionElementHandler handler = getTestingHandler();
+ var handler = getTestingHandler();
var element = getTestingAcElement();
- var acElementDefinition = Mockito.mock(ToscaNodeTemplate.class);
-
- assertDoesNotThrow(() -> handler
- .automationCompositionElementUpdate(automationCompositionId, element, acElementDefinition));
- assertDoesNotThrow(() -> handler
- .automationCompositionElementStateChange(automationCompositionId,
- automationCompositionElementId,
- AutomationCompositionState.PASSIVE,
- AutomationCompositionOrderedState.UNINITIALISED));
+ assertDoesNotThrow(() -> handler.automationCompositionElementUpdate(AC_ID, element, Map.of()));
+ assertDoesNotThrow(() -> handler.automationCompositionElementStateChange(AC_ID, automationCompositionElementId,
+ AutomationCompositionState.PASSIVE, AutomationCompositionOrderedState.UNINITIALISED));
- //Mock failure in policy deployment
+ // Mock failure in policy deployment
doReturn(Response.serverError().build()).when(pap).handlePolicyDeployOrUndeploy(any(), any(), any());
- assertDoesNotThrow(() -> handler
- .automationCompositionElementUpdate(automationCompositionId, element, acElementDefinition));
+ assertDoesNotThrow(() -> handler.automationCompositionElementUpdate(AC_ID, element, Map.of()));
// Mock failure in policy type creation
doReturn(Response.serverError().build()).when(api).createPolicyType(any());
- assertDoesNotThrow(() -> handler
- .automationCompositionElementUpdate(automationCompositionId, element, acElementDefinition));
+ assertDoesNotThrow(() -> handler.automationCompositionElementUpdate(AC_ID, element, Map.of()));
}
}