Merge "add logger messages to pnf flow"
authorRob Daugherty <rd472p@att.com>
Thu, 15 Nov 2018 00:35:06 +0000 (00:35 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 15 Nov 2018 00:35:06 +0000 (00:35 +0000)
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java

index 469069e..8d353f1 100644 (file)
@@ -29,20 +29,23 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
 import org.onap.so.bpmn.common.scripts.ExceptionUtil;
 import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 /**
  * Implementation of "Check AAI for correlation_id" task in CreateAndActivatePnfResource.bpmn
  *
- * Inputs:
- * - correlationId - String
+ * Inputs: - correlationId - String
  *
- * Outputs:
- * - aaiContainsInfoAboutPnf - local Boolean
+ * Outputs: - aaiContainsInfoAboutPnf - local Boolean
  */
 @Component
 public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
+
+    private static final Logger logger = LoggerFactory.getLogger(CheckAaiForCorrelationIdDelegate.class);
+
     private AaiConnection aaiConnection;
 
     @Autowired
@@ -58,6 +61,7 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
         }
         try {
             boolean isEntry = aaiConnection.getEntryFor(correlationId).isPresent();
+            logger.debug("AAI entry is found for pnf correlation id {}: {}", CORRELATION_ID, isEntry);
             execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, isEntry);
         } catch (IOException e) {
             new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage());
index a8754cd..209cbac 100644 (file)
@@ -26,6 +26,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
 import org.onap.aai.domain.yang.Pnf;
 import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -38,6 +40,7 @@ import org.springframework.stereotype.Component;
 @Component
 public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate {
 
+    private static final Logger logger = LoggerFactory.getLogger(CreateAaiEntryWithPnfIdDelegate.class);
     private AaiConnection aaiConnection;
 
     @Autowired
@@ -53,5 +56,6 @@ public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate {
         pnf.setPnfId(correlationId);
         pnf.setPnfName(correlationId);
         aaiConnection.createEntry(correlationId, pnf);
+        logger.debug("AAI entry is created for pnf correlation id: {}", correlationId);
     }
 }
index 373e84b..f290444 100644 (file)
@@ -35,7 +35,8 @@ import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.util.EntityUtils;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Component;
@@ -43,8 +44,7 @@ import org.springframework.stereotype.Component;
 @Component
 public class PnfEventReadyDmaapClient implements DmaapClient {
 
-    private static final MsoLogger LOGGER = MsoLogger
-            .getMsoLogger(MsoLogger.Catalog.RA, PnfEventReadyDmaapClient.class);
+    private static final Logger logger = LoggerFactory.getLogger(PnfEventReadyDmaapClient.class);
 
     private HttpClient httpClient;
     private Map<String, Runnable> pnfCorrelationIdToThreadMap;
@@ -70,7 +70,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
 
     @Override
     public synchronized void registerForUpdate(String correlationId, Runnable informConsumer) {
-        LOGGER.debug("registering for pnf ready dmaap event for correlation id: " + correlationId);
+        logger.debug("registering for pnf ready dmaap event for correlation id: {}", correlationId);
         pnfCorrelationIdToThreadMap.put(correlationId, informConsumer);
         if (!dmaapThreadListenerIsRunning) {
             startDmaapThreadListener();
@@ -79,7 +79,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
 
     @Override
     public synchronized Runnable unregister(String correlationId) {
-        LOGGER.debug("unregistering from pnf ready dmaap event for correlation id: " + correlationId);
+        logger.debug("unregistering from pnf ready dmaap event for correlation id: {}", correlationId);
         Runnable runnable = pnfCorrelationIdToThreadMap.remove(correlationId);
         if (pnfCorrelationIdToThreadMap.isEmpty()) {
             stopDmaapThreadListener();
@@ -111,10 +111,11 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
         @Override
         public void run() {
             try {
+                logger.debug("dmaap listener starts listening pnf ready dmaap topic");
                 HttpResponse response = httpClient.execute(getRequest);
                 getCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfCorrelationIdFound);
             } catch (IOException e) {
-                LOGGER.error("Exception caught during sending rest request to dmaap for listening event topic", e);
+                logger.error("Exception caught during sending rest request to dmaap for listening event topic", e);
             }
         }
 
@@ -131,7 +132,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
         private void informAboutPnfReadyIfCorrelationIdFound(String correlationId) {
             Runnable runnable = unregister(correlationId);
             if (runnable != null) {
-                LOGGER.debug("pnf ready event got from dmaap for correlationId: " + correlationId);
+                logger.debug("dmaap listener gets pnf ready event for correlationId: {}", correlationId);
                 runnable.run();
             }
         }