aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/impl/JobWorker.java30
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java2
3 files changed, 22 insertions, 14 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt
index a266dd002..97c9f99ce 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt
@@ -23,7 +23,6 @@ package org.onap.vid.job.command
import com.fasterxml.jackson.module.kotlin.convertValue
import org.apache.commons.lang3.ObjectUtils.defaultIfNull
-import org.onap.logging.ref.slf4j.ONAPLogConstants
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate
import org.onap.vid.changeManagement.RequestDetailsWrapper
import org.onap.vid.exceptions.AbortingException
@@ -38,7 +37,6 @@ import org.onap.vid.mso.RestMsoImplementation
import org.onap.vid.mso.model.ModelInfo
import org.onap.vid.utils.JACKSON_OBJECT_MAPPER
import org.onap.vid.utils.getEnumFromMapOfStrings
-import org.slf4j.MDC
import org.springframework.http.HttpMethod
import java.util.*
@@ -362,8 +360,6 @@ abstract class ResourceCommand(
}
protected fun executeAndHandleMsoInstanceRequest(restCallPlan: MsoRestCallPlan): JobStatus {
- //make sure requestIds are unique
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, UUID.randomUUID().toString())
val msoResponse = restMso.restCall(
restCallPlan.httpMethod,
RequestReferencesContainer::class.java,
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/impl/JobWorker.java b/vid-app-common/src/main/java/org/onap/vid/job/impl/JobWorker.java
index 0b277b4d2..80d8cc53c 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/impl/JobWorker.java
+++ b/vid-app-common/src/main/java/org/onap/vid/job/impl/JobWorker.java
@@ -20,23 +20,28 @@
package org.onap.vid.job.impl;
+import static org.onap.vid.job.Job.JobStatus.FAILED;
+import static org.onap.vid.job.Job.JobStatus.STOPPED;
+import static org.onap.vid.job.command.ResourceCommandKt.ACTION_PHASE;
+import static org.onap.vid.job.command.ResourceCommandKt.INTERNAL_STATE;
+
+import java.util.Optional;
+import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.onap.vid.job.*;
+import org.onap.vid.job.Job;
+import org.onap.vid.job.JobCommand;
+import org.onap.vid.job.JobException;
+import org.onap.vid.job.JobsBrokerService;
+import org.onap.vid.job.NextCommand;
import org.onap.vid.job.command.JobCommandFactory;
import org.quartz.JobExecutionContext;
+import org.slf4j.MDC;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;
-import java.util.Optional;
-import java.util.UUID;
-
-import static org.onap.vid.job.Job.JobStatus.FAILED;
-import static org.onap.vid.job.Job.JobStatus.STOPPED;
-import static org.onap.vid.job.command.ResourceCommandKt.ACTION_PHASE;
-import static org.onap.vid.job.command.ResourceCommandKt.INTERNAL_STATE;
-
@Component
public class JobWorker extends QuartzJobBean {
@@ -80,6 +85,8 @@ public class JobWorker extends QuartzJobBean {
}
protected Job executeJobAndGetNext(Job job) {
+ setThreadWithRandomRequestId();
+
Object internalState = job.getData().get(INTERNAL_STATE);
Object actionPhase = job.getData().get(ACTION_PHASE);
LOGGER.debug(EELFLoggerDelegate.debugLogger, "going to execute job {} of {}: {}/{} {}/{}",
@@ -96,6 +103,11 @@ public class JobWorker extends QuartzJobBean {
return setNextCommandInJob(nextCommand, job);
}
+ private void setThreadWithRandomRequestId() {
+ //make sure requestIds in outgoing requests are not reused
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, UUID.randomUUID().toString());
+ }
+
private NextCommand executeCommandAndGetNext(Job job) {
NextCommand nextCommand;
try {
diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java
index c32c88525..ff30c9ce5 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java
@@ -481,7 +481,7 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase {
final String UUID_REGEX = "[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}";
- final String msoURL = "/mso/serviceInstantiation/v";
+ final String msoURL = "/mso";
deploy1ServiceFromCypress__verifyStatusAndMsoCalls_andRetry("none", emptyMap(), emptyMap(), true);
List<String> logLines = LoggerFormatTest.getLogLinesAsList(LogName.metrics2019, 200, 1, restTemplate, uri);