-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mock-tasks: allow flows to be executed instead of tasks (#1042)
- Loading branch information
Showing
11 changed files
with
192 additions
and
36 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
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
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
20 changes: 20 additions & 0 deletions
20
.../resources/com/walmartlabs/concord/plugins/mock/method-mock-with-flow-execute/concord.yml
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,20 @@ | ||
flows: | ||
default: | ||
- expr: "${testTask.myMethod(1, 'b', false, [1, 2, 3], {'k': 'v'})}" | ||
out: result | ||
|
||
- log: "result.ok: ${result}" | ||
|
||
assertMyMethod: | ||
- log: "flow can access method args: ${args}" | ||
|
||
- set: | ||
result: "WOW" | ||
|
||
configuration: | ||
arguments: | ||
mocks: | ||
- task: "testTask" | ||
method: "myMethod" | ||
args: [1, 'b', false, [1, 2, 3], {k: 'v'}] | ||
executeFlow: "assertMyMethod" |
24 changes: 24 additions & 0 deletions
24
...st/resources/com/walmartlabs/concord/plugins/mock/task-mock-with-flow-execute/concord.yml
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,24 @@ | ||
flows: | ||
default: | ||
- task: testTask | ||
in: | ||
p1: "value-1" | ||
p2: "value-2" | ||
out: result | ||
|
||
- log: "result.ok: ${result}" | ||
|
||
testTaskLogic: | ||
- log: "testTaskLogic can access task input params: p1=${p1}, p2=${p2}" | ||
|
||
- set: | ||
result: | ||
fromMockAsFlow: "WOW" | ||
|
||
# and override result | ||
|
||
configuration: | ||
arguments: | ||
mocks: | ||
- task: "testTask" | ||
executeFlow: "testTaskLogic" |
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
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
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
20 changes: 20 additions & 0 deletions
20
runtime/v2/vm/src/main/java/com/walmartlabs/concord/svm/EvalResult.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,20 @@ | ||
package com.walmartlabs.concord.svm; | ||
|
||
import java.io.Serial; | ||
import java.io.Serializable; | ||
|
||
public class EvalResult implements Serializable { | ||
|
||
@Serial | ||
private static final long serialVersionUID = 1L; | ||
|
||
private final Frame lastFrame; | ||
|
||
public EvalResult(Frame lastFrame) { | ||
this.lastFrame = lastFrame; | ||
} | ||
|
||
public Frame lastFrame() { | ||
return lastFrame; | ||
} | ||
} |
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
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