-
Notifications
You must be signed in to change notification settings - Fork 52
Name tasks on DSL class #1250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Name tasks on DSL class #1250
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,10 +16,19 @@ | |||||||||||
| package io.serverlessworkflow.fluent.spec; | ||||||||||||
|
|
||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.basic; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.call; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.cases; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.doTasks; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.emit; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.forEach; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.fork; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.http; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.listen; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.produced; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.raise; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.set; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.switchCase; | ||||||||||||
| import static io.serverlessworkflow.fluent.spec.dsl.DSL.tryCatch; | ||||||||||||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||||||||||||
| import static org.junit.jupiter.api.Assertions.assertInstanceOf; | ||||||||||||
| import static org.junit.jupiter.api.Assertions.assertNotNull; | ||||||||||||
|
|
@@ -125,6 +134,117 @@ void testDoTaskSetAndForEach() { | |||||||||||
| assertNotNull(forItem.getTask().getForTask(), "ForTask should be present"); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| @Test | ||||||||||||
| void testTaskNamedSet() { | ||||||||||||
| // Test that we can now name a task "set" using the DSL | ||||||||||||
| Workflow wf = | ||||||||||||
| WorkflowBuilder.workflow("flowWithSetTask") | ||||||||||||
| .tasks( | ||||||||||||
| d -> | ||||||||||||
| d.set("set", "$.value = 'test'").set("set", s -> s.expr("$.another = 'value'"))) | ||||||||||||
|
Comment on lines
+143
to
+144
|
||||||||||||
| d -> | |
| d.set("set", "$.value = 'test'").set("set", s -> s.expr("$.another = 'value'"))) | |
| doTasks( | |
| set("set", "$.value = 'test'"), | |
| set("set", s -> s.expr("$.another = 'value'")))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new overload call(String name, CallOpenAPIConfigurer) isn’t exercised by the test suite (current tests cover only the HTTP variant). Add a unit test that builds a workflow using call("name", openapi()...) and asserts the TaskItem name and that CallTask.callOpenAPI is present/configured, to prevent regressions in this overload.