aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test/java/org
diff options
context:
space:
mode:
authorBhatt, Prema <prema.bhatt@att.com>2019-08-15 15:54:22 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2019-08-15 15:54:23 -0400
commit185461225e4a1fb6f2ad1624931de3164e834e9c (patch)
treef2211eae60321c9037228eda9995d45979d7209a /asdc-controller/src/test/java/org
parente536a1035d0f224de32f76a1226c772b8f8d7c01 (diff)
asdc controller treat distributionid as requestid
Setting RequestId in MDC using DistributionID value in ASDC-controller Setting RequestId in MDC using DistributionID value in ASDC-controller. Cleaned up code. Removing the log line as per the review comments. Issue-ID: SO-2231 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I07880a80d479ad01411e0c5ece12d77722b8cb6c
Diffstat (limited to 'asdc-controller/src/test/java/org')
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java
index 0681cd8aed..055968cc95 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java
@@ -33,6 +33,7 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.asdc.BaseTest;
import org.onap.so.asdc.client.exceptions.ASDCControllerException;
import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl;
@@ -55,6 +56,7 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@@ -277,6 +279,35 @@ public class ASDCControllerITTest extends BaseTest {
}
}
+ /**
+ * Test to check RequestId is being set using the DistributionID.
+ */
+ @Test
+ public void treatNotification_verifyRequestID() {
+
+ String serviceUuid = "efaea486-561f-4159-9191-a8d3cb346728";
+ String serviceInvariantUuid = "f2edfbf4-bb0a-4fe7-a57a-71362d4b0b23";
+ distributionId = "bb15de12-166d-4e45-9e5f-4b3f25200d7b";
+
+ initMockAaiServer(serviceUuid, serviceInvariantUuid);
+
+ NotificationDataImpl notificationData = new NotificationDataImpl();
+ notificationData.setServiceUUID(serviceUuid);
+ notificationData.setDistributionID(distributionId);
+ notificationData.setServiceInvariantUUID(serviceInvariantUuid);
+ notificationData.setServiceVersion("1.0");
+
+ try {
+ asdcController.treatNotification(notificationData);
+ logger.info("Verify RequestId : {}", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ assertEquals("bb15de12-166d-4e45-9e5f-4b3f25200d7b", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+
+ } catch (Exception e) {
+ logger.info(e.getMessage(), e);
+ fail(e.getMessage());
+ }
+ }
+
private ArtifactInfoImpl constructPnfServiceArtifact() {
ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl();
artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR);