diff options
7 files changed, 93 insertions, 57 deletions
@@ -40,7 +40,7 @@ <properties> <app>org.onap.cps.ncmp.dmi.Application</app> <base.image>${docker.pull.registry}/onap/integration-java17:12.0.0</base.image> - <cps.version>3.3.6</cps.version> + <cps.version>3.3.8</cps.version> <image.tag>${project.version}-${maven.build.timestamp}</image.tag> <jacoco.minimum.coverage>0.98</jacoco.minimum.coverage> <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> @@ -49,6 +49,20 @@ <dependencyManagement> <dependencies> <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>3.1.2</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-dependencies</artifactId> + <version>2022.0.3</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.8.9</version> @@ -84,35 +98,29 @@ <version>4.5.13</version> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-dependencies</artifactId> - <version>2.7.6</version> - <type>pom</type> - <scope>import</scope> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy</artifactId> + <version>3.0.18</version> </dependency> <dependency> <groupId>org.spockframework</groupId> - <artifactId>spock-bom</artifactId> - <version>2.0-M5-groovy-3.0</version> - <type>pom</type> - <scope>import</scope> + <artifactId>spock-core</artifactId> + <version>2.4-M1-groovy-3.0</version> </dependency> <dependency> - <groupId>org.springdoc</groupId> - <artifactId>springdoc-openapi-ui</artifactId> - <version>1.6.6</version> + <groupId>org.spockframework</groupId> + <artifactId>spock-spring</artifactId> + <version>2.4-M1-groovy-3.0</version> </dependency> <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-dependencies</artifactId> - <version>2021.0.3</version> - <type>pom</type> - <scope>import</scope> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + <version>2.0.2</version> </dependency> <dependency> <groupId>org.testcontainers</groupId> <artifactId>testcontainers-bom</artifactId> - <version>1.17.3</version> + <version>1.18.3</version> <type>pom</type> <scope>import</scope> </dependency> @@ -122,14 +130,48 @@ <version>3.1.7</version> </dependency> <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.18.24</version> + </dependency> + <dependency> <groupId>org.onap.cps</groupId> <artifactId>cps-ncmp-events</artifactId> <version>${cps.version}</version> </dependency> + <dependency> + <groupId>org.apache.httpcomponents.client5</groupId> + <artifactId>httpclient5</artifactId> + <version>5.2.1</version> + </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-validation</artifactId> + </dependency> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-security</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-actuator</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.kafka</groupId> + <artifactId>spring-kafka</artifactId> + </dependency> + <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> </dependency> @@ -169,6 +211,7 @@ <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> + <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy</artifactId> @@ -178,36 +221,24 @@ <artifactId>janino</artifactId> </dependency> <dependency> - <groupId>org.onap.cps</groupId> - <artifactId>cps-ncmp-events</artifactId> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-server</artifactId> </dependency> <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-http</artifactId> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-validation</artifactId> - </dependency> - <dependency> - <groupId>org.springdoc</groupId> - <artifactId>springdoc-openapi-ui</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-security</artifactId> + <groupId>org.onap.cps</groupId> + <artifactId>cps-ncmp-events</artifactId> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> </dependency> <dependency> - <groupId>org.springframework.kafka</groupId> - <artifactId>spring-kafka</artifactId> + <groupId>org.apache.httpcomponents.client5</groupId> + <artifactId>httpclient5</artifactId> </dependency> <!-- T E S T - D E P E N D E N C I E S --> <dependency> @@ -295,6 +326,7 @@ <dateLibrary>java11</dateLibrary> <interfaceOnly>true</interfaceOnly> <useTags>true</useTags> + <useSpringBoot3>true</useSpringBoot3> <openApiNullable>false</openApiNullable> <skipDefaultInterface>true</skipDefaultInterface> </configOptions> @@ -339,7 +371,7 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <version>2.6.4</version> + <version>3.1.2</version> <executions> <execution> <goals> @@ -492,6 +524,7 @@ <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> + <version>0.8.10</version> <configuration> <excludes> <exclude>org/onap/cps/ncmp/dmi/model/*</exclude> @@ -545,6 +578,7 @@ <plugin> <groupId>com.google.cloud.tools</groupId> <artifactId>jib-maven-plugin</artifactId> + <version>3.3.2</version> <configuration> <container> <mainClass>${app}</mainClass> 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 |