This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Enable extra task fields in Java-SDK (#3009)
* Fix: Enable extra task fields in Java-SDK * Enables `Start Delay` field for a Task. * Enables `Optional` field for a Task.
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
java-sdk/src/test/java/com/netflix/conductor/sdk/workflow/def/WorkflowDefTaskTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 2022 Netflix, Inc. | ||
* <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.sdk.workflow.def; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.netflix.conductor.common.metadata.workflow.WorkflowTask; | ||
import com.netflix.conductor.sdk.workflow.def.tasks.*; | ||
import com.netflix.conductor.sdk.workflow.executor.WorkflowExecutor; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class WorkflowDefTaskTests { | ||
|
||
static { | ||
WorkflowExecutor.initTaskImplementations(); | ||
} | ||
|
||
@Test | ||
public void testWorkflowDefTaskWithStartDelay() { | ||
SimpleTask simpleTask = new SimpleTask("task_name", "task_ref_name"); | ||
int startDelay = 5; | ||
|
||
simpleTask.setStartDelay(startDelay); | ||
|
||
WorkflowTask workflowTask = simpleTask.getWorkflowDefTasks().get(0); | ||
|
||
assertEquals(simpleTask.getStartDelay(), workflowTask.getStartDelay()); | ||
assertEquals(startDelay, simpleTask.getStartDelay()); | ||
assertEquals(startDelay, workflowTask.getStartDelay()); | ||
} | ||
|
||
@Test | ||
public void testWorkflowDefTaskWithOptionalEnabled() { | ||
SimpleTask simpleTask = new SimpleTask("task_name", "task_ref_name"); | ||
|
||
simpleTask.setOptional(true); | ||
|
||
WorkflowTask workflowTask = simpleTask.getWorkflowDefTasks().get(0); | ||
|
||
assertEquals(simpleTask.getStartDelay(), workflowTask.getStartDelay()); | ||
assertEquals(true, simpleTask.isOptional()); | ||
assertEquals(true, workflowTask.isOptional()); | ||
} | ||
} |