Fix xacml pdp registration issue
[policy/xacml-pdp.git] / main / src / main / java / org / onap / policy / pdpx / main / startstop / XacmlPdpActivator.java
index 330fbd6..4db11d0 100644 (file)
@@ -98,17 +98,19 @@ public class XacmlPdpActivator extends ServiceManagerContainer {
      * @param topicProperties properties used to configure the topics
      */
     public XacmlPdpActivator(final XacmlPdpParameterGroup xacmlPdpParameterGroup, Properties topicProperties) {
+        LOGGER.info("Activator initializing using {} and {}", xacmlPdpParameterGroup, topicProperties);
+
         TopicEndpoint.manager.addTopicSinks(topicProperties);
         TopicEndpoint.manager.addTopicSources(topicProperties);
 
         try {
-            TopicSinkClient sinkClient = new TopicSinkClient(TOPIC);
+            final TopicSinkClient sinkClient = new TopicSinkClient(TOPIC);
+            this.message = new XacmlPdpMessage();
             this.xacmlPdpParameterGroup = xacmlPdpParameterGroup;
             this.msgDispatcher = new MessageTypeDispatcher(MSG_TYPE_NAMES);
-            this.pdpStateChangeListener = new XacmlPdpStateChangeListener(sinkClient);
-            this.pdpUpdateListener = new XacmlPdpUpdateListener(sinkClient);
+            this.pdpStateChangeListener = new XacmlPdpStateChangeListener(sinkClient, message);
+            this.pdpUpdateListener = new XacmlPdpUpdateListener(sinkClient, message);
             this.register = new XacmlPdpPapRegistration(sinkClient);
-            this.message = new XacmlPdpMessage();
         } catch (RuntimeException | TopicSinkClientException e) {
             throw new PolicyXacmlPdpRuntimeException(e.getMessage(), e);
         }
@@ -152,10 +154,10 @@ public class XacmlPdpActivator extends ServiceManagerContainer {
 
         addAction("Initial Registration with PAP",
             () -> {
-                register.pdpRegistration(message.formatStatusMessage(PdpState.PASSIVE));
+                register.pdpRegistration(message.formatInitialStatusMessage(PdpState.PASSIVE));
             },
             () -> {
-                register.pdpRegistration(message.formatStatusMessage(PdpState.TERMINATED));
+                register.pdpRegistration(message.formatInitialStatusMessage(PdpState.TERMINATED));
             });
         // @formatter:on