Skip to content

Commit ad3a7b5

Browse files
authored
Merge pull request #507 from fjtirado/Fix_#506
[Fix #506] Change order of parameters in WorkflowReader
2 parents e1b2935 + d525aa7 commit ad3a7b5

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

api/src/main/java/io/serverlessworkflow/api/WorkflowReader.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ public static Workflow readWorkflow(byte[] input, WorkflowFormat format) throws
3838
}
3939

4040
public static Workflow readWorkflow(Path path) throws IOException {
41-
return readWorkflow(defaultReader(), path, WorkflowFormat.fromPath(path));
41+
return readWorkflow(path, WorkflowFormat.fromPath(path), defaultReader());
4242
}
4343

4444
public static Workflow readWorkflow(Path path, WorkflowFormat format) throws IOException {
45-
return readWorkflow(defaultReader(), path, format);
45+
return readWorkflow(path, format, defaultReader());
4646
}
4747

4848
public static Workflow readWorkflowFromString(String input, WorkflowFormat format)
@@ -51,35 +51,35 @@ public static Workflow readWorkflowFromString(String input, WorkflowFormat forma
5151
}
5252

5353
public static Workflow readWorkflowFromClasspath(String classpath) throws IOException {
54-
return readWorkflowFromClasspath(defaultReader(), classpath);
54+
return readWorkflowFromClasspath(classpath, defaultReader());
5555
}
5656

5757
public static Workflow readWorkflowFromClasspath(
5858
String classpath, ClassLoader cl, WorkflowFormat format) throws IOException {
59-
return readWorkflowFromClasspath(defaultReader(), classpath);
59+
return readWorkflowFromClasspath(classpath, defaultReader());
6060
}
6161

62-
public static Workflow readWorkflow(WorkflowReaderOperations reader, Path path)
62+
public static Workflow readWorkflow(Path path, WorkflowReaderOperations reader)
6363
throws IOException {
64-
return readWorkflow(reader, path, WorkflowFormat.fromPath(path));
64+
return readWorkflow(path, WorkflowFormat.fromPath(path), reader);
6565
}
6666

6767
public static Workflow readWorkflow(
68-
WorkflowReaderOperations reader, Path path, WorkflowFormat format) throws IOException {
68+
Path path, WorkflowFormat format, WorkflowReaderOperations reader) throws IOException {
6969
return reader.read(Files.readAllBytes(path), format);
7070
}
7171

7272
public static Workflow readWorkflowFromClasspath(
73-
WorkflowReaderOperations reader, String classpath) throws IOException {
73+
String classpath, WorkflowReaderOperations reader) throws IOException {
7474
return readWorkflowFromClasspath(
75-
reader,
7675
classpath,
7776
Thread.currentThread().getContextClassLoader(),
78-
WorkflowFormat.fromFileName(classpath));
77+
WorkflowFormat.fromFileName(classpath),
78+
reader);
7979
}
8080

8181
public static Workflow readWorkflowFromClasspath(
82-
WorkflowReaderOperations reader, String classpath, ClassLoader cl, WorkflowFormat format)
82+
String classpath, ClassLoader cl, WorkflowFormat format, WorkflowReaderOperations reader)
8383
throws IOException {
8484
try (InputStream in = cl.getResourceAsStream(classpath)) {
8585
if (in == null) {

api/src/test/java/io/serverlessworkflow/api/FeaturesTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class FeaturesTest {
6060
"features/call-http-query-parameters.yaml"
6161
})
6262
public void testSpecFeaturesParsing(String workflowLocation) throws IOException {
63-
Workflow workflow = readWorkflowFromClasspath(validation(), workflowLocation);
63+
Workflow workflow = readWorkflowFromClasspath(workflowLocation, validation());
6464
assertWorkflow(workflow);
6565
assertWorkflowEquals(workflow, writeAndReadInMemory(workflow));
6666
}

impl/core/src/test/java/io/serverlessworkflow/impl/WorkflowDefinitionTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static void init() {
5353
@MethodSource("provideParameters")
5454
void testWorkflowExecution(String fileName, Consumer<WorkflowDefinition> assertions)
5555
throws IOException {
56-
assertions.accept(appl.workflowDefinition(readWorkflowFromClasspath(validation(), fileName)));
56+
assertions.accept(appl.workflowDefinition(readWorkflowFromClasspath(fileName, validation())));
5757
}
5858

5959
private static Stream<Arguments> provideParameters() {

0 commit comments

Comments
 (0)