Skip to content

Commit

Permalink
ran gradlew spotlessApply for formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
junaidHussain-clari committed Aug 27, 2024
1 parent 05df715 commit 70b06c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import com.netflix.conductor.common.metadata.events.EventHandler.Action;
import com.netflix.conductor.common.metadata.events.EventHandler.StartWorkflow;
Expand All @@ -32,7 +33,6 @@
import com.netflix.conductor.metrics.Monitors;
import com.netflix.conductor.model.TaskModel;
import com.netflix.conductor.model.WorkflowModel;
import org.springframework.util.CollectionUtils;

/**
* Action Processor subscribes to the Event Actions queue and processes the actions (e.g. start
Expand Down Expand Up @@ -198,17 +198,18 @@ private Map<String, Object> startWorkflow(

Map<String, Object> paramsMap = new HashMap<>();
// extracting taskToDomain map from the event payload
paramsMap.put("taskToDomain","${taskToDomain}");
paramsMap.put("taskToDomain", "${taskToDomain}");
Optional.ofNullable(params.getCorrelationId())
.ifPresent(value -> paramsMap.put("correlationId", value));
Map<String, Object> replaced = parametersUtils.replace(paramsMap, payload);

// if taskToDomain is absent from event handler definition, and taskDomain Map is passed as a part of payload
// if taskToDomain is absent from event handler definition, and taskDomain Map is passed
// as a part of payload
// then assign payload taskToDomain map to the new workflow instance
final Map<String, String> taskToDomain = params.getTaskToDomain() != null ?
params.getTaskToDomain() :
(Map<String, String>) replaced.get("taskToDomain");

final Map<String, String> taskToDomain =
params.getTaskToDomain() != null
? params.getTaskToDomain()
: (Map<String, String>) replaced.get("taskToDomain");

workflowInput.put("conductor.event.messageId", messageId);
workflowInput.put("conductor.event.name", event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public void testStartWorkflow_taskDomain() throws Exception {

Object payload =
objectMapper.readValue(
"{ \"testId\": \"test_1\", \"taskToDomain\":{\"testTask\":\"testDomain\"} }", Object.class);
"{ \"testId\": \"test_1\", \"taskToDomain\":{\"testTask\":\"testDomain\"} }",
Object.class);

Map<String, String> taskToDomain = new HashMap<>();
taskToDomain.put("testTask", "testDomain");
Expand Down Expand Up @@ -156,7 +157,6 @@ public void testStartWorkflow_taskDomain() throws Exception {
assertEquals("testEvent", capturedValue.getWorkflowInput().get("conductor.event.name"));
}


@SuppressWarnings({"unchecked", "rawtypes"})
@Test
public void testStartWorkflow() throws Exception {
Expand Down

0 comments on commit 70b06c7

Please sign in to comment.