summaryrefslogtreecommitdiffstats
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/activity/DeployActivitySpecs.java2
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csarbin96398 -> 95725 bytes
3 files changed, 14 insertions, 2 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/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index d60c377730..1fda277b6e 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -155,7 +155,7 @@ public class DeployActivitySpecs {
connection.setConnectTimeout(5000);
responseCode = connection.getResponseCode();
} catch (Exception e) {
- logger.warn("Exception on connecting to SDC WFD endpoint: " + e.getMessage());
+ logger.warn("Exception on connecting to SDC WFD endpoint: ", e);
}
if (responseCode == HttpStatus.SC_OK || responseCode == HttpStatus.SC_NOT_FOUND) {
isUp = true;
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar
index d5ea949cdc..b8cc1f3919 100644
--- a/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar
Binary files differ