Dependency management update 78/137678/1
authoradheli.tavares <adheli.tavares@est.tech>
Wed, 10 Apr 2024 13:02:33 +0000 (14:02 +0100)
committeradheli.tavares <adheli.tavares@est.tech>
Wed, 10 Apr 2024 13:02:48 +0000 (14:02 +0100)
- including dependencies to pom.xml files only where they are used,
avoiding extra dependencies being added in all packages.

Issue-ID: POLICY-4945
Change-Id: Ib92fcae59a3da6fa3bf3d4a5e741ca1b012c4a40
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
gui-editors/gui-editor-apex/pom.xml
gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/handling/plugin/upload/PolicyUploadHandler.java
gui-server/src/main/java/org/onap/policy/gui/server/config/BaseRestTemplateConfig.java
packages/pom.xml

index 45e5276..4d16483 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
-   Modifications Copyright (C) 2019-2023 Nordix Foundation.
+   Modifications Copyright (C) 2019-2024 Nordix Foundation.
    Modifications Copyright (C) 2020 Bell Canada.
    Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
   ================================================================================
             <groupId>org.onap.policy.models</groupId>
             <artifactId>policy-models-tosca</artifactId>
             <version>${policy.models.version}</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.json</groupId>
-                    <artifactId>json</artifactId>
-                </exclusion>
-            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.model</groupId>
             <artifactId>model</artifactId>
             <version>${policy.apex-pdp.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.onap.policy.models</groupId>
+            <artifactId>policy-models-examples</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>jakarta.ws.rs</groupId>
+            <artifactId>jakarta.ws.rs-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.junit.vintage</groupId>
-                    <artifactId>junit-vintage-engine</artifactId>
-                </exclusion>
-            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             </plugin>
 
             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-resources-plugin</artifactId>
                 <executions>
                     <execution>
                         <configuration>
                             <!-- By default, the repackage goal replaces the original artifact with the repackaged one.
                                  By specifying a classifier here, we can retain both the original and repackaged jars.
-                                 Thus two jars are produced: a regular jar that we can include in other modules, and an
+                                 Thus, two jars are produced: a regular jar that we can include in other modules, and an
                                  executable Spring Boot jar with the suffix 'exec'. -->
                             <classifier>exec</classifier>
                         </configuration>
index 677b3dd..095b544 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2020-2022 Nordix Foundation
+ *  Copyright (C) 2020-2022, 2024 Nordix Foundation
  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  *  Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
  *  ================================================================================
@@ -111,7 +111,7 @@ public class PolicyUploadHandler {
             final var apexApiResult = new ApexApiResult(Result.FAILED);
             apexApiResult.addMessage(
                 String.format("uploading Policy '%s' to URL '%s' with userId '%s' failed with status %d",
-                    policyModelKey.getId(), uploadUrl, uploadUserId, e.getRawStatusCode()));
+                    policyModelKey.getId(), uploadUrl, uploadUserId, e.getStatusCode().value()));
             LOGGER.exit(MODEL_UPLOAD_NOT_OK);
             return apexApiResult;
 
index 289a629..0fe4673 100644 (file)
@@ -1,7 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation.
- *  Modifications Copyright (C) 2023 Nordix Foundation.
+ *  Copyright (C) 2022-2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -30,10 +29,10 @@ import lombok.Setter;
 import org.apache.hc.client5.http.impl.classic.HttpClients;
 import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
 import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
+import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
 import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder;
 import org.apache.hc.client5.http.ssl.TrustAllStrategy;
 import org.apache.hc.core5.ssl.SSLContextBuilder;
-import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
@@ -78,15 +77,16 @@ public class BaseRestTemplateConfig {
             sslContext = new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustStorePassword).build();
         }
 
-        HostnameVerifier hostnameVerifier;
+        SSLConnectionSocketFactory csf;
         if (disableSslHostnameCheck) {
-            hostnameVerifier = new NoopHostnameVerifier();
+            HostnameVerifier hostnameVerifier = new NoopHostnameVerifier();
+            csf = SSLConnectionSocketFactoryBuilder.create()
+                .setSslContext(sslContext).setHostnameVerifier(hostnameVerifier).build();
         } else {
-            hostnameVerifier = SSLConnectionSocketFactory.getDefaultHostnameVerifier();
+            csf = SSLConnectionSocketFactoryBuilder.create()
+                .setSslContext(sslContext).build();
         }
 
-        var csf = SSLConnectionSocketFactoryBuilder.create()
-                .setSslContext(sslContext).setHostnameVerifier(hostnameVerifier).build();
         var httpClientBuilder = PoolingHttpClientConnectionManagerBuilder.create().setSSLSocketFactory(csf).build();
         var httpClient = HttpClients.custom().setConnectionManager(httpClientBuilder).build();
         var requestFactory = new HttpComponentsClientHttpRequestFactory();
index 5c6878a..10a3813 100644 (file)
@@ -1,6 +1,6 @@
 <!--
   ============LICENSE_START=======================================================
-   Copyright (C) 2021 Nordix Foundation.
+   Copyright (C) 2021, 2024 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@
     <description>[${project.parent.artifactId}] packaging</description>
 
     <properties>
-        <!-- There is no code in this sub-module, only holds interfaces. So skip sonar. -->
+        <!-- There is no code in this submodule, only holds interfaces. So skip sonar. -->
         <sonar.skip>true</sonar.skip>
     </properties>