diff options
author | mmis <michael.morris@ericsson.com> | 2018-07-30 19:24:09 +0100 |
---|---|---|
committer | mmis <michael.morris@ericsson.com> | 2018-07-30 19:31:55 +0100 |
commit | 7e80f2ce69d5d16224ffcbfa424836a035a26878 (patch) | |
tree | be8212c72fd604e6765aca410a2cbd2807b54e72 /policy-management/src | |
parent | 64f53ef14f5a9ea98208fd2b835bfb01fda9a5f9 (diff) |
Copy policy-endpoints from drools-pdp to common
Issue-ID: POLICY-967
Change-Id: Ib19d3a89ffa328c39f7871bff59efb3dd1617f7a
Signed-off-by: mmis <michael.morris@ericsson.com>
Diffstat (limited to 'policy-management/src')
7 files changed, 64 insertions, 89 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java index 26bed5e4..00da884e 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java +++ b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java @@ -53,7 +53,6 @@ import org.onap.policy.common.endpoints.event.comm.bus.DmaapTopicSource; import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicSink; import org.onap.policy.common.endpoints.event.comm.bus.UebTopicSink; import org.onap.policy.common.endpoints.event.comm.bus.UebTopicSource; -import org.onap.policy.common.endpoints.event.comm.impl.ProxyTopicEndpointManager; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.features.PolicyControllerFeatureAPI; import org.onap.policy.drools.features.PolicyEngineFeatureAPI; @@ -1451,7 +1450,7 @@ public class RestManager { @ApiOperation(value = "Retrieves the managed topics", notes = "Network Topics Aggregation", response = TopicEndpoint.class) public Response topics() { - return Response.status(Response.Status.OK).entity(ProxyTopicEndpointManager.getInstance()).build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager).build(); } @GET @@ -1469,9 +1468,9 @@ public class RestManager { @ApiResponses(value = {@ApiResponse(code = 406, message = "The system is an administrative state that prevents " + "this request to be fulfilled")}) public Response topicsLock() { - final boolean success = ProxyTopicEndpointManager.getInstance().lock(); + final boolean success = TopicEndpoint.manager.lock(); if (success) { - return Response.status(Status.OK).entity(ProxyTopicEndpointManager.getInstance()).build(); + return Response.status(Status.OK).entity(TopicEndpoint.manager).build(); } else { return Response.status(Status.NOT_ACCEPTABLE).entity(new Error("cannot perform operation")).build(); } @@ -1484,9 +1483,9 @@ public class RestManager { @ApiResponses(value = {@ApiResponse(code = 406, message = "The system is an administrative state that prevents " + "this request to be fulfilled")}) public Response topicsUnlock() { - final boolean success = ProxyTopicEndpointManager.getInstance().unlock(); + final boolean success = TopicEndpoint.manager.unlock(); if (success) { - return Response.status(Status.OK).entity(ProxyTopicEndpointManager.getInstance()).build(); + return Response.status(Status.OK).entity(TopicEndpoint.manager).build(); } else { return Response.status(Status.NOT_ACCEPTABLE).entity(new Error("cannot perform operation")).build(); } @@ -1497,8 +1496,7 @@ public class RestManager { @ApiOperation(value = "Retrieves the managed topic sources", notes = "Network Topic Sources Agregation", responseContainer = "List", response = TopicSource.class) public Response sources() { - return Response.status(Response.Status.OK).entity(ProxyTopicEndpointManager.getInstance().getTopicSources()) - .build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getTopicSources()).build(); } @GET @@ -1506,8 +1504,7 @@ public class RestManager { @ApiOperation(value = "Retrieves the managed topic sinks", notes = "Network Topic Sinks Agregation", responseContainer = "List", response = TopicSink.class) public Response sinks() { - return Response.status(Response.Status.OK).entity(ProxyTopicEndpointManager.getInstance().getTopicSinks()) - .build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getTopicSinks()).build(); } @GET @@ -1515,8 +1512,7 @@ public class RestManager { @ApiOperation(value = "Retrieves the UEB managed topic sources", notes = "UEB Topic Sources Agregation", responseContainer = "List", response = UebTopicSource.class) public Response uebSources() { - return Response.status(Response.Status.OK).entity(ProxyTopicEndpointManager.getInstance().getUebTopicSources()) - .build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getUebTopicSources()).build(); } @GET @@ -1524,8 +1520,7 @@ public class RestManager { @ApiOperation(value = "Retrieves the UEB managed topic sinks", notes = "UEB Topic Sinks Agregation", responseContainer = "List", response = UebTopicSink.class) public Response uebSinks() { - return Response.status(Response.Status.OK).entity(ProxyTopicEndpointManager.getInstance().getUebTopicSinks()) - .build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getUebTopicSinks()).build(); } @GET @@ -1533,8 +1528,7 @@ public class RestManager { @ApiOperation(value = "Retrieves the DMaaP managed topic sources", notes = "DMaaP Topic Sources Agregation", responseContainer = "List", response = DmaapTopicSource.class) public Response dmaapSources() { - return Response.status(Response.Status.OK) - .entity(ProxyTopicEndpointManager.getInstance().getDmaapTopicSources()).build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getDmaapTopicSources()).build(); } @GET @@ -1542,8 +1536,7 @@ public class RestManager { @ApiOperation(value = "Retrieves the DMaaP managed topic sinks", notes = "DMaaP Topic Sinks Agregation", responseContainer = "List", response = DmaapTopicSink.class) public Response dmaapSinks() { - return Response.status(Response.Status.OK).entity(ProxyTopicEndpointManager.getInstance().getDmaapTopicSinks()) - .build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getDmaapTopicSinks()).build(); } @GET @@ -1552,8 +1545,7 @@ public class RestManager { notes = "This is an UEB Network Communicaton Endpoint source of messages for the Engine", response = UebTopicSource.class) public Response uebSourceTopic(@ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { - return Response.status(Response.Status.OK) - .entity(ProxyTopicEndpointManager.getInstance().getUebTopicSource(topic)).build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getUebTopicSource(topic)).build(); } @GET @@ -1562,8 +1554,7 @@ public class RestManager { notes = "This is an UEB Network Communicaton Endpoint destination of messages from the Engine", response = UebTopicSink.class) public Response uebSinkTopic(@ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { - return Response.status(Response.Status.OK) - .entity(ProxyTopicEndpointManager.getInstance().getUebTopicSink(topic)).build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getUebTopicSink(topic)).build(); } @GET @@ -1573,8 +1564,7 @@ public class RestManager { response = DmaapTopicSource.class) public Response dmaapSourceTopic( @ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { - return Response.status(Response.Status.OK) - .entity(ProxyTopicEndpointManager.getInstance().getDmaapTopicSource(topic)).build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getDmaapTopicSource(topic)).build(); } @GET @@ -1583,8 +1573,7 @@ public class RestManager { notes = "This is a DMaaP Network Communicaton Endpoint destination of messages from the Engine", response = DmaapTopicSink.class) public Response dmaapSinkTopic(@ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { - return Response.status(Response.Status.OK) - .entity(ProxyTopicEndpointManager.getInstance().getDmaapTopicSink(topic)).build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getDmaapTopicSink(topic)).build(); } @GET @@ -1594,9 +1583,7 @@ public class RestManager { responseContainer = "List") public Response uebSourceEvents(@ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { return Response.status(Status.OK) - .entity(Arrays - .asList(ProxyTopicEndpointManager.getInstance().getUebTopicSource(topic).getRecentEvents())) - .build(); + .entity(Arrays.asList(TopicEndpoint.manager.getUebTopicSource(topic).getRecentEvents())).build(); } @GET @@ -1606,8 +1593,7 @@ public class RestManager { responseContainer = "List") public Response uebSinkEvents(@ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { return Response.status(Status.OK) - .entity(Arrays.asList(ProxyTopicEndpointManager.getInstance().getUebTopicSink(topic).getRecentEvents())) - .build(); + .entity(Arrays.asList(TopicEndpoint.manager.getUebTopicSink(topic).getRecentEvents())).build(); } @GET @@ -1618,9 +1604,7 @@ public class RestManager { public Response dmaapSourceEvents( @ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { return Response.status(Status.OK) - .entity(Arrays - .asList(ProxyTopicEndpointManager.getInstance().getDmaapTopicSource(topic).getRecentEvents())) - .build(); + .entity(Arrays.asList(TopicEndpoint.manager.getDmaapTopicSource(topic).getRecentEvents())).build(); } @GET @@ -1630,9 +1614,7 @@ public class RestManager { responseContainer = "List") public Response dmaapSinkEvents(@PathParam("topic") String topic) { return Response.status(Status.OK) - .entity(Arrays - .asList(ProxyTopicEndpointManager.getInstance().getDmaapTopicSink(topic).getRecentEvents())) - .build(); + .entity(Arrays.asList(TopicEndpoint.manager.getDmaapTopicSink(topic).getRecentEvents())).build(); } @GET @@ -1640,8 +1622,7 @@ public class RestManager { @ApiOperation(value = "Retrieves the NOOP managed topic sinks", notes = "NOOP Topic Sinks Agregation", responseContainer = "List", response = NoopTopicSink.class) public Response noopSinks() { - return Response.status(Response.Status.OK).entity(ProxyTopicEndpointManager.getInstance().getNoopTopicSinks()) - .build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getNoopTopicSinks()).build(); } @GET @@ -1649,8 +1630,7 @@ public class RestManager { @ApiOperation(value = "Retrieves a NOOP managed topic sink", notes = "NOOP is an dev/null Network Communicaton Sink", response = NoopTopicSink.class) public Response noopSinkTopic(@ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { - return Response.status(Response.Status.OK) - .entity(ProxyTopicEndpointManager.getInstance().getNoopTopicSink(topic)).build(); + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getNoopTopicSink(topic)).build(); } @GET @@ -1659,9 +1639,7 @@ public class RestManager { notes = "NOOP is an dev/null Network Communicaton Sink", responseContainer = "List") public Response noopSinkEvents(@PathParam("topic") String topic) { return Response.status(Status.OK) - .entity(Arrays - .asList(ProxyTopicEndpointManager.getInstance().getNoopTopicSink(topic).getRecentEvents())) - .build(); + .entity(Arrays.asList(TopicEndpoint.manager.getNoopTopicSink(topic).getRecentEvents())).build(); } @GET @@ -1678,7 +1656,7 @@ public class RestManager { @ApiResponses(value = {@ApiResponse(code = 406, message = "The system is an administrative state that prevents " + "this request to be fulfilled")}) public Response uebTopicLock(@ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { - final UebTopicSource source = ProxyTopicEndpointManager.getInstance().getUebTopicSource(topic); + final UebTopicSource source = TopicEndpoint.manager.getUebTopicSource(topic); final boolean success = source.lock(); if (success) { return Response.status(Status.OK).entity(source).build(); @@ -1693,7 +1671,7 @@ public class RestManager { @ApiResponses(value = {@ApiResponse(code = 406, message = "The system is an administrative state that prevents " + "this request to be fulfilled")}) public Response uebTopicUnlock(@ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { - final UebTopicSource source = ProxyTopicEndpointManager.getInstance().getUebTopicSource(topic); + final UebTopicSource source = TopicEndpoint.manager.getUebTopicSource(topic); final boolean success = source.unlock(); if (success) { return Response.status(Status.OK).entity(source).build(); @@ -1720,7 +1698,7 @@ public class RestManager { @ApiResponses(value = {@ApiResponse(code = 406, message = "The system is an administrative state that prevents " + "this request to be fulfilled")}) public Response dmmapTopicLock(@ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { - final DmaapTopicSource source = ProxyTopicEndpointManager.getInstance().getDmaapTopicSource(topic); + final DmaapTopicSource source = TopicEndpoint.manager.getDmaapTopicSource(topic); final boolean success = source.lock(); if (success) { return Response.status(Status.OK).entity(source).build(); @@ -1736,7 +1714,7 @@ public class RestManager { message = "The system is an administrative state that prevents " + "this request to be fulfilled")}) public Response dmaapTopicUnlock( @ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { - final DmaapTopicSource source = ProxyTopicEndpointManager.getInstance().getDmaapTopicSource(topic); + final DmaapTopicSource source = TopicEndpoint.manager.getDmaapTopicSource(topic); final boolean success = source.unlock(); if (success) { return Response.status(Status.OK).entity(source).build(); @@ -1757,12 +1735,11 @@ public class RestManager { public Response uebOffer(@ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic, @ApiParam(value = "Network Message", required = true) String json) { try { - final UebTopicSource uebReader = ProxyTopicEndpointManager.getInstance().getUebTopicSource(topic); + final UebTopicSource uebReader = TopicEndpoint.manager.getUebTopicSource(topic); final boolean success = uebReader.offer(json); if (success) { return Response.status(Status.OK) - .entity(Arrays.asList( - ProxyTopicEndpointManager.getInstance().getUebTopicSource(topic).getRecentEvents())) + .entity(Arrays.asList(TopicEndpoint.manager.getUebTopicSource(topic).getRecentEvents())) .build(); } else { return Response.status(Status.NOT_ACCEPTABLE).entity(new Error("Failure to inject event over " + topic)) @@ -1797,12 +1774,11 @@ public class RestManager { public Response dmaapOffer(@ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic, @ApiParam(value = "Network Message", required = true) String json) { try { - final DmaapTopicSource dmaapReader = ProxyTopicEndpointManager.getInstance().getDmaapTopicSource(topic); + final DmaapTopicSource dmaapReader = TopicEndpoint.manager.getDmaapTopicSource(topic); final boolean success = dmaapReader.offer(json); if (success) { return Response.status(Status.OK) - .entity(Arrays.asList( - ProxyTopicEndpointManager.getInstance().getDmaapTopicSource(topic).getRecentEvents())) + .entity(Arrays.asList(TopicEndpoint.manager.getDmaapTopicSource(topic).getRecentEvents())) .build(); } else { return Response.status(Status.NOT_ACCEPTABLE).entity(new Error("Failure to inject event over " + topic)) diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java index 71c509c2..4be85022 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java @@ -33,12 +33,11 @@ import org.onap.policy.common.capabilities.Lockable; import org.onap.policy.common.capabilities.Startable; import org.onap.policy.common.endpoints.event.comm.Topic; 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.TopicListener; 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.impl.ProxyTopicEndpointManager; import org.onap.policy.common.endpoints.http.server.HttpServletServer; -import org.onap.policy.common.endpoints.http.server.impl.IndexedHttpServletServerFactory; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.core.PolicyContainer; @@ -499,7 +498,7 @@ class PolicyEngineManager implements PolicyEngine { this.properties = properties; try { - this.sources = ProxyTopicEndpointManager.getInstance().addTopicSources(properties); + this.sources = TopicEndpoint.manager.addTopicSources(properties); for (final TopicSource source : this.sources) { source.register(this); } @@ -508,13 +507,13 @@ class PolicyEngineManager implements PolicyEngine { } try { - this.sinks = ProxyTopicEndpointManager.getInstance().addTopicSinks(properties); + this.sinks = TopicEndpoint.manager.addTopicSinks(properties); } catch (final IllegalArgumentException e) { logger.error("{}: add-sinks failed", this, e); } try { - this.httpServers = IndexedHttpServletServerFactory.getInstance().build(properties); + this.httpServers = HttpServletServer.factory.build(properties); } catch (final IllegalArgumentException e) { logger.error("{}: add-http-servers failed", this, e); } @@ -817,7 +816,7 @@ class PolicyEngineManager implements PolicyEngine { /* Start managed Topic Endpoints */ try { - if (!ProxyTopicEndpointManager.getInstance().start()) { + if (!TopicEndpoint.manager.start()) { success = false; } } catch (final IllegalStateException e) { @@ -903,7 +902,7 @@ class PolicyEngineManager implements PolicyEngine { } /* stop all managed topics sources and sinks */ - if (!ProxyTopicEndpointManager.getInstance().stop()) { + if (!TopicEndpoint.manager.stop()) { success = false; } @@ -1009,8 +1008,8 @@ class PolicyEngineManager implements PolicyEngine { /* Shutdown managed resources */ PolicyController.factory.shutdown(); - ProxyTopicEndpointManager.getInstance().shutdown(); - IndexedHttpServletServerFactory.getInstance().destroy(); + TopicEndpoint.manager.shutdown(); + HttpServletServer.factory.destroy(); // Stop the JMX listener @@ -1069,7 +1068,7 @@ class PolicyEngineManager implements PolicyEngine { } } - success = ProxyTopicEndpointManager.getInstance().lock() && success; + success = TopicEndpoint.manager.lock() && success; /* policy-engine dispatch post lock hook */ for (final PolicyEngineFeatureAPI feature : PolicyEngineFeatureAPI.providers.getList()) { @@ -1119,7 +1118,7 @@ class PolicyEngineManager implements PolicyEngine { } } - success = ProxyTopicEndpointManager.getInstance().unlock() && success; + success = TopicEndpoint.manager.unlock() && success; /* policy-engine dispatch after unlock hook */ for (final PolicyEngineFeatureAPI feature : PolicyEngineFeatureAPI.providers.getList()) { @@ -1255,7 +1254,7 @@ class PolicyEngineManager implements PolicyEngine { throw new IllegalStateException(ENGINE_LOCKED_MSG); } - final List<? extends TopicSink> topicSinks = ProxyTopicEndpointManager.getInstance().getTopicSinks(topic); + final List<? extends TopicSink> topicSinks = TopicEndpoint.manager.getTopicSinks(topic); if (topicSinks == null || topicSinks.isEmpty() || topicSinks.size() > 1) { throw new IllegalStateException("Cannot ensure correct delivery on topic " + topic + ": " + topicSinks); } @@ -1376,7 +1375,7 @@ class PolicyEngineManager implements PolicyEngine { } try { - final TopicSink sink = ProxyTopicEndpointManager.getInstance().getTopicSink(busType, topic); + final TopicSink sink = TopicEndpoint.manager.getTopicSink(busType, topic); if (sink == null) { throw new IllegalStateException("Inconsistent State: " + this); diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java b/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java index 41408258..5172fc3d 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java @@ -27,10 +27,10 @@ import java.util.List; import java.util.Properties; import org.onap.policy.common.endpoints.event.comm.Topic; +import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; import org.onap.policy.common.endpoints.event.comm.TopicListener; 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.impl.ProxyTopicEndpointManager; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.features.PolicyControllerFeatureAPI; import org.onap.policy.drools.persistence.SystemPersistence; @@ -115,8 +115,8 @@ public class AggregatedPolicyController implements PolicyController, TopicListen // Create/Reuse Readers/Writers for all event sources endpoints - this.sources = ProxyTopicEndpointManager.getInstance().addTopicSources(properties); - this.sinks = ProxyTopicEndpointManager.getInstance().addTopicSinks(properties); + this.sources = TopicEndpoint.manager.addTopicSources(properties); + this.sinks = TopicEndpoint.manager.addTopicSinks(properties); initDrools(properties); initSinks(); diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java index a23820cf..b42c64b1 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java @@ -26,7 +26,7 @@ import static org.junit.Assert.assertTrue; import java.util.Properties; import org.junit.Test; -import org.onap.policy.common.endpoints.event.comm.impl.ProxyTopicEndpointManager; +import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.drools.protocol.configuration.DroolsConfiguration; @@ -82,7 +82,7 @@ public class EventProtocolCoderTest { final Properties noopSinkProperties = new Properties(); noopSinkProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); - ProxyTopicEndpointManager.getInstance().addTopicSinks(noopSinkProperties); + TopicEndpoint.manager.addTopicSinks(noopSinkProperties); EventProtocolCoder.manager.addEncoder(ENCODER_GROUP, ENCODER_ARTIFACT, NOOP_TOPIC, DroolsConfiguration.class.getCanonicalName(), new JsonProtocolFilter(), null, null, diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java index 02b09bb1..aa04f407 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java @@ -36,8 +36,8 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.kie.api.builder.ReleaseId; +import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.impl.ProxyTopicEndpointManager; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.controller.internal.MavenDroolsControllerTest; @@ -242,7 +242,7 @@ public class ProtocolCoderToolsetTest { Properties sinkConfig = new Properties(); sinkConfig.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, JUNIT_PROTOCOL_CODER_TOPIC); - List<? extends TopicSink> noopTopics = ProxyTopicEndpointManager.getInstance().addTopicSinks(sinkConfig); + List<? extends TopicSink> noopTopics = TopicEndpoint.manager.addTopicSinks(sinkConfig); Properties droolsControllerConfig = new Properties(); droolsControllerConfig.put(DroolsProperties.RULES_GROUPID, releaseId.getGroupId()); diff --git a/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java b/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java index 0f57cd97..e96a4b91 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java @@ -43,7 +43,7 @@ import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; -import org.onap.policy.common.endpoints.event.comm.impl.ProxyTopicEndpointManager; +import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.drools.persistence.SystemPersistence; import org.onap.policy.drools.system.PolicyController; @@ -65,10 +65,10 @@ public class RestManagerTest { private static final String UEB_SOURCE_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS + "." + UEB_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; - private static final String UEB_SINK_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." + UEB_TOPIC - + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; - private static final String DMAAP_SOURCE_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." - + DMAAP_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; + private static final String UEB_SINK_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." + + UEB_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; + private static final String DMAAP_SOURCE_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + + "." + DMAAP_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; private static final String DMAAP_SINK_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." + DMAAP_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; private static final String UEB_SERVER = "localhost"; @@ -81,10 +81,10 @@ public class RestManagerTest { private static final String DMAAP_SOURCE_PASSWD_KEY = PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + DMAAP_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_AAF_PASSWORD_SUFFIX; - private static final String DMAAP_SINK_MECHID_KEY = PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." + DMAAP_TOPIC - + PolicyEndPointProperties.PROPERTY_TOPIC_AAF_MECHID_SUFFIX; - private static final String DMAAP_SINK_PASSWD_KEY = PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." + DMAAP_TOPIC - + PolicyEndPointProperties.PROPERTY_TOPIC_AAF_PASSWORD_SUFFIX; + private static final String DMAAP_SINK_MECHID_KEY = PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." + + DMAAP_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_AAF_MECHID_SUFFIX; + private static final String DMAAP_SINK_PASSWD_KEY = PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." + + DMAAP_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_AAF_PASSWORD_SUFFIX; private static final String FOO_CONTROLLER_FILE = FOO_CONTROLLER + "-controller.properties"; @@ -137,7 +137,7 @@ public class RestManagerTest { public static void tearDown() throws IOException, InterruptedException { /* Shutdown managed resources */ PolicyController.factory.shutdown(); - ProxyTopicEndpointManager.getInstance().shutdown(); + TopicEndpoint.manager.shutdown(); PolicyEngine.manager.stop(); Thread.sleep(10000L); client.close(); diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/test/PolicyEngineTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/test/PolicyEngineTest.java index 88d25563..c6a4ffb8 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/test/PolicyEngineTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/test/PolicyEngineTest.java @@ -34,9 +34,9 @@ import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; +import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.bus.impl.IndexedNoopTopicSinkFactory; -import org.onap.policy.common.endpoints.event.comm.impl.ProxyTopicEndpointManager; +import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicSink; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.drools.persistence.SystemPersistence; import org.onap.policy.drools.properties.DroolsProperties; @@ -198,7 +198,7 @@ public class PolicyEngineTest { final Properties noopSinkProperties = new Properties(); noopSinkProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); - ProxyTopicEndpointManager.getInstance().addTopicSinks(noopSinkProperties).get(0).start(); + TopicEndpoint.manager.addTopicSinks(noopSinkProperties).get(0).start(); EventProtocolCoder.manager.addEncoder(ENCODER_GROUP, ENCODER_ARTIFACT, NOOP_TOPIC, DroolsConfiguration.class.getCanonicalName(), new JsonProtocolFilter(), null, null, @@ -207,7 +207,7 @@ public class PolicyEngineTest { assertTrue(PolicyEngine.manager.deliver(NOOP_TOPIC, new DroolsConfiguration(ENCODER_GROUP, ENCODER_ARTIFACT, ENCODER_VERSION))); - final TopicSink sink = IndexedNoopTopicSinkFactory.getInstance().get(NOOP_TOPIC); + final TopicSink sink = NoopTopicSink.factory.get(NOOP_TOPIC); assertTrue(sink.getRecentEvents()[0].contains(ENCODER_GROUP)); assertTrue(sink.getRecentEvents()[0].contains(ENCODER_ARTIFACT)); @@ -280,7 +280,7 @@ public class PolicyEngineTest { /* Shutdown managed resources */ PolicyController.factory.shutdown(); - ProxyTopicEndpointManager.getInstance().shutdown(); + TopicEndpoint.manager.shutdown(); PolicyEngine.manager.stop(); Thread.sleep(10000L); |