Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading