diff options
author | Jim Hahn <jrh3@att.com> | 2019-07-08 12:13:39 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-07-08 12:13:39 -0400 |
commit | a805d1f1044b204e7aeb898b4b5682925bf9284d (patch) | |
tree | 0934140eb11bd6e1a84c0f3985bbd048fc53db10 | |
parent | aba606406dded6ea6d9bf140ea2cbbf11fe90238 (diff) |
Fix xacml-pdp due to sonar changes in common
Fixed breakages due to changes made in policy/common to satisfy
sonar.
Change-Id: I6c655ca9509bc1d52277d55b02103e9875de2c29
Issue-ID: POLICY-1791
Signed-off-by: Jim Hahn <jrh3@att.com>
3 files changed, 13 insertions, 11 deletions
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestServer.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestServer.java index a8441524..a6213da2 100644 --- a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestServer.java +++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestServer.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.Properties; import org.onap.policy.common.capabilities.Startable; import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.parameters.RestServerParameters; import org.onap.policy.common.gson.GsonMessageBodyHandler; import org.slf4j.Logger; @@ -65,7 +66,7 @@ public class XacmlPdpRestServer implements Startable { // // Get the server properties // - servers = HttpServletServer.factory.build(getServerProperties()); + servers = HttpServletServerFactoryInstance.getServerFactory().build(getServerProperties()); // // Start all the servers // diff --git a/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java b/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java index 8af412d5..eb3ac230 100644 --- a/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java +++ b/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java @@ -25,7 +25,7 @@ import java.util.Arrays; import java.util.Properties; import lombok.Getter; import lombok.Setter; -import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; +import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient; import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClientException; @@ -85,8 +85,8 @@ public class XacmlPdpActivator extends ServiceManagerContainer { public XacmlPdpActivator(final XacmlPdpParameterGroup xacmlPdpParameterGroup, Properties topicProperties) { LOGGER.info("Activator initializing using {} and {}", xacmlPdpParameterGroup, topicProperties); - TopicEndpoint.manager.addTopicSinks(topicProperties); - TopicEndpoint.manager.addTopicSources(topicProperties); + TopicEndpointManager.getManager().addTopicSinks(topicProperties); + TopicEndpointManager.getManager().addTopicSources(topicProperties); final XacmlPdpHearbeatPublisher heartbeat; final TopicSinkClient sinkClient; @@ -135,8 +135,8 @@ public class XacmlPdpActivator extends ServiceManagerContainer { this::unregisterMsgDispatcher); addAction("topics", - TopicEndpoint.manager::start, - TopicEndpoint.manager::shutdown); + TopicEndpointManager.getManager()::start, + TopicEndpointManager.getManager()::shutdown); addAction("Terminate PDP", () -> { }, @@ -196,7 +196,7 @@ public class XacmlPdpActivator extends ServiceManagerContainer { * Registers the dispatcher with the topic source(s). */ private void registerMsgDispatcher() { - for (TopicSource source : TopicEndpoint.manager.getTopicSources(Arrays.asList(TOPIC))) { + for (TopicSource source : TopicEndpointManager.getManager().getTopicSources(Arrays.asList(TOPIC))) { source.register(msgDispatcher); } } @@ -205,7 +205,7 @@ public class XacmlPdpActivator extends ServiceManagerContainer { * Unregisters the dispatcher from the topic source(s). */ private void unregisterMsgDispatcher() { - for (TopicSource source : TopicEndpoint.manager.getTopicSources(Arrays.asList(TOPIC))) { + for (TopicSource source : TopicEndpointManager.getManager().getTopicSources(Arrays.asList(TOPIC))) { source.unregister(msgDispatcher); } } diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java index b1732048..0edfc6f5 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java @@ -48,6 +48,8 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; 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.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.parameters.RestServerParameters; import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; import org.onap.policy.common.gson.GsonMessageBodyHandler; @@ -200,9 +202,8 @@ public class TestDecision { return HttpClient.getBody(response, ErrorResponse.class); } - private static HttpClient getNoAuthHttpClient() - throws KeyManagementException, NoSuchAlgorithmException, ClassNotFoundException { - return HttpClient.factory.build(BusTopicParams.builder() + private static HttpClient getNoAuthHttpClient() throws HttpClientConfigException { + return HttpClientFactoryInstance.getClientFactory().build(BusTopicParams.builder() .clientName("testDecisionClient") .serializationProvider(GsonMessageBodyHandler.class.getName()) .useHttps(false).allowSelfSignedCerts(false).hostname("localhost").port(port) |