diff --git a/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaConsumerCallExecutor.java b/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaConsumerCallExecutor.java index 14db6543d..91b912ff5 100644 --- a/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaConsumerCallExecutor.java +++ b/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaConsumerCallExecutor.java @@ -21,23 +21,28 @@ import io.serverlessworkflow.impl.WorkflowContext; import io.serverlessworkflow.impl.WorkflowDefinition; import io.serverlessworkflow.impl.WorkflowModel; +import io.serverlessworkflow.impl.WorkflowMutablePosition; import io.serverlessworkflow.impl.executors.CallableTask; +import io.serverlessworkflow.impl.executors.CallableTaskBuilder; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; -public class JavaConsumerCallExecutor implements CallableTask> { +public class JavaConsumerCallExecutor + implements CallableTaskBuilder> { private Consumer consumer; - private Optional> inputClass = Optional.empty(); + private Optional> inputClass; - public void init(CallJava.CallJavaConsumer task, WorkflowDefinition definition) { + public void init( + CallJava.CallJavaConsumer task, + WorkflowDefinition definition, + WorkflowMutablePosition position) { consumer = task.consumer(); inputClass = task.inputClass(); } - @Override - public CompletableFuture apply( + private CompletableFuture apply( WorkflowContext workflowContext, TaskContext taskContext, WorkflowModel input) { T typed = JavaFuncUtils.convertT(input, inputClass); consumer.accept(typed); @@ -48,4 +53,9 @@ public CompletableFuture apply( public boolean accept(Class clazz) { return CallJava.CallJavaConsumer.class.isAssignableFrom(clazz); } + + @Override + public CallableTask build() { + return this::apply; + } } diff --git a/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaContextFunctionCallExecutor.java b/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaContextFunctionCallExecutor.java index dd3b37ca7..e59d9def9 100644 --- a/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaContextFunctionCallExecutor.java +++ b/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaContextFunctionCallExecutor.java @@ -17,29 +17,44 @@ import io.serverlessworkflow.api.types.TaskBase; import io.serverlessworkflow.api.types.func.CallJava; +import io.serverlessworkflow.api.types.func.CallJava.CallJavaContextFunction; import io.serverlessworkflow.api.types.func.JavaContextFunction; import io.serverlessworkflow.impl.TaskContext; import io.serverlessworkflow.impl.WorkflowContext; import io.serverlessworkflow.impl.WorkflowDefinition; import io.serverlessworkflow.impl.WorkflowModel; +import io.serverlessworkflow.impl.WorkflowMutablePosition; import io.serverlessworkflow.impl.executors.CallableTask; +import io.serverlessworkflow.impl.executors.CallableTaskBuilder; import java.util.Optional; import java.util.concurrent.CompletableFuture; public class JavaContextFunctionCallExecutor - implements CallableTask> { + implements CallableTaskBuilder> { private JavaContextFunction function; private Optional> inputClass; @Override - public void init(CallJava.CallJavaContextFunction task, WorkflowDefinition definition) { + public boolean accept(Class clazz) { + return CallJava.CallJavaContextFunction.class.isAssignableFrom(clazz); + } + + @Override + public void init( + CallJavaContextFunction task, + WorkflowDefinition definition, + WorkflowMutablePosition position) { this.function = task.function(); this.inputClass = task.inputClass(); } @Override - public CompletableFuture apply( + public CallableTask build() { + return this::apply; + } + + private CompletableFuture apply( WorkflowContext workflowContext, TaskContext taskContext, WorkflowModel input) { return CompletableFuture.completedFuture( workflowContext @@ -49,9 +64,4 @@ public CompletableFuture apply( .fromAny( input, function.apply(JavaFuncUtils.convertT(input, inputClass), workflowContext))); } - - @Override - public boolean accept(Class clazz) { - return CallJava.CallJavaContextFunction.class.isAssignableFrom(clazz); - } } diff --git a/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaFilterFunctionCallExecutor.java b/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaFilterFunctionCallExecutor.java index d346f2b10..c60f6cb68 100644 --- a/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaFilterFunctionCallExecutor.java +++ b/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaFilterFunctionCallExecutor.java @@ -17,29 +17,25 @@ import io.serverlessworkflow.api.types.TaskBase; import io.serverlessworkflow.api.types.func.CallJava; +import io.serverlessworkflow.api.types.func.CallJava.CallJavaFilterFunction; import io.serverlessworkflow.api.types.func.JavaFilterFunction; import io.serverlessworkflow.impl.TaskContext; import io.serverlessworkflow.impl.WorkflowContext; import io.serverlessworkflow.impl.WorkflowDefinition; import io.serverlessworkflow.impl.WorkflowModel; +import io.serverlessworkflow.impl.WorkflowMutablePosition; import io.serverlessworkflow.impl.executors.CallableTask; +import io.serverlessworkflow.impl.executors.CallableTaskBuilder; import java.util.Optional; import java.util.concurrent.CompletableFuture; public class JavaFilterFunctionCallExecutor - implements CallableTask> { + implements CallableTaskBuilder> { private JavaFilterFunction function; private Optional> inputClass; - @Override - public void init(CallJava.CallJavaFilterFunction task, WorkflowDefinition definition) { - this.function = task.function(); - this.inputClass = task.inputClass(); - } - - @Override - public CompletableFuture apply( + private CompletableFuture apply( WorkflowContext workflowContext, TaskContext taskContext, WorkflowModel input) { return CompletableFuture.completedFuture( workflowContext @@ -56,4 +52,18 @@ public CompletableFuture apply( public boolean accept(Class clazz) { return CallJava.CallJavaFilterFunction.class.isAssignableFrom(clazz); } + + @Override + public void init( + CallJavaFilterFunction task, + WorkflowDefinition definition, + WorkflowMutablePosition position) { + this.function = task.function(); + this.inputClass = task.inputClass(); + } + + @Override + public CallableTask build() { + return this::apply; + } } diff --git a/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaFunctionCallExecutor.java b/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaFunctionCallExecutor.java index b5cf8287d..734ece909 100644 --- a/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaFunctionCallExecutor.java +++ b/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaFunctionCallExecutor.java @@ -17,28 +17,25 @@ import io.serverlessworkflow.api.types.TaskBase; import io.serverlessworkflow.api.types.func.CallJava; +import io.serverlessworkflow.api.types.func.CallJava.CallJavaFunction; import io.serverlessworkflow.impl.TaskContext; import io.serverlessworkflow.impl.WorkflowContext; import io.serverlessworkflow.impl.WorkflowDefinition; import io.serverlessworkflow.impl.WorkflowModel; +import io.serverlessworkflow.impl.WorkflowMutablePosition; import io.serverlessworkflow.impl.executors.CallableTask; +import io.serverlessworkflow.impl.executors.CallableTaskBuilder; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.function.Function; public class JavaFunctionCallExecutor - implements CallableTask> { + implements CallableTaskBuilder> { private Function function; private Optional> inputClass; - public void init(CallJava.CallJavaFunction task, WorkflowDefinition definition) { - function = task.function(); - inputClass = task.inputClass(); - } - - @Override - public CompletableFuture apply( + private CompletableFuture apply( WorkflowContext workflowContext, TaskContext taskContext, WorkflowModel input) { return CompletableFuture.completedFuture( workflowContext @@ -52,4 +49,18 @@ public CompletableFuture apply( public boolean accept(Class clazz) { return CallJava.CallJavaFunction.class.isAssignableFrom(clazz); } + + @Override + public void init( + CallJavaFunction task, + WorkflowDefinition definition, + WorkflowMutablePosition position) { + function = task.function(); + inputClass = task.inputClass(); + } + + @Override + public CallableTask build() { + return this::apply; + } } diff --git a/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaLoopFunctionCallExecutor.java b/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaLoopFunctionCallExecutor.java index 9c6c11df7..263c7e037 100644 --- a/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaLoopFunctionCallExecutor.java +++ b/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaLoopFunctionCallExecutor.java @@ -19,27 +19,25 @@ import io.serverlessworkflow.api.types.TaskBase; import io.serverlessworkflow.api.types.func.CallJava; +import io.serverlessworkflow.api.types.func.CallJava.CallJavaLoopFunction; import io.serverlessworkflow.api.types.func.LoopFunction; import io.serverlessworkflow.impl.TaskContext; import io.serverlessworkflow.impl.WorkflowContext; import io.serverlessworkflow.impl.WorkflowDefinition; import io.serverlessworkflow.impl.WorkflowModel; import io.serverlessworkflow.impl.WorkflowModelFactory; +import io.serverlessworkflow.impl.WorkflowMutablePosition; import io.serverlessworkflow.impl.executors.CallableTask; +import io.serverlessworkflow.impl.executors.CallableTaskBuilder; import java.util.concurrent.CompletableFuture; -public class JavaLoopFunctionCallExecutor implements CallableTask { +public class JavaLoopFunctionCallExecutor + implements CallableTaskBuilder { private LoopFunction function; private String varName; - public void init(CallJava.CallJavaLoopFunction task, WorkflowDefinition definition) { - function = task.function(); - varName = task.varName(); - } - - @Override - public CompletableFuture apply( + private CompletableFuture apply( WorkflowContext workflowContext, TaskContext taskContext, WorkflowModel input) { WorkflowModelFactory modelFactory = workflowContext.definition().application().modelFactory(); return CompletableFuture.completedFuture( @@ -51,7 +49,18 @@ public CompletableFuture apply( @Override public boolean accept(Class clazz) { - return CallJava.CallJavaLoopFunction.class.isAssignableFrom(clazz); } + + @Override + public void init( + CallJavaLoopFunction task, WorkflowDefinition definition, WorkflowMutablePosition position) { + function = task.function(); + varName = task.varName(); + } + + @Override + public CallableTask build() { + return this::apply; + } } diff --git a/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaLoopFunctionIndexCallExecutor.java b/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaLoopFunctionIndexCallExecutor.java index 808833e79..797ad0671 100644 --- a/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaLoopFunctionIndexCallExecutor.java +++ b/experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaLoopFunctionIndexCallExecutor.java @@ -19,30 +19,26 @@ import io.serverlessworkflow.api.types.TaskBase; import io.serverlessworkflow.api.types.func.CallJava; +import io.serverlessworkflow.api.types.func.CallJava.CallJavaLoopFunctionIndex; import io.serverlessworkflow.api.types.func.LoopFunctionIndex; import io.serverlessworkflow.impl.TaskContext; import io.serverlessworkflow.impl.WorkflowContext; import io.serverlessworkflow.impl.WorkflowDefinition; import io.serverlessworkflow.impl.WorkflowModel; import io.serverlessworkflow.impl.WorkflowModelFactory; +import io.serverlessworkflow.impl.WorkflowMutablePosition; import io.serverlessworkflow.impl.executors.CallableTask; +import io.serverlessworkflow.impl.executors.CallableTaskBuilder; import java.util.concurrent.CompletableFuture; public class JavaLoopFunctionIndexCallExecutor - implements CallableTask { + implements CallableTaskBuilder { private LoopFunctionIndex function; private String varName; private String indexName; - public void init(CallJava.CallJavaLoopFunctionIndex task, WorkflowDefinition definition) { - function = task.function(); - varName = task.varName(); - indexName = task.indexName(); - } - - @Override - public CompletableFuture apply( + private CompletableFuture apply( WorkflowContext workflowContext, TaskContext taskContext, WorkflowModel input) { WorkflowModelFactory modelFactory = workflowContext.definition().application().modelFactory(); @@ -59,4 +55,19 @@ public CompletableFuture apply( public boolean accept(Class clazz) { return CallJava.CallJavaLoopFunctionIndex.class.isAssignableFrom(clazz); } + + @Override + public void init( + CallJavaLoopFunctionIndex task, + WorkflowDefinition definition, + WorkflowMutablePosition position) { + function = task.function(); + varName = task.varName(); + indexName = task.indexName(); + } + + @Override + public CallableTask build() { + return this::apply; + } } diff --git a/experimental/lambda/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTask b/experimental/lambda/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTaskBuilder similarity index 100% rename from experimental/lambda/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTask rename to experimental/lambda/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTaskBuilder diff --git a/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallFunctionExecutor.java b/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallFunctionExecutor.java new file mode 100644 index 000000000..416cad30b --- /dev/null +++ b/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallFunctionExecutor.java @@ -0,0 +1,75 @@ +/* + * Copyright 2020-Present The Serverless Workflow Specification Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.serverlessworkflow.impl.executors; + +import io.serverlessworkflow.api.types.CallFunction; +import io.serverlessworkflow.api.types.FunctionArguments; +import io.serverlessworkflow.api.types.Task; +import io.serverlessworkflow.api.types.TaskBase; +import io.serverlessworkflow.impl.WorkflowDefinition; +import io.serverlessworkflow.impl.WorkflowMutablePosition; +import io.serverlessworkflow.impl.WorkflowUtils; +import io.serverlessworkflow.impl.WorkflowValueResolver; +import java.util.Map; +import java.util.Optional; + +public class CallFunctionExecutor implements CallableTaskBuilder { + + private TaskExecutorBuilder executorBuilder; + private WorkflowValueResolver> args; + + @Override + public void init( + CallFunction task, WorkflowDefinition definition, WorkflowMutablePosition position) { + String functionName = task.getCall(); + FunctionArguments functionArgs = task.getWith(); + args = + functionArgs != null + ? WorkflowUtils.buildMapResolver( + definition.application(), functionArgs.getAdditionalProperties()) + : (w, t, m) -> Map.of(); + Task function = null; + if (definition.workflow().getUse() != null + && definition.workflow().getUse().getFunctions() != null + && definition.workflow().getUse().getFunctions().getAdditionalProperties() != null) { + function = + definition.workflow().getUse().getFunctions().getAdditionalProperties().get(functionName); + } + if (function == null) { + // TODO search in catalog + throw new UnsupportedOperationException("Function Catalog not supported yet"); + } + executorBuilder = + definition.application().taskFactory().getTaskExecutor(position, function, definition); + } + + @Override + public boolean accept(Class clazz) { + return clazz.equals(CallFunction.class); + } + + @Override + public CallableTask build() { + TaskExecutor executor = executorBuilder.build(); + return (w, t, m) -> + executor + .apply( + w, + Optional.of(t), + w.definition().application().modelFactory().fromAny(args.apply(w, t, m))) + .thenApply(o -> o.output()); + } +} diff --git a/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallTaskExecutor.java b/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallTaskExecutor.java index 99d2ec79c..23d4cc179 100644 --- a/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallTaskExecutor.java +++ b/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallTaskExecutor.java @@ -25,20 +25,20 @@ public class CallTaskExecutor extends RegularTaskExecutor { - private final CallableTask callable; + private final CallableTask callable; public static class CallTaskExecutorBuilder extends RegularTaskExecutorBuilder { - private CallableTask callable; + private final CallableTaskBuilder callable; protected CallTaskExecutorBuilder( WorkflowMutablePosition position, T task, WorkflowDefinition definition, - CallableTask callable) { + CallableTaskBuilder callable) { super(position, task, definition); this.callable = callable; - callable.init(task, definition); + callable.init(task, definition, position); } @Override @@ -49,7 +49,7 @@ public CallTaskExecutor buildInstance() { protected CallTaskExecutor(CallTaskExecutorBuilder builder) { super(builder); - this.callable = builder.callable; + this.callable = builder.callable.build(); } @Override diff --git a/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallableTask.java b/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallableTask.java index c6f7be0d8..de5d2c091 100644 --- a/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallableTask.java +++ b/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallableTask.java @@ -15,18 +15,13 @@ */ package io.serverlessworkflow.impl.executors; -import io.serverlessworkflow.api.types.TaskBase; import io.serverlessworkflow.impl.TaskContext; import io.serverlessworkflow.impl.WorkflowContext; -import io.serverlessworkflow.impl.WorkflowDefinition; import io.serverlessworkflow.impl.WorkflowModel; import java.util.concurrent.CompletableFuture; -public interface CallableTask { - default void init(T task, WorkflowDefinition definition) {} - +@FunctionalInterface +public interface CallableTask { CompletableFuture apply( WorkflowContext workflowContext, TaskContext taskContext, WorkflowModel input); - - boolean accept(Class clazz); } diff --git a/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallableTaskBuilder.java b/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallableTaskBuilder.java new file mode 100644 index 000000000..5fb010455 --- /dev/null +++ b/impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallableTaskBuilder.java @@ -0,0 +1,30 @@ +/* + * Copyright 2020-Present The Serverless Workflow Specification Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.serverlessworkflow.impl.executors; + +import io.serverlessworkflow.api.types.TaskBase; +import io.serverlessworkflow.impl.ServicePriority; +import io.serverlessworkflow.impl.WorkflowDefinition; +import io.serverlessworkflow.impl.WorkflowMutablePosition; + +public interface CallableTaskBuilder extends ServicePriority { + + boolean accept(Class clazz); + + void init(T task, WorkflowDefinition definition, WorkflowMutablePosition position); + + CallableTask build(); +} diff --git a/impl/core/src/main/java/io/serverlessworkflow/impl/executors/DefaultTaskExecutorFactory.java b/impl/core/src/main/java/io/serverlessworkflow/impl/executors/DefaultTaskExecutorFactory.java index dedbf30d4..105f95328 100644 --- a/impl/core/src/main/java/io/serverlessworkflow/impl/executors/DefaultTaskExecutorFactory.java +++ b/impl/core/src/main/java/io/serverlessworkflow/impl/executors/DefaultTaskExecutorFactory.java @@ -45,7 +45,8 @@ public static TaskExecutorFactory get() { protected DefaultTaskExecutorFactory() {} - private ServiceLoader callTasks = ServiceLoader.load(CallableTask.class); + private ServiceLoader callTasks = + ServiceLoader.load(CallableTaskBuilder.class); @Override public TaskExecutorBuilder getTaskExecutor( @@ -84,8 +85,8 @@ public TaskExecutorBuilder getTaskExecutor( } @SuppressWarnings("unchecked") - private CallableTask findCallTask(Class clazz) { - return (CallableTask) + private CallableTaskBuilder findCallTask(Class clazz) { + return (CallableTaskBuilder) callTasks.stream() .map(Provider::get) .filter(s -> s.accept(clazz)) diff --git a/impl/core/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTaskBuilder b/impl/core/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTaskBuilder new file mode 100644 index 000000000..6c31b128f --- /dev/null +++ b/impl/core/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTaskBuilder @@ -0,0 +1 @@ +io.serverlessworkflow.impl.executors.CallFunctionExecutor \ No newline at end of file diff --git a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/AbstractHttpExecutorBuilder.java b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/AbstractHttpExecutorBuilder.java new file mode 100644 index 000000000..78dc86e33 --- /dev/null +++ b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/AbstractHttpExecutorBuilder.java @@ -0,0 +1,75 @@ +/* + * Copyright 2020-Present The Serverless Workflow Specification Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.serverlessworkflow.impl.executors.http; + +import io.serverlessworkflow.impl.WorkflowApplication; +import io.serverlessworkflow.impl.WorkflowFilter; +import io.serverlessworkflow.impl.WorkflowUtils; +import io.serverlessworkflow.impl.WorkflowValueResolver; +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.client.WebTarget; +import java.net.URI; +import java.util.Map; +import java.util.Optional; + +abstract class AbstractHttpExecutorBuilder { + + protected WorkflowValueResolver targetSupplier; + protected WorkflowValueResolver> headersMap; + protected WorkflowValueResolver> queryMap; + protected Optional authProvider = Optional.empty(); + protected RequestSupplier requestFunction; + protected boolean redirect; + + protected static RequestSupplier buildRequestSupplier( + String method, Object body, WorkflowApplication application) { + + switch (method.toUpperCase()) { + case HttpMethod.POST: + WorkflowFilter bodyFilter = WorkflowUtils.buildWorkflowFilter(application, body); + return (request, w, t, node) -> { + HttpModelConverter converter = HttpConverterResolver.converter(w, t); + return w.definition() + .application() + .modelFactory() + .fromAny( + request.post( + converter.toEntity(bodyFilter.apply(w, t, node)), converter.responseType())); + }; + case HttpMethod.GET: + default: + return (request, w, t, n) -> + w.definition() + .application() + .modelFactory() + .fromAny(request.get(HttpConverterResolver.converter(w, t).responseType())); + } + } + + protected static WorkflowValueResolver getTargetSupplier( + WorkflowValueResolver uriSupplier) { + return (w, t, n) -> HttpClientResolver.client(w, t).target(uriSupplier.apply(w, t, n)); + } + + public HttpExecutor build() { + return new HttpExecutor( + targetSupplier, + Optional.ofNullable(headersMap), + Optional.ofNullable(queryMap), + authProvider, + requestFunction); + } +} diff --git a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/CallableTaskHttpExecutorBuilder.java b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/CallableTaskHttpExecutorBuilder.java new file mode 100644 index 000000000..52076b9e9 --- /dev/null +++ b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/CallableTaskHttpExecutorBuilder.java @@ -0,0 +1,73 @@ +/* + * Copyright 2020-Present The Serverless Workflow Specification Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.serverlessworkflow.impl.executors.http; + +import static io.serverlessworkflow.impl.WorkflowUtils.buildMapResolver; + +import io.serverlessworkflow.api.types.CallHTTP; +import io.serverlessworkflow.api.types.Endpoint; +import io.serverlessworkflow.api.types.HTTPArguments; +import io.serverlessworkflow.api.types.TaskBase; +import io.serverlessworkflow.impl.WorkflowDefinition; +import io.serverlessworkflow.impl.WorkflowMutablePosition; +import io.serverlessworkflow.impl.executors.CallableTaskBuilder; +import java.util.Optional; + +public class CallableTaskHttpExecutorBuilder extends AbstractHttpExecutorBuilder + implements CallableTaskBuilder { + + @Override + public void init(CallHTTP task, WorkflowDefinition definition, WorkflowMutablePosition position) { + final HTTPArguments httpArgs = task.getWith(); + final Endpoint endpoint = httpArgs.getEndpoint(); + + this.authProvider = + endpoint.getEndpointConfiguration() == null + ? Optional.empty() + : AuthProviderFactory.getAuth( + definition, endpoint.getEndpointConfiguration().getAuthentication()); + + this.targetSupplier = getTargetSupplier(definition.resourceLoader().uriSupplier(endpoint)); + + if (httpArgs.getHeaders() != null) { + this.headersMap = + buildMapResolver( + definition.application(), + httpArgs.getHeaders().getRuntimeExpression(), + httpArgs.getHeaders().getHTTPHeaders() != null + ? httpArgs.getHeaders().getHTTPHeaders().getAdditionalProperties() + : null); + } + + if (httpArgs.getQuery() != null) { + queryMap = + buildMapResolver( + definition.application(), + httpArgs.getQuery().getRuntimeExpression(), + httpArgs.getQuery().getHTTPQuery() != null + ? httpArgs.getQuery().getHTTPQuery().getAdditionalProperties() + : null); + } + this.requestFunction = + buildRequestSupplier( + httpArgs.getMethod().toUpperCase(), httpArgs.getBody(), definition.application()); + } + + @Override + public boolean accept(Class clazz) { + return clazz.equals(CallHTTP.class); + } +} diff --git a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java index 1ec92c4d5..6331af998 100644 --- a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java +++ b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java @@ -15,189 +15,40 @@ */ package io.serverlessworkflow.impl.executors.http; -import static io.serverlessworkflow.impl.WorkflowUtils.buildMapResolver; - -import io.serverlessworkflow.api.types.CallHTTP; -import io.serverlessworkflow.api.types.Endpoint; -import io.serverlessworkflow.api.types.HTTPArguments; -import io.serverlessworkflow.api.types.ReferenceableAuthenticationPolicy; -import io.serverlessworkflow.api.types.TaskBase; import io.serverlessworkflow.impl.TaskContext; -import io.serverlessworkflow.impl.WorkflowApplication; import io.serverlessworkflow.impl.WorkflowContext; -import io.serverlessworkflow.impl.WorkflowDefinition; import io.serverlessworkflow.impl.WorkflowError; import io.serverlessworkflow.impl.WorkflowException; -import io.serverlessworkflow.impl.WorkflowFilter; import io.serverlessworkflow.impl.WorkflowModel; -import io.serverlessworkflow.impl.WorkflowUtils; import io.serverlessworkflow.impl.WorkflowValueResolver; import io.serverlessworkflow.impl.executors.CallableTask; -import jakarta.ws.rs.HttpMethod; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.client.Invocation.Builder; import jakarta.ws.rs.client.WebTarget; -import java.net.URI; import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.function.Supplier; -public class HttpExecutor implements CallableTask { - - private WorkflowValueResolver targetSupplier; - private Optional>> headersMap; - private Optional>> queryMap; - private Optional authProvider; - private RequestSupplier requestFunction; - - public static class HttpExecutorBuilder { - - private final WorkflowDefinition definition; - - private ReferenceableAuthenticationPolicy authPolicy; - private WorkflowValueResolver> headersMap; - private WorkflowValueResolver> queryMap; - private WorkflowValueResolver pathSupplier; - private Object body; - private boolean redirect; - private String method = HttpMethod.GET; - - private HttpExecutorBuilder(WorkflowDefinition definition) { - this.definition = definition; - } - - public HttpExecutorBuilder withAuth(ReferenceableAuthenticationPolicy policy) { - this.authPolicy = policy; - return this; - } - - public HttpExecutorBuilder withBody(Object body) { - this.body = body; - return this; - } - - public HttpExecutorBuilder withPath(WorkflowValueResolver pathSupplier) { - this.pathSupplier = pathSupplier; - return this; - } - - public HttpExecutorBuilder withHeaders(WorkflowValueResolver> headersMap) { - this.headersMap = headersMap; - return this; - } - - public HttpExecutorBuilder withQueryMap(WorkflowValueResolver> queryMap) { - this.queryMap = queryMap; - return this; - } - - public HttpExecutorBuilder withHeaders(Map headersMap) { - return withHeaders(WorkflowUtils.buildMapResolver(definition.application(), headersMap)); - } - - public HttpExecutorBuilder withQueryMap(Map queryMap) { - return withQueryMap(WorkflowUtils.buildMapResolver(definition.application(), queryMap)); - } - - public HttpExecutorBuilder withMethod(String method) { - this.method = method; - return this; - } - - public HttpExecutorBuilder redirect(boolean redirect) { - this.redirect = redirect; - return this; - } - - public HttpExecutor build(String uri) { - return build((w, f, n) -> URI.create(uri)); - } - - public HttpExecutor build(WorkflowValueResolver uriSupplier) { - HttpExecutor executor = new HttpExecutor(); - executor.targetSupplier = - pathSupplier == null - ? getTargetSupplier(uriSupplier) - : getTargetSupplier(uriSupplier, pathSupplier); - executor.authProvider = AuthProviderFactory.getAuth(definition, authPolicy); - executor.requestFunction = buildRequestSupplier(method, body, definition.application()); - executor.headersMap = Optional.ofNullable(headersMap); - executor.queryMap = Optional.ofNullable(queryMap); - return executor; - } - } - - public static HttpExecutorBuilder builder(WorkflowDefinition definition) { - return new HttpExecutorBuilder(definition); - } - - @FunctionalInterface - private interface RequestSupplier { - WorkflowModel apply( - Builder request, WorkflowContext workflow, TaskContext task, WorkflowModel node); - } - - @Override - public void init(CallHTTP task, WorkflowDefinition definition) { - final HTTPArguments httpArgs = task.getWith(); - final Endpoint endpoint = httpArgs.getEndpoint(); - - this.authProvider = - endpoint.getEndpointConfiguration() == null - ? Optional.empty() - : AuthProviderFactory.getAuth( - definition, endpoint.getEndpointConfiguration().getAuthentication()); - - this.targetSupplier = getTargetSupplier(definition.resourceLoader().uriSupplier(endpoint)); - this.headersMap = - httpArgs.getHeaders() != null - ? Optional.of( - buildMapResolver( - definition.application(), - httpArgs.getHeaders().getRuntimeExpression(), - httpArgs.getHeaders().getHTTPHeaders() != null - ? httpArgs.getHeaders().getHTTPHeaders().getAdditionalProperties() - : null)) - : Optional.empty(); - this.queryMap = - httpArgs.getQuery() != null - ? Optional.of( - buildMapResolver( - definition.application(), - httpArgs.getQuery().getRuntimeExpression(), - httpArgs.getQuery().getHTTPQuery() != null - ? httpArgs.getQuery().getHTTPQuery().getAdditionalProperties() - : null)) - : Optional.empty(); - this.requestFunction = - buildRequestSupplier( - httpArgs.getMethod().toUpperCase(), httpArgs.getBody(), definition.application()); - } - - private static RequestSupplier buildRequestSupplier( - String method, Object body, WorkflowApplication application) { - - switch (method.toUpperCase()) { - case HttpMethod.POST: - WorkflowFilter bodyFilter = WorkflowUtils.buildWorkflowFilter(application, body); - return (request, w, t, node) -> { - HttpModelConverter converter = HttpConverterResolver.converter(w, t); - return w.definition() - .application() - .modelFactory() - .fromAny( - request.post( - converter.toEntity(bodyFilter.apply(w, t, node)), converter.responseType())); - }; - case HttpMethod.GET: - default: - return (request, w, t, n) -> - w.definition() - .application() - .modelFactory() - .fromAny(request.get(HttpConverterResolver.converter(w, t).responseType())); - } +public class HttpExecutor implements CallableTask { + + private final WorkflowValueResolver targetSupplier; + private final Optional>> headersMap; + private final Optional>> queryMap; + private final Optional authProvider; + private final RequestSupplier requestFunction; + + HttpExecutor( + WorkflowValueResolver targetSupplier, + Optional>> headersMap, + Optional>> queryMap, + Optional authProvider, + RequestSupplier requestFunction) { + this.targetSupplier = targetSupplier; + this.headersMap = headersMap; + this.queryMap = queryMap; + this.authProvider = authProvider; + this.requestFunction = requestFunction; } private static class TargetQuerySupplier implements Supplier { @@ -217,7 +68,6 @@ public WebTarget get() { } } - @Override public CompletableFuture apply( WorkflowContext workflow, TaskContext taskContext, WorkflowModel input) { TargetQuerySupplier supplier = @@ -241,22 +91,4 @@ public CompletableFuture apply( }, workflow.definition().application().executorService()); } - - @Override - public boolean accept(Class clazz) { - return clazz.equals(CallHTTP.class); - } - - private static WorkflowValueResolver getTargetSupplier( - WorkflowValueResolver uriSupplier) { - return (w, t, n) -> HttpClientResolver.client(w, t).target(uriSupplier.apply(w, t, n)); - } - - private static WorkflowValueResolver getTargetSupplier( - WorkflowValueResolver uriSupplier, WorkflowValueResolver pathSupplier) { - return (w, t, n) -> - HttpClientResolver.client(w, t) - .target( - WorkflowUtils.concatURI(uriSupplier.apply(w, t, n), pathSupplier.apply(w, t, n))); - } } diff --git a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutorBuilder.java b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutorBuilder.java new file mode 100644 index 000000000..319434093 --- /dev/null +++ b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutorBuilder.java @@ -0,0 +1,105 @@ +/* + * Copyright 2020-Present The Serverless Workflow Specification Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.serverlessworkflow.impl.executors.http; + +import io.serverlessworkflow.api.types.ReferenceableAuthenticationPolicy; +import io.serverlessworkflow.impl.WorkflowDefinition; +import io.serverlessworkflow.impl.WorkflowUtils; +import io.serverlessworkflow.impl.WorkflowValueResolver; +import jakarta.ws.rs.HttpMethod; +import jakarta.ws.rs.client.WebTarget; +import java.net.URI; +import java.util.Map; + +public class HttpExecutorBuilder extends AbstractHttpExecutorBuilder { + + private final WorkflowDefinition definition; + private WorkflowValueResolver pathSupplier; + private Object body; + private String method = HttpMethod.GET; + + private HttpExecutorBuilder(WorkflowDefinition definition) { + this.definition = definition; + } + + public HttpExecutorBuilder withAuth(ReferenceableAuthenticationPolicy policy) { + this.authProvider = AuthProviderFactory.getAuth(definition, policy); + return this; + } + + public HttpExecutorBuilder withBody(Object body) { + this.body = body; + return this; + } + + public HttpExecutorBuilder withPath(WorkflowValueResolver pathSupplier) { + this.pathSupplier = pathSupplier; + return this; + } + + public HttpExecutorBuilder withHeaders(Map headersMap) { + return withHeaders(WorkflowUtils.buildMapResolver(definition.application(), headersMap)); + } + + public HttpExecutorBuilder withQueryMap(Map queryMap) { + return withQueryMap(WorkflowUtils.buildMapResolver(definition.application(), queryMap)); + } + + public HttpExecutorBuilder withHeaders(WorkflowValueResolver> headersMap) { + this.headersMap = headersMap; + return this; + } + + public HttpExecutorBuilder withQueryMap(WorkflowValueResolver> queryMap) { + this.queryMap = queryMap; + return this; + } + + public HttpExecutorBuilder withMethod(String method) { + this.method = method; + return this; + } + + public HttpExecutorBuilder redirect(boolean redirect) { + this.redirect = redirect; + return this; + } + + public HttpExecutor build(String uri) { + return build((w, f, n) -> URI.create(uri)); + } + + public HttpExecutor build(WorkflowValueResolver uriSupplier) { + this.requestFunction = buildRequestSupplier(method, body, definition.application()); + this.targetSupplier = + pathSupplier == null + ? getTargetSupplier(uriSupplier) + : getTargetSupplier(uriSupplier, pathSupplier); + return build(); + } + + private static WorkflowValueResolver getTargetSupplier( + WorkflowValueResolver uriSupplier, WorkflowValueResolver pathSupplier) { + return (w, t, n) -> + HttpClientResolver.client(w, t) + .target( + WorkflowUtils.concatURI(uriSupplier.apply(w, t, n), pathSupplier.apply(w, t, n))); + } + + public static HttpExecutorBuilder builder(WorkflowDefinition definition) { + return new HttpExecutorBuilder(definition); + } +} diff --git a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/RequestSupplier.java b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/RequestSupplier.java new file mode 100644 index 000000000..5b498759a --- /dev/null +++ b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/RequestSupplier.java @@ -0,0 +1,27 @@ +/* + * Copyright 2020-Present The Serverless Workflow Specification Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.serverlessworkflow.impl.executors.http; + +import io.serverlessworkflow.impl.TaskContext; +import io.serverlessworkflow.impl.WorkflowContext; +import io.serverlessworkflow.impl.WorkflowModel; +import jakarta.ws.rs.client.Invocation.Builder; + +@FunctionalInterface +interface RequestSupplier { + WorkflowModel apply( + Builder request, WorkflowContext workflow, TaskContext task, WorkflowModel node); +} diff --git a/impl/http/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTask b/impl/http/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTask deleted file mode 100644 index 2a9aac2d2..000000000 --- a/impl/http/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTask +++ /dev/null @@ -1 +0,0 @@ -io.serverlessworkflow.impl.executors.http.HttpExecutor \ No newline at end of file diff --git a/impl/http/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTaskBuilder b/impl/http/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTaskBuilder new file mode 100644 index 000000000..ac3c2ec47 --- /dev/null +++ b/impl/http/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTaskBuilder @@ -0,0 +1 @@ +io.serverlessworkflow.impl.executors.http.CallableTaskHttpExecutorBuilder \ No newline at end of file diff --git a/impl/openapi/src/main/java/io/serverlessworkflow/impl/executors/openapi/OpenAPIExecutor.java b/impl/openapi/src/main/java/io/serverlessworkflow/impl/executors/openapi/OpenAPIExecutor.java index 4d0c1a01b..da3e369a1 100644 --- a/impl/openapi/src/main/java/io/serverlessworkflow/impl/executors/openapi/OpenAPIExecutor.java +++ b/impl/openapi/src/main/java/io/serverlessworkflow/impl/executors/openapi/OpenAPIExecutor.java @@ -15,18 +15,14 @@ */ package io.serverlessworkflow.impl.executors.openapi; -import io.serverlessworkflow.api.types.CallOpenAPI; import io.serverlessworkflow.api.types.ExternalResource; -import io.serverlessworkflow.api.types.OpenAPIArguments; -import io.serverlessworkflow.api.types.TaskBase; import io.serverlessworkflow.impl.TaskContext; import io.serverlessworkflow.impl.WorkflowApplication; import io.serverlessworkflow.impl.WorkflowContext; -import io.serverlessworkflow.impl.WorkflowDefinition; import io.serverlessworkflow.impl.WorkflowModel; import io.serverlessworkflow.impl.executors.CallableTask; import io.serverlessworkflow.impl.executors.http.HttpExecutor; -import io.serverlessworkflow.impl.executors.http.HttpExecutor.HttpExecutorBuilder; +import io.serverlessworkflow.impl.executors.http.HttpExecutorBuilder; import io.serverlessworkflow.impl.resources.ResourceLoaderUtils; import io.swagger.v3.oas.models.media.Schema; import java.util.Collection; @@ -37,31 +33,22 @@ import java.util.Set; import java.util.concurrent.CompletableFuture; -public class OpenAPIExecutor implements CallableTask { +class OpenAPIExecutor implements CallableTask { - private OpenAPIProcessor processor; - private ExternalResource resource; - private Map parameters; - private HttpExecutorBuilder builder; + private final OpenAPIProcessor processor; + private final ExternalResource resource; + private final Map parameters; + private final HttpExecutorBuilder builder; - @Override - public boolean accept(Class clazz) { - return clazz.equals(CallOpenAPI.class); - } - - @Override - public void init(CallOpenAPI task, WorkflowDefinition definition) { - OpenAPIArguments with = task.getWith(); - this.processor = new OpenAPIProcessor(with.getOperationId()); - this.resource = with.getDocument(); - this.parameters = - with.getParameters() != null && with.getParameters().getAdditionalProperties() != null - ? with.getParameters().getAdditionalProperties() - : Map.of(); - this.builder = - HttpExecutor.builder(definition) - .withAuth(with.getAuthentication()) - .redirect(with.isRedirect()); + OpenAPIExecutor( + OpenAPIProcessor processor, + ExternalResource resource, + Map parameters, + HttpExecutorBuilder builder) { + this.processor = processor; + this.resource = resource; + this.parameters = parameters; + this.builder = builder; } @Override diff --git a/impl/openapi/src/main/java/io/serverlessworkflow/impl/executors/openapi/OpenAPIExecutorBuilder.java b/impl/openapi/src/main/java/io/serverlessworkflow/impl/executors/openapi/OpenAPIExecutorBuilder.java new file mode 100644 index 000000000..c2a3fabbd --- /dev/null +++ b/impl/openapi/src/main/java/io/serverlessworkflow/impl/executors/openapi/OpenAPIExecutorBuilder.java @@ -0,0 +1,61 @@ +/* + * Copyright 2020-Present The Serverless Workflow Specification Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.serverlessworkflow.impl.executors.openapi; + +import io.serverlessworkflow.api.types.CallOpenAPI; +import io.serverlessworkflow.api.types.ExternalResource; +import io.serverlessworkflow.api.types.OpenAPIArguments; +import io.serverlessworkflow.api.types.TaskBase; +import io.serverlessworkflow.impl.WorkflowDefinition; +import io.serverlessworkflow.impl.WorkflowMutablePosition; +import io.serverlessworkflow.impl.executors.CallableTask; +import io.serverlessworkflow.impl.executors.CallableTaskBuilder; +import io.serverlessworkflow.impl.executors.http.HttpExecutorBuilder; +import java.util.Map; + +public class OpenAPIExecutorBuilder implements CallableTaskBuilder { + + private OpenAPIProcessor processor; + private ExternalResource resource; + private Map parameters; + private HttpExecutorBuilder builder; + + @Override + public boolean accept(Class clazz) { + return clazz.equals(CallOpenAPI.class); + } + + @Override + public void init( + CallOpenAPI task, WorkflowDefinition definition, WorkflowMutablePosition position) { + OpenAPIArguments with = task.getWith(); + this.processor = new OpenAPIProcessor(with.getOperationId()); + this.resource = with.getDocument(); + this.parameters = + with.getParameters() != null && with.getParameters().getAdditionalProperties() != null + ? with.getParameters().getAdditionalProperties() + : Map.of(); + this.builder = + HttpExecutorBuilder.builder(definition) + .withAuth(with.getAuthentication()) + .redirect(with.isRedirect()); + } + + @Override + public CallableTask build() { + return new OpenAPIExecutor(processor, resource, parameters, builder); + } +} diff --git a/impl/openapi/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTask b/impl/openapi/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTask deleted file mode 100644 index e394143ce..000000000 --- a/impl/openapi/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTask +++ /dev/null @@ -1 +0,0 @@ -io.serverlessworkflow.impl.executors.openapi.OpenAPIExecutor diff --git a/impl/openapi/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTaskBuilder b/impl/openapi/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTaskBuilder new file mode 100644 index 000000000..517495e43 --- /dev/null +++ b/impl/openapi/src/main/resources/META-INF/services/io.serverlessworkflow.impl.executors.CallableTaskBuilder @@ -0,0 +1 @@ +io.serverlessworkflow.impl.executors.openapi.OpenAPIExecutorBuilder diff --git a/impl/test/src/test/java/io/serverlessworkflow/impl/test/OAuthHTTPWorkflowDefinitionTest.java b/impl/test/src/test/java/io/serverlessworkflow/impl/test/OAuthHTTPWorkflowDefinitionTest.java index 07ee5b6e0..541d04c10 100644 --- a/impl/test/src/test/java/io/serverlessworkflow/impl/test/OAuthHTTPWorkflowDefinitionTest.java +++ b/impl/test/src/test/java/io/serverlessworkflow/impl/test/OAuthHTTPWorkflowDefinitionTest.java @@ -102,7 +102,8 @@ public void testOAuthClientSecretPostPasswordWorkflowExecution() throws Exceptio .setResponseCode(200)); Workflow workflow = - readWorkflowFromClasspath("workflows-samples/oAuthClientSecretPostPasswordHttpCall.yaml"); + readWorkflowFromClasspath( + "workflows-samples/oauth2/oAuthClientSecretPostPasswordHttpCall.yaml"); Map result = app.workflowDefinition(workflow).instance(Map.of()).start().get().asMap().orElseThrow(); @@ -144,7 +145,7 @@ public void testOAuthClientSecretPostWithArgsWorkflowExecution() throws Exceptio Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/oAuthClientSecretPostPasswordAsArgHttpCall.yaml"); + "workflows-samples/oauth2/oAuthClientSecretPostPasswordAsArgHttpCall.yaml"); Map params = Map.of( @@ -194,7 +195,7 @@ public void testOAuthClientSecretPostWithArgsNoEndPointWorkflowExecution() throw Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/oAuthClientSecretPostPasswordNoEndpointsHttpCall.yaml"); + "workflows-samples/oauth2/oAuthClientSecretPostPasswordNoEndpointsHttpCall.yaml"); Map params = Map.of( @@ -244,7 +245,7 @@ public void testOAuthClientSecretPostWithArgsAllGrantsWorkflowExecution() throws Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/oAuthClientSecretPostPasswordAllGrantsHttpCall.yaml"); + "workflows-samples/oauth2/oAuthClientSecretPostPasswordAllGrantsHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -301,7 +302,7 @@ public void testOAuthClientSecretPostClientCredentialsWorkflowExecution() throws Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/oAuthClientSecretPostClientCredentialsHttpCall.yaml"); + "workflows-samples/oauth2/oAuthClientSecretPostClientCredentialsHttpCall.yaml"); Map result = app.workflowDefinition(workflow).instance(Map.of()).start().get().asMap().orElseThrow(); @@ -344,7 +345,7 @@ public void testOAuthClientSecretPostClientCredentialsParamsWorkflowExecution() Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/oAuthClientSecretPostClientCredentialsParamsHttpCall.yaml"); + "workflows-samples/oauth2/oAuthClientSecretPostClientCredentialsParamsHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -393,7 +394,7 @@ public void testOAuthClientSecretPostClientCredentialsParamsNoEndpointWorkflowEx Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/oAuthClientSecretPostClientCredentialsParamsNoEndPointHttpCall.yaml"); + "workflows-samples/oauth2/oAuthClientSecretPostClientCredentialsParamsNoEndPointHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -439,7 +440,7 @@ public void testOAuthJSONPasswordWorkflowExecution() throws Exception { .setResponseCode(200)); Workflow workflow = - readWorkflowFromClasspath("workflows-samples/oAuthJSONPasswordHttpCall.yaml"); + readWorkflowFromClasspath("workflows-samples/oauth2/oAuthJSONPasswordHttpCall.yaml"); Map result = app.workflowDefinition(workflow).instance(Map.of()).start().get().asMap().orElseThrow(); @@ -494,7 +495,7 @@ public void testOAuthJSONWithArgsWorkflowExecution() throws Exception { .setResponseCode(200)); Workflow workflow = - readWorkflowFromClasspath("workflows-samples/oAuthJSONPasswordAsArgHttpCall.yaml"); + readWorkflowFromClasspath("workflows-samples/oauth2/oAuthJSONPasswordAsArgHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -553,7 +554,8 @@ public void testOAuthJSONWithArgsNoEndPointWorkflowExecution() throws Exception .setResponseCode(200)); Workflow workflow = - readWorkflowFromClasspath("workflows-samples/oAuthJSONPasswordNoEndpointsHttpCall.yaml"); + readWorkflowFromClasspath( + "workflows-samples/oauth2/oAuthJSONPasswordNoEndpointsHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -611,7 +613,8 @@ public void testOAuthJSONWithArgsAllGrantsWorkflowExecution() throws Exception { .setResponseCode(200)); Workflow workflow = - readWorkflowFromClasspath("workflows-samples/oAuthJSONPasswordAllGrantsHttpCall.yaml"); + readWorkflowFromClasspath( + "workflows-samples/oauth2/oAuthJSONPasswordAllGrantsHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -683,7 +686,8 @@ public void testOAuthJSONClientCredentialsWorkflowExecution() throws Exception { .setResponseCode(200)); Workflow workflow = - readWorkflowFromClasspath("workflows-samples/oAuthJSONClientCredentialsHttpCall.yaml"); + readWorkflowFromClasspath( + "workflows-samples/oauth2/oAuthJSONClientCredentialsHttpCall.yaml"); Map result = app.workflowDefinition(workflow).instance(Map.of()).start().get().asMap().orElseThrow(); @@ -731,7 +735,7 @@ public void testOAuthJSONClientCredentialsParamsWorkflowExecution() throws Excep Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/oAuthJSONClientCredentialsParamsHttpCall.yaml"); + "workflows-samples/oauth2/oAuthJSONClientCredentialsParamsHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -784,7 +788,7 @@ public void testOAuthJSONClientCredentialsParamsNoEndpointWorkflowExecution() th Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/oAuthJSONClientCredentialsParamsNoEndPointHttpCall.yaml"); + "workflows-samples/oauth2/oAuthJSONClientCredentialsParamsNoEndPointHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", diff --git a/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenIDCHTTPWorkflowDefinitionTest.java b/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenIDCHTTPWorkflowDefinitionTest.java index 42604632b..66cc17cd1 100644 --- a/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenIDCHTTPWorkflowDefinitionTest.java +++ b/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenIDCHTTPWorkflowDefinitionTest.java @@ -103,7 +103,8 @@ public void testOpenIDCClientSecretPostPasswordWorkflowExecution() throws Except .setResponseCode(200)); Workflow workflow = - readWorkflowFromClasspath("workflows-samples/openidcClientSecretPostPasswordHttpCall.yaml"); + readWorkflowFromClasspath( + "workflows-samples/openid/openidcClientSecretPostPasswordHttpCall.yaml"); Map result = app.workflowDefinition(workflow).instance(Map.of()).start().get().asMap().orElseThrow(); @@ -148,7 +149,7 @@ public void testOpenIDCClientSecretPostWithArgsWorkflowExecution() throws Except Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/openidcClientSecretPostPasswordAsArgHttpCall.yaml"); + "workflows-samples/openid/openidcClientSecretPostPasswordAsArgHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -199,7 +200,7 @@ public void testOpenIDCClientSecretPostWithArgsAllGrantsWorkflowExecution() thro Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/openidcClientSecretPostPasswordAllGrantsHttpCall.yaml"); + "workflows-samples/openid/openidcClientSecretPostPasswordAllGrantsHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -258,7 +259,7 @@ public void testOpenIDCClientSecretPostClientCredentialsParamsWorkflowExecution( Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/openidcClientSecretPostClientCredentialsParamsHttpCall.yaml"); + "workflows-samples/openid/openidcClientSecretPostClientCredentialsParamsHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -307,7 +308,7 @@ public void testOpenIDCClientSecretPostClientCredentialsParamsNoEndpointWorkflow Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/openidcClientSecretPostClientCredentialsParamsNoEndPointHttpCall.yaml"); + "workflows-samples/openid/openidcClientSecretPostClientCredentialsParamsNoEndPointHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -352,7 +353,7 @@ public void testOpenIDCJSONPasswordWorkflowExecution() throws Exception { .setResponseCode(200)); Workflow workflow = - readWorkflowFromClasspath("workflows-samples/openidcJSONPasswordHttpCall.yaml"); + readWorkflowFromClasspath("workflows-samples/openid/openidcJSONPasswordHttpCall.yaml"); Map result = app.workflowDefinition(workflow).instance(Map.of()).start().get().asMap().orElseThrow(); @@ -407,7 +408,7 @@ public void testOpenIDCJSONWithArgsWorkflowExecution() throws Exception { .setResponseCode(200)); Workflow workflow = - readWorkflowFromClasspath("workflows-samples/openidcJSONPasswordAsArgHttpCall.yaml"); + readWorkflowFromClasspath("workflows-samples/openid/openidcJSONPasswordAsArgHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -466,7 +467,8 @@ public void testOpenIDCJSONWithArgsNoEndPointWorkflowExecution() throws Exceptio .setResponseCode(200)); Workflow workflow = - readWorkflowFromClasspath("workflows-samples/openidcJSONPasswordNoEndpointsHttpCall.yaml"); + readWorkflowFromClasspath( + "workflows-samples/openid/openidcJSONPasswordNoEndpointsHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -524,7 +526,8 @@ public void testOpenIDCJSONWithArgsAllGrantsWorkflowExecution() throws Exception .setResponseCode(200)); Workflow workflow = - readWorkflowFromClasspath("workflows-samples/openidcJSONPasswordAllGrantsHttpCall.yaml"); + readWorkflowFromClasspath( + "workflows-samples/openid/openidcJSONPasswordAllGrantsHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -596,7 +599,8 @@ public void testOpenIDCJSONClientCredentialsWorkflowExecution() throws Exception .setResponseCode(200)); Workflow workflow = - readWorkflowFromClasspath("workflows-samples/openidcJSONClientCredentialsHttpCall.yaml"); + readWorkflowFromClasspath( + "workflows-samples/openid/openidcJSONClientCredentialsHttpCall.yaml"); Map result = app.workflowDefinition(workflow).instance(Map.of()).start().get().asMap().orElseThrow(); @@ -644,7 +648,7 @@ public void testOpenIDCJSONClientCredentialsParamsWorkflowExecution() throws Exc Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/openidcJSONClientCredentialsParamsHttpCall.yaml"); + "workflows-samples/openid/openidcJSONClientCredentialsParamsHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", @@ -697,7 +701,7 @@ public void testOpenIDCJSONClientCredentialsParamsNoEndpointWorkflowExecution() Workflow workflow = readWorkflowFromClasspath( - "workflows-samples/openidcJSONClientCredentialsParamsNoEndPointHttpCall.yaml"); + "workflows-samples/openid/openidcJSONClientCredentialsParamsNoEndPointHttpCall.yaml"); Map params = Map.of( "clientId", "serverless-workflow", diff --git a/impl/test/src/test/java/io/serverlessworkflow/impl/test/RetryTimeoutTest.java b/impl/test/src/test/java/io/serverlessworkflow/impl/test/RetryTimeoutTest.java index 586cc0181..976820262 100644 --- a/impl/test/src/test/java/io/serverlessworkflow/impl/test/RetryTimeoutTest.java +++ b/impl/test/src/test/java/io/serverlessworkflow/impl/test/RetryTimeoutTest.java @@ -121,4 +121,19 @@ void testTimeout() throws IOException { .orElseThrow(); assertThat(result.get("message")).isEqualTo("Viva er Beti Balompie"); } + + @Test + void testCustomFunction() { + assertThatThrownBy( + () -> + app.workflowDefinition( + readWorkflowFromClasspath( + "workflows-samples/call-custom-function-inline.yaml")) + .instance(Map.of()) + .start() + .join()) + .hasCauseInstanceOf(WorkflowException.class) + .extracting(w -> ((WorkflowException) w.getCause()).getWorkflowError().status()) + .isEqualTo(404); + } } diff --git a/impl/test/src/test/resources/workflows-samples/call-custom-function-inline.yaml b/impl/test/src/test/resources/workflows-samples/call-custom-function-inline.yaml new file mode 100644 index 000000000..617fe6b05 --- /dev/null +++ b/impl/test/src/test/resources/workflows-samples/call-custom-function-inline.yaml @@ -0,0 +1,25 @@ +document: + dsl: '1.0.1' + namespace: test + name: call-custom-function-inline + version: '0.1.0' +use: + functions: + getPetById: + input: + schema: + document: + type: object + properties: + petId: + type: integer + required: [ petId ] + call: http + with: + method: get + endpoint: https://petstore.swagger.io/v2/pet/{petId} +do: + - getPet: + call: getPetById + with: + petId: 69 \ No newline at end of file diff --git a/impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostClientCredentialsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostClientCredentialsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostClientCredentialsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostClientCredentialsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostClientCredentialsParamsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostClientCredentialsParamsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostClientCredentialsParamsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostClientCredentialsParamsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostClientCredentialsParamsNoEndPointHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostClientCredentialsParamsNoEndPointHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostClientCredentialsParamsNoEndPointHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostClientCredentialsParamsNoEndPointHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostPasswordAllGrantsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostPasswordAllGrantsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostPasswordAllGrantsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostPasswordAllGrantsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostPasswordAsArgHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostPasswordAsArgHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostPasswordAsArgHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostPasswordAsArgHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostPasswordHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostPasswordHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostPasswordHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostPasswordHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostPasswordNoEndpointsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostPasswordNoEndpointsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthClientSecretPostPasswordNoEndpointsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthClientSecretPostPasswordNoEndpointsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthJSONClientCredentialsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONClientCredentialsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthJSONClientCredentialsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONClientCredentialsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthJSONClientCredentialsParamsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONClientCredentialsParamsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthJSONClientCredentialsParamsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONClientCredentialsParamsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthJSONClientCredentialsParamsNoEndPointHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONClientCredentialsParamsNoEndPointHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthJSONClientCredentialsParamsNoEndPointHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONClientCredentialsParamsNoEndPointHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthJSONPasswordAllGrantsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONPasswordAllGrantsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthJSONPasswordAllGrantsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONPasswordAllGrantsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthJSONPasswordAsArgHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONPasswordAsArgHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthJSONPasswordAsArgHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONPasswordAsArgHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthJSONPasswordHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONPasswordHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthJSONPasswordHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONPasswordHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/oAuthJSONPasswordNoEndpointsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONPasswordNoEndpointsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/oAuthJSONPasswordNoEndpointsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/oauth2/oAuthJSONPasswordNoEndpointsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/openidcClientSecretPostClientCredentialsParamsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/openid/openidcClientSecretPostClientCredentialsParamsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/openidcClientSecretPostClientCredentialsParamsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/openid/openidcClientSecretPostClientCredentialsParamsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/openidcClientSecretPostClientCredentialsParamsNoEndPointHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/openid/openidcClientSecretPostClientCredentialsParamsNoEndPointHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/openidcClientSecretPostClientCredentialsParamsNoEndPointHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/openid/openidcClientSecretPostClientCredentialsParamsNoEndPointHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/openidcClientSecretPostPasswordAllGrantsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/openid/openidcClientSecretPostPasswordAllGrantsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/openidcClientSecretPostPasswordAllGrantsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/openid/openidcClientSecretPostPasswordAllGrantsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/openidcClientSecretPostPasswordAsArgHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/openid/openidcClientSecretPostPasswordAsArgHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/openidcClientSecretPostPasswordAsArgHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/openid/openidcClientSecretPostPasswordAsArgHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/openidcClientSecretPostPasswordHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/openid/openidcClientSecretPostPasswordHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/openidcClientSecretPostPasswordHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/openid/openidcClientSecretPostPasswordHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/openidcJSONClientCredentialsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/openid/openidcJSONClientCredentialsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/openidcJSONClientCredentialsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/openid/openidcJSONClientCredentialsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/openidcJSONClientCredentialsParamsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/openid/openidcJSONClientCredentialsParamsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/openidcJSONClientCredentialsParamsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/openid/openidcJSONClientCredentialsParamsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/openidcJSONClientCredentialsParamsNoEndPointHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/openid/openidcJSONClientCredentialsParamsNoEndPointHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/openidcJSONClientCredentialsParamsNoEndPointHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/openid/openidcJSONClientCredentialsParamsNoEndPointHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/openidcJSONPasswordAllGrantsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/openid/openidcJSONPasswordAllGrantsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/openidcJSONPasswordAllGrantsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/openid/openidcJSONPasswordAllGrantsHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/openidcJSONPasswordAsArgHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/openid/openidcJSONPasswordAsArgHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/openidcJSONPasswordAsArgHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/openid/openidcJSONPasswordAsArgHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/openidcJSONPasswordHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/openid/openidcJSONPasswordHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/openidcJSONPasswordHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/openid/openidcJSONPasswordHttpCall.yaml diff --git a/impl/test/src/test/resources/workflows-samples/openidcJSONPasswordNoEndpointsHttpCall.yaml b/impl/test/src/test/resources/workflows-samples/openid/openidcJSONPasswordNoEndpointsHttpCall.yaml similarity index 100% rename from impl/test/src/test/resources/workflows-samples/openidcJSONPasswordNoEndpointsHttpCall.yaml rename to impl/test/src/test/resources/workflows-samples/openid/openidcJSONPasswordNoEndpointsHttpCall.yaml