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.endpoints.properties.PolicyEndPointProperties;
import org.onap.policy.common.gson.GsonMessageBodyHandler;
@Override
public boolean start() {
try {
- servers = HttpServletServer.factory.build(getServerProperties());
+ servers = HttpServletServerFactoryInstance.getServerFactory().build(getServerProperties());
for (final HttpServletServer server : servers) {
if (server.isAaf()) {
server.addFilterClass(null, PapAafFilter.class.getName());
import java.util.Arrays;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicReference;
-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.listeners.MessageTypeDispatcher;
import org.onap.policy.common.endpoints.listeners.RequestIdDispatcher;
public PapActivator(final PapParameterGroup papParameterGroup, final Properties topicProperties) {
super("Policy PAP");
- TopicEndpoint.manager.addTopicSinks(topicProperties);
- TopicEndpoint.manager.addTopicSources(topicProperties);
+ TopicEndpointManager.getManager().addTopicSinks(topicProperties);
+ TopicEndpointManager.getManager().addTopicSources(topicProperties);
try {
this.papParameterGroup = papParameterGroup;
this::unregisterMsgDispatcher);
addAction("topics",
- TopicEndpoint.manager::start,
- TopicEndpoint.manager::shutdown);
+ TopicEndpointManager.getManager()::start,
+ TopicEndpointManager.getManager()::shutdown);
addAction("PAP statistics",
() -> Registry.register(PapConstants.REG_STATISTICS_MANAGER, new PapStatisticsManager()),
* Registers the dispatcher with the topic source(s).
*/
private void registerMsgDispatcher() {
- for (final TopicSource source : TopicEndpoint.manager
+ for (final TopicSource source : TopicEndpointManager.getManager()
.getTopicSources(Arrays.asList(PapConstants.TOPIC_POLICY_PDP_PAP))) {
source.register(msgDispatcher);
}
* Unregisters the dispatcher from the topic source(s).
*/
private void unregisterMsgDispatcher() {
- for (final TopicSource source : TopicEndpoint.manager
+ for (final TopicSource source : TopicEndpointManager.getManager()
.getTopicSources(Arrays.asList(PapConstants.TOPIC_POLICY_PDP_PAP))) {
source.unregister(msgDispatcher);
}
import org.junit.BeforeClass;
import org.junit.Test;
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.TopicListener;
import org.onap.policy.common.endpoints.utils.ParameterUtils;
import org.onap.policy.common.utils.coder.Coder;
final PapCommandLineArguments arguments = new PapCommandLineArguments(papConfigParameters);
final PapParameterGroup parameterGroup = new PapParameterHandler().getParameters(arguments);
Properties props = ParameterUtils.getTopicProperties(parameterGroup.getTopicParameterGroup());
- TopicEndpoint.manager.shutdown();
+ TopicEndpointManager.getManager().shutdown();
- TopicEndpoint.manager.addTopics(props);
- TopicEndpoint.manager.start();
+ TopicEndpointManager.getManager().addTopics(props);
+ TopicEndpointManager.getManager().start();
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
- TopicEndpoint.manager.shutdown();
+ TopicEndpointManager.getManager().shutdown();
}
/**
pub = new Publisher(PapConstants.TOPIC_POLICY_PDP_PAP);
listener = new MyListener();
- TopicEndpoint.manager.getNoopTopicSink(PapConstants.TOPIC_POLICY_PDP_PAP).register(listener);
+ TopicEndpointManager.getManager().getNoopTopicSink(PapConstants.TOPIC_POLICY_PDP_PAP).register(listener);
}
/**
*/
@After
public void tearDown() throws Exception {
- TopicEndpoint.manager.getNoopTopicSink(PapConstants.TOPIC_POLICY_PDP_PAP).unregister(listener);
+ TopicEndpointManager.getManager().getNoopTopicSink(PapConstants.TOPIC_POLICY_PDP_PAP).unregister(listener);
super.tearDown();
}
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
-import org.onap.policy.common.endpoints.event.comm.TopicEndpoint;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
+import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
+import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.gson.GsonMessageBodyHandler;
import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.common.utils.services.Registry;
makeConfigFile();
- HttpServletServer.factory.destroy();
- TopicEndpoint.manager.shutdown();
+ HttpServletServerFactoryInstance.getServerFactory().destroy();
+ TopicEndpointManager.getManager().shutdown();
CommonTestData.newDb();
import java.util.concurrent.LinkedBlockingQueue;
import lombok.Getter;
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.TopicListener;
import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicSource;
import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher;
* Constructs the object.
*/
public End2EndContext() {
- toPapTopic = TopicEndpoint.manager.getNoopTopicSource(PapConstants.TOPIC_POLICY_PDP_PAP);
+ toPapTopic = TopicEndpointManager.getManager().getNoopTopicSource(PapConstants.TOPIC_POLICY_PDP_PAP);
- TopicEndpoint.manager.getNoopTopicSink(PapConstants.TOPIC_POLICY_PDP_PAP).register(topicListener);
+ TopicEndpointManager.getManager().getNoopTopicSink(PapConstants.TOPIC_POLICY_PDP_PAP).register(topicListener);
dispatcher = new MessageTypeDispatcher("messageName");
dispatcher.register(PdpMessageType.PDP_UPDATE.name(), new UpdateListener());
toPap.clear();
pdps.forEach(pdp -> toPap.add(DONE));
- TopicEndpoint.manager.getNoopTopicSink(PapConstants.TOPIC_POLICY_PDP_PAP).unregister(topicListener);
+ TopicEndpointManager.getManager().getNoopTopicSink(PapConstants.TOPIC_POLICY_PDP_PAP).unregister(topicListener);
}
/**
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
+import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.pap.main.PapConstants;
import org.onap.policy.pap.main.PolicyPapException;
@Before
public void setUp() {
Registry.newRegistry();
- HttpServletServer.factory.destroy();
+ HttpServletServerFactoryInstance.getServerFactory().destroy();
}
/**
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
+import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.endpoints.utils.ParameterUtils;
import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.pap.main.PapConstants;
@Before
public void setUp() throws Exception {
Registry.newRegistry();
- HttpServletServer.factory.destroy();
+ HttpServletServerFactoryInstance.getServerFactory().destroy();
final String[] papConfigParameters = {"-c", "parameters/PapConfigParameters.json"};
final PapCommandLineArguments arguments = new PapCommandLineArguments(papConfigParameters);