summaryrefslogtreecommitdiffstats
path: root/feature-lifecycle/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-07-08 10:21:36 -0400
committerJim Hahn <jrh3@att.com>2019-07-08 15:51:01 -0400
commita593d0931f9a5785572bb52c5dfae32faa5d8116 (patch)
tree5b8aac486241678b83afd744868e1bb01d7670a2 /feature-lifecycle/src
parentf1d4f751519980c7683538b3530f9c3661093c6c (diff)
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 <jrh3@att.com>
Diffstat (limited to 'feature-lifecycle/src')
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java6
-rw-r--r--feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java18
2 files changed, 13 insertions, 11 deletions
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<TopicSource> sources = TopicEndpoint.manager.addTopicSources(properties);
+ List<TopicSource> sources = TopicEndpointManager.getManager().addTopicSources(properties);
if (sources.isEmpty()) {
return false;
}
@@ -369,7 +369,7 @@ public class LifecycleFsm implements Startable {
}
private boolean sink() {
- List<TopicSink> sinks = TopicEndpoint.manager.addTopicSinks(properties);
+ List<TopicSink> 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());
}