Skip to content

Commit 74e2680

Browse files
committed
Use input and output instead
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
1 parent 0ec1036 commit 74e2680

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

experimental/fluent/func/src/main/java/io/serverlessworkflow/fluent/func/dsl/FuncDSL.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ public static FuncCallHttpStep post(
13461346
* @param inputClass the class object representing the target type for deserialization
13471347
* @return the deserialized workflow input object of type T
13481348
*/
1349-
public static <T> T taskInput(WorkflowContextData context, Class<T> inputClass) {
1349+
public static <T> T input(WorkflowContextData context, Class<T> inputClass) {
13501350
return context.instanceData().input().as(inputClass).orElseThrow();
13511351
}
13521352

@@ -1373,7 +1373,7 @@ public static <T> T taskInput(WorkflowContextData context, Class<T> inputClass)
13731373
* @param inputClass the class object representing the target type for deserialization
13741374
* @return the deserialized workflow input object of type T
13751375
*/
1376-
public static <T> T taskInput(TaskContextData taskContextData, Class<T> inputClass) {
1376+
public static <T> T input(TaskContextData taskContextData, Class<T> inputClass) {
13771377
return taskContextData.input().as(inputClass).orElseThrow();
13781378
}
13791379

@@ -1400,7 +1400,7 @@ public static <T> T taskInput(TaskContextData taskContextData, Class<T> inputCla
14001400
* @param inputClass the class object representing the target type for deserialization
14011401
* @return the deserialized task output object of type T
14021402
*/
1403-
public static <T> T taskOutput(TaskContextData taskContextData, Class<T> inputClass) {
1403+
public static <T> T output(TaskContextData taskContextData, Class<T> inputClass) {
14041404
return taskContextData.output().as(inputClass).orElseThrow();
14051405
}
14061406
}

impl/test/src/test/java/io/serverlessworkflow/impl/test/FuncDSLEnrichWithTest.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
package io.serverlessworkflow.impl.test;
1717

1818
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.function;
19-
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.taskInput;
20-
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.taskOutput;
19+
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.input;
20+
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.output;
2121

2222
import io.serverlessworkflow.api.types.Workflow;
2323
import io.serverlessworkflow.fluent.func.FuncWorkflowBuilder;
24-
import io.serverlessworkflow.fluent.func.dsl.FuncDSL;
2524
import io.serverlessworkflow.impl.WorkflowApplication;
2625
import io.serverlessworkflow.impl.WorkflowDefinition;
2726
import io.serverlessworkflow.impl.WorkflowModel;
@@ -31,7 +30,7 @@
3130
class FuncDSLEnrichWithTest {
3231

3332
@Test
34-
void test_input_with_taskInput_from() {
33+
void test_input_with_input_from() {
3534

3635
SoftAssertions softly = new SoftAssertions();
3736

@@ -49,7 +48,7 @@ void test_input_with_taskInput_from() {
4948
.inputFrom(
5049
(object, workflowContext) -> {
5150
softly.assertThat(object).isEqualTo(15L);
52-
Long input = FuncDSL.taskInput(workflowContext, Long.class);
51+
Long input = input(workflowContext, Long.class);
5352
softly.assertThat(input).isEqualTo(10L);
5453
return object + input;
5554
},
@@ -90,7 +89,7 @@ void test_enrich_Input_with_workflowInput_task() {
9089
Long.class)
9190
.inputFrom(
9291
(object, workflowContext) ->
93-
FuncDSL.taskInput(workflowContext, Long.class)))
92+
input(workflowContext, Long.class)))
9493
.build();
9594

9695
try (WorkflowApplication app = WorkflowApplication.builder().build()) {
@@ -104,7 +103,7 @@ void test_enrich_Input_with_workflowInput_task() {
104103
}
105104

106105
@Test
107-
void test_output_as_with_taskInput_utility() {
106+
void test_output_as_with_input_utility() {
108107

109108
SoftAssertions softly = new SoftAssertions();
110109

@@ -121,7 +120,7 @@ void test_output_as_with_taskInput_utility() {
121120
.outputAs(
122121
(object, workflowContext, taskContextData) -> {
123122
softly.assertThat(object).isEqualTo(15L);
124-
Long input = FuncDSL.taskInput(workflowContext, Long.class);
123+
Long input = input(workflowContext, Long.class);
125124
softly.assertThat(input).isEqualTo(10L);
126125
return input + object;
127126
},
@@ -141,7 +140,7 @@ void test_output_as_with_taskInput_utility() {
141140
}
142141

143142
@Test
144-
void test_export_as_with_taskInput_utility() {
143+
void test_export_as_with_input_utility() {
145144

146145
SoftAssertions softly = new SoftAssertions();
147146

@@ -157,7 +156,7 @@ void test_export_as_with_taskInput_utility() {
157156
Long.class)
158157
.exportAs(
159158
(object, workflowContext, taskContextData) -> {
160-
Long input = taskOutput(taskContextData, Long.class);
159+
Long input = output(taskContextData, Long.class);
161160
softly.assertThat(input).isEqualTo(15L);
162161
return input * 2;
163162
}))
@@ -183,7 +182,7 @@ void test_using_fluent() {
183182
function("sumFive", (Long input) -> input + 5, Long.class)
184183
.inputFrom(
185184
(object, workflowContext, taskContextData) ->
186-
taskInput(taskContextData, Long.class) * 2))
185+
input(taskContextData, Long.class) * 2))
187186
.build();
188187

189188
try (WorkflowApplication app = WorkflowApplication.builder().build()) {

0 commit comments

Comments
 (0)