summaryrefslogtreecommitdiffstats
path: root/plugins/forwarding-plugins/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-07-08 12:07:42 -0400
committerJim Hahn <jrh3@att.com>2019-07-08 16:17:49 -0400
commitd1e0acb7a85403e365764589327b9aef62509318 (patch)
treedb825002fcf6af1c64e639a1fbe587e344c238d3 /plugins/forwarding-plugins/src/main
parenteb2ea3650a6c64a898195b2f78e72af270415ed7 (diff)
Fix distribution due to sonar changes in common
Fixed breakages due to changes made in policy/common to satisfy sonar. Change-Id: Ib1e57668f727db1b87a9aa3bc9a8266884f5e994 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'plugins/forwarding-plugins/src/main')
-rw-r--r--plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyForwarder.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyForwarder.java b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyForwarder.java
index 6db56653..196818b5 100644
--- a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyForwarder.java
+++ b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/xacml/pdp/XacmlPdpPolicyForwarder.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Copyright (C) 2019 Intel Corp. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +22,6 @@
package org.onap.policy.distribution.forwarding.xacml.pdp;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
import java.util.Collection;
import java.util.Collections;
import javax.ws.rs.client.Entity;
@@ -32,12 +31,14 @@ import org.onap.policy.api.PolicyParameters;
import org.onap.policy.api.PushPolicyParameters;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.http.client.HttpClient;
+import org.onap.policy.common.endpoints.http.client.HttpClientConfigException;
+import org.onap.policy.common.endpoints.http.client.HttpClientFactory;
+import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.forwarding.PolicyForwarder;
import org.onap.policy.distribution.forwarding.xacml.pdp.adapters.XacmlPdpOptimizationPolicyAdapter;
import org.onap.policy.distribution.model.OptimizationPolicy;
import org.onap.policy.distribution.model.Policy;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
@@ -109,7 +110,7 @@ public class XacmlPdpPolicyForwarder implements PolicyForwarder {
method, policyName, response.getStatus(), response.getStatusInfo());
return false;
}
- } catch (KeyManagementException | NoSuchAlgorithmException | ClassNotFoundException exception) {
+ } catch (HttpClientConfigException exception) {
LOGGER.error("Invocation of method " + method + " failed for policy " + policyName
+ " due to error opening Http client", exception);
return false;
@@ -117,8 +118,7 @@ public class XacmlPdpPolicyForwarder implements PolicyForwarder {
return true;
}
- private HttpClient getHttpClient()
- throws KeyManagementException, NoSuchAlgorithmException, ClassNotFoundException {
+ private HttpClient getHttpClient() throws HttpClientConfigException {
boolean useHttps = configurationParameters.isUseHttps();
String hostname = configurationParameters.getHostname();
int port = configurationParameters.getPort();
@@ -127,7 +127,7 @@ public class XacmlPdpPolicyForwarder implements PolicyForwarder {
boolean managed = configurationParameters.isManaged();
BusTopicParams params = BusTopicParams.builder().clientName("SDC Dist").useHttps(useHttps).hostname(hostname)
.port(port).userName(userName).password(password).basePath(BASE_PATH).managed(managed).build();
- return HttpClient.factory.build(params);
+ return getHttpClientFactory().build(params);
}
@Override
@@ -135,4 +135,9 @@ public class XacmlPdpPolicyForwarder implements PolicyForwarder {
configurationParameters = ParameterService.get(parameterGroupName);
}
+ // these may be overridden by junit tests
+
+ protected HttpClientFactory getHttpClientFactory() {
+ return HttpClientFactoryInstance.getClientFactory();
+ }
}