aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-http
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2022-01-25 19:55:43 +0000
committerliamfallon <liam.fallon@est.tech>2022-02-18 15:54:40 +0000
commit43098043c4ef31d9d5dead66568d7d9482a6b165 (patch)
tree6f6ea4812ff93d65e7c64e12a3ec6ab4462a64e2 /participant/participant-impl/participant-impl-http
parentf401b5099bcb64f3e21de608d0207dd69d8043cd (diff)
Rename TOSCA Control Loop to ACM
This commit renames the TOSCA Control Loop functionality in CLAMP to Automation Composition Management. This review is a direct renaming review and, as everything is renamed together it is large. Issue-ID: POLICY-3939 Change-Id: I28f0a6dd889bf3570a4c1365ae9e71fc58db6d6c Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-http')
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/Application.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/Application.java)12
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/ParticipantConfig.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/config/ParticipantConfig.java)18
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/SecurityConfig.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/config/SecurityConfig.java)2
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/exception/HttpWebClientException.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/exception/HttpWebClientException.java)2
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java)84
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigRequest.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/ConfigRequest.java)2
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigurationEntity.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/ConfigurationEntity.java)2
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/RestParams.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/RestParams.java)2
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/webclient/AcHttpClient.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/webclient/ClHttpClient.java)14
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/parameters/ParticipantHttpParameters.java (renamed from participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/parameters/ParticipantHttpParameters.java)7
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml10
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java106
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/rest/ActuatorControllerTest.java (renamed from participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/rest/ActuatorControllerTest.java)4
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonActuatorController.java (renamed from participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/CommonActuatorController.java)4
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java (renamed from participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/CommonTestData.java)87
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/ToscaUtils.java (renamed from participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/ToscaUtils.java)12
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/webclient/AcHttpClientTest.java (renamed from participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/webclient/ClHttpClientTest.java)16
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java108
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/resources/HttpParticipantConfig.yaml48
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/resources/application_test.properties22
20 files changed, 275 insertions, 287 deletions
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/Application.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/Application.java
index 4f8096502..2f26a8659 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/Application.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/Application.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http;
+package org.onap.policy.clamp.acm.participant.http;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -29,10 +29,14 @@ import org.springframework.context.annotation.ComponentScan;
* Starter.
*
*/
+// @formatter:off
@SpringBootApplication
-@ComponentScan({"org.onap.policy.clamp.controlloop.participant.http",
- "org.onap.policy.clamp.controlloop.participant.intermediary"})
-@ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.participant.http.parameters")
+@ComponentScan({
+ "org.onap.policy.clamp.acm.participant.http",
+ "org.onap.policy.clamp.acm.participant.intermediary"
+})
+@ConfigurationPropertiesScan("org.onap.policy.clamp.acm.participant.http.parameters")
+//@formatter:on
public class Application {
/**
* Main class.
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/config/ParticipantConfig.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/ParticipantConfig.java
index ce013a765..e2b5d1718 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/config/ParticipantConfig.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/ParticipantConfig.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.config;
+package org.onap.policy.clamp.acm.participant.http.config;
-import org.onap.policy.clamp.controlloop.participant.http.main.handler.ControlLoopElementHandler;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.http.main.handler.AutomationCompositionElementHandler;
+import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@@ -29,15 +29,15 @@ import org.springframework.context.annotation.Configuration;
public class ParticipantConfig {
/**
- * Register ControlLoopElementListener.
+ * Register AutomationCompositionElementListener.
*
* @param intermediaryApi the ParticipantIntermediaryApi
- * @param clElementHandler the ControlLoop Element Handler
+ * @param acElementHandler the AutomationComposition Element Handler
*/
@Autowired
- public void registerControlLoopElementListener(ParticipantIntermediaryApi intermediaryApi,
- ControlLoopElementHandler clElementHandler) {
- intermediaryApi.registerControlLoopElementListener(clElementHandler);
- clElementHandler.setIntermediaryApi(intermediaryApi);
+ public void registerAutomationCompositionElementListener(ParticipantIntermediaryApi intermediaryApi,
+ AutomationCompositionElementHandler acElementHandler) {
+ intermediaryApi.registerAutomationCompositionElementListener(acElementHandler);
+ acElementHandler.setIntermediaryApi(intermediaryApi);
}
}
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/config/SecurityConfig.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/SecurityConfig.java
index 499bbe153..25a945e7e 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/config/SecurityConfig.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/config/SecurityConfig.java
@@ -16,7 +16,7 @@
* ========================LICENSE_END===================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.config;
+package org.onap.policy.clamp.acm.participant.http.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/exception/HttpWebClientException.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/exception/HttpWebClientException.java
index 6b27700c4..8978e88ec 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/exception/HttpWebClientException.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/exception/HttpWebClientException.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.main.exception;
+package org.onap.policy.clamp.acm.participant.http.main.exception;
import org.springframework.web.reactive.function.client.WebClientResponseException;
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
index 69d8c750a..89c98400e 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.main.handler;
+package org.onap.policy.clamp.acm.participant.http.main.handler;
import java.io.Closeable;
import java.io.IOException;
@@ -38,14 +38,14 @@ import javax.validation.Validation;
import javax.validation.ValidationException;
import lombok.Setter;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigRequest;
-import org.onap.policy.clamp.controlloop.participant.http.main.webclient.ClHttpClient;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigRequest;
+import org.onap.policy.clamp.acm.participant.http.main.webclient.AcHttpClient;
+import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
+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.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -58,59 +58,60 @@ import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
/**
- * This class handles implementation of controlLoopElement updates.
+ * This class handles implementation of automationCompositionElement updates.
*/
@Component
-public class ControlLoopElementHandler implements ControlLoopElementListener, Closeable {
+public class AutomationCompositionElementHandler implements AutomationCompositionElementListener, Closeable {
private static final Coder CODER = new StandardCoder();
private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
+ private final ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
- private Map<ToscaConceptIdentifier, Pair<Integer, String>> restResponseMap = new ConcurrentHashMap<>();
+ private final Map<ToscaConceptIdentifier, Pair<Integer, String>> restResponseMap = new ConcurrentHashMap<>();
@Setter
private ParticipantIntermediaryApi intermediaryApi;
/**
- * Handle controlLoopElement statistics.
+ * Handle automationCompositionElement statistics.
*
- * @param controlLoopElementId controlloop element id
+ * @param automationCompositionElementId automation composition element id
*/
@Override
- public void handleStatistics(UUID controlLoopElementId) throws PfModelException {
+ public void handleStatistics(UUID automationCompositionElementId) {
// Implementation not needed for http participant
}
/**
- * Handle a control loop element state change.
+ * Handle a automation composition element state change.
*
- * @param controlLoopElementId the ID of the control loop element
- * @param currentState the current state of the control loop element
- * @param newState the state to which the control loop element is changing to
+ * @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 controlLoopElementStateChange(ToscaConceptIdentifier controlLoopId, UUID controlLoopElementId,
- ControlLoopState currentState, ControlLoopOrderedState newState) throws PfModelException {
+ public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ UUID automationCompositionElementId, AutomationCompositionState currentState,
+ AutomationCompositionOrderedState newState) {
switch (newState) {
case UNINITIALISED:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.UNINITIALISED,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.UNINITIALISED,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
break;
case PASSIVE:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.PASSIVE,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
break;
case RUNNING:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.RUNNING,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
+ automationCompositionElementId, newState, AutomationCompositionState.RUNNING,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
break;
default:
LOGGER.warn("Cannot transition from state {} to state {}", currentState, newState);
@@ -119,27 +120,27 @@ public class ControlLoopElementHandler implements ControlLoopElementListener, Cl
}
/**
- * Callback method to handle an update on a control loop element.
+ * Callback method to handle an update on a automation composition element.
*
- * @param element the information on the control loop element
+ * @param element the information on the automation composition element
* @param nodeTemplate toscaNodeTemplate
*/
@Override
- public void controlLoopElementUpdate(ToscaConceptIdentifier controlLoopId, ControlLoopElement element,
- ToscaNodeTemplate nodeTemplate) {
+ public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
+ AutomationCompositionElement element, ToscaNodeTemplate nodeTemplate) {
try {
var configRequest = CODER.convert(nodeTemplate.getProperties(), ConfigRequest.class);
- Set<ConstraintViolation<ConfigRequest>> violations = Validation.buildDefaultValidatorFactory()
- .getValidator().validate(configRequest);
+ Set<ConstraintViolation<ConfigRequest>> violations =
+ Validation.buildDefaultValidatorFactory().getValidator().validate(configRequest);
if (violations.isEmpty()) {
invokeHttpClient(configRequest);
List<Pair<Integer, String>> failedResponseStatus = restResponseMap.values().stream()
.filter(response -> !HttpStatus.valueOf(response.getKey())
.is2xxSuccessful()).collect(Collectors.toList());
if (failedResponseStatus.isEmpty()) {
- intermediaryApi.updateControlLoopElementState(controlLoopId, element.getId(),
- ControlLoopOrderedState.PASSIVE, ControlLoopState.PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
+ AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.PASSIVE,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
} else {
LOGGER.error("Error on Invoking the http request: {}", failedResponseStatus);
}
@@ -154,11 +155,12 @@ public class ControlLoopElementHandler implements ControlLoopElementListener, Cl
/**
* Invoke a runnable thread to execute http requests.
+ *
* @param configRequest ConfigRequest
*/
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 ClHttpClient(configRequest, restResponseMap), restResponseMap);
+ Future<Map> 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/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/ConfigRequest.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigRequest.java
index 87cab88a7..c630b3c7c 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/ConfigRequest.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigRequest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.main.models;
+package org.onap.policy.clamp.acm.participant.http.main.models;
import java.util.List;
import java.util.Map;
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/ConfigurationEntity.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigurationEntity.java
index 8703a9d21..6ac2edb56 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/ConfigurationEntity.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/ConfigurationEntity.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.main.models;
+package org.onap.policy.clamp.acm.participant.http.main.models;
import java.util.List;
import javax.validation.Valid;
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/RestParams.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/RestParams.java
index fc4e02897..717131f5a 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/models/RestParams.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/models/RestParams.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.main.models;
+package org.onap.policy.clamp.acm.participant.http.main.models;
import java.util.Map;
import javax.validation.constraints.Max;
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/webclient/ClHttpClient.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/webclient/AcHttpClient.java
index 0e0ea557e..563daecd9 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/webclient/ClHttpClient.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/webclient/AcHttpClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.main.webclient;
+package org.onap.policy.clamp.acm.participant.http.main.webclient;
import java.lang.invoke.MethodHandles;
import java.time.Duration;
@@ -26,10 +26,10 @@ import java.util.Map;
import java.util.Objects;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.clamp.controlloop.participant.http.main.exception.HttpWebClientException;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigRequest;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigurationEntity;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.RestParams;
+import org.onap.policy.clamp.acm.participant.http.main.exception.HttpWebClientException;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigRequest;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigurationEntity;
+import org.onap.policy.clamp.acm.participant.http.main.models.RestParams;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,7 +40,7 @@ import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.util.UriComponentsBuilder;
import reactor.core.publisher.Mono;
-public class ClHttpClient implements Runnable {
+public class AcHttpClient implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -51,7 +51,7 @@ public class ClHttpClient implements Runnable {
/**
* Constructor.
*/
- public ClHttpClient(ConfigRequest configRequest, Map<ToscaConceptIdentifier, Pair<Integer, String>> responseMap) {
+ public AcHttpClient(ConfigRequest configRequest, Map<ToscaConceptIdentifier, Pair<Integer, String>> responseMap) {
this.configRequest = configRequest;
this.responseMap = responseMap;
}
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/parameters/ParticipantHttpParameters.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/parameters/ParticipantHttpParameters.java
index 62bbd7593..c0f3c6a7a 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/parameters/ParticipantHttpParameters.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/parameters/ParticipantHttpParameters.java
@@ -19,14 +19,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.parameters;
+package org.onap.policy.clamp.acm.participant.http.parameters;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
@@ -43,5 +43,4 @@ public class ParticipantHttpParameters implements ParticipantParameters {
@NotNull
@Valid
private ParticipantIntermediaryParameters intermediaryParameters;
-
}
diff --git a/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml
index df0ad7df3..8a3d0fbf2 100644
--- a/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml
@@ -13,17 +13,17 @@ participant:
name: HttpParticipant0
version: 1.0.0
participantType:
- name: org.onap.k8s.controlloop.HttpControlLoopParticipant
+ name: org.onap.policy.clamp.acm.HttpParticipant
version: 2.3.4
- clampControlLoopTopics:
+ clampAutomationCompositionTopics:
topicSources:
- - topic: POLICY-CLRUNTIME-PARTICIPANT
+ - topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
fetchTimeout: 15000
topicSinks:
- - topic: POLICY-CLRUNTIME-PARTICIPANT
+ - topic: POLICY-ACRUNTIME-PARTICIPANT
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
@@ -35,4 +35,4 @@ management:
server:
port: 8084
servlet:
- context-path: /onap/httpparticipant
+ context-path: /onap/policy/clamp/acm/httpparticipant
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
new file mode 100644
index 000000000..fbb689448
--- /dev/null
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java
@@ -0,0 +1,106 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 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.http.handler;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doNothing;
+
+import java.io.IOException;
+import java.util.Map;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.onap.policy.clamp.acm.participant.http.main.handler.AutomationCompositionElementHandler;
+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.common.utils.coder.CoderException;
+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;
+
+@ExtendWith(SpringExtension.class)
+class AcElementHandlerTest {
+
+ @InjectMocks
+ @Spy
+ private AutomationCompositionElementHandler automationCompositionElementHandler =
+ new AutomationCompositionElementHandler();
+
+ @Mock
+ private ParticipantIntermediaryApi participantIntermediaryApi;
+
+ private CommonTestData commonTestData = new CommonTestData();
+
+ private static ToscaServiceTemplate serviceTemplate;
+ private static final String HTTP_AUTOMATION_COMPOSITION_ELEMENT =
+ "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement";
+
+ @BeforeAll
+ static void init() throws CoderException {
+ serviceTemplate = ToscaUtils.readAutomationCompositionFromTosca();
+ }
+
+ @Test
+ void test_automationCompositionElementeStateChange() throws IOException {
+ var automationCompositionId = commonTestData.getAutomationCompositionId();
+ var element = commonTestData.getAutomationCompositionElement();
+ var automationCompositionElementId = element.getId();
+
+ var config = Mockito.mock(ConfigRequest.class);
+ assertDoesNotThrow(() -> automationCompositionElementHandler.invokeHttpClient(config));
+
+ assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
+ automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.PASSIVE));
+
+ assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
+ automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.UNINITIALISED));
+
+ assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
+ automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.RUNNING));
+
+ automationCompositionElementHandler.close();
+ }
+
+ @Test
+ void test_AutomationCompositionElementUpdate() throws Exception {
+ doNothing().when(automationCompositionElementHandler).invokeHttpClient(any());
+ AutomationCompositionElement element = commonTestData.getAutomationCompositionElement();
+
+ Map<String, ToscaNodeTemplate> nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+
+ assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementUpdate(
+ commonTestData.getAutomationCompositionId(), element,
+ nodeTemplatesMap.get(HTTP_AUTOMATION_COMPOSITION_ELEMENT)));
+ }
+}
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/rest/ActuatorControllerTest.java
index 8efff8f6a..f0a465fa2 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/rest/ActuatorControllerTest.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/rest/ActuatorControllerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.rest;
+package org.onap.policy.clamp.acm.participant.http.rest;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -27,7 +27,7 @@ import javax.ws.rs.core.Response;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.policy.clamp.controlloop.participant.http.utils.CommonActuatorController;
+import org.onap.policy.clamp.acm.participant.http.utils.CommonActuatorController;
import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonActuatorController.java
index 5ebce8126..cfe3ec2c3 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/CommonActuatorController.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonActuatorController.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.utils;
+package org.onap.policy.clamp.acm.participant.http.utils;
import static org.junit.Assert.assertEquals;
@@ -40,7 +40,7 @@ import org.onap.policy.common.utils.network.NetworkUtil;
public class CommonActuatorController {
public static final String SELF = NetworkUtil.getHostname();
- public static final String CONTEXT_PATH = "onap/httpparticipant";
+ public static final String CONTEXT_PATH = "onap/policy/clamp/acm/httpparticipant";
public static final String ACTUATOR_ENDPOINT = CONTEXT_PATH + "/actuator/";
private static String httpPrefix;
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/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 1f92a86e0..010d29a66 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/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
@@ -19,36 +19,38 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.utils;
+package org.onap.policy.clamp.acm.participant.http.utils;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigurationEntity;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.RestParams;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigurationEntity;
+import org.onap.policy.clamp.acm.participant.http.main.models.RestParams;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
public class CommonTestData {
- private static final String TEST_KEY_NAME = "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement";
-
+ private static final String TEST_KEY_NAME =
+ "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement";
/**
- * Get a controlLoop Element.
- * @return controlLoopElement object
+ * Get a automationComposition Element.
+ *
+ * @return automationCompositionElement object
*/
- public ControlLoopElement getControlLoopElement() {
- ControlLoopElement element = new ControlLoopElement();
+ public AutomationCompositionElement getAutomationCompositionElement() {
+ AutomationCompositionElement element = new AutomationCompositionElement();
element.setId(UUID.randomUUID());
element.setDefinition(new ToscaConceptIdentifier(TEST_KEY_NAME, "1.0.1"));
- element.setOrderedState(ControlLoopOrderedState.PASSIVE);
+ element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
return element;
}
/**
* Get query params.
+ *
* @return Map of query params
*/
public Map<String, String> getQueryParams() {
@@ -57,6 +59,7 @@ public class CommonTestData {
/**
* Get path params.
+ *
* @return Map of path params
*/
public Map<String, Object> getPathParams() {
@@ -65,88 +68,70 @@ public class CommonTestData {
/**
* Rest params with GET request.
+ *
* @return RestParams obj
*/
public RestParams restParamsWithGet() {
- return new RestParams(
- new ToscaConceptIdentifier("getRequest", "1.0"),
- "GET",
- "get",
- 200,
- null,
- getQueryParams(),
- null
- );
+ return new RestParams(new ToscaConceptIdentifier("getRequest", "1.0"), "GET", "get", 200, null,
+ getQueryParams(), null);
}
/**
* Rest params with POST request.
+ *
* @return RestParams obj
*/
public RestParams restParamsWithPost() {
- return new RestParams(
- new ToscaConceptIdentifier("postRequest", "1.0"),
- "POST",
- "post",
- 200,
- null,
- getQueryParams(),
- "Test body"
- );
+ return new RestParams(new ToscaConceptIdentifier("postRequest", "1.0"), "POST", "post", 200, null,
+ getQueryParams(), "Test body");
}
/**
* Rest params with POST request.
+ *
* @return RestParams obj
*/
public RestParams restParamsWithInvalidPost() {
- return new RestParams(
- new ToscaConceptIdentifier("postRequest", "1.0"),
- "POST",
- "post/{id}/{name}",
- 200,
- getPathParams(),
- getQueryParams(),
- "Test body"
- );
+ return new RestParams(new ToscaConceptIdentifier("postRequest", "1.0"), "POST", "post/{id}/{name}", 200,
+ getPathParams(), getQueryParams(), "Test body");
}
/**
* Get invalid configuration entity.
+ *
* @return ConfigurationEntity obj
*/
public ConfigurationEntity getInvalidConfigurationEntity() {
- return new ConfigurationEntity(
- new ToscaConceptIdentifier("config1", "1.0.1"),
- List.of(restParamsWithGet(), restParamsWithInvalidPost())
- );
+ return new ConfigurationEntity(new ToscaConceptIdentifier("config1", "1.0.1"),
+ List.of(restParamsWithGet(), restParamsWithInvalidPost()));
}
/**
* Get configuration entity.
+ *
* @return ConfigurationEntity obj
*/
public ConfigurationEntity getConfigurationEntity() {
- return new ConfigurationEntity(
- new ToscaConceptIdentifier("config1", "1.0.1"),
- List.of(restParamsWithGet(), restParamsWithPost())
- );
+ return new ConfigurationEntity(new ToscaConceptIdentifier("config1", "1.0.1"),
+ List.of(restParamsWithGet(), restParamsWithPost()));
}
/**
- * Get controlloop id.
- * @return ToscaConceptIdentifier controlLoopId
+ * Get automation composition id.
+ *
+ * @return ToscaConceptIdentifier automationCompositionId
*/
- public ToscaConceptIdentifier getControlLoopId() {
+ public ToscaConceptIdentifier getAutomationCompositionId() {
return new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
}
/**
* Get headers for config request.
+ *
* @return Map of headers
*/
public Map<String, String> getHeaders() {
- return Map.of("Content-Type", "application/json", "Accept", "application/json");
+ return Map.of("Content-Type", "application/json", "Accept", "application/json");
}
}
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/ToscaUtils.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/ToscaUtils.java
index fdba28c0e..9e46212bf 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/utils/ToscaUtils.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/ToscaUtils.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.utils;
+package org.onap.policy.clamp.acm.participant.http.utils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@@ -40,12 +40,12 @@ public final class ToscaUtils {
* Read a service template yaml.
* @return ToscaServiceTemplate
*/
- public static ToscaServiceTemplate readControlLoopFromTosca() {
- return serializeControlLoopYaml(TOSCA_TEMPLATE_YAML);
+ public static ToscaServiceTemplate readAutomationCompositionFromTosca() {
+ return serializeAutomationCompositionYaml(TOSCA_TEMPLATE_YAML);
}
- private static ToscaServiceTemplate serializeControlLoopYaml(String controlLoopFilePath) {
- String controlLoopString = ResourceUtils.getResourceAsString(controlLoopFilePath);
- return yamlTranslator.fromYaml(controlLoopString, ToscaServiceTemplate.class);
+ private static ToscaServiceTemplate serializeAutomationCompositionYaml(String automationCompositionFilePath) {
+ String automationCompositionString = ResourceUtils.getResourceAsString(automationCompositionFilePath);
+ return yamlTranslator.fromYaml(automationCompositionString, ToscaServiceTemplate.class);
}
}
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/webclient/ClHttpClientTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/webclient/AcHttpClientTest.java
index e3ff9dbba..44ef50848 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/webclient/ClHttpClientTest.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/webclient/AcHttpClientTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.http.webclient;
+package org.onap.policy.clamp.acm.participant.http.webclient;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
@@ -38,16 +38,16 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockserver.integration.ClientAndServer;
import org.mockserver.model.Parameter;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigRequest;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigurationEntity;
-import org.onap.policy.clamp.controlloop.participant.http.main.webclient.ClHttpClient;
-import org.onap.policy.clamp.controlloop.participant.http.utils.CommonTestData;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigRequest;
+import org.onap.policy.clamp.acm.participant.http.main.models.ConfigurationEntity;
+import org.onap.policy.clamp.acm.participant.http.main.webclient.AcHttpClient;
+import org.onap.policy.clamp.acm.participant.http.utils.CommonTestData;
import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
-class ClHttpClientTest {
+class AcHttpClientTest {
private static CommonTestData commonTestData;
@@ -99,7 +99,7 @@ class ClHttpClientTest {
ConfigRequest configRequest = new ConfigRequest(testMockUrl + ":" + mockServerPort, headers,
List.of(configurationEntity), 10);
- ClHttpClient client = new ClHttpClient(configRequest, responseMap);
+ AcHttpClient client = new AcHttpClient(configRequest, responseMap);
assertDoesNotThrow(client::run);
assertThat(responseMap).hasSize(2).containsKey(commonTestData
.restParamsWithGet().getRestRequestId());
@@ -118,7 +118,7 @@ class ClHttpClientTest {
ConfigRequest configRequest = new ConfigRequest(testMockUrl + ":" + mockServerPort, headers,
List.of(configurationEntity), 10);
- ClHttpClient client = new ClHttpClient(configRequest, responseMap);
+ AcHttpClient client = new AcHttpClient(configRequest, responseMap);
assertDoesNotThrow(client::run);
assertThat(responseMap).hasSize(2).containsKey(commonTestData
.restParamsWithGet().getRestRequestId());
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java
deleted file mode 100644
index 08f008ef3..000000000
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/controlloop/participant/http/handler/ClElementHandlerTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 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.controlloop.participant.http.handler;
-
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doNothing;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.Spy;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.participant.http.main.handler.ControlLoopElementHandler;
-import org.onap.policy.clamp.controlloop.participant.http.main.models.ConfigRequest;
-import org.onap.policy.clamp.controlloop.participant.http.utils.CommonTestData;
-import org.onap.policy.clamp.controlloop.participant.http.utils.ToscaUtils;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.common.utils.coder.CoderException;
-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;
-
-
-@ExtendWith(SpringExtension.class)
-class ClElementHandlerTest {
-
- @InjectMocks
- @Spy
- private ControlLoopElementHandler controlLoopElementHandler = new ControlLoopElementHandler();
-
- @Mock
- private ParticipantIntermediaryApi participantIntermediaryApi;
-
- private CommonTestData commonTestData = new CommonTestData();
-
- private static ToscaServiceTemplate serviceTemplate;
- private static final String HTTP_CONTROL_LOOP_ELEMENT =
- "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement";
-
- @BeforeAll
- static void init() throws CoderException {
- serviceTemplate = ToscaUtils.readControlLoopFromTosca();
- }
-
- @Test
- void test_controlLoopElementeStateChange() throws IOException {
- var controlLoopId = commonTestData.getControlLoopId();
- var element = commonTestData.getControlLoopElement();
- var controlLoopElementId = element.getId();
-
- var config = Mockito.mock(ConfigRequest.class);
- assertDoesNotThrow(() -> controlLoopElementHandler.invokeHttpClient(config));
-
- assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementStateChange(controlLoopId,
- controlLoopElementId, ControlLoopState.PASSIVE, ControlLoopOrderedState.PASSIVE));
-
- assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementStateChange(controlLoopId,
- controlLoopElementId, ControlLoopState.PASSIVE, ControlLoopOrderedState.UNINITIALISED));
-
- assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementStateChange(controlLoopId,
- controlLoopElementId, ControlLoopState.PASSIVE, ControlLoopOrderedState.RUNNING));
-
- controlLoopElementHandler.close();
- }
-
- @Test
- void test_ControlLoopElementUpdate() throws ExecutionException, InterruptedException {
- doNothing().when(controlLoopElementHandler).invokeHttpClient(any());
- ControlLoopElement element = commonTestData.getControlLoopElement();
-
- Map<String, ToscaNodeTemplate> nodeTemplatesMap =
- serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
-
- assertDoesNotThrow(() -> controlLoopElementHandler
- .controlLoopElementUpdate(commonTestData.getControlLoopId(), element,
- nodeTemplatesMap.get(HTTP_CONTROL_LOOP_ELEMENT)));
- }
-}
diff --git a/participant/participant-impl/participant-impl-http/src/test/resources/HttpParticipantConfig.yaml b/participant/participant-impl/participant-impl-http/src/test/resources/HttpParticipantConfig.yaml
index f221bcbd7..57c6e40d1 100644
--- a/participant/participant-impl/participant-impl-http/src/test/resources/HttpParticipantConfig.yaml
+++ b/participant/participant-impl/participant-impl-http/src/test/resources/HttpParticipantConfig.yaml
@@ -27,7 +27,7 @@ data_types:
type: string
required: true
- org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest:
+ org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest:
version: 1.0.0
derived_from: tosca.datatypes.Root
properties:
@@ -56,7 +56,7 @@ data_types:
constraints:
- in_range: [100, 599]
description: THe expected HTTP status code for the REST request
- org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.ConfigurationEntity:
+ org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity:
version: 1.0.0
derived_from: tosca.datatypes.Root
properties:
@@ -64,24 +64,24 @@ data_types:
type: onap.datatypes.ToscaConceptIdentifier
typeVersion: 1.0.0
required: true
- description: The name and version of a Configuration Entity to be handled by the HTTP Control Loop Element
+ description: The name and version of a Configuration Entity to be handled by the HTTP Automation Composition Element
restSequence:
type: list
entry_schema:
- type: org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.RestRequest
+ type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest
typeVersion: 1.0.0
description: A sequence of REST commands to send to the REST endpoint
node_types:
- org.onap.policy.clamp.controlloop.Participant:
+ org.onap.policy.clamp.acm.Participant:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
provider:
type: string
requred: false
- org.onap.policy.clamp.controlloop.ControlLoopElement:
+ org.onap.policy.clamp.acm.AutomationCompositionElement:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -98,11 +98,11 @@ node_types:
- greater-or-equal: 0
metadata:
common: true
- description: A value indicating the start phase in which this control loop element will be started, the
- first start phase is zero. Control Loop Elements are started in their start_phase order and stopped
- in reverse start phase order. Control Loop Elements with the same start phase are started and
+ description: A value indicating the start phase in which this automation composition element will be started, the
+ first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped
+ in reverse start phase order. Automation Composition Elements with the same start phase are started and
stopped simultaneously
- org.onap.policy.clamp.controlloop.ControlLoop:
+ org.onap.policy.clamp.acm.AutomationComposition:
version: 1.0.1
derived_from: tosca.nodetypes.Root
properties:
@@ -114,9 +114,9 @@ node_types:
required: true
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
- org.onap.policy.clamp.controlloop.HttpControlLoopElement:
+ org.onap.policy.clamp.acm.HttpAutomationCompositionElement:
version: 1.0.1
- derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
baseUrl:
type: string
@@ -132,29 +132,29 @@ node_types:
type: map
required: true
entry_schema:
- type: org.onap.datatypes.policy.clamp.controlloop.httpControlLoopElement.ConfigurationEntity
+ type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity
typeVersion: 1.0.0
- description: The connfiguration entities the Control Loop Element is managing and their associated REST requests
+ description: The connfiguration entities the Automation Composition Element is managing and their associated REST requests
topology_template:
node_templates:
- org.onap.k8s.controlloop.HttpControlLoopParticipant:
+ org.onap.k8s.acm.HttpAutomationCompositionParticipant:
version: 2.3.4
- type: org.onap.policy.clamp.controlloop.Participant
+ type: org.onap.policy.clamp.acm.Participant
type_version: 1.0.1
description: Participant for Http requests
properties:
provider: ONAP
- org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement:
+ org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement:
# Http config for PMSH.
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.HttpControlLoopElement
+ type: org.onap.policy.clamp.acm.HttpAutomationCompositionElement
type_version: 1.0.1
- description: Control loop element for the http requests of PMSH microservice
+ description: Automation composition element for the http requests of PMSH microservice
properties:
provider: ONAP
participantType:
- name: org.onap.controlloop.HttpControlLoopParticipant
+ name: org.onap.acm.HttpAutomationCompositionParticipant
version: 2.3.4
startPhase: 1
uninitializedToPassiveTimeout: 180
@@ -208,13 +208,13 @@ topology_template:
expectedResponse: 200
- org.onap.domain.sample.GenericK8s_ControlLoopDefinition:
+ org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition:
version: 1.2.3
- type: org.onap.policy.clamp.controlloop.ControlLoop
+ type: org.onap.policy.clamp.acm.AutomationComposition
type_version: 1.0.0
- description: Control loop for HTTP request
+ description: Automation composition for HTTP request
properties:
provider: ONAP
elements:
- - name: org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement
+ - name: org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement
version: 1.2.3
diff --git a/participant/participant-impl/participant-impl-http/src/test/resources/application_test.properties b/participant/participant-impl/participant-impl-http/src/test/resources/application_test.properties
index 698a965b8..e9f3b37cb 100644
--- a/participant/participant-impl/participant-impl-http/src/test/resources/application_test.properties
+++ b/participant/participant-impl/participant-impl-http/src/test/resources/application_test.properties
@@ -1,24 +1,24 @@
spring.security.user.name=participantUser
spring.security.user.password=zb!XztG34
-server.servlet.context-path=/onap/httpparticipant
+server.servlet.context-path=/onap/policy/clamp/acm/httpparticipant
server.error.path=/error
server.http-port=8084
-participant.name=ControlLoopParticipant Http Test
+participant.name=AutomationCompositionParticipant Http Test
participant.intermediaryParameters.name=Participant parameters
participant.intermediaryParameters.reportingTimeInterval=120000
participant.intermediaryParameters.description=Participant Description
participant.intermediaryParameters.participantId.name=HttpParticipant0
participant.intermediaryParameters.participantId.version=1.0.0
-participant.intermediaryParameters.participantType.name=org.onap.k8s.controlloop.HttpControlLoopParticipant
+participant.intermediaryParameters.participantType.name=org.onap.clamp.acm.HttpParticipant
participant.intermediaryParameters.participantType.version=2.3.4
-participant.intermediaryParameters.clampControlLoopTopics.name=ControlLoop Topics
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topic=POLICY-CLRUNTIME-PARTICIPANT
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].servers[0]=localhost
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topicCommInfrastructure=dmaap
-participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].fetchTimeout=15000
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topic=POLICY-CLRUNTIME-PARTICIPANT
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].servers[0]=localhost
-participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topicCommInfrastructure=dmaap
+participant.intermediaryParameters.clampAutomationCompositionTopics.name=AutomationComposition Topics
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].topic=POLICY-ACRUNTIME-PARTICIPANT
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].servers[0]=localhost
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].topicCommInfrastructure=dmaap
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].fetchTimeout=15000
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].topic=POLICY-ACRUNTIME-PARTICIPANT
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].servers[0]=localhost
+participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].topicCommInfrastructure=dmaap
management.endpoints.web.exposure.include=health,metrics,prometheus