summaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/main
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2023-08-11 15:10:44 +0100
committeradheli.tavares <adheli.tavares@est.tech>2023-09-25 13:40:52 +0100
commit4407ea6948a060734a4f2836b11bd2d5c6ea6194 (patch)
tree6a6e482126ec3d8e830faf80a392b2161ced6de0 /runtime-acm/src/main
parentc4b3c527882610afc3f08c0efd73e2f7841e9fe5 (diff)
Upgrade Java 17
Issue-ID: POLICY-4673 Change-Id: I01fd3677687b5d2e065d0cc131b338ed841d7e99 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'runtime-acm/src/main')
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java4
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/AafConfiguration.java2
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/ConverterConfiguration.java11
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java34
-rwxr-xr-xruntime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java6
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/AcRuntimeParameterGroup.java4
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/ParticipantParameters.java2
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/CommissioningController.java2
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java2
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/InstantiationControllerStub.java2
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/StubUtils.java2
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/AbstractRestController.java4
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java4
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java2
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantAckPublisher.java2
-rwxr-xr-x[-rw-r--r--]runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantPublisher.java2
16 files changed, 41 insertions, 44 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
index 961f12a5c..3400b2e60 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
@@ -21,12 +21,12 @@
package org.onap.policy.clamp.acm.runtime.commissioning;
+import jakarta.ws.rs.core.Response.Status;
import java.util.HashSet;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
-import javax.ws.rs.core.Response.Status;
import lombok.RequiredArgsConstructor;
import org.onap.policy.clamp.acm.runtime.participants.AcmParticipantProvider;
import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantPrimePublisher;
@@ -72,7 +72,7 @@ public class CommissioningProvider {
.values()
.stream()
.map(template -> template.getKey().asIdentifier())
- .collect(Collectors.toList()));
+ .toList());
// @formatter:on
return response;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/AafConfiguration.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/AafConfiguration.java
index b1f408048..f3ad9a3e9 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/AafConfiguration.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/AafConfiguration.java
@@ -20,7 +20,7 @@
package org.onap.policy.clamp.acm.runtime.config;
-import javax.servlet.Filter;
+import jakarta.servlet.Filter;
import org.onap.policy.clamp.acm.runtime.main.web.AutomationConfiguraitonAafFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/ConverterConfiguration.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/ConverterConfiguration.java
index 6776e59a6..f08e28f70 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/ConverterConfiguration.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/ConverterConfiguration.java
@@ -21,7 +21,7 @@
package org.onap.policy.clamp.acm.runtime.config;
import java.util.List;
-import org.onap.policy.clamp.common.acm.rest.CoderHttpMesageConverter;
+import org.onap.policy.common.spring.utils.YamlHttpMessageConverter;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
@@ -33,11 +33,12 @@ public class ConverterConfiguration implements WebMvcConfigurer {
@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
- converters.add(new CoderHttpMesageConverter<>("yaml"));
- converters.add(new CoderHttpMesageConverter<>("json"));
+ var yamlConverter = new YamlHttpMessageConverter();
+ yamlConverter.setSupportedMediaTypes(List.of(MediaType.parseMediaType("application/yaml")));
+ converters.add(yamlConverter);
- StringHttpMessageConverter converter = new StringHttpMessageConverter();
+ var converter = new StringHttpMessageConverter();
converter.setSupportedMediaTypes(List.of(MediaType.TEXT_PLAIN));
converters.add(converter);
}
-}
+} \ No newline at end of file
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java
index e8b28079b..e32eacb37 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java
@@ -23,7 +23,9 @@ package org.onap.policy.clamp.acm.runtime.config;
import org.springframework.beans.factory.annotation.Value;
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;
/**
@@ -31,35 +33,29 @@ import org.springframework.security.web.SecurityFilterChain;
*/
@Configuration
public class SecurityConfig {
+
@Value("${metrics.security.disabled}")
private boolean disableMetricsSecurity;
+
/**
* Return the configuration of how access to this module's REST end points is secured.
*
* @param http the HTTP security settings
* @return the HTTP security settings
*/
-
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
- if (disableMetricsSecurity) {
- http
- .httpBasic()
- .and()
- .authorizeHttpRequests(request ->
- request
- .antMatchers("/prometheus").permitAll()
- .anyRequest().authenticated())
- .csrf().disable();
- } else {
- http
- .httpBasic()
- .and()
- .authorizeHttpRequests().anyRequest().authenticated()
- .and()
- .csrf().disable();
- }
-
+ http
+ .httpBasic(Customizer.withDefaults())
+ .authorizeHttpRequests(authorize -> {
+ if (disableMetricsSecurity) {
+ authorize.requestMatchers("/prometheus").permitAll()
+ .anyRequest().authenticated();
+ } else {
+ authorize.anyRequest().authenticated();
+ }
+ })
+ .csrf(AbstractHttpConfigurer::disable);
return http.build();
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
index 84944e74c..f8d5894b3 100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
@@ -21,11 +21,11 @@
package org.onap.policy.clamp.acm.runtime.instantiation;
+import jakarta.validation.Valid;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.Response.Status;
import java.util.UUID;
import java.util.stream.Collectors;
-import javax.validation.Valid;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
import lombok.AllArgsConstructor;
import org.onap.policy.clamp.acm.runtime.participants.AcmParticipantProvider;
import org.onap.policy.clamp.acm.runtime.supervision.SupervisionAcHandler;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/AcRuntimeParameterGroup.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/AcRuntimeParameterGroup.java
index 563da1268..87aa92386 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/AcRuntimeParameterGroup.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/AcRuntimeParameterGroup.java
@@ -20,8 +20,8 @@
package org.onap.policy.clamp.acm.runtime.main.parameters;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/ParticipantParameters.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/ParticipantParameters.java
index 8c3a7078a..ae5f22a97 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/ParticipantParameters.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/parameters/ParticipantParameters.java
@@ -18,7 +18,7 @@
package org.onap.policy.clamp.acm.runtime.main.parameters;
-import javax.validation.constraints.Min;
+import jakarta.validation.constraints.Min;
import lombok.Getter;
import lombok.Setter;
import org.springframework.validation.annotation.Validated;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/CommissioningController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/CommissioningController.java
index 4799880db..5bbe27737 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/CommissioningController.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/CommissioningController.java
@@ -20,8 +20,8 @@
package org.onap.policy.clamp.acm.runtime.main.rest;
+import jakarta.validation.Valid;
import java.util.UUID;
-import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.onap.policy.clamp.acm.runtime.commissioning.CommissioningProvider;
import org.onap.policy.clamp.acm.runtime.main.rest.gen.AutomationCompositionDefinitionApi;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java
index 931b47517..c88ab69e0 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java
@@ -21,8 +21,8 @@
package org.onap.policy.clamp.acm.runtime.main.rest;
+import jakarta.validation.Valid;
import java.util.UUID;
-import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.onap.policy.clamp.acm.runtime.instantiation.AutomationCompositionInstantiationProvider;
import org.onap.policy.clamp.acm.runtime.main.rest.gen.AutomationCompositionInstanceApi;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/InstantiationControllerStub.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/InstantiationControllerStub.java
index 9d72a5b2c..d5991e47c 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/InstantiationControllerStub.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/InstantiationControllerStub.java
@@ -20,8 +20,8 @@
package org.onap.policy.clamp.acm.runtime.main.rest.stub;
+import jakarta.validation.Valid;
import java.util.UUID;
-import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.onap.policy.clamp.acm.runtime.main.rest.gen.AutomationCompositionInstanceApi;
import org.onap.policy.clamp.acm.runtime.main.web.AbstractRestController;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/StubUtils.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/StubUtils.java
index 3a209a096..7bc22acaa 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/StubUtils.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/StubUtils.java
@@ -21,9 +21,9 @@
package org.onap.policy.clamp.acm.runtime.main.rest.stub;
import com.google.gson.Gson;
+import jakarta.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import javax.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardYamlCoder;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/AbstractRestController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/AbstractRestController.java
index 736f258ee..a1830125f 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/AbstractRestController.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/AbstractRestController.java
@@ -20,10 +20,10 @@
package org.onap.policy.clamp.acm.runtime.main.web;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
import java.net.URI;
import java.net.URISyntaxException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
import org.springframework.web.bind.annotation.RequestMapping;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java
index 5eecb92dd..f7feba32c 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/web/RuntimeErrorController.java
@@ -23,9 +23,9 @@
package org.onap.policy.clamp.acm.runtime.main.web;
import io.swagger.v3.oas.annotations.Hidden;
+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.slf4j.Logger;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java
index 670ae5301..13382e0fb 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java
@@ -20,13 +20,13 @@
package org.onap.policy.clamp.acm.runtime.participants;
+import jakarta.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
-import javax.ws.rs.core.Response;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.MapUtils;
import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantStatusReqPublisher;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantAckPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantAckPublisher.java
index 22284a4eb..df3af1c18 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantAckPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantAckPublisher.java
@@ -20,8 +20,8 @@
package org.onap.policy.clamp.acm.runtime.supervision.comm;
+import jakarta.ws.rs.core.Response.Status;
import java.util.List;
-import javax.ws.rs.core.Response.Status;
import org.onap.policy.clamp.acm.runtime.config.messaging.Publisher;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantPublisher.java
index 054eaf7b5..3711ced9a 100644..100755
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AbstractParticipantPublisher.java
@@ -20,8 +20,8 @@
package org.onap.policy.clamp.acm.runtime.supervision.comm;
+import jakarta.ws.rs.core.Response.Status;
import java.util.List;
-import javax.ws.rs.core.Response.Status;
import org.onap.policy.clamp.acm.runtime.config.messaging.Publisher;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;