Skip to content

Commit 0544cc4

Browse files
committed
Apply fmt
1 parent e3db135 commit 0544cc4

File tree

2 files changed

+87
-90
lines changed

2 files changed

+87
-90
lines changed

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

Lines changed: 72 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -34,84 +34,82 @@
3434

3535
public class HTTPWorkflowDefinitionTest {
3636

37-
private static WorkflowApplication appl;
37+
private static WorkflowApplication appl;
3838

39-
@BeforeAll
40-
static void init() {
41-
appl = WorkflowApplication.builder().build();
42-
}
39+
@BeforeAll
40+
static void init() {
41+
appl = WorkflowApplication.builder().build();
42+
}
4343

44-
@AfterAll
45-
static void cleanup() {
46-
appl.close();
47-
}
44+
@AfterAll
45+
static void cleanup() {
46+
appl.close();
47+
}
4848

49-
@ParameterizedTest
50-
@MethodSource("provideParameters")
51-
void testWorkflowExecution(String fileName, Object input, Condition<Object> condition)
52-
throws IOException {
53-
assertThat(
54-
appl.workflowDefinition(readWorkflowFromClasspath(fileName))
55-
.instance(input)
56-
.start()
57-
.join())
58-
.is(condition);
59-
}
49+
@ParameterizedTest
50+
@MethodSource("provideParameters")
51+
void testWorkflowExecution(String fileName, Object input, Condition<Object> condition)
52+
throws IOException {
53+
assertThat(
54+
appl.workflowDefinition(readWorkflowFromClasspath(fileName))
55+
.instance(input)
56+
.start()
57+
.join())
58+
.is(condition);
59+
}
6060

61-
@ParameterizedTest
62-
@ValueSource(
63-
strings = {
64-
"workflows-samples/call-http-query-parameters.yaml",
65-
"workflows-samples/call-http-query-parameters-external-schema.yaml"
66-
})
67-
void testWrongSchema(String fileName) {
68-
IllegalArgumentException exception =
69-
catchThrowableOfType(
70-
IllegalArgumentException.class,
71-
() -> appl.workflowDefinition(readWorkflowFromClasspath(fileName)).instance(Map.of()));
72-
assertThat(exception)
73-
.isNotNull()
74-
.hasMessageContaining("There are JsonSchema validation errors");
75-
}
61+
@ParameterizedTest
62+
@ValueSource(
63+
strings = {
64+
"workflows-samples/call-http-query-parameters.yaml",
65+
"workflows-samples/call-http-query-parameters-external-schema.yaml"
66+
})
67+
void testWrongSchema(String fileName) {
68+
IllegalArgumentException exception =
69+
catchThrowableOfType(
70+
IllegalArgumentException.class,
71+
() -> appl.workflowDefinition(readWorkflowFromClasspath(fileName)).instance(Map.of()));
72+
assertThat(exception)
73+
.isNotNull()
74+
.hasMessageContaining("There are JsonSchema validation errors");
75+
}
7676

77-
private static boolean httpCondition(WorkflowModel obj) {
78-
Map<String, Object> map = obj.asMap().orElseThrow();
79-
return map.containsKey("photoUrls") || map.containsKey("petId");
80-
}
77+
private static boolean httpCondition(WorkflowModel obj) {
78+
Map<String, Object> map = obj.asMap().orElseThrow();
79+
return map.containsKey("photoUrls") || map.containsKey("petId");
80+
}
8181

82-
private static Stream<Arguments> provideParameters() {
83-
Map<String, Object> petInput = Map.of("petId", 10);
84-
Map<String, Object> starTrekInput = Map.of("uid", "MOMA0000092393");
85-
Condition<WorkflowModel> petCondition =
86-
new Condition<>(HTTPWorkflowDefinitionTest::httpCondition, "callHttpCondition");
87-
Condition<WorkflowModel> starTrekCondition =
88-
new Condition<>(
89-
o ->
90-
((Map<String, Object>) o.asMap().orElseThrow().get("movie"))
91-
.get("title")
92-
.equals("Star Trek"),
93-
"StartTrek");
94-
return Stream.of(
95-
Arguments.of("workflows-samples/callGetHttp.yaml", petInput, petCondition),
96-
Arguments.of(
97-
"workflows-samples/callGetHttp.yaml",
98-
Map.of("petId", "-1"),
99-
new Condition<WorkflowModel>(
100-
o -> o.asMap().orElseThrow().containsKey("petId"), "notFoundCondition")),
101-
Arguments.of(
102-
"workflows-samples/call-http-endpoint-interpolation.yaml", petInput,
103-
petCondition),
104-
Arguments.of(
105-
"workflows-samples/call-http-query-parameters.yaml", starTrekInput,
106-
starTrekCondition),
107-
Arguments.of(
108-
"workflows-samples/call-http-query-parameters-external-schema.yaml",
109-
starTrekInput,
110-
starTrekCondition),
111-
Arguments.of(
112-
"workflows-samples/callPostHttp.yaml",
113-
Map.of("name", "Javierito", "surname", "Unknown"),
114-
new Condition<WorkflowModel>(
115-
o -> o.asText().orElseThrow().equals("Javierito"), "CallHttpPostCondition")));
116-
}
82+
private static Stream<Arguments> provideParameters() {
83+
Map<String, Object> petInput = Map.of("petId", 10);
84+
Map<String, Object> starTrekInput = Map.of("uid", "MOMA0000092393");
85+
Condition<WorkflowModel> petCondition =
86+
new Condition<>(HTTPWorkflowDefinitionTest::httpCondition, "callHttpCondition");
87+
Condition<WorkflowModel> starTrekCondition =
88+
new Condition<>(
89+
o ->
90+
((Map<String, Object>) o.asMap().orElseThrow().get("movie"))
91+
.get("title")
92+
.equals("Star Trek"),
93+
"StartTrek");
94+
return Stream.of(
95+
Arguments.of("workflows-samples/callGetHttp.yaml", petInput, petCondition),
96+
Arguments.of(
97+
"workflows-samples/callGetHttp.yaml",
98+
Map.of("petId", "-1"),
99+
new Condition<WorkflowModel>(
100+
o -> o.asMap().orElseThrow().containsKey("petId"), "notFoundCondition")),
101+
Arguments.of(
102+
"workflows-samples/call-http-endpoint-interpolation.yaml", petInput, petCondition),
103+
Arguments.of(
104+
"workflows-samples/call-http-query-parameters.yaml", starTrekInput, starTrekCondition),
105+
Arguments.of(
106+
"workflows-samples/call-http-query-parameters-external-schema.yaml",
107+
starTrekInput,
108+
starTrekCondition),
109+
Arguments.of(
110+
"workflows-samples/callPostHttp.yaml",
111+
Map.of("name", "Javierito", "surname", "Unknown"),
112+
new Condition<WorkflowModel>(
113+
o -> o.asText().orElseThrow().equals("Javierito"), "CallHttpPostCondition")));
114+
}
117115
}

impl/test/src/test/java/io/serverlessworkflow/impl/test/shell/RunTaskExecutorTest.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,22 @@ void testEchoWithEnvironment() throws IOException {
8181
}
8282
}
8383

84-
@Test
85-
void testTouchAndCat() throws IOException {
86-
Workflow workflow =
87-
WorkflowReader.readWorkflowFromClasspath(
88-
"workflows-samples/shell-process/touch-cat.yaml");
89-
try (WorkflowApplication appl = WorkflowApplication.builder().build()) {
90-
WorkflowModel model =
91-
appl.workflowDefinition(workflow).instance(Map.of("lastName", "Doe")).start().join();
92-
SoftAssertions.assertSoftly(
93-
softly -> {
94-
ProcessResult result = model.as(ProcessResult.class).orElseThrow();
95-
softly.assertThat(result.code()).isEqualTo(0);
96-
softly.assertThat(result.stderr()).isEmpty();
97-
softly.assertThat(result.stdout()).contains("hello world");
98-
});
99-
}
84+
@Test
85+
void testTouchAndCat() throws IOException {
86+
Workflow workflow =
87+
WorkflowReader.readWorkflowFromClasspath("workflows-samples/shell-process/touch-cat.yaml");
88+
try (WorkflowApplication appl = WorkflowApplication.builder().build()) {
89+
WorkflowModel model =
90+
appl.workflowDefinition(workflow).instance(Map.of("lastName", "Doe")).start().join();
91+
SoftAssertions.assertSoftly(
92+
softly -> {
93+
ProcessResult result = model.as(ProcessResult.class).orElseThrow();
94+
softly.assertThat(result.code()).isEqualTo(0);
95+
softly.assertThat(result.stderr()).isEmpty();
96+
softly.assertThat(result.stdout()).contains("hello world");
97+
});
10098
}
99+
}
101100

102101
record Input(User user) {}
103102

0 commit comments

Comments
 (0)