diff options
author | ambrishest <ambrish.singh@est.tech> | 2023-07-04 11:13:42 +0100 |
---|---|---|
committer | ambrishest <ambrish.singh@est.tech> | 2023-07-04 11:13:42 +0100 |
commit | ec48f44085307bfdaf71190efa0a36897c51cb7a (patch) | |
tree | 08dc5c0ba1752c3e6c5cb9d30b2cbdfedc35a8b2 | |
parent | 9460f99cb82833a8acc19d870c94927e76e716aa (diff) |
Removing Unnecessary Maven Dependencies
Issue-ID: CCSDK-3919
Change-Id: I58a94dbf660f867998d1208a5fdcb2872c1b5db2
Signed-off-by: ambrishest <ambrish.singh@est.tech>
-rw-r--r-- | a1-policy-management/pom.xml | 10 | ||||
-rw-r--r-- | a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/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 @@ <artifactId>everit-json-schema</artifactId> <version>1.14.0</version> </dependency> - <dependency> - <groupId>org.codehaus.httpcache4j.uribuilder</groupId> - <artifactId>uribuilder</artifactId> - <version>2.0.0</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>4.5.13</version> - </dependency> </dependencies> <build> <plugins> 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} |