From ec48f44085307bfdaf71190efa0a36897c51cb7a Mon Sep 17 00:00:00 2001 From: ambrishest Date: Tue, 4 Jul 2023 11:13:42 +0100 Subject: Removing Unnecessary Maven Dependencies Issue-ID: CCSDK-3919 Change-Id: I58a94dbf660f867998d1208a5fdcb2872c1b5db2 Signed-off-by: ambrishest --- a1-policy-management/pom.xml | 10 ------ .../clients/OscA1Client.java | 36 ++++++++++++---------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/a1-policy-management/pom.xml b/a1-policy-management/pom.xml index 338477b6..8cac379a 100644 --- a/a1-policy-management/pom.xml +++ b/a1-policy-management/pom.xml @@ -213,16 +213,6 @@ everit-json-schema 1.14.0 - - org.codehaus.httpcache4j.uribuilder - uribuilder - 2.0.0 - - - org.apache.httpcomponents - httpclient - 4.5.13 - diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java index f2a79cd8..eac79ad9 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java @@ -21,6 +21,9 @@ package org.onap.ccsdk.oran.a1policymanagementservice.clients; import java.lang.invoke.MethodHandles; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Set; @@ -32,7 +35,6 @@ import org.slf4j.LoggerFactory; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import org.apache.http.client.utils.URIBuilder; /** * Client for accessing OSC A1 REST API */ @@ -99,22 +101,22 @@ public class OscA1Client implements A1Client { /** * ​/a1-p​/policytypes​/{policy_type_id}​/policies​/{policy_instance_id} */ - private String createPolicyUri(String type, String id, String notificationDestination) { - String url = ""; - URIBuilder ub = null; - try { - ub = new URIBuilder(createPolicyTypeUri(type) + "/policies/" + id); - if(notificationDestination != null) { - ub.addParameter("notificationDestination", notificationDestination); - } - url = ub.toString(); - } - catch(Exception e) { - String exceptionString = e.toString(); - logger.error("Unexpected error in policy URI creation for policy type: {}, exception: {}", type, exceptionString); - } - return url; - } + private String createPolicyUri(String type, String id, String notificationDestination) { + try { + String baseUrl = createPolicyTypeUri(type); + String url = baseUrl + "/policies/" + id; + if (notificationDestination != null) { + url += "?notificationDestination=" + + URLEncoder.encode(notificationDestination, StandardCharsets.UTF_8.toString()); + } + return new URI(url).toString(); + } catch (Exception e) { + String exceptionString = e.getMessage(); + logger.error("Unexpected error in policy URI creation for policy type: {}, exception: {}", type, + exceptionString); + return ""; + } + } /** * /a1-p/policytypes/{policy_type_id} -- cgit 1.2.3-korg