Skip to content

Commit

Permalink
Merge pull request #507 from fjtirado/Fix_#506
Browse files Browse the repository at this point in the history
[Fix #506] Change order of parameters in WorkflowReader
  • Loading branch information
fjtirado authored Dec 27, 2024
2 parents e1b2935 + d525aa7 commit ad3a7b5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions api/src/main/java/io/serverlessworkflow/api/WorkflowReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public static Workflow readWorkflow(byte[] input, WorkflowFormat format) throws
}

public static Workflow readWorkflow(Path path) throws IOException {
return readWorkflow(defaultReader(), path, WorkflowFormat.fromPath(path));
return readWorkflow(path, WorkflowFormat.fromPath(path), defaultReader());
}

public static Workflow readWorkflow(Path path, WorkflowFormat format) throws IOException {
return readWorkflow(defaultReader(), path, format);
return readWorkflow(path, format, defaultReader());
}

public static Workflow readWorkflowFromString(String input, WorkflowFormat format)
Expand All @@ -51,35 +51,35 @@ public static Workflow readWorkflowFromString(String input, WorkflowFormat forma
}

public static Workflow readWorkflowFromClasspath(String classpath) throws IOException {
return readWorkflowFromClasspath(defaultReader(), classpath);
return readWorkflowFromClasspath(classpath, defaultReader());
}

public static Workflow readWorkflowFromClasspath(
String classpath, ClassLoader cl, WorkflowFormat format) throws IOException {
return readWorkflowFromClasspath(defaultReader(), classpath);
return readWorkflowFromClasspath(classpath, defaultReader());
}

public static Workflow readWorkflow(WorkflowReaderOperations reader, Path path)
public static Workflow readWorkflow(Path path, WorkflowReaderOperations reader)
throws IOException {
return readWorkflow(reader, path, WorkflowFormat.fromPath(path));
return readWorkflow(path, WorkflowFormat.fromPath(path), reader);
}

public static Workflow readWorkflow(
WorkflowReaderOperations reader, Path path, WorkflowFormat format) throws IOException {
Path path, WorkflowFormat format, WorkflowReaderOperations reader) throws IOException {
return reader.read(Files.readAllBytes(path), format);
}

public static Workflow readWorkflowFromClasspath(
WorkflowReaderOperations reader, String classpath) throws IOException {
String classpath, WorkflowReaderOperations reader) throws IOException {
return readWorkflowFromClasspath(
reader,
classpath,
Thread.currentThread().getContextClassLoader(),
WorkflowFormat.fromFileName(classpath));
WorkflowFormat.fromFileName(classpath),
reader);
}

public static Workflow readWorkflowFromClasspath(
WorkflowReaderOperations reader, String classpath, ClassLoader cl, WorkflowFormat format)
String classpath, ClassLoader cl, WorkflowFormat format, WorkflowReaderOperations reader)
throws IOException {
try (InputStream in = cl.getResourceAsStream(classpath)) {
if (in == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class FeaturesTest {
"features/call-http-query-parameters.yaml"
})
public void testSpecFeaturesParsing(String workflowLocation) throws IOException {
Workflow workflow = readWorkflowFromClasspath(validation(), workflowLocation);
Workflow workflow = readWorkflowFromClasspath(workflowLocation, validation());
assertWorkflow(workflow);
assertWorkflowEquals(workflow, writeAndReadInMemory(workflow));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void init() {
@MethodSource("provideParameters")
void testWorkflowExecution(String fileName, Consumer<WorkflowDefinition> assertions)
throws IOException {
assertions.accept(appl.workflowDefinition(readWorkflowFromClasspath(validation(), fileName)));
assertions.accept(appl.workflowDefinition(readWorkflowFromClasspath(fileName, validation())));
}

private static Stream<Arguments> provideParameters() {
Expand Down

0 comments on commit ad3a7b5

Please sign in to comment.