aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java14
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java8
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java2
4 files changed, 19 insertions, 7 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
index e00bb1eb36..ecffb683ca 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
@@ -22,16 +22,21 @@
package org.onap.so.asdc;
+import java.security.SecureRandom;
import javax.annotation.PreDestroy;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.asdc.client.ASDCController;
import org.onap.so.asdc.client.exceptions.ASDCControllerException;
+import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.ScheduledTasksMDCSetup;
+import org.onap.so.utils.Components;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
-import java.security.SecureRandom;
@Component
@@ -42,12 +47,16 @@ public class ASDCControllerSingleton {
private final ASDCController asdcController;
@Autowired
+ private ScheduledTasksMDCSetup scheduledMDCSetup;
+
+ @Autowired
public ASDCControllerSingleton(final ASDCController asdcController) {
this.asdcController = asdcController;
}
@Scheduled(fixedRate = 50000)
public void periodicControllerTask() {
+ scheduledMDCSetup.mdcSetup(Components.ASDC_CONTROLLER, "periodicControllerTask");
try {
final int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
asdcController.setControllerName("mso-controller" + randomNumber);
@@ -57,8 +66,11 @@ public class ASDCControllerSingleton {
asdcController.initASDC();
}
} catch (final ASDCControllerException controllerException) {
+ scheduledMDCSetup.errorMDCSetup(ErrorCode.UnknownError, controllerException.getMessage());
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString());
logger.error("Exception occurred", controllerException);
}
+ scheduledMDCSetup.exitAndClearMDC();
}
@PreDestroy
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index 37f6462bba..f64adfd760 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -688,7 +688,7 @@ public class ASDCController {
iNotif.getDistributionID());
logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Database concurrency exception: ", "ASDC", "treatNotification",
- ErrorCode.BusinessProcesssError.getValue(), "RuntimeException in treatNotification", e);
+ ErrorCode.BusinessProcessError.getValue(), "RuntimeException in treatNotification", e);
} catch (Exception e) {
logger.error("", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
@@ -823,7 +823,7 @@ public class ASDCController {
} catch (ASDCDownloadException | UnsupportedEncodingException e) {
logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during Installation of artifact", "ASDC", "processResourceNotification",
- ErrorCode.BusinessProcesssError.getValue(), "Exception in processResourceNotification", e);
+ ErrorCode.BusinessProcessError.getValue(), "Exception in processResourceNotification", e);
}
}
@@ -869,7 +869,7 @@ public class ASDCController {
} catch (Exception e) {
logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during processCsarServiceArtifacts", "ASDC",
- "processCsarServiceArtifacts", ErrorCode.BusinessProcesssError.getValue(),
+ "processCsarServiceArtifacts", ErrorCode.BusinessProcessError.getValue(),
"Exception in processCsarServiceArtifacts", e);
}
} else if (artifact.getArtifactType().equals(ASDCConfiguration.WORKFLOW)) {
@@ -890,7 +890,7 @@ public class ASDCController {
logger.info("Whats the error {}", e.getMessage());
logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during processCsarServiceArtifacts", "ASDC",
- "processCsarServiceArtifacts", ErrorCode.BusinessProcesssError.getValue(),
+ "processCsarServiceArtifacts", ErrorCode.BusinessProcessError.getValue(),
"Exception in processCsarServiceArtifacts", e);
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
index 24e1887847..a9d06d8e82 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
@@ -138,7 +138,7 @@ public class ASDCRestInterface {
logger.info("Error caught " + e.getMessage());
logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION.toString(),
"Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService",
- ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e);
+ ErrorCode.BusinessProcessError.getValue(), "Exception in invokeASDCService", e);
}
return null;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
index c49cb3e50f..3f1b080ec1 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
@@ -152,7 +152,7 @@ public class ToscaResourceStructure {
logger.debug(e.getMessage(), e);
logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC",
- "processResourceNotification", ErrorCode.BusinessProcesssError.getValue(),
+ "processResourceNotification", ErrorCode.BusinessProcessError.getValue(),
"Exception in " + "processResourceNotification", e);
throw new ASDCDownloadException("Exception caught when passing the csar file to the parser ", e);