diff --git a/api/src/main/java/io/serverlessworkflow/api/WorkflowReader.java b/api/src/main/java/io/serverlessworkflow/api/WorkflowReader.java index f5eb3f2e..6868a6dc 100644 --- a/api/src/main/java/io/serverlessworkflow/api/WorkflowReader.java +++ b/api/src/main/java/io/serverlessworkflow/api/WorkflowReader.java @@ -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) @@ -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) { diff --git a/api/src/test/java/io/serverlessworkflow/api/FeaturesTest.java b/api/src/test/java/io/serverlessworkflow/api/FeaturesTest.java index 5d58e8b7..39d7045b 100644 --- a/api/src/test/java/io/serverlessworkflow/api/FeaturesTest.java +++ b/api/src/test/java/io/serverlessworkflow/api/FeaturesTest.java @@ -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)); } diff --git a/impl/core/src/test/java/io/serverlessworkflow/impl/WorkflowDefinitionTest.java b/impl/core/src/test/java/io/serverlessworkflow/impl/WorkflowDefinitionTest.java index c97f11e5..6ac708b7 100644 --- a/impl/core/src/test/java/io/serverlessworkflow/impl/WorkflowDefinitionTest.java +++ b/impl/core/src/test/java/io/serverlessworkflow/impl/WorkflowDefinitionTest.java @@ -53,7 +53,7 @@ static void init() { @MethodSource("provideParameters") void testWorkflowExecution(String fileName, Consumer assertions) throws IOException { - assertions.accept(appl.workflowDefinition(readWorkflowFromClasspath(validation(), fileName))); + assertions.accept(appl.workflowDefinition(readWorkflowFromClasspath(fileName, validation()))); } private static Stream provideParameters() {