summaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-acelement
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl/participant-impl-acelement')
-rwxr-xr-x[-rw-r--r--]participant/participant-impl/participant-impl-acelement/pom.xml6
-rw-r--r--participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/SecurityConfig.java10
-rw-r--r--participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java6
-rwxr-xr-x[-rw-r--r--]participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java10
-rwxr-xr-x[-rw-r--r--]participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java2
-rwxr-xr-x[-rw-r--r--]participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/AcElement.java4
-rwxr-xr-x[-rw-r--r--]participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AcElementErrorController.java4
-rwxr-xr-x[-rw-r--r--]participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ConfigService.java2
-rw-r--r--participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java2
-rwxr-xr-x[-rw-r--r--]participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java2
-rwxr-xr-x[-rw-r--r--]participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/AcElementControllerTest.java2
-rwxr-xr-x[-rw-r--r--]participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/ActuatorControllerTest.java49
-rwxr-xr-x[-rw-r--r--]participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/utils/CommonActuatorController.java12
13 files changed, 55 insertions, 56 deletions
diff --git a/participant/participant-impl/participant-impl-acelement/pom.xml b/participant/participant-impl/participant-impl-acelement/pom.xml
index b4a63406a..b82f9b501 100644..100755
--- a/participant/participant-impl/participant-impl-acelement/pom.xml
+++ b/participant/participant-impl/participant-impl-acelement/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.clamp.participant</groupId>
<artifactId>policy-clamp-participant-impl</artifactId>
- <version>7.0.0-SNAPSHOT</version>
+ <version>7.0.1-SNAPSHOT</version>
</parent>
<artifactId>policy-clamp-acm-element-impl</artifactId>
@@ -56,9 +56,10 @@
</importMappings>
<configOptions>
<sourceFolder>src/gen/java</sourceFolder>
- <dateLibrary>java11</dateLibrary>
+ <dateLibrary>java17</dateLibrary>
<interfaceOnly>true</interfaceOnly>
<useTags>true</useTags>
+ <jakarta>true</jakarta>
</configOptions>
</configuration>
</execution>
@@ -67,6 +68,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${version.springboot}</version>
<executions>
<execution>
<goals>
diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/SecurityConfig.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/SecurityConfig.java
index ecb127580..71b01dbdf 100644
--- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/SecurityConfig.java
+++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/config/SecurityConfig.java
@@ -22,7 +22,9 @@ package org.onap.policy.clamp.acm.element.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.web.SecurityFilterChain;
/**
@@ -39,11 +41,9 @@ public class SecurityConfig {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
- .httpBasic()
- .and()
- .authorizeHttpRequests().anyRequest().authenticated()
- .and()
- .csrf().disable();
+ .httpBasic(Customizer.withDefaults())
+ .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated())
+ .csrf(AbstractHttpConfigurer::disable);
return http.build();
}
}
diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java
index ac3c72e52..ef8ceb00f 100644
--- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java
+++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java
@@ -24,7 +24,6 @@ import java.io.IOException;
import java.util.List;
import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessageType;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
-import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.TopicSource;
import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher;
import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
@@ -46,13 +45,12 @@ public class MessageActivator extends ServiceManagerContainer implements AutoClo
private static final String[] MSG_TYPE_NAMES = { "messageType" };
// Topics from which the AC element receives and sends messages
- private List<TopicSink> topicSinks;
private List<TopicSource> topicSources;
private final MessageListener listener;
private final MessagePublisher publisher;
- private MessageTypeDispatcher msgDispatcher;
+ private final MessageTypeDispatcher msgDispatcher;
/**
* Constructor.
@@ -73,7 +71,7 @@ public class MessageActivator extends ServiceManagerContainer implements AutoClo
* @param parameters TopicParameterGroup
*/
public void activate(final TopicParameterGroup parameters) {
- topicSinks = TopicEndpointManager.getManager().addTopicSinks(parameters.getTopicSinks());
+ var topicSinks = TopicEndpointManager.getManager().addTopicSinks(parameters.getTopicSinks());
topicSources = TopicEndpointManager.getManager().addTopicSources(parameters.getTopicSources());
// @formatter:off
diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java
index 906fc321c..c0ac329e0 100644..100755
--- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java
+++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java
@@ -21,10 +21,10 @@
package org.onap.policy.clamp.acm.element.handler;
import io.micrometer.core.annotation.Timed;
-import java.util.HashMap;
+import jakarta.ws.rs.core.Response;
+import java.util.EnumMap;
import java.util.List;
import java.util.Map;
-import javax.ws.rs.core.Response;
import lombok.NonNull;
import org.onap.policy.clamp.acm.element.main.parameters.AcElement;
import org.onap.policy.clamp.acm.element.service.ElementService;
@@ -39,9 +39,9 @@ import org.springframework.stereotype.Component;
public class MessageHandler {
private ElementType elementType;
- private ToscaConceptIdentifier elementId;
+ private final ToscaConceptIdentifier elementId;
- private Map<ElementType, ElementService> map = new HashMap<>();
+ private final Map<ElementType, ElementService> map = new EnumMap<>(ElementType.class);
/**
* Constructor.
@@ -51,7 +51,7 @@ public class MessageHandler {
*/
public MessageHandler(AcElement acElement, List<ElementService> elementServices) {
elementId = acElement.getElementId();
- elementServices.stream().forEach(elementService -> map.put(elementService.getType(), elementService));
+ elementServices.forEach(elementService -> map.put(elementService.getType(), elementService));
}
/**
diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java
index 1b0c2234a..09c681d93 100644..100755
--- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java
+++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java
@@ -21,8 +21,8 @@
package org.onap.policy.clamp.acm.element.handler;
import io.micrometer.core.annotation.Timed;
+import jakarta.ws.rs.core.Response;
import java.util.List;
-import javax.ws.rs.core.Response;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessage;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/AcElement.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/AcElement.java
index bb80cc638..a0df74c50 100644..100755
--- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/AcElement.java
+++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/AcElement.java
@@ -21,8 +21,8 @@
package org.onap.policy.clamp.acm.element.main.parameters;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AcElementErrorController.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AcElementErrorController.java
index 717390088..3442eedf6 100644..100755
--- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AcElementErrorController.java
+++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/rest/AcElementErrorController.java
@@ -22,9 +22,9 @@
package org.onap.policy.clamp.acm.element.main.rest;
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.http.HttpServletRequest;
import java.util.Map;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.http.HttpServletRequest;
import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse;
import org.springframework.beans.factory.annotation.Value;
diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ConfigService.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ConfigService.java
index ff07cef53..b3f662c86 100644..100755
--- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ConfigService.java
+++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ConfigService.java
@@ -20,8 +20,8 @@
package org.onap.policy.clamp.acm.element.service;
+import jakarta.ws.rs.core.Response;
import java.util.List;
-import javax.ws.rs.core.Response;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.onap.policy.clamp.acm.element.handler.MessageActivator;
diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java
index 6de8255ba..c90643f39 100644
--- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java
+++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java
@@ -36,7 +36,7 @@ public class SinkService extends AbstractElementService {
@Override
public void handleMessage(ElementMessage message) {
- LOGGER.info("Cycle completed in sink service with the full message: " + message);
+ LOGGER.info("Cycle completed in sink service with the full message: {}", message);
}
@Override
diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java
index 479fa44b6..236ba502b 100644..100755
--- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java
+++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java
@@ -20,10 +20,10 @@
package org.onap.policy.clamp.acm.element.service;
+import jakarta.ws.rs.core.Response;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-import javax.ws.rs.core.Response;
import org.onap.policy.clamp.acm.element.handler.MessagePublisher;
import org.onap.policy.clamp.acm.element.main.parameters.AcElement;
import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementStatus;
diff --git a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/AcElementControllerTest.java b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/AcElementControllerTest.java
index 1d19b1a17..1ffe7d11d 100644..100755
--- a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/AcElementControllerTest.java
+++ b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/AcElementControllerTest.java
@@ -30,10 +30,10 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+import jakarta.ws.rs.core.Response;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import javax.ws.rs.core.Response;
import org.apache.commons.io.FileUtils;
import org.json.JSONObject;
import org.junit.jupiter.api.BeforeAll;
diff --git a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/ActuatorControllerTest.java
index c37bca3aa..5ccee7b31 100644..100755
--- a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/ActuatorControllerTest.java
+++ b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/ActuatorControllerTest.java
@@ -22,29 +22,28 @@ package org.onap.policy.clamp.acm.element.rest;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.core.Response;
+import jakarta.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.acm.element.utils.CommonActuatorController;
-import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics;
+import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
-@AutoConfigureMetrics
+@AutoConfigureObservability(tracing = false)
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("test")
+@ActiveProfiles({ "test", "default" })
class ActuatorControllerTest extends CommonActuatorController {
- private static final String HEALTH_ENDPOINT = "onap/policy/clamp/acelement/v2/health/";
- private static final String METRICS_ENDPOINT = "onap/policy/clamp/acelement/v2/metrics/";
- private static final String PROMETHEUS_ENDPOINT = "onap/policy/clamp/acelement/v2/prometheus/";
- private static final String SWAGGER_ENDPOINT = "onap/policy/clamp/acelement/v2/v3/api-docs/";
+ private static final String HEALTH_ENDPOINT = "onap/policy/clamp/acelement/v2/health";
+ private static final String METRICS_ENDPOINT = "onap/policy/clamp/acelement/v2/metrics";
+ private static final String PROMETHEUS_ENDPOINT = "onap/policy/clamp/acelement/v2/prometheus";
+ private static final String SWAGGER_ENDPOINT = "onap/policy/clamp/acelement/v2/v3/api-docs";
@LocalServerPort
private int randomServerPort;
@@ -55,50 +54,50 @@ class ActuatorControllerTest extends CommonActuatorController {
}
@Test
- void testGetHealth_Unauthorized() throws Exception {
+ void testGetHealth_Unauthorized() {
assertUnauthorizedActGet(HEALTH_ENDPOINT);
}
@Test
- void testGetMetrics_Unauthorized() throws Exception {
+ void testGetMetrics_Unauthorized() {
assertUnauthorizedActGet(METRICS_ENDPOINT);
}
@Test
- void testGetPrometheus_Unauthorized() throws Exception {
+ void testGetPrometheus_Unauthorized() {
assertUnauthorizedActGet(PROMETHEUS_ENDPOINT);
}
@Test
- void testGetSwagger_Unauthorized() throws Exception {
+ void testGetSwagger_Unauthorized() {
assertUnauthorizedActGet(SWAGGER_ENDPOINT);
}
@Test
- void testGetHealth() throws Exception {
- Invocation.Builder invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT);
- Response rawresp = invocationBuilder.buildGet().invoke();
+ void testGetHealth() {
+ var invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT);
+ var rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
}
@Test
- void testGetMetrics() throws Exception {
- Invocation.Builder invocationBuilder = super.sendActRequest(METRICS_ENDPOINT);
- Response rawresp = invocationBuilder.buildGet().invoke();
+ void testGetMetrics() {
+ var invocationBuilder = super.sendActRequest(METRICS_ENDPOINT);
+ var rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
}
@Test
- void testGetPrometheus() throws Exception {
- Invocation.Builder invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT);
- Response rawresp = invocationBuilder.buildGet().invoke();
+ void testGetPrometheus() {
+ var invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT);
+ var rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
}
@Test
- void testGetSwagger() throws Exception {
- Invocation.Builder invocationBuilder = super.sendActRequest(SWAGGER_ENDPOINT);
- Response rawresp = invocationBuilder.buildGet().invoke();
+ void testGetSwagger() {
+ var invocationBuilder = super.sendActRequest(SWAGGER_ENDPOINT);
+ var rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
}
}
diff --git a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/utils/CommonActuatorController.java
index 022925dab..1b43e607f 100644..100755
--- a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/utils/CommonActuatorController.java
+++ b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/utils/CommonActuatorController.java
@@ -22,12 +22,12 @@ package org.onap.policy.clamp.acm.element.utils;
import static org.junit.Assert.assertEquals;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
+import jakarta.ws.rs.client.Client;
+import jakarta.ws.rs.client.ClientBuilder;
+import jakarta.ws.rs.client.Invocation;
+import jakarta.ws.rs.client.WebTarget;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import org.onap.policy.common.gson.GsonMessageBodyHandler;