diff --git a/kogito-quarkus-examples/dmn-15-quarkus-example/pom.xml b/kogito-quarkus-examples/dmn-15-quarkus-example/pom.xml new file mode 100644 index 0000000000..fa813092a8 --- /dev/null +++ b/kogito-quarkus-examples/dmn-15-quarkus-example/pom.xml @@ -0,0 +1,150 @@ + + + 4.0.0 + + org.kie.kogito.examples + kogito-quarkus-examples + 999-SNAPSHOT + + + dmn-15-quarkus-example + Kogito Example :: DMN :: 1.5 Features + + 3.2.10.Final + quarkus-bom + io.quarkus + 3.2.10.Final + org.kie.kogito + kogito-bom + 999-SNAPSHOT + 999-SNAPSHOT + 3.6.1 + + + + + org.kie + kie-dmn-test-resources + ${project.version} + tests + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + ${kogito.bom.group-id} + ${kogito.bom.artifact-id} + ${kogito.bom.version} + pom + import + + + + + + org.kie + kie-dmn-test-resources + tests + + + org.drools + drools-quarkus-decisions + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-resteasy-jackson + + + io.quarkus + quarkus-smallrye-openapi + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + org.kie.kogito + kogito-scenario-simulation + test + + + io.quarkus + quarkus-smallrye-health + + + + ${project.artifactId} + + + src/main/resources + + + + ${project.build.directory}/generated-resources + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus-plugin.version} + + + + build + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + ${dependency-plugin.version} + + + unpack + generate-resources + + unpack + + + + + org.kie + kie-dmn-test-resources + ${project.version} + tests + jar + true + ${project.build.directory}/generated-resources + valid_models/**/*.dmn + + + + + + + + + \ No newline at end of file diff --git a/kogito-quarkus-examples/dmn-15-quarkus-example/src/main/resources/application.properties b/kogito-quarkus-examples/dmn-15-quarkus-example/src/main/resources/application.properties new file mode 100644 index 0000000000..727b6c82f1 --- /dev/null +++ b/kogito-quarkus-examples/dmn-15-quarkus-example/src/main/resources/application.properties @@ -0,0 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# + +# Packaging + +quarkus.swagger-ui.always-include=true diff --git a/kogito-quarkus-examples/pom.xml b/kogito-quarkus-examples/pom.xml index 4527828151..fbecf477cb 100644 --- a/kogito-quarkus-examples/pom.xml +++ b/kogito-quarkus-examples/pom.xml @@ -50,6 +50,7 @@ decisiontable-quarkus-example + dmn-15-quarkus-example dmn-drools-quarkus-metrics dmn-event-driven-quarkus dmn-incubation-api-quarkus @@ -127,12 +128,15 @@ decisiontable-quarkus-example + dmn-15-quarkus-example dmn-drools-quarkus-metrics dmn-event-driven-quarkus dmn-knative-quickstart-quarkus dmn-listener-quarkus dmn-pmml-quarkus-example dmn-quarkus-example + dmn-resource-jar-quarkus-example + dmn-multiple-models-quarkus-example dmn-tracing-quarkus flexible-process-quarkus kogito-travel-agency diff --git a/serverless-workflow-examples/pom.xml b/serverless-workflow-examples/pom.xml index 0980443157..4fac574db8 100644 --- a/serverless-workflow-examples/pom.xml +++ b/serverless-workflow-examples/pom.xml @@ -78,6 +78,7 @@ serverless-workflow-timeouts-showcase-extended serverless-workflow-timeouts-showcase-operator-devprofile serverless-workflow-python-quarkus + sonataflow-fluent diff --git a/serverless-workflow-examples/serverless-workflow-annotations-description/pom.xml b/serverless-workflow-examples/serverless-workflow-annotations-description/pom.xml index d2f2636c3e..a0e76573f9 100644 --- a/serverless-workflow-examples/serverless-workflow-annotations-description/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-annotations-description/pom.xml @@ -70,8 +70,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -82,7 +82,7 @@ quarkus-resteasy-jackson - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-callback-events-over-http-quarkus/callback-workflow/pom.xml b/serverless-workflow-examples/serverless-workflow-callback-events-over-http-quarkus/callback-workflow/pom.xml index 1bc7f44e9c..edfc25e6b2 100644 --- a/serverless-workflow-examples/serverless-workflow-callback-events-over-http-quarkus/callback-workflow/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-callback-events-over-http-quarkus/callback-workflow/pom.xml @@ -67,8 +67,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -79,7 +79,7 @@ quarkus-resteasy-jackson - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-callback-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-callback-quarkus/pom.xml index 2dc7c13696..952b55b9a8 100644 --- a/serverless-workflow-examples/serverless-workflow-callback-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-callback-quarkus/pom.xml @@ -69,8 +69,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus org.kie @@ -89,7 +89,7 @@ kie-addons-quarkus-process-management - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-camel-routes/pom.xml b/serverless-workflow-examples/serverless-workflow-camel-routes/pom.xml index 9e806dbb18..5fbcbc189e 100644 --- a/serverless-workflow-examples/serverless-workflow-camel-routes/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-camel-routes/pom.xml @@ -76,12 +76,12 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus - org.kie.kogito - kogito-addons-quarkus-camel + org.apache.kie.sonataflow + sonataflow-addons-quarkus-camel org.apache.camel.quarkus diff --git a/serverless-workflow-examples/serverless-workflow-compensation-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-compensation-quarkus/pom.xml index f86ec69c16..e1e779d3bd 100644 --- a/serverless-workflow-examples/serverless-workflow-compensation-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-compensation-quarkus/pom.xml @@ -70,8 +70,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -87,7 +87,7 @@ quarkus-resteasy-jackson - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-consuming-events-over-http-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-consuming-events-over-http-quarkus/pom.xml index af52a03fa0..99f2c875fd 100644 --- a/serverless-workflow-examples/serverless-workflow-consuming-events-over-http-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-consuming-events-over-http-quarkus/pom.xml @@ -71,8 +71,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -83,7 +83,7 @@ quarkus-resteasy-jackson - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-correlation-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-correlation-quarkus/pom.xml index d57a0600a0..108ef48941 100644 --- a/serverless-workflow-examples/serverless-workflow-correlation-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-correlation-quarkus/pom.xml @@ -69,8 +69,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus org.kie @@ -93,7 +93,7 @@ quarkus-smallrye-health - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-custom-function-knative/README.md b/serverless-workflow-examples/serverless-workflow-custom-function-knative/README.md index 4243d40c5b..31c03fd5b9 100644 --- a/serverless-workflow-examples/serverless-workflow-custom-function-knative/README.md +++ b/serverless-workflow-examples/serverless-workflow-custom-function-knative/README.md @@ -23,27 +23,51 @@ You will need: - Note that GraalVM native image compilation typically requires other packages (glibc-devel, zlib-devel and gcc) to be installed too. You also need 'native-image' installed in GraalVM (using 'gu install native-image'). Please refer to [GraalVM installation documentation](https://www.graalvm.org/docs/reference-manual/aot-compilation/#prerequisites) for more details. - minikube (https://minikube.sigs.k8s.io/docs/start/) - Knative [quickstarts](https://knative.dev/docs/getting-started/quickstart-install/) - - Run `eval $(minikube -p minikube docker-env --profile knative)` to build the images in your internal Minikube registry. - + +### Minikube settings + +Execute this command to build the images in your Minikube internal registry. +```shell +eval $(minikube -p minikube docker-env --profile knative) +``` + +To expose the service URLs in your local environment you must start the minikube tunnel. + +```shell +# you will be asked for your admin password +minikube tunnel --profile knative +``` + +### Creating the namespace + +```shell +# The namespace name is very important to ensure all the services that compose the example can interact. +kubectl create ns custom-functions +``` + ### Deploy the `custom-function-knative-service` project to Knative From the `custom-function-knative-service` directory run: ```sh -mvn clean package -Dquarkus.kubernetes.deploy=true -Dquarkus.container-image.group=dev.local/ +mvn clean package -Dcontainer +``` + +```sh +kubectl apply -f target/kubernetes/knative.yml ``` Check if the service was successfully deployed: ```sh -kn service list +kn service list -n custom-functions ``` You should see something similar to (URL should change): ```sh -NAME URL LATEST AGE CONDITIONS READY REASON -custom-function-knative-service http://custom-function-knative-service.default.10.109.169.193.sslip.io custom-function-knative-service-00001 13s 3 OK / 3 True +NAME URL LATEST AGE CONDITIONS READY REASON +custom-function-knative-service http://custom-function-knative-service.custom-functions.10.107.55.54.sslip.io custom-function-knative-service-00001 53s 3 OK / 3 True ``` ### Deploy the `workflow` project to Knative @@ -51,21 +75,25 @@ custom-function-knative-service http://custom-function-knative-service.default From the `workflow` directory run: ```sh -mvn clean package -Dquarkus.kubernetes.deploy=true -Dquarkus.container-image.group=dev.local/ +mvn clean package -Dcontainer +``` + +```sh +kubectl apply -f target/kubernetes/knative.yml ``` Check if the service was successfully deployed: ```sh -kn service list +kn service list -n custom-functions ``` You should see both services deployed similar to (URLs should change): ```sh -NAME URL LATEST AGE CONDITIONS READY REASON -custom-function-knative-service http://custom-function-knative-service.default.10.109.169.193.sslip.io custom-function-knative-service-00001 3m53s 3 OK / 3 True -workflow http://workflow.default.10.109.169.193.sslip.io workflow-00001 12s 3 OK / 3 True +NAME URL LATEST AGE CONDITIONS READY REASON +custom-function-knative-service http://custom-function-knative-service.custom-functions.10.107.55.54.sslip.io custom-function-knative-service-00001 9m45s 3 OK / 3 True +workflow http://workflow.custom-functions.10.107.55.54.sslip.io workflow-00001 8s 3 OK / 3 True ``` ### Submit a request with a plain JSON object @@ -103,7 +131,10 @@ The service based on the JSON workflow definition can be accessed by sending a r "cloudevent": { "specversion": "1.0", "source": "org.acme.source", - "type": "test" + "type": "test", + "data": { + "value": "test data" + } } } ``` @@ -120,11 +151,20 @@ curl -X 'POST' \ '/cloudEventKnativeFunction' \ -H 'accept: */*' \ -H 'Content-Type: application/json' \ - -d '{ "cloudevent": { "specversion": "1.0", "source": "org.acme.source", "type": "test" }}' + -d '{ "cloudevent": { "specversion": "1.0", "source": "org.acme.source", "type": "test", "data": { "value": "test data"} }}' ``` Should return something like this ("id" will change): ```json {"id":"8dc00353-c1c6-45e9-845d-e9188d103f50","workflowdata":{"id":"response-of-org.acme.source_8dc00353-c1c6-45e9-845d-e9188d103f50","specversion":"1.0","source":"cloudEventFunction","type":"annotated"}} -``` \ No newline at end of file +``` + +### Cleaning the example + +To remove the installed services from your minikube installation you can use the following command: + +```shell +# Note: this command might take some seconds. +kubectl delete namespace custom-functions +``` diff --git a/serverless-workflow-examples/serverless-workflow-custom-function-knative/custom-function-knative-service/pom.xml b/serverless-workflow-examples/serverless-workflow-custom-function-knative/custom-function-knative-service/pom.xml index e0c14d0ec5..9a39ba77bc 100644 --- a/serverless-workflow-examples/serverless-workflow-custom-function-knative/custom-function-knative-service/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-custom-function-knative/custom-function-knative-service/pom.xml @@ -39,9 +39,11 @@ org.kie.kogito kogito-bom 999-SNAPSHOT - 3.8.1 + 3.11.0 17 3.0.0-M7 + UTF-8 + UTF-8 @@ -79,10 +81,6 @@ io.quarkus quarkus-kubernetes - - io.quarkus - quarkus-container-image-jib - io.quarkus quarkus-funqy-knative-events diff --git a/serverless-workflow-examples/serverless-workflow-custom-function-knative/custom-function-knative-service/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-custom-function-knative/custom-function-knative-service/src/main/resources/application.properties index c17fbdeed9..cba1b3fe93 100644 --- a/serverless-workflow-examples/serverless-workflow-custom-function-knative/custom-function-knative-service/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-custom-function-knative/custom-function-knative-service/src/main/resources/application.properties @@ -19,7 +19,13 @@ quarkus.native.native-image-xmx=8g quarkus.kubernetes.deployment-target=knative +quarkus.knative.namespace=custom-functions +quarkus.knative.image-pull-policy=if-not-present quarkus.funqy.knative-events.mapping.cloudEventFunction.trigger=test quarkus.funqy.knative-events.mapping.cloudEventFunction.response-type=annotated -quarkus.funqy.knative-events.mapping.cloudEventFunction.response-source=cloudEventFunction \ No newline at end of file +quarkus.funqy.knative-events.mapping.cloudEventFunction.response-source=cloudEventFunction + +%container.quarkus.container-image.build=true +%container.quarkus.container-image.registry=dev.local +%container.quarkus.container-image.group=${USER} diff --git a/serverless-workflow-examples/serverless-workflow-custom-function-knative/pom.xml b/serverless-workflow-examples/serverless-workflow-custom-function-knative/pom.xml index 3c99443a7b..e740789938 100644 --- a/serverless-workflow-examples/serverless-workflow-custom-function-knative/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-custom-function-knative/pom.xml @@ -32,7 +32,6 @@ ../serverless-workflow-examples-parent/pom.xml - org.kie.kogito.examples serverless-workflow-custom-function-knative 1.0-SNAPSHOT Kogito Example :: Serverless Workflow Custom Function :: Quarkus diff --git a/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/pom.xml b/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/pom.xml index 26fd62fc32..d963ef104f 100644 --- a/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/pom.xml @@ -40,11 +40,13 @@ org.kie.kogito kogito-bom 999-SNAPSHOT - 3.8.1 + 3.11.0 17 3.0.0-M7 2.33.2 2.35.0 + UTF-8 + UTF-8 @@ -66,10 +68,6 @@ - - org.kie.kogito - kogito-quarkus-serverless-workflow - io.quarkus quarkus-resteasy @@ -79,8 +77,16 @@ quarkus-resteasy-jackson - org.kie.kogito - sonataflow-quarkus-devui + io.quarkus + quarkus-smallrye-openapi + + + io.quarkus + quarkus-kubernetes + + + org.apache.kie.sonataflow + sonataflow-quarkus org.kie @@ -98,14 +104,6 @@ org.kie kogito-addons-quarkus-fabric8-kubernetes-service-catalog - - io.quarkus - quarkus-kubernetes - - - io.quarkus - quarkus-container-image-jib - io.quarkus quarkus-junit5 diff --git a/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/kubernetes/common.yml b/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/kubernetes/common.yml new file mode 100644 index 0000000000..93ca6f22bb --- /dev/null +++ b/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/kubernetes/common.yml @@ -0,0 +1,49 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: service-discovery-role +rules: + - apiGroups: + - "" + resources: + - pods + - services + verbs: + - get + - list + - apiGroups: + - apps + resources: + - deployments + - statefulsets + verbs: + - get + - list + - apiGroups: + - networking.k8s.io + resources: + - ingresses + verbs: + - get + - list + # Knative + - apiGroups: + - serving.knative.dev + resources: + - services + verbs: + - get + - list +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: service-discovery-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: service-discovery-role +subjects: + - kind: ServiceAccount + name: default \ No newline at end of file diff --git a/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/application.properties index ece1f79438..f37ee1ea88 100644 --- a/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/application.properties @@ -16,6 +16,20 @@ # specific language governing permissions and limitations # under the License. # +quarkus.swagger-ui.always-include=true +kogito.devservices.enabled=false quarkus.native.native-image-xmx=8g -quarkus.kubernetes.deployment-target=knative \ No newline at end of file +quarkus.kubernetes.deployment-target=knative +# The name of the application. This value will be used for naming Kubernetes resources like: Deployment, Service, etc. +quarkus.knative.name=workflow +quarkus.knative.namespace=custom-functions +quarkus.knative.image-pull-policy=if-not-present + +%container.quarkus.container-image.build=true +# Since the Quarkus project has no java files, Quarkus 3.2.10.Final is picking the default image +# base: registry.access.redhat.com/ubi8/openjdk-11-runtime:1.16'. Not good, since the workflows requires java 17. +# Quarkus 3.8.1 picks openjdk-17 even when no java files, so this configuration can be removed in the future. +%container.quarkus.jib.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-17-runtime:1.16 +%container.quarkus.container-image.registry=dev.local +%container.quarkus.container-image.group=${USER} \ No newline at end of file diff --git a/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/cloudeventKnativeFunction.sw.json b/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/cloudeventKnativeFunction.sw.json index 2b1b420267..2e7d35fc1b 100644 --- a/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/cloudeventKnativeFunction.sw.json +++ b/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/cloudeventKnativeFunction.sw.json @@ -8,7 +8,7 @@ { "name": "greet", "type": "custom", - "operation": "knative:services.v1.serving.knative.dev/default/custom-function-knative-service?path=/cloudEventFunction&asCloudEvent=true" + "operation": "knative:services.v1.serving.knative.dev/custom-functions/custom-function-knative-service?path=/cloudEventFunction&asCloudEvent=true" } ], "states": [ @@ -19,7 +19,12 @@ { "functionRef": { "refName": "greet", - "arguments": ".cloudevent" + "arguments": { + "specversion" : ".cloudevent.specversion", + "type": ".cloudevent.type", + "source": ".cloudevent.source", + "data": ".cloudevent.data" + } } } ], diff --git a/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/fullGvkPlainJsonKnativeFunction.sw.json b/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/fullGvkPlainJsonKnativeFunction.sw.json index 8d76b4f1a5..5eadcd9928 100644 --- a/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/fullGvkPlainJsonKnativeFunction.sw.json +++ b/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/fullGvkPlainJsonKnativeFunction.sw.json @@ -8,7 +8,7 @@ { "name": "greet", "type": "custom", - "operation": "knative:services.v1.serving.knative.dev/custom-function-knative-service?path=/plainJsonFunction" + "operation": "knative:services.v1.serving.knative.dev/custom-functions/custom-function-knative-service?path=/plainJsonFunction" } ], "states": [ diff --git a/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/plainJsonKnativeFunction.sw.json b/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/plainJsonKnativeFunction.sw.json index 7c69121513..d29a2b2481 100644 --- a/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/plainJsonKnativeFunction.sw.json +++ b/serverless-workflow-examples/serverless-workflow-custom-function-knative/workflow/src/main/resources/plainJsonKnativeFunction.sw.json @@ -8,7 +8,7 @@ { "name": "greet", "type": "custom", - "operation": "knative:services.v1.serving.knative.dev/default/custom-function-knative-service?path=/plainJsonFunction" + "operation": "knative:services.v1.serving.knative.dev/custom-functions/custom-function-knative-service?path=/plainJsonFunction" } ], "states": [ diff --git a/serverless-workflow-examples/serverless-workflow-custom-type/serverless-workflow-custom-rpc-deployment/pom.xml b/serverless-workflow-examples/serverless-workflow-custom-type/serverless-workflow-custom-rpc-deployment/pom.xml index 641b863951..e76fac5082 100644 --- a/serverless-workflow-examples/serverless-workflow-custom-type/serverless-workflow-custom-rpc-deployment/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-custom-type/serverless-workflow-custom-rpc-deployment/pom.xml @@ -41,8 +41,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow-deployment + org.apache.kie.sonataflow + sonataflow-quarkus-deployment diff --git a/serverless-workflow-examples/serverless-workflow-custom-type/serverless-workflow-custom-rpc/pom.xml b/serverless-workflow-examples/serverless-workflow-custom-type/serverless-workflow-custom-rpc/pom.xml index 05f4af7480..4b46ec33bf 100644 --- a/serverless-workflow-examples/serverless-workflow-custom-type/serverless-workflow-custom-rpc/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-custom-type/serverless-workflow-custom-rpc/pom.xml @@ -35,8 +35,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus org.kie.kogito.examples diff --git a/serverless-workflow-examples/serverless-workflow-custom-type/serverless-workflow-custom-type-example/pom.xml b/serverless-workflow-examples/serverless-workflow-custom-type/serverless-workflow-custom-type-example/pom.xml index 8312bc59db..78ac2ca09f 100644 --- a/serverless-workflow-examples/serverless-workflow-custom-type/serverless-workflow-custom-type-example/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-custom-type/serverless-workflow-custom-type-example/pom.xml @@ -36,8 +36,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus diff --git a/serverless-workflow-examples/serverless-workflow-data-index-persistence-addon-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-data-index-persistence-addon-quarkus/pom.xml index f05a6de5dc..140acb90df 100644 --- a/serverless-workflow-examples/serverless-workflow-data-index-persistence-addon-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-data-index-persistence-addon-quarkus/pom.xml @@ -49,8 +49,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -77,7 +77,7 @@ kie-addons-quarkus-process-management - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-data-index-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-data-index-quarkus/pom.xml index b388d83641..04ea1b8314 100644 --- a/serverless-workflow-examples/serverless-workflow-data-index-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-data-index-quarkus/pom.xml @@ -69,8 +69,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus org.kie @@ -81,7 +81,7 @@ quarkus-smallrye-reactive-messaging-kafka - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-error-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-error-quarkus/pom.xml index 8386c4a170..9d57340daf 100644 --- a/serverless-workflow-examples/serverless-workflow-error-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-error-quarkus/pom.xml @@ -69,8 +69,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -81,7 +81,7 @@ quarkus-resteasy-jackson - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-events-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-events-quarkus/pom.xml index 6975755e5c..5f3da1bf93 100644 --- a/serverless-workflow-examples/serverless-workflow-events-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-events-quarkus/pom.xml @@ -70,8 +70,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -94,7 +94,7 @@ jackson-databind - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-expression-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-expression-quarkus/pom.xml index f17c960ddb..a0459cb10e 100644 --- a/serverless-workflow-examples/serverless-workflow-expression-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-expression-quarkus/pom.xml @@ -69,8 +69,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -81,7 +81,7 @@ quarkus-resteasy-jackson - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-foreach-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-foreach-quarkus/pom.xml index 05b76f2acf..5ef3348ca2 100644 --- a/serverless-workflow-examples/serverless-workflow-foreach-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-foreach-quarkus/pom.xml @@ -69,8 +69,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -86,7 +86,7 @@ quarkus-resteasy-jackson - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-functions-events-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-functions-events-quarkus/pom.xml index c2aa4e6922..464b455b1c 100644 --- a/serverless-workflow-examples/serverless-workflow-functions-events-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-functions-events-quarkus/pom.xml @@ -77,8 +77,8 @@ drools-quarkus-rules - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus org.kie @@ -109,7 +109,7 @@ quarkus-smallrye-health - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-functions-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-functions-quarkus/pom.xml index 4fce1c7553..25f51fbef8 100644 --- a/serverless-workflow-examples/serverless-workflow-functions-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-functions-quarkus/pom.xml @@ -72,8 +72,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -96,7 +96,7 @@ quarkus-smallrye-health - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-funqy/sw-funqy-workflow/pom.xml b/serverless-workflow-examples/serverless-workflow-funqy/sw-funqy-workflow/pom.xml index f3a4bd953b..d8a71f9751 100644 --- a/serverless-workflow-examples/serverless-workflow-funqy/sw-funqy-workflow/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-funqy/sw-funqy-workflow/pom.xml @@ -64,8 +64,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus diff --git a/serverless-workflow-examples/serverless-workflow-github-showcase/pr-checker-workflow/pom.xml b/serverless-workflow-examples/serverless-workflow-github-showcase/pr-checker-workflow/pom.xml index 8b948626fb..96d42cd698 100644 --- a/serverless-workflow-examples/serverless-workflow-github-showcase/pr-checker-workflow/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-github-showcase/pr-checker-workflow/pom.xml @@ -61,8 +61,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus org.kie diff --git a/serverless-workflow-examples/serverless-workflow-greeting-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-greeting-quarkus/pom.xml index 4800e00de8..7e28cb9f0b 100644 --- a/serverless-workflow-examples/serverless-workflow-greeting-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-greeting-quarkus/pom.xml @@ -69,8 +69,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -85,7 +85,7 @@ quarkus-jsonp - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-greeting-rpc-quarkus/serverless-workflow-greeting-client-rpc-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-greeting-rpc-quarkus/serverless-workflow-greeting-client-rpc-quarkus/pom.xml index edb7b2ea42..eb1e2627a9 100644 --- a/serverless-workflow-examples/serverless-workflow-greeting-rpc-quarkus/serverless-workflow-greeting-client-rpc-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-greeting-rpc-quarkus/serverless-workflow-greeting-client-rpc-quarkus/pom.xml @@ -62,8 +62,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus org.kie.kogito.examples @@ -94,7 +94,7 @@ quarkus-smallrye-health - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-hello-world/pom.xml b/serverless-workflow-examples/serverless-workflow-hello-world/pom.xml index 4fd5ac2aa2..89cf971118 100644 --- a/serverless-workflow-examples/serverless-workflow-hello-world/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-hello-world/pom.xml @@ -73,8 +73,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -89,7 +89,7 @@ quarkus-arc - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/pom.xml b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/pom.xml index 0c90c537b6..842644f709 100644 --- a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/pom.xml @@ -53,8 +53,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus org.kie diff --git a/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/pom.xml b/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/pom.xml index 95366d5e26..ef56a59c80 100644 --- a/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/pom.xml @@ -72,8 +72,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus @@ -102,7 +102,7 @@ - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-oauth2-orchestration-quarkus/currency-exchange-workflow/pom.xml b/serverless-workflow-examples/serverless-workflow-oauth2-orchestration-quarkus/currency-exchange-workflow/pom.xml index 9a8dc66d8c..b133699a4c 100644 --- a/serverless-workflow-examples/serverless-workflow-oauth2-orchestration-quarkus/currency-exchange-workflow/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-oauth2-orchestration-quarkus/currency-exchange-workflow/pom.xml @@ -83,12 +83,12 @@ quarkus-oidc-client-filter - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus - org.kie.kogito - sonataflow-quarkus-devui + org.apache.kie.sonataflow + sonataflow-quarkus-devui org.kie diff --git a/serverless-workflow-examples/serverless-workflow-openvino-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-openvino-quarkus/pom.xml index f1f1313fbf..ff747c52cc 100644 --- a/serverless-workflow-examples/serverless-workflow-openvino-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-openvino-quarkus/pom.xml @@ -71,12 +71,12 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus - org.kie.kogito - kogito-addons-quarkus-serverless-workflow-python + org.apache.kie.sonataflow + sonataflow-addons-quarkus-python io.quarkus @@ -87,7 +87,7 @@ quarkus-resteasy-jackson - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-order-processing/pom.xml b/serverless-workflow-examples/serverless-workflow-order-processing/pom.xml index 69247b2886..057f0882de 100644 --- a/serverless-workflow-examples/serverless-workflow-order-processing/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-order-processing/pom.xml @@ -71,8 +71,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus org.kie @@ -91,7 +91,7 @@ quarkus-smallrye-health - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-parallel-execution/pom.xml b/serverless-workflow-examples/serverless-workflow-parallel-execution/pom.xml index e695bce93a..a4fc7ef4b6 100644 --- a/serverless-workflow-examples/serverless-workflow-parallel-execution/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-parallel-execution/pom.xml @@ -73,8 +73,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus diff --git a/serverless-workflow-examples/serverless-workflow-python-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-python-quarkus/pom.xml index edef0088fe..55dacffb77 100644 --- a/serverless-workflow-examples/serverless-workflow-python-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-python-quarkus/pom.xml @@ -71,12 +71,12 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus - org.kie.kogito - kogito-addons-quarkus-serverless-workflow-python + org.apache.kie.sonataflow + sonataflow-addons-quarkus-python io.quarkus @@ -87,7 +87,7 @@ quarkus-resteasy-jackson - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-qas-service-showcase/query-answer-service/pom.xml b/serverless-workflow-examples/serverless-workflow-qas-service-showcase/query-answer-service/pom.xml index c98b9a19c5..4110defc0d 100644 --- a/serverless-workflow-examples/serverless-workflow-qas-service-showcase/query-answer-service/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-qas-service-showcase/query-answer-service/pom.xml @@ -74,11 +74,11 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-saga-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-saga-quarkus/pom.xml index 517fc973af..4cb7ae9bac 100644 --- a/serverless-workflow-examples/serverless-workflow-saga-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-saga-quarkus/pom.xml @@ -72,15 +72,15 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus quarkus-resteasy-jackson - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-service-calls-quarkus/pom.xml b/serverless-workflow-examples/serverless-workflow-service-calls-quarkus/pom.xml index 921a31f44e..306771ae84 100644 --- a/serverless-workflow-examples/serverless-workflow-service-calls-quarkus/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-service-calls-quarkus/pom.xml @@ -70,8 +70,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -90,7 +90,7 @@ quarkus-smallrye-health - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-stock-profit/stock-profit/pom.xml b/serverless-workflow-examples/serverless-workflow-stock-profit/stock-profit/pom.xml index 85ac07177d..cc06b8d0ed 100644 --- a/serverless-workflow-examples/serverless-workflow-stock-profit/stock-profit/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-stock-profit/stock-profit/pom.xml @@ -31,8 +31,8 @@ Kogito Example :: Serverless Workflow Stock Profit :: Quarkus - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus diff --git a/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow-full/pom.xml b/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow-full/pom.xml index 04d25a6369..090b25db6a 100644 --- a/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow-full/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow-full/pom.xml @@ -63,8 +63,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -83,7 +83,7 @@ quarkus-smallrye-health - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow-function/pom.xml b/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow-function/pom.xml index 87e8350b57..1562cc5fbd 100644 --- a/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow-function/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow-function/pom.xml @@ -63,8 +63,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -83,7 +83,7 @@ quarkus-smallrye-health - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow-spec/pom.xml b/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow-spec/pom.xml index 9e20c64b52..ccde440bf8 100644 --- a/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow-spec/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow-spec/pom.xml @@ -63,8 +63,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -83,7 +83,7 @@ quarkus-smallrye-health - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow/pom.xml b/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow/pom.xml index eab38437df..c4feb2a57f 100644 --- a/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-temperature-conversion/conversion-workflow/pom.xml @@ -63,8 +63,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -79,8 +79,8 @@ quarkus-smallrye-health - org.kie.kogito - sonataflow-quarkus-devui + org.apache.kie.sonataflow + sonataflow-quarkus-devui org.kie diff --git a/serverless-workflow-examples/serverless-workflow-testing-with-rest-assured/pom.xml b/serverless-workflow-examples/serverless-workflow-testing-with-rest-assured/pom.xml index 4f265432bd..f91411f15f 100644 --- a/serverless-workflow-examples/serverless-workflow-testing-with-rest-assured/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-testing-with-rest-assured/pom.xml @@ -71,8 +71,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus io.quarkus @@ -87,7 +87,7 @@ quarkus-resteasy - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-timeouts-showcase-embedded/pom.xml b/serverless-workflow-examples/serverless-workflow-timeouts-showcase-embedded/pom.xml index 2b8df219a5..6e54700896 100644 --- a/serverless-workflow-examples/serverless-workflow-timeouts-showcase-embedded/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-timeouts-showcase-embedded/pom.xml @@ -100,11 +100,11 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/serverless-workflow-timeouts-showcase-extended/pom.xml b/serverless-workflow-examples/serverless-workflow-timeouts-showcase-extended/pom.xml index 0661a8674c..329beb51ac 100644 --- a/serverless-workflow-examples/serverless-workflow-timeouts-showcase-extended/pom.xml +++ b/serverless-workflow-examples/serverless-workflow-timeouts-showcase-extended/pom.xml @@ -93,8 +93,8 @@ - org.kie.kogito - kogito-quarkus-serverless-workflow + org.apache.kie.sonataflow + sonataflow-quarkus org.kie @@ -105,7 +105,7 @@ kogito-addons-quarkus-fabric8-kubernetes-service-catalog - org.kie.kogito + org.apache.kie.sonataflow sonataflow-quarkus-devui diff --git a/serverless-workflow-examples/sonataflow-fluent/README.md b/serverless-workflow-examples/sonataflow-fluent/README.md new file mode 100644 index 0000000000..cdd38688dd --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/README.md @@ -0,0 +1,16 @@ +## Sonata Workflow Embedded examples + +Contains several examples of serverless workflow embedded execution, located at package `org.kie.kogito.serverless.workflow.examples`. + +Each example consist of a commented Java class that can be run using its main method. + +The recommend order of execution is + +* HelloWorld +* Concatenation +* JQInterpolation +* ForEachJava +* ParallelRest + +Read comments, run and enjoy! + \ No newline at end of file diff --git a/serverless-workflow-examples/sonataflow-fluent/pom.xml b/serverless-workflow-examples/sonataflow-fluent/pom.xml new file mode 100644 index 0000000000..c075143d37 --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/pom.xml @@ -0,0 +1,49 @@ + + 4.0.0 + + org.kie.kogito.examples + serverless-workflow-examples + 999-SNAPSHOT + + sonataflow-fluent + Kogito Example :: SonataFlow :: Java Embedded examples + + org.kie.kogito + kogito-bom + 999-SNAPSHOT + 17 + SonataFlowFluent + + + + + ${kogito.bom.group-id} + ${kogito.bom.artifact-id} + ${kogito.bom.version} + pom + import + + + + + + org.kie.kogito + kogito-serverless-workflow-executor + pom + + + org.slf4j + slf4j-simple + + + org.assertj + assertj-core + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + diff --git a/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/Concatenation.java b/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/Concatenation.java new file mode 100644 index 0000000000..a10a515c23 --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/Concatenation.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.kie.kogito.serverless.workflow.examples; + +import java.util.Map; + +import org.kie.kogito.process.Process; +import org.kie.kogito.serverless.workflow.actions.WorkflowLogLevel; +import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication; +import org.kie.kogito.serverless.workflow.models.JsonNodeModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.serverlessworkflow.api.Workflow; + +import static org.kie.kogito.serverless.workflow.fluent.ActionBuilder.call; +import static org.kie.kogito.serverless.workflow.fluent.ActionBuilder.log; +import static org.kie.kogito.serverless.workflow.fluent.FunctionBuilder.expr; +import static org.kie.kogito.serverless.workflow.fluent.StateBuilder.operation; +import static org.kie.kogito.serverless.workflow.fluent.WorkflowBuilder.workflow; + +public class Concatenation { + + private static final Logger logger = LoggerFactory.getLogger(Concatenation.class); + + public static void main(String[] args) { + try (StaticWorkflowApplication application = StaticWorkflowApplication.create()) { + // This flow illustrate the usage of two consecutive function calls + // create a reusable process for several executions + Process process = application.process(getWorkflow()); + // execute it with one person name + logger.info(application.execute(process, Map.of("name", "Javier", "surname", "Tirado")).getWorkflowdata().toPrettyString()); + // execute it with other person name + logger.info(application.execute(process, Map.of("name", "Mark", "surname", "Proctor")).getWorkflowdata().toPrettyString()); + } + } + + static Workflow getWorkflow() { + return workflow("ExpressionExample") + // concatenate name + .start(operation() + .action(call(expr("name", "\"My name is \"+.name"))) + // you can add several sequential actions into an operation + .action(log(WorkflowLogLevel.DEBUG, "\"Response is\"+.response"))) + // concatenate surname + .next(operation() + .action(call(expr("surname", ".response+\" and my surname is \"+.surname"))) + .outputFilter(".response")) + .end().build(); + } +} diff --git a/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/ForEachJava.java b/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/ForEachJava.java new file mode 100644 index 0000000000..52c74e5cfc --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/ForEachJava.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.kie.kogito.serverless.workflow.examples; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; + +import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.serverlessworkflow.api.Workflow; + +import static org.kie.kogito.serverless.workflow.fluent.ActionBuilder.call; +import static org.kie.kogito.serverless.workflow.fluent.FunctionBuilder.expr; +import static org.kie.kogito.serverless.workflow.fluent.FunctionBuilder.java; +import static org.kie.kogito.serverless.workflow.fluent.StateBuilder.forEach; +import static org.kie.kogito.serverless.workflow.fluent.StateBuilder.operation; +import static org.kie.kogito.serverless.workflow.fluent.WorkflowBuilder.workflow; + +public class ForEachJava { + + private static final Logger logger = LoggerFactory.getLogger(ForEachJava.class); + + public static void main(String[] args) { + try (StaticWorkflowApplication application = StaticWorkflowApplication.create()) { + // execute the flow passing the list of names and the file name + logger.info(application.execute(getWorkflow(), Map.of("names", Arrays.asList("Javi", "Mark", "Kris", "Alessandro"), "fileName", "message.txt")).getWorkflowdata().toPrettyString()); + } + } + + static Workflow getWorkflow() { + // this flow illustrate the usage of foreach and how to use java to perform task that are not part of sw spec. + // The flow accepts a list of names and suffix them with a message read from a file + return workflow("ForEachExample") + // first load the message from the file and store it in message property + .start(operation().action(call(java("getMessage", ForEachJava::addAdvice), ".fileName"))) + // then for each element in input names concatenate it with that message + .next(forEach(".names").loopVar("name").outputCollection(".messages") + // jq expression that suffix each name with the message retrieved from the file + .action(call(expr("concat", ".name+.adviceMessage"))) + // only return messages list as result of the flow + .outputFilter("{messages}")) + .end().build(); + } + + // Java method invoked from workflow accepts one parameter, which might be a Map or a primitive/wrapper type, depending on the args provided in the flow + // In this case, we are passing the name of a file in the classpath, so the argument is a string + // Java method return type is always a Map (if not output,it should return an empty map). In this case, + // we are adding an advice message to the flow model read from the file. If the file cannot be read, we return empty map. + private static Map addAdvice(String fileName) { + try (InputStream is = ClassLoader.getSystemResourceAsStream(fileName)) { + if (is != null) { + return Collections.singletonMap("adviceMessage", new String(is.readAllBytes())); + } + } catch (IOException io) { + logger.warn("Error reading file " + fileName + " from classpath", io); + } + return Collections.emptyMap(); + } + +} diff --git a/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/HelloWorld.java b/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/HelloWorld.java new file mode 100644 index 0000000000..3d8648e93a --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/HelloWorld.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.kie.kogito.serverless.workflow.examples; + +import java.util.Collections; + +import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.serverlessworkflow.api.Workflow; + +import static org.kie.kogito.serverless.workflow.fluent.StateBuilder.inject; +import static org.kie.kogito.serverless.workflow.fluent.WorkflowBuilder.jsonObject; +import static org.kie.kogito.serverless.workflow.fluent.WorkflowBuilder.workflow; + +public class HelloWorld { + + private static final Logger logger = LoggerFactory.getLogger(HelloWorld.class); + + public static void main(String[] args) { + try (StaticWorkflowApplication application = StaticWorkflowApplication.create()) { + logger.info("Workflow execution result is {}", application.execute(getWorkflow(), Collections.emptyMap()).getWorkflowdata()); + } + } + + static Workflow getWorkflow() { + return workflow("HelloWorld").start( + inject( + jsonObject().put("greeting", "Hello World").put("mantra", "Serverless Workflow is awesome!"))) + .end() + .build(); + } +} diff --git a/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/JQInterpolation.java b/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/JQInterpolation.java new file mode 100644 index 0000000000..b090d23d23 --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/JQInterpolation.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.kie.kogito.serverless.workflow.examples; + +import java.io.IOException; + +import org.kie.kogito.jackson.utils.ObjectMapperFactory; +import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.serverlessworkflow.api.Workflow; + +import static org.kie.kogito.serverless.workflow.fluent.ActionBuilder.call; +import static org.kie.kogito.serverless.workflow.fluent.FunctionBuilder.expr; +import static org.kie.kogito.serverless.workflow.fluent.StateBuilder.operation; +import static org.kie.kogito.serverless.workflow.fluent.WorkflowBuilder.workflow; + +public class JQInterpolation { + + private static final Logger logger = LoggerFactory.getLogger(JQInterpolation.class); + + public static void main(String[] args) throws IOException { + try (StaticWorkflowApplication application = StaticWorkflowApplication.create()) { + logger.info(application.execute(getWorkflow(), ObjectMapperFactory.get().createObjectNode().put("name", "Javierito").put("language", "Spanish")).getWorkflowdata().toPrettyString()); + + } + } + + static Workflow getWorkflow() { + final String INTERPOLATION = "interpolation"; + return workflow("PlayingWithExpression").function(expr(INTERPOLATION, "{greeting: \"My name is \\(.name). My language is \\(.language)\"}")) + .start(operation().action(call(INTERPOLATION))).end().build(); + } +} diff --git a/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/ParallelRest.java b/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/ParallelRest.java new file mode 100644 index 0000000000..58a5d3871c --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/examples/ParallelRest.java @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.kie.kogito.serverless.workflow.examples; + +import java.util.Map; + +import org.kie.kogito.process.Process; +import org.kie.kogito.serverless.workflow.actions.WorkflowLogLevel; +import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication; +import org.kie.kogito.serverless.workflow.fluent.FunctionBuilder.HttpMethod; +import org.kie.kogito.serverless.workflow.models.JsonNodeModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +import io.serverlessworkflow.api.Workflow; + +import static org.kie.kogito.serverless.workflow.fluent.ActionBuilder.call; +import static org.kie.kogito.serverless.workflow.fluent.ActionBuilder.log; +import static org.kie.kogito.serverless.workflow.fluent.ActionBuilder.subprocess; +import static org.kie.kogito.serverless.workflow.fluent.FunctionBuilder.rest; +import static org.kie.kogito.serverless.workflow.fluent.StateBuilder.operation; +import static org.kie.kogito.serverless.workflow.fluent.StateBuilder.parallel; +import static org.kie.kogito.serverless.workflow.fluent.WorkflowBuilder.jsonObject; +import static org.kie.kogito.serverless.workflow.fluent.WorkflowBuilder.workflow; + +public class ParallelRest { + + private static final Logger logger = LoggerFactory.getLogger(ParallelRest.class); + + public static void main(String[] args) { + try (StaticWorkflowApplication application = StaticWorkflowApplication.create()) { + // create a reusable process for several executions + Process process = application.process(getWorkflow(application)); + // execute it with one person name + logger.info(application.execute(process, Map.of("name", "Javier")).getWorkflowdata().toPrettyString()); + // execute it with another person name + logger.info(application.execute(process, Map.of("name", "Alba")).getWorkflowdata().toPrettyString()); + } + } + + static Workflow getWorkflow(StaticWorkflowApplication application) { + ObjectNode nameArgs = jsonObject().put("name", ".name"); + + // Define a subflow process that retrieve country information from the given name + Workflow subflow = workflow("GetCountry") + // subflow consist of just one state with two sequential actions + .start(operation() + // call rest function to retrieve country id + .action(call(rest("getCountryId", HttpMethod.get, "https://api.nationalize.io:/?name={name}"), nameArgs) + // extract relevant information from the response using JQ expression + .resultFilter(".country[0].country_id").outputFilter(".id")) + // call rest function to retrieve country information from country id + .action(call(rest("getCountryInfo", HttpMethod.get, "https://restcountries.com/v3.1/alpha/{id}"), jsonObject().put("id", ".id")) + // we are only interested in country name, longitude and latitude + .resultFilter("{country: {name:.[].name.common, latitude: .[].latlng[0], longitude: .[].latlng[1] }}")) + // return only country field to parent flow + .outputFilter("{country}")) + .end().build(); + + Process subprocess = application.process(subflow); + // This is the main flow, it invokes two services (one for retrieving the age and another to get the gender of the given name )and one subprocess (the country one defined above) in parallel + // Once the three of them has been executed, if age is greater than 50, it retrieve the weather information for the retrieved country, + // Else, it gets the list of universities for that country. + return workflow("FullExample") + // Api key to be used in getting weather call + .constant("apiKey", "2482c1d33308a7cffedff5764e9ef203") + // Starts performing retrieval of gender, country and age from the given name on parallel + .start(parallel() + .newBranch().action(call(rest("getAge", HttpMethod.get, "https://api.agify.io/?name={name}"), nameArgs).resultFilter("{age}")).endBranch() + .newBranch().action(subprocess(subprocess)).endBranch() + .newBranch().action(call(rest("getGender", HttpMethod.get, "https://api.genderize.io/?name={name}"), nameArgs).resultFilter("{gender}")).endBranch()) + // once done, logs the age (using Jq string interpolation) + .next(operation().action(log(WorkflowLogLevel.INFO, "\"Age is \\(.age)\""))) + // If age is less that fifty, retrieve the list of universities (the parameters object is built using jq expressions) + .when(".age<50").next(operation().action(call(rest("getUniversities", HttpMethod.get, "http://universities.hipolabs.com/search?country={country}"), + jsonObject().put("country", ".country.name")).resultFilter(".[].name").outputFilter(".universities"))) + // Else retrieve the weather for that country capital latitude and longitude (note how parameters are build from model info) + .end().or() + .next(operation().action(call(rest("getWeather", HttpMethod.get, "https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={appid}"), + jsonObject().put("lat", ".country.latitude").put("lon", ".country.longitude").put("appid", "$CONST.apiKey")) + .resultFilter("{weather:.main}"))) + .end().build(); + } +} diff --git a/serverless-workflow-examples/sonataflow-fluent/src/main/resources/division.sw.json b/serverless-workflow-examples/sonataflow-fluent/src/main/resources/division.sw.json new file mode 100644 index 0000000000..73b9960357 --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/src/main/resources/division.sw.json @@ -0,0 +1,26 @@ +{ + "id": "division", + "version": "1.0", + "name": "division", + "start": "divide", + "functions": [ + { + "name": "divide", + "type": "expression", + "operation": ".numerator / .denominator" + } + ], + "states": [ + { + "name": "divide", + "type": "operation", + "actions": [ + { + "name": "divide", + "functionRef": "divide" + } + ], + "end": true + } + ] +} diff --git a/serverless-workflow-examples/sonataflow-fluent/src/main/resources/expression.sw.json b/serverless-workflow-examples/sonataflow-fluent/src/main/resources/expression.sw.json new file mode 100644 index 0000000000..dcf80ae8ce --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/src/main/resources/expression.sw.json @@ -0,0 +1,73 @@ +{ + "id": "expression", + "version": "1.0", + "name": "Workflow Expression example", + "constants" : { + "Dog" : { + "castellano" : "perro", + "leones": "perru", + "gallego" : "can", + "aragones" : "cocho", + "catalan" : "gos", + "vasco": "txakurra" + } + }, + "dataInputSchema" : "schema/expression.json", + "description": "An example of how to use a JQ expression assignment", + "start": "squareState", + "extensions" : [ { + "extensionid": "workflow-output-schema", + "outputSchema": "schema/result.json" + } + ], + "functions": [ + { + "name": "max", + "type": "expression", + "operation": "{max: .numbers | max_by(.x), min: .numbers | min_by(.y)}" + }, + { + "name": "printMessage", + "type": "custom", + "operation": "sysout" + } + ], + "states": [ + { + "name": "squareState", + "type": "operation", + "actions": [ + { + "name": "maxAction", + "functionRef": { + "refName": "max" + }, + "actionDataFilter": { + "results" : ".max.x", + "toStateData" : ".number" + } + } + ], + "transition": "finish" + }, + { + "name": "finish", + "type": "operation", + "stateDataFilter": { + "input": "{result: .number}" + }, + "actions": [ + { + "name": "printAction", + "functionRef": { + "refName": "printMessage", + "arguments": { + "message": ".result" + } + } + } + ], + "end": true + } + ] +} diff --git a/serverless-workflow-examples/sonataflow-fluent/src/main/resources/message.txt b/serverless-workflow-examples/sonataflow-fluent/src/main/resources/message.txt new file mode 100644 index 0000000000..01b797e5bc --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/src/main/resources/message.txt @@ -0,0 +1 @@ + , congratulations, you are a happy user of serverless workflow \ No newline at end of file diff --git a/serverless-workflow-examples/sonataflow-fluent/src/main/resources/schema/complex.json b/serverless-workflow-examples/sonataflow-fluent/src/main/resources/schema/complex.json new file mode 100644 index 0000000000..7a4e0728f6 --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/src/main/resources/schema/complex.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Complex", + "description": "Complex number", + "type": "object", + "properties": { + "x" : {"type":"number"}, + "y" : {"type":"number"} + + }, + "required": ["x","y"] +} \ No newline at end of file diff --git a/serverless-workflow-examples/sonataflow-fluent/src/main/resources/schema/expression.json b/serverless-workflow-examples/sonataflow-fluent/src/main/resources/schema/expression.json new file mode 100644 index 0000000000..3633e4e547 --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/src/main/resources/schema/expression.json @@ -0,0 +1,15 @@ +{ + "$id": "classpath:/schema/expression.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Expression", + "description": "Schema for expression test", + "type": "object", + "properties": { + "numbers": { + "description": "The array of numbers to be operated with", + "type": "array", + "items": {"$ref" : "complex.json"} + } + }, + "required": ["numbers"] +} \ No newline at end of file diff --git a/serverless-workflow-examples/sonataflow-fluent/src/main/resources/schema/result.json b/serverless-workflow-examples/sonataflow-fluent/src/main/resources/schema/result.json new file mode 100644 index 0000000000..c5a55d1d5e --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/src/main/resources/schema/result.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Expression Output", + "description": "Output schema for expression example", + "type": "object", + "properties": { + "result": { + "type" : "number", + "description": "Maximum value on x" + } + }, + "required": ["result"] +} \ No newline at end of file diff --git a/serverless-workflow-examples/sonataflow-fluent/src/test/java/org/kie/kogito/serverless/workflow/examples/WorkflowFluentExamplesTest.java b/serverless-workflow-examples/sonataflow-fluent/src/test/java/org/kie/kogito/serverless/workflow/examples/WorkflowFluentExamplesTest.java new file mode 100644 index 0000000000..11fe8b4739 --- /dev/null +++ b/serverless-workflow-examples/sonataflow-fluent/src/test/java/org/kie/kogito/serverless/workflow/examples/WorkflowFluentExamplesTest.java @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.kie.kogito.serverless.workflow.examples; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication; +import org.kie.kogito.serverless.workflow.utils.ServerlessWorkflowUtils; +import org.kie.kogito.serverless.workflow.utils.WorkflowFormat; + +import com.fasterxml.jackson.databind.node.IntNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.fasterxml.jackson.databind.node.TextNode; + +import io.serverlessworkflow.api.Workflow; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.kie.kogito.serverless.workflow.fluent.WorkflowBuilder.jsonObject; + +public class WorkflowFluentExamplesTest { + + private static StaticWorkflowApplication application; + + @BeforeAll + static void init() { + application = StaticWorkflowApplication.create(); + } + + @AfterAll + static void cleanUp() { + application.close(); + } + + @Test + void testHelloWorldDefinition() { + ObjectNode expected = jsonObject().put("greeting", "Hello World").put("mantra", "Serverless Workflow is awesome!"); + assertThat(application.execute(HelloWorld.getWorkflow(), Collections.emptyMap()).getWorkflowdata()).isEqualTo(expected); + } + + @Test + void testForEachJavaDefinition() { + assertThat(application.execute(ForEachJava.getWorkflow(), Map.of("names", Arrays.asList("Javi", "Mark"), "fileName", "message.txt")).getWorkflowdata().get("messages")) + .containsExactly(new TextNode("Javi , congratulations, you are a happy user of serverless workflow"), + new TextNode("Mark , congratulations, you are a happy user of serverless workflow")); + } + + @Test + void testJQInterpolation() { + assertThat(application.execute(JQInterpolation.getWorkflow(), Map.of("name", "Javierito", "language", "Spanish")).getWorkflowdata().get("greeting")) + .isEqualTo(new TextNode("My name is Javierito. My language is Spanish")); + } + + @Test + void testConcatenationDefinition() { + assertThat(application.execute(Concatenation.getWorkflow(), Map.of("name", "Javier", "surname", "Tirado")).getWorkflowdata()) + .isEqualTo(new TextNode("My name is Javier and my surname is Tirado")); + } + + @Test + void testDivisionDefinition() throws IOException { + assertThat(application.execute( + getWorkflow("division.sw.json"), Map.of("numerator", 4, "denominator", 2)).getWorkflowdata().get("response")).isEqualTo(new IntNode(2)); + } + + @Test + void testExpressionDefinition() throws IOException { + assertThat(application.execute( + getWorkflow("expression.sw.json"), Map.of("numbers", Arrays.asList(Map.of("x", 3, "y", 4), Map.of("x", 5, "y", 7)))).getWorkflowdata().get("result")).isEqualTo(new IntNode(5)); + } + + private Workflow getWorkflow(String filename) throws IOException { + try (Reader in = new InputStreamReader(ClassLoader.getSystemResourceAsStream(filename))) { + return ServerlessWorkflowUtils.getWorkflow(in, WorkflowFormat.JSON); + } + } +}