diff --git a/handler/core/docs/asciidoc/dataobjects.adoc b/handler/core/docs/asciidoc/dataobjects.adoc
index 23eb32c1..6b7822cd 100644
--- a/handler/core/docs/asciidoc/dataobjects.adoc
+++ b/handler/core/docs/asciidoc/dataobjects.adoc
@@ -129,6 +129,10 @@ Sets a node factory name to SubtasksNodeFactory.NAME
and configures
|[[node]]`@node`|`link:dataobjects.html#NodeOptions[NodeOptions]`|+++
Node options define a node factory and its configuration.
+++
+|[[on]]`@on`|`link:dataobjects.html#GraphNodeOptions[GraphNodeOptions]`|+++
+Alias for "onTransitions".
+ See link
++++
|[[onTransitions]]`@onTransitions`|`link:dataobjects.html#GraphNodeOptions[GraphNodeOptions]`|+++
The outgoing graph node edges, called transitions. A transition is named graph edge that
defines the next graph node in fragment's processing.
diff --git a/handler/core/handler/common/customTask.conf b/handler/core/handler/common/customTask.conf
new file mode 100644
index 00000000..853bd933
--- /dev/null
+++ b/handler/core/handler/common/customTask.conf
@@ -0,0 +1,25 @@
+tasks {
+ success-task {
+ action = success-action
+ }
+}
+
+nodeFactories = [
+ {
+ factory = action
+ config {
+ actions {
+ success-action {
+ factory = test-action
+ config {
+ transition = _success
+ body = "custom"
+ }
+ }
+ }
+ }
+ }
+ {
+ factory = subtasks
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/common/failingTask.conf b/handler/core/handler/common/failingTask.conf
new file mode 100644
index 00000000..46a94974
--- /dev/null
+++ b/handler/core/handler/common/failingTask.conf
@@ -0,0 +1,24 @@
+tasks {
+ failing-task {
+ action = failing-action
+ }
+}
+
+nodeFactories = [
+ {
+ factory = action
+ config {
+ actions {
+ failing-action {
+ factory = test-action
+ config {
+ transition = not-existing-transition
+ }
+ }
+ }
+ }
+ }
+ {
+ factory = subtasks
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/common/successTask.conf b/handler/core/handler/common/successTask.conf
new file mode 100644
index 00000000..0b561976
--- /dev/null
+++ b/handler/core/handler/common/successTask.conf
@@ -0,0 +1,25 @@
+tasks {
+ success-task {
+ action = success-action
+ }
+}
+
+nodeFactories = [
+ {
+ factory = action
+ config {
+ actions {
+ success-action {
+ factory = test-action
+ config {
+ transition = _success
+ body = "success"
+ }
+ }
+ }
+ }
+ }
+ {
+ factory = subtasks
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/common/successTaskWithHtmlBody.conf b/handler/core/handler/common/successTaskWithHtmlBody.conf
new file mode 100644
index 00000000..752e2db9
--- /dev/null
+++ b/handler/core/handler/common/successTaskWithHtmlBody.conf
@@ -0,0 +1,25 @@
+tasks {
+ success-task {
+ action = success-action
+ }
+}
+
+nodeFactories = [
+ {
+ factory = action
+ config {
+ actions {
+ success-action {
+ factory = test-action
+ config {
+ transition = _success
+ body = "
success
"
+ }
+ }
+ }
+ }
+ }
+ {
+ factory = subtasks
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/consumerFactoryFound.conf b/handler/core/handler/consumerFactoryFound.conf
new file mode 100644
index 00000000..ed3008d6
--- /dev/null
+++ b/handler/core/handler/consumerFactoryFound.conf
@@ -0,0 +1,12 @@
+taskFactories = [
+ {
+ factory = default
+ config { include required(classpath("handler/common/successTask.conf")) }
+ }
+]
+
+consumerFactories = [
+ {
+ factory = testConsumer
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/consumerFactoryNameNotDefined.conf b/handler/core/handler/consumerFactoryNameNotDefined.conf
new file mode 100644
index 00000000..858746e9
--- /dev/null
+++ b/handler/core/handler/consumerFactoryNameNotDefined.conf
@@ -0,0 +1,4 @@
+consumerFactories = [
+ {
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/consumerFactoryNotFound.conf b/handler/core/handler/consumerFactoryNotFound.conf
new file mode 100644
index 00000000..67c32596
--- /dev/null
+++ b/handler/core/handler/consumerFactoryNotFound.conf
@@ -0,0 +1,5 @@
+consumerFactories = [
+ {
+ factory = invalid
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/factoriesNotDefined.conf b/handler/core/handler/factoriesNotDefined.conf
new file mode 100644
index 00000000..e69de29b
diff --git a/handler/core/handler/fragmentWithFailingTask.conf b/handler/core/handler/fragmentWithFailingTask.conf
new file mode 100644
index 00000000..7ec10ca1
--- /dev/null
+++ b/handler/core/handler/fragmentWithFailingTask.conf
@@ -0,0 +1,6 @@
+taskFactories = [
+ {
+ factory = default
+ config { include required(classpath("handler/common/failingTask.conf")) }
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/fragmentWithHtmlConsumer.conf b/handler/core/handler/fragmentWithHtmlConsumer.conf
new file mode 100644
index 00000000..62da6c55
--- /dev/null
+++ b/handler/core/handler/fragmentWithHtmlConsumer.conf
@@ -0,0 +1,18 @@
+taskFactories = [
+ {
+ factory = default
+ config { include required(classpath("handler/common/successTask.conf")) }
+ }
+]
+
+consumerFactories = [
+ {
+ factory = fragmentHtmlBodyWriter
+ config {
+ condition {
+ param = debug
+ }
+ fragmentTypes = [ "snippet" ]
+ }
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/fragmentWithSuccessTask.conf b/handler/core/handler/fragmentWithSuccessTask.conf
new file mode 100644
index 00000000..ea3e4bb7
--- /dev/null
+++ b/handler/core/handler/fragmentWithSuccessTask.conf
@@ -0,0 +1,6 @@
+taskFactories = [
+ {
+ factory = default
+ config { include required(classpath("handler/common/successTask.conf")) }
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/manyTaskFactoriesWithTheSameName.conf b/handler/core/handler/manyTaskFactoriesWithTheSameName.conf
new file mode 100644
index 00000000..a104a973
--- /dev/null
+++ b/handler/core/handler/manyTaskFactoriesWithTheSameName.conf
@@ -0,0 +1,13 @@
+taskFactories = [
+ {
+ factory = default
+ config {include required(classpath("handler/common/successTask.conf"))}
+ }
+ {
+ factory = default
+ config {include required(classpath("handler/common/customTask.conf"))}
+ config {
+ taskNameKey = task
+ }
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/singleTaskFactoryWithFailingTask.conf b/handler/core/handler/singleTaskFactoryWithFailingTask.conf
new file mode 100644
index 00000000..7ec10ca1
--- /dev/null
+++ b/handler/core/handler/singleTaskFactoryWithFailingTask.conf
@@ -0,0 +1,6 @@
+taskFactories = [
+ {
+ factory = default
+ config { include required(classpath("handler/common/failingTask.conf")) }
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/singleTaskFactoryWithSuccessTask.conf b/handler/core/handler/singleTaskFactoryWithSuccessTask.conf
new file mode 100644
index 00000000..ea3e4bb7
--- /dev/null
+++ b/handler/core/handler/singleTaskFactoryWithSuccessTask.conf
@@ -0,0 +1,6 @@
+taskFactories = [
+ {
+ factory = default
+ config { include required(classpath("handler/common/successTask.conf")) }
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/taskFactoryNameNotDefined.conf b/handler/core/handler/taskFactoryNameNotDefined.conf
new file mode 100644
index 00000000..4e222c46
--- /dev/null
+++ b/handler/core/handler/taskFactoryNameNotDefined.conf
@@ -0,0 +1,4 @@
+taskFactories = [
+ {
+ }
+]
\ No newline at end of file
diff --git a/handler/core/handler/taskFactoryNotFound.conf b/handler/core/handler/taskFactoryNotFound.conf
new file mode 100644
index 00000000..79cdce2a
--- /dev/null
+++ b/handler/core/handler/taskFactoryNotFound.conf
@@ -0,0 +1,5 @@
+taskFactories = [
+ {
+ factory = invalid
+ }
+]
\ No newline at end of file
diff --git a/handler/core/src/main/java/io/knotx/fragments/task/factory/GraphNodeOptions.java b/handler/core/src/main/java/io/knotx/fragments/task/factory/GraphNodeOptions.java
index 99beacda..9174f253 100644
--- a/handler/core/src/main/java/io/knotx/fragments/task/factory/GraphNodeOptions.java
+++ b/handler/core/src/main/java/io/knotx/fragments/task/factory/GraphNodeOptions.java
@@ -115,6 +115,18 @@ public GraphNodeOptions setOnTransitions(Map onTransit
return this;
}
+ /**
+ * Alias for "onTransitions".
+ * See {@link #setOnTransitions(Map) setOnTransitions}
+ *
+ * @param on - map of possible transitions
+ * @return reference to this, so the API can be used fluently
+ */
+ public GraphNodeOptions setOn(Map on) {
+ this.onTransitions = on;
+ return this;
+ }
+
/**
* Sets a node factory name to {@code ActionNodeFactory.NAME} and configures the action.
*
diff --git a/handler/core/src/test/java/io/knotx/fragments/task/factory/GraphNodeOptionsTest.java b/handler/core/src/test/java/io/knotx/fragments/task/factory/GraphNodeOptionsTest.java
index bc525a64..a41b9b7b 100644
--- a/handler/core/src/test/java/io/knotx/fragments/task/factory/GraphNodeOptionsTest.java
+++ b/handler/core/src/test/java/io/knotx/fragments/task/factory/GraphNodeOptionsTest.java
@@ -17,8 +17,7 @@
import static io.knotx.fragments.HoconLoader.verify;
import static io.knotx.fragments.api.FragmentResult.SUCCESS_TRANSITION;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
import io.knotx.fragments.task.factory.node.action.ActionNodeConfig;
import io.knotx.fragments.task.factory.node.action.ActionNodeFactory;
@@ -27,6 +26,8 @@
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.junit5.VertxExtension;
+
+import java.util.Map;
import java.util.Optional;
import java.util.function.Consumer;
import org.junit.jupiter.api.DisplayName;
@@ -86,6 +87,16 @@ void expectTransitionSuccessWithNodeBThenNodeC(Vertx vertx) throws Throwable {
}, vertx);
}
+ @Test
+ @DisplayName("Expect 'on' to alias 'onTransitions'")
+ void expectAssignedTransitions(Vertx vertx) throws Throwable {
+ verify("task/factory/taskWithTransitions-alias.conf", config -> {
+ GraphNodeOptions graphNodeOptions = new GraphNodeOptions(config);
+ Map transitions = graphNodeOptions.getOnTransitions();
+
+ assertFalse(transitions.isEmpty());
+ }, vertx);
+ }
private Consumer validateActionNode() {
return config -> {
diff --git a/handler/core/src/test/resources/task/factory/taskWithTransitions-alias.conf b/handler/core/src/test/resources/task/factory/taskWithTransitions-alias.conf
new file mode 100644
index 00000000..b24ed568
--- /dev/null
+++ b/handler/core/src/test/resources/task/factory/taskWithTransitions-alias.conf
@@ -0,0 +1,7 @@
+# node & transitions
+action = a
+on {
+ _success {
+ action = b
+ }
+}
\ No newline at end of file