Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2020 Conductor Authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.netflix.conductor.common.metadata.workflow;

import java.io.IOException;
import java.io.InputStream;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import com.netflix.conductor.common.config.ObjectMapperProvider;

import com.fasterxml.jackson.databind.ObjectMapper;


class WorkflowDefDeserializationTest {

private ObjectMapper objectMapper;

@BeforeEach
public void setup() {
objectMapper = new ObjectMapperProvider().getObjectMapper();
}

@Test
@DisplayName("Should correctly deserialize subworkflow priority as a dynamic expression")
public void testSubworkflowPriorityDeserialization() throws Exception {
try (InputStream inputStream = getClass().getResourceAsStream("/workflows/main_workflow.json")) {
if (inputStream == null) {
throw new IOException("Resource not found: /workflows/main_workflow.json");
}
WorkflowDef mainWorkflowDef = objectMapper.readValue(inputStream, WorkflowDef.class);
Assertions.assertEquals("${fetchPriority.output.priority}",
mainWorkflowDef.getTasks().get(1).getSubWorkflowParam().getPriority().toString(),
"Subworkflow priority should be deserialized as a dynamic expression");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "main_workflow_with_priority",
"version": 1,
"tasks": [
{
"name": "fetch_priority_config",
"taskReferenceName": "fetchPriority",
"type": "SIMPLE",
"outputParameters": {
"priority": 42
}
},
{
"name": "sub_workflow_example",
"taskReferenceName": "subWorkflowTask",
"type": "SUB_WORKFLOW",
"subWorkflowParam": {
"name": "sub_workflow_example",
"version": 1,
"priority": "${fetchPriority.output.priority}"
}
}
],
"schemaVersion": 2
}
Loading