From d59b5eff6118663cdf8e57ed2c61c9b4900f3c29 Mon Sep 17 00:00:00 2001 From: egernug Date: Thu, 19 Oct 2023 11:23:13 +0100 Subject: Upgrade of DMI-Plugin to Spring Boot 3.1.2 Issue-ID: CPS-1790 Signed-off-by: egernug Change-Id: I3eaf8307660ce8d8d33ad98cabb891bcdd663713 --- src/main/java/org/onap/cps/ncmp/dmi/config/DmiPluginConfig.java | 4 ++-- .../java/org/onap/cps/ncmp/dmi/config/WebSecurityConfig.java | 9 +++++---- src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java | 4 ++-- src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java | 7 ++++--- .../org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java | 4 ++-- .../org/onap/cps/ncmp/dmi/config/DmiPluginConfigSpec.groovy | 4 ++-- 6 files changed, 17 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/main/java/org/onap/cps/ncmp/dmi/config/DmiPluginConfig.java b/src/main/java/org/onap/cps/ncmp/dmi/config/DmiPluginConfig.java index 6106c6af..fb22b358 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/config/DmiPluginConfig.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/config/DmiPluginConfig.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation + * Copyright (C) 2021-2023 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ package org.onap.cps.ncmp.dmi.config; import lombok.Getter; -import org.springdoc.core.GroupedOpenApi; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/org/onap/cps/ncmp/dmi/config/WebSecurityConfig.java b/src/main/java/org/onap/cps/ncmp/dmi/config/WebSecurityConfig.java index 1eb9523d..11d2ae53 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/config/WebSecurityConfig.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/config/WebSecurityConfig.java @@ -20,6 +20,8 @@ package org.onap.cps.ncmp.dmi.config; +import static org.springframework.security.config.Customizer.withDefaults; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; @@ -77,13 +79,12 @@ public class WebSecurityConfig { @SuppressWarnings("squid:S4502") public SecurityFilterChain filterChain(final HttpSecurity http) throws Exception { http - .httpBasic() - .and() + .httpBasic(withDefaults()) .authorizeRequests() - .antMatchers(permitUris).permitAll() + .requestMatchers(permitUris).permitAll() .anyRequest().authenticated() .and() - .csrf().disable(); + .csrf((csrf) -> csrf.disable()); return http.build(); } diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java index e5b08d9a..f0826a81 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiService.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation + * Copyright (C) 2021-2023 Nordix Foundation * Modifications Copyright (C) 2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,8 +21,8 @@ package org.onap.cps.ncmp.dmi.service; +import jakarta.validation.constraints.NotNull; import java.util.List; -import javax.validation.constraints.NotNull; import org.onap.cps.ncmp.dmi.exception.DmiException; import org.onap.cps.ncmp.dmi.model.DataAccessRequest; import org.onap.cps.ncmp.dmi.model.ModuleSet; diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java index a9a13a38..6acbe09b 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation + * Copyright (C) 2021-2023 Nordix Foundation * Modifications Copyright (C) 2021-2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -106,7 +106,7 @@ public class DmiServiceImpl implements DmiService { } else { log.error("Error occurred when getting module resources from SDNC for the given cmHandle {}", cmHandle); throw new HttpClientRequestException( - cmHandle, responseEntity.getBody(), responseEntity.getStatusCode()); + cmHandle, responseEntity.getBody(), (HttpStatus) responseEntity.getStatusCode()); } } return yangResources; @@ -171,7 +171,8 @@ public class DmiServiceImpl implements DmiService { if (responseEntity.getStatusCode().is2xxSuccessful()) { return responseEntity.getBody(); } else { - throw new HttpClientRequestException(cmHandle, responseEntity.getBody(), responseEntity.getStatusCode()); + throw new HttpClientRequestException(cmHandle, responseEntity.getBody(), + (HttpStatus) responseEntity.getStatusCode()); } } diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java b/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java index c2a4a7ed..fd94e634 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation + * Copyright (C) 2021-2023 Nordix Foundation * Modifications Copyright (C) 2021-2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -115,7 +115,7 @@ public class SdncOperations { } throw new SdncException( String.format("SDNC failed to get Modules Schema for node %s", nodeId), - modulesResponseEntity.getStatusCode(), modulesResponseEntity.getBody()); + (HttpStatus) modulesResponseEntity.getStatusCode(), modulesResponseEntity.getBody()); } /** diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/config/DmiPluginConfigSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/config/DmiPluginConfigSpec.groovy index b391f8c0..c09403d7 100644 --- a/src/test/groovy/org/onap/cps/ncmp/dmi/config/DmiPluginConfigSpec.groovy +++ b/src/test/groovy/org/onap/cps/ncmp/dmi/config/DmiPluginConfigSpec.groovy @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation + * Copyright (C) 2021-2023 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ package org.onap.cps.ncmp.dmi.config -import org.springdoc.core.GroupedOpenApi +import org.springdoc.core.models.GroupedOpenApi import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.context.ContextConfiguration -- cgit 1.2.3-korg