Skip to content

Commit 0f9f581

Browse files
committed
Rename enrich to enrichInput
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
1 parent 7195854 commit 0f9f581

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public static FuncPredicateEventConfigurer event(String type) {
293293
* function("processData", (Long input) -> input + 5, Long.class),
294294
* function("combineData", (Long enrichedValue) -> enrichedValue, Long.class)
295295
* .inputFrom(
296-
* FuncDSL.enrich((Long lastState, WorkflowModel rootInputModel) -> {
296+
* FuncDSL.enrichInput((Long lastState, WorkflowModel rootInputModel) -> {
297297
* Long rootInput = rootInputModel.as(Long.class).orElse(0L);
298298
* return lastState + rootInput;
299299
* }),
@@ -305,7 +305,7 @@ public static FuncPredicateEventConfigurer event(String type) {
305305
* @param <R> the type of the enriched result
306306
* @return a JavaContextFunction that can be used with inputFrom
307307
*/
308-
public static <T, R> JavaContextFunction<T, R> enrich(EnrichWithModelBiFunction<T, R> fn) {
308+
public static <T, R> JavaContextFunction<T, R> enrichInput(EnrichWithModelBiFunction<T, R> fn) {
309309
return (lastState, workflowContext) -> {
310310
final WorkflowModel rootInput = workflowContext.instanceData().input();
311311
return fn.apply(lastState, rootInput);
@@ -322,14 +322,14 @@ public static <T, R> JavaContextFunction<T, R> enrich(EnrichWithModelBiFunction<
322322
*
323323
* <pre>{@code
324324
* function("processData", (Long input) -> input * 2, Long.class)
325-
* .inputFrom(enrich(rootInput -> rootInput.asNumber().orElseThrow()))
325+
* .inputFrom(enrichInput(rootInput -> rootInput.asNumber().orElseThrow()))
326326
* }</pre>
327327
*
328328
* @param fn the function that receives the root workflow input and returns the enriched result
329329
* @param <R> the type of the enriched result
330330
* @return a JavaContextFunction that can be used with inputFrom
331331
*/
332-
public static <R> JavaContextFunction<Object, R> enrich(Function<WorkflowModel, R> fn) {
332+
public static <R> JavaContextFunction<Object, R> enrichInput(Function<WorkflowModel, R> fn) {
333333
return (lastState, workflowContext) -> {
334334
final WorkflowModel rootInput = workflowContext.instanceData().input();
335335
return fn.apply(rootInput);

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package io.serverlessworkflow.impl.test;
1717

18-
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.enrich;
18+
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.enrichInput;
1919
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.enrichOutput;
2020
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.function;
2121
import static org.assertj.core.api.Assertions.within;
@@ -32,7 +32,7 @@
3232
class FuncDSLEnrichWithTest {
3333

3434
@Test
35-
void test_enrich_with_model_in_workflow() {
35+
void test_enrich_Input_with_model_in_workflow() {
3636

3737
SoftAssertions softly = new SoftAssertions();
3838

@@ -48,7 +48,7 @@ void test_enrich_with_model_in_workflow() {
4848
Long.class),
4949
function("returnEnriched", (Long enrichedValue) -> enrichedValue, Long.class)
5050
.inputFrom(
51-
FuncDSL.enrich(
51+
FuncDSL.enrichInput(
5252
(Long lastState, WorkflowModel rootInputModel) -> {
5353
softly.assertThat(lastState).isEqualTo(15L);
5454
Long originalInput = rootInputModel.as(Long.class).orElse(0L);
@@ -70,7 +70,7 @@ void test_enrich_with_model_in_workflow() {
7070
}
7171

7272
@Test
73-
void test_enrich_with_input_workflow() {
73+
void test_enrich_Input_with_input_workflow() {
7474

7575
SoftAssertions softly = new SoftAssertions();
7676

@@ -91,7 +91,7 @@ void test_enrich_with_input_workflow() {
9191
return enrichedValue;
9292
},
9393
Long.class)
94-
.inputFrom(enrich(rootInput -> rootInput.asNumber().orElseThrow().longValue())))
94+
.inputFrom(enrichInput(rootInput -> rootInput.asNumber().orElseThrow().longValue())))
9595
.build();
9696

9797
WorkflowApplication app = WorkflowApplication.builder().build();
@@ -106,7 +106,7 @@ void test_enrich_with_input_workflow() {
106106
}
107107

108108
@Test
109-
void test_enrich_output_with_model_in_workflow() {
109+
void test_enrich_Input_output_with_model_in_workflow() {
110110

111111
SoftAssertions softly = new SoftAssertions();
112112

@@ -146,7 +146,7 @@ void test_enrich_output_with_model_in_workflow() {
146146
}
147147

148148
@Test
149-
void test_enrich_output_with_input_in_workflow() {
149+
void test_enrich_Input_output_with_input_in_workflow() {
150150

151151
SoftAssertions softly = new SoftAssertions();
152152

@@ -181,7 +181,7 @@ void test_enrich_output_with_input_in_workflow() {
181181
}
182182

183183
@Test
184-
void test_enrichOutput_number_conversion_long_to_integer() {
184+
void test_enrichInputOutput_number_conversion_long_to_integer() {
185185
SoftAssertions softly = new SoftAssertions();
186186

187187
Workflow workflow =
@@ -215,7 +215,7 @@ void test_enrichOutput_number_conversion_long_to_integer() {
215215
}
216216

217217
@Test
218-
void test_enrichOutput_number_conversion_integer_to_long() {
218+
void test_enrichInputOutput_number_conversion_integer_to_long() {
219219
SoftAssertions softly = new SoftAssertions();
220220

221221
Workflow workflow =
@@ -249,7 +249,7 @@ void test_enrichOutput_number_conversion_integer_to_long() {
249249
}
250250

251251
@Test
252-
void test_enrichOutput_number_conversion_long_to_double() {
252+
void test_enrichInputOutput_number_conversion_long_to_double() {
253253
SoftAssertions softly = new SoftAssertions();
254254

255255
Workflow workflow =
@@ -283,7 +283,7 @@ void test_enrichOutput_number_conversion_long_to_double() {
283283
}
284284

285285
@Test
286-
void test_enrichOutput_number_conversion_double_to_float() {
286+
void test_enrichInputOutput_number_conversion_double_to_float() {
287287
SoftAssertions softly = new SoftAssertions();
288288

289289
Workflow workflow =
@@ -318,7 +318,7 @@ void test_enrichOutput_number_conversion_double_to_float() {
318318
}
319319

320320
@Test
321-
void test_enrichOutput_number_conversion_integer_to_short() {
321+
void test_enrichInputOutput_number_conversion_integer_to_short() {
322322
SoftAssertions softly = new SoftAssertions();
323323

324324
Workflow workflow =
@@ -352,7 +352,7 @@ void test_enrichOutput_number_conversion_integer_to_short() {
352352
}
353353

354354
@Test
355-
void test_enrichOutput_number_conversion_integer_to_byte() {
355+
void test_enrichInputOutput_number_conversion_integer_to_byte() {
356356
SoftAssertions softly = new SoftAssertions();
357357

358358
Workflow workflow =
@@ -386,7 +386,7 @@ void test_enrichOutput_number_conversion_integer_to_byte() {
386386
}
387387

388388
@Test
389-
void test_enrichOutput_null_handling() {
389+
void test_enrichInputOutput_null_handling() {
390390
SoftAssertions softly = new SoftAssertions();
391391

392392
Workflow workflow =
@@ -419,7 +419,7 @@ void test_enrichOutput_null_handling() {
419419
}
420420

421421
@Test
422-
void test_enrichOutput_same_type_no_conversion() {
422+
void test_enrichInputOutput_same_type_no_conversion() {
423423
SoftAssertions softly = new SoftAssertions();
424424

425425
Workflow workflow =

0 commit comments

Comments
 (0)