From a593d0931f9a5785572bb52c5dfae32faa5d8116 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 8 Jul 2019 10:21:36 -0400 Subject: Fix drools-pdp due to sonar changes in common Fixed breakages due to changes made in policy/common to satisfy sonar. Change-Id: I26a38340707b2903e089350c31c5dfdb5c019ee0 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn --- .../org/onap/policy/drools/lifecycle/LifecycleFsm.java | 6 +++--- .../server/restful/RestLifecycleManagerTest.java | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'feature-lifecycle') diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java index 0e853e80..60399d74 100644 --- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java @@ -35,7 +35,7 @@ import lombok.Setter; import org.apache.commons.lang3.StringUtils; import org.onap.policy.common.capabilities.Startable; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.TopicSink; import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient; @@ -352,7 +352,7 @@ public class LifecycleFsm implements Startable { } private boolean source() { - List sources = TopicEndpoint.manager.addTopicSources(properties); + List sources = TopicEndpointManager.getManager().addTopicSources(properties); if (sources.isEmpty()) { return false; } @@ -369,7 +369,7 @@ public class LifecycleFsm implements Startable { } private boolean sink() { - List sinks = TopicEndpoint.manager.addTopicSinks(properties); + List sinks = TopicEndpointManager.getManager().addTopicSinks(properties); if (sinks.isEmpty()) { logger.error("Lifecycle Manager sinks have not been configured"); return false; diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java index 3cf5c596..92269167 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java @@ -29,7 +29,9 @@ import org.junit.Before; import org.junit.Test; 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.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.drools.persistence.SystemPersistence; import org.onap.policy.models.pdp.enums.PdpState; @@ -44,12 +46,12 @@ public class RestLifecycleManagerTest { */ @Before public void setUp() throws Exception { - HttpServletServer.factory.destroy(); - HttpClient.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); + HttpClientFactoryInstance.getClientFactory().destroy(); SystemPersistence.manager.setConfigurationDir("target/test-classes"); - HttpClient.factory.build( + HttpClientFactoryInstance.getClientFactory().build( BusTopicParams.builder() .clientName("lifecycle") .hostname("localhost") @@ -59,7 +61,7 @@ public class RestLifecycleManagerTest { .build()); HttpServletServer server = - HttpServletServer.factory.build("lifecycle", "localhost", 8765, "/", true, true); + HttpServletServerFactoryInstance.getServerFactory().build("lifecycle", "localhost", 8765, "/", true, true); server.addServletClass("/*", RestLifecycleManager.class.getName()); server.setSerializationProvider("org.onap.policy.common.gson.JacksonHandler"); server.waitedStart(5000L); @@ -73,17 +75,17 @@ public class RestLifecycleManagerTest { */ @After public void tearDown() { - HttpServletServer.factory.destroy(); - HttpClient.factory.destroy(); + HttpServletServerFactoryInstance.getServerFactory().destroy(); + HttpClientFactoryInstance.getClientFactory().destroy(); } @Test public void fsm() { - Response response = HttpClient.factory.get("lifecycle").get("fsm"); + Response response = HttpClientFactoryInstance.getClientFactory().get("lifecycle").get("fsm"); assertNotNull(HttpClient.getBody(response, String.class)); assertEquals(Status.OK.getStatusCode(), response.getStatus()); - response = HttpClient.factory.get("lifecycle").get("fsm/state"); + response = HttpClientFactoryInstance.getClientFactory().get("lifecycle").get("fsm/state"); assertEquals(PdpState.TERMINATED, HttpClient.getBody(response, PdpState.class)); assertEquals(Status.OK.getStatusCode(), response.getStatus()); } -- cgit 1.2.3-korg